Implemented separate ColorStateLists for the individual chips in CanteenFragment.kt to show their distinct colours when clicked

This commit is contained in:
denizk0461
2023-05-01 09:35:01 +02:00
parent 079e66ad50
commit d4737d8e14
29 changed files with 225 additions and 98 deletions
@@ -42,7 +42,7 @@ class MainActivity : FragmentActivity() {
setContentView(binding.root)
// Set up navigation view bar to launch fragments
binding.contentMain.navView.setOnItemSelectedListener { item ->
binding.navView.setOnItemSelectedListener { item ->
// Launch fragment based on the item that has been clicked
loadFragment(when (item.itemId) {
R.id.food -> "canteen"
@@ -58,11 +58,11 @@ class MainActivity : FragmentActivity() {
.getBooleanPreference(SettingsPreferences.LAUNCH_CANTEEN_ON_START)
) {
// Open canteen fragment
binding.contentMain.navView.selectedItemId = R.id.food
binding.navView.selectedItemId = R.id.food
currentFragment = "canteen"
} else {
// Open event fragment
binding.contentMain.navView.selectedItemId = R.id.plan
binding.navView.selectedItemId = R.id.plan
currentFragment = "event"
}
@@ -137,38 +137,21 @@ class SettingsFragment : AppFragment() {
bundle.putString("img", "garbage")
intent.putExtras(bundle)
})
appVersionClick += 1
}
10 -> {
showToast(context, "ahhh yes")
appVersionClick += 1
}
15 -> {
showToast(context, "keep clicking")
appVersionClick += 1
}
20 -> {
showToast(context, "^_^")
appVersionClick += 1
}
30 -> {
showToast(context, "^_____^")
appVersionClick += 1
}
121 -> {
showToast(context, "Shouldn't you study for your exam?")
appVersionClick += 1
}
200 -> {
showToast(context, "\\__*")
appVersionClick += 1
}
10 -> showToast(context, getString(R.string.settings_app_version_10))
15 -> showToast(context, getString(R.string.settings_app_version_15))
20 -> showToast(context, getString(R.string.settings_app_version_20))
30 -> showToast(context, getString(R.string.settings_app_version_30))
90 -> showToast(context, getString(R.string.settings_app_version_90))
121 -> showToast(context, getString(R.string.settings_app_version_121))
165 -> showToast(context, getString(R.string.settings_app_version_165))
200 -> showToast(context, getString(R.string.settings_app_version_200))
222 -> {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(mysteryLink)))
appVersionClick = 0
appVersionClick = -1
}
else -> appVersionClick += 1
}
appVersionClick += 1
}
/*