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

View file

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

View file

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

View file

@ -85,7 +85,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
private var languageHistoryListView: ListView? = null private var languageHistoryListView: ListView? = null
private lateinit var inAppCameraLocationPermissionLauncher: ActivityResultLauncher<Array<String>> 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> = private val cameraPickLauncherForResult: ActivityResultLauncher<Intent> =
registerForActivityResult(StartActivityForResult()) { result -> registerForActivityResult(StartActivityForResult()) { result ->
@ -297,7 +297,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
getString(R.string.ok), getString(R.string.ok),
getString(R.string.read_help_link), getString(R.string.read_help_link),
{ }, { },
{ Utils.handleWebUrl(requireContext(), Uri.parse(GET_CONTENT_PICKER_HELP_URL)) }, { Utils.handleWebUrl(requireContext(), Uri.parse(getContentPickerHelpUrl)) },
null 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.ImageUtils.IMAGE_OK
import fr.free.nrw.commons.utils.ImageUtilsWrapper import fr.free.nrw.commons.utils.ImageUtilsWrapper
import io.reactivex.Single import io.reactivex.Single
import io.reactivex.functions.Function
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import org.apache.commons.lang3.StringUtils import org.apache.commons.lang3.StringUtils
import timber.log.Timber import timber.log.Timber
@ -26,7 +25,7 @@ class ImageProcessingService @Inject constructor(
private val fileUtilsWrapper: FileUtilsWrapper, private val fileUtilsWrapper: FileUtilsWrapper,
private val imageUtilsWrapper: ImageUtilsWrapper, private val imageUtilsWrapper: ImageUtilsWrapper,
private val readFBMD: ReadFBMD, private val readFBMD: ReadFBMD,
private val EXIFReader: EXIFReader, private val exifReader: EXIFReader,
private val mediaClient: MediaClient private val mediaClient: MediaClient
) { ) {
/** /**
@ -94,7 +93,7 @@ class ImageProcessingService @Inject constructor(
* the presence of some basic Exif metadata. * the presence of some basic Exif metadata.
*/ */
private fun checkEXIF(filepath: String): Single<Int> = 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 x1 = 0f
private var x2 = 0f private var x2 = 0f
private val MINIMUM_THRESHOLD_FOR_SWIPE = 100f private val minimumThresholdForSwipe = 100f
init { init {
interceptOnTouchListener() interceptOnTouchListener()
@ -45,7 +45,7 @@ abstract class SwipableCardView @JvmOverloads constructor(
isSwipe = deltaX != 0f isSwipe = deltaX != 0f
} }
} }
if (isSwipe && pixelToDp(abs(deltaX)) > MINIMUM_THRESHOLD_FOR_SWIPE) { if (isSwipe && pixelToDp(abs(deltaX)) > minimumThresholdForSwipe) {
onSwipe(v) onSwipe(v)
return@setOnTouchListener true return@setOnTouchListener true
} }