Skip to content

Commit cf88f9b

Browse files
authored
Migrated settings modules from Java to Kotlin (commons-app#5944)
* Rename .java to .kt * Migrated settings module to Kotlin
1 parent 5f1d284 commit cf88f9b

File tree

6 files changed

+640
-665
lines changed

6 files changed

+640
-665
lines changed

app/src/main/java/fr/free/nrw/commons/settings/Prefs.java

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package fr.free.nrw.commons.settings
2+
3+
object Prefs {
4+
const val GLOBAL_PREFS = "fr.free.nrw.commons.preferences"
5+
6+
const val TRACKING_ENABLED = "eventLogging"
7+
const val DEFAULT_LICENSE = "defaultLicense"
8+
const val UPLOADS_SHOWING = "uploadsShowing"
9+
const val MANAGED_EXIF_TAGS = "managed_exif_tags"
10+
const val DESCRIPTION_LANGUAGE = "languageDescription"
11+
const val APP_UI_LANGUAGE = "appUiLanguage"
12+
const val KEY_THEME_VALUE = "appThemePref"
13+
14+
object Licenses {
15+
const val CC_BY_SA_3 = "CC BY-SA 3.0"
16+
const val CC_BY_3 = "CC BY 3.0"
17+
const val CC_BY_SA_4 = "CC BY-SA 4.0"
18+
const val CC_BY_4 = "CC BY 4.0"
19+
const val CC0 = "CC0"
20+
}
21+
}

app/src/main/java/fr/free/nrw/commons/settings/SettingsActivity.java

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package fr.free.nrw.commons.settings
2+
3+
import android.os.Bundle
4+
import android.view.MenuItem
5+
import fr.free.nrw.commons.databinding.ActivitySettingsBinding
6+
import fr.free.nrw.commons.theme.BaseActivity
7+
8+
9+
/**
10+
* allows the user to change the settings
11+
*/
12+
class SettingsActivity : BaseActivity() {
13+
14+
private lateinit var binding: ActivitySettingsBinding
15+
// private var settingsDelegate: AppCompatDelegate? = null
16+
17+
/**
18+
* to be called when the activity starts
19+
* @param savedInstanceState the previously saved state
20+
*/
21+
override fun onCreate(savedInstanceState: Bundle?) {
22+
super.onCreate(savedInstanceState)
23+
binding = ActivitySettingsBinding.inflate(layoutInflater)
24+
val view = binding.root
25+
setContentView(view)
26+
27+
setSupportActionBar(binding.toolbarBinding.toolbar)
28+
supportActionBar?.setDisplayHomeAsUpEnabled(true)
29+
}
30+
31+
// Get an action bar
32+
/**
33+
* takes care of actions taken after the creation has happened
34+
* @param savedInstanceState the saved state
35+
*/
36+
override fun onPostCreate(savedInstanceState: Bundle?) {
37+
super.onPostCreate(savedInstanceState)
38+
// if (settingsDelegate == null) {
39+
// settingsDelegate = AppCompatDelegate.create(this, null)
40+
// }
41+
// settingsDelegate?.onPostCreate(savedInstanceState)
42+
}
43+
44+
override fun onSupportNavigateUp(): Boolean {
45+
onBackPressed()
46+
return true
47+
}
48+
49+
/**
50+
* Handle action-bar clicks
51+
* @param item the selected item
52+
* @return true on success, false on failure
53+
*/
54+
override fun onOptionsItemSelected(item: MenuItem): Boolean {
55+
return when (item.itemId) {
56+
android.R.id.home -> {
57+
finish()
58+
true
59+
}
60+
else -> super.onOptionsItemSelected(item)
61+
}
62+
}
63+
}

0 commit comments

Comments
 (0)