Refactor: Rename Constants to Follow CamelCase Naming Convention

>Updated all constant variable names to follow the camelCase naming convention, removing underscores in the middle or end.

>Ensured variable names remain descriptive and align with code readability best practices.
This commit is contained in:
Akshay Komar 2025-01-13 20:21:26 +05:30
parent f2ef4bb434
commit 7edf3938aa
6 changed files with 23 additions and 24 deletions

View file

@ -14,17 +14,17 @@ class QuizController {
private val quiz: ArrayList<QuizQuestion> = ArrayList()
private val URL_FOR_SELFIE = "https://i.imgur.com/0fMYcpM.jpg"
private val URL_FOR_TAJ_MAHAL = "https://upload.wikimedia.org/wikipedia/commons/1/15/Taj_Mahal-03.jpg"
private val URL_FOR_BLURRY_IMAGE = "https://i.imgur.com/Kepb5jR.jpg"
private val URL_FOR_SCREENSHOT = "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8b/Social_media_app_mockup_screenshot.svg/500px-Social_media_app_mockup_screenshot.svg.png"
private val URL_FOR_EVENT = "https://upload.wikimedia.org/wikipedia/commons/5/51/HouseBuildingInNorthernVietnam.jpg"
private val urlForSelfie = "https://i.imgur.com/0fMYcpM.jpg"
private val urlForTajMahal = "https://upload.wikimedia.org/wikipedia/commons/1/15/Taj_Mahal-03.jpg"
private val urlForBlurryImage = "https://i.imgur.com/Kepb5jR.jpg"
private val urlForScreenshot = "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8b/Social_media_app_mockup_screenshot.svg/500px-Social_media_app_mockup_screenshot.svg.png"
private val urlForEvent = "https://upload.wikimedia.org/wikipedia/commons/5/51/HouseBuildingInNorthernVietnam.jpg"
fun initialize(context: Context) {
val q1 = QuizQuestion(
1,
context.getString(R.string.quiz_question_string),
URL_FOR_SELFIE,
urlForSelfie,
false,
context.getString(R.string.selfie_answer)
)
@ -33,7 +33,7 @@ class QuizController {
val q2 = QuizQuestion(
2,
context.getString(R.string.quiz_question_string),
URL_FOR_TAJ_MAHAL,
urlForTajMahal,
true,
context.getString(R.string.taj_mahal_answer)
)
@ -42,7 +42,7 @@ class QuizController {
val q3 = QuizQuestion(
3,
context.getString(R.string.quiz_question_string),
URL_FOR_BLURRY_IMAGE,
urlForBlurryImage,
false,
context.getString(R.string.blurry_image_answer)
)
@ -51,7 +51,7 @@ class QuizController {
val q4 = QuizQuestion(
4,
context.getString(R.string.quiz_screenshot_question),
URL_FOR_SCREENSHOT,
urlForScreenshot,
false,
context.getString(R.string.screenshot_answer)
)
@ -60,7 +60,7 @@ class QuizController {
val q5 = QuizQuestion(
5,
context.getString(R.string.quiz_question_string),
URL_FOR_EVENT,
urlForEvent,
true,
context.getString(R.string.construction_event_answer)
)

View file

@ -45,12 +45,12 @@ class ReviewActivity : BaseActivity() {
private var hasNonHiddenCategories = false
var media: Media? = null
private val SAVED_MEDIA = "saved_media"
private val savedMedia = "saved_media"
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
media?.let {
outState.putParcelable(SAVED_MEDIA, it)
outState.putParcelable(savedMedia, it)
}
}
@ -90,8 +90,8 @@ class ReviewActivity : BaseActivity() {
PorterDuff.Mode.SRC_IN
)
if (savedInstanceState?.getParcelable<Media>(SAVED_MEDIA) != null) {
updateImage(savedInstanceState.getParcelable(SAVED_MEDIA)!!)
if (savedInstanceState?.getParcelable<Media>(savedMedia) != null) {
updateImage(savedInstanceState.getParcelable(savedMedia)!!)
setUpMediaDetailOnOrientation()
} else {
runRandomizer()

View file

@ -31,7 +31,7 @@ class ReviewImageFragment : CommonsDaggerSupportFragment() {
lateinit var sessionManager: SessionManager
// Constant variable used to store user's key name for onSaveInstanceState method
private val SAVED_USER = "saved_user"
private val savedUser = "saved_user"
// Variable that stores the value of user
private var user: String? = null
@ -129,7 +129,7 @@ class ReviewImageFragment : CommonsDaggerSupportFragment() {
question = getString(R.string.review_thanks)
user = reviewActivity.reviewController.firstRevision?.user()
?: savedInstanceState?.getString(SAVED_USER)
?: savedInstanceState?.getString(savedUser)
//if the user is null because of whatsoever reason, review will not be sent anyways
if (!user.isNullOrEmpty()) {
@ -172,7 +172,7 @@ class ReviewImageFragment : CommonsDaggerSupportFragment() {
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
//Save user name when configuration changes happen
outState.putString(SAVED_USER, user)
outState.putString(savedUser, user)
}
private val reviewCallback: ReviewController.ReviewCallback

View file

@ -85,7 +85,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
private var languageHistoryListView: ListView? = null
private lateinit var inAppCameraLocationPermissionLauncher: ActivityResultLauncher<Array<String>>
private val GET_CONTENT_PICKER_HELP_URL = "https://commons-app.github.io/docs.html#get-content"
private val getContentPickerHelpUrl = "https://commons-app.github.io/docs.html#get-content"
private val cameraPickLauncherForResult: ActivityResultLauncher<Intent> =
registerForActivityResult(StartActivityForResult()) { result ->
@ -297,7 +297,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
getString(R.string.ok),
getString(R.string.read_help_link),
{ },
{ Utils.handleWebUrl(requireContext(), Uri.parse(GET_CONTENT_PICKER_HELP_URL)) },
{ Utils.handleWebUrl(requireContext(), Uri.parse(getContentPickerHelpUrl)) },
null
)
}

View file

@ -10,7 +10,6 @@ import fr.free.nrw.commons.utils.ImageUtils.IMAGE_KEEP
import fr.free.nrw.commons.utils.ImageUtils.IMAGE_OK
import fr.free.nrw.commons.utils.ImageUtilsWrapper
import io.reactivex.Single
import io.reactivex.functions.Function
import io.reactivex.schedulers.Schedulers
import org.apache.commons.lang3.StringUtils
import timber.log.Timber
@ -26,7 +25,7 @@ class ImageProcessingService @Inject constructor(
private val fileUtilsWrapper: FileUtilsWrapper,
private val imageUtilsWrapper: ImageUtilsWrapper,
private val readFBMD: ReadFBMD,
private val EXIFReader: EXIFReader,
private val exifReader: EXIFReader,
private val mediaClient: MediaClient
) {
/**
@ -94,7 +93,7 @@ class ImageProcessingService @Inject constructor(
* the presence of some basic Exif metadata.
*/
private fun checkEXIF(filepath: String): Single<Int> =
EXIFReader.processMetadata(filepath)
exifReader.processMetadata(filepath)
/**

View file

@ -23,7 +23,7 @@ abstract class SwipableCardView @JvmOverloads constructor(
private var x1 = 0f
private var x2 = 0f
private val MINIMUM_THRESHOLD_FOR_SWIPE = 100f
private val minimumThresholdForSwipe = 100f
init {
interceptOnTouchListener()
@ -45,7 +45,7 @@ abstract class SwipableCardView @JvmOverloads constructor(
isSwipe = deltaX != 0f
}
}
if (isSwipe && pixelToDp(abs(deltaX)) > MINIMUM_THRESHOLD_FOR_SWIPE) {
if (isSwipe && pixelToDp(abs(deltaX)) > minimumThresholdForSwipe) {
onSwipe(v)
return@setOnTouchListener true
}