fixing the Settings top menu

This commit is contained in:
tibbi 2022-07-13 23:29:27 +02:00
parent 189b245351
commit 1dd23d474e
2 changed files with 12 additions and 16 deletions

View File

@ -2,8 +2,6 @@ package com.simplemobiletools.camera.activities
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.os.Bundle import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.core.content.res.ResourcesCompat import androidx.core.content.res.ResourcesCompat
import com.simplemobiletools.camera.BuildConfig import com.simplemobiletools.camera.BuildConfig
import com.simplemobiletools.camera.R import com.simplemobiletools.camera.R
@ -15,19 +13,21 @@ import com.simplemobiletools.commons.helpers.LICENSE_GLIDE
import com.simplemobiletools.commons.helpers.NavigationIcon import com.simplemobiletools.commons.helpers.NavigationIcon
import com.simplemobiletools.commons.models.FAQItem import com.simplemobiletools.commons.models.FAQItem
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import java.util.Locale
import kotlin.system.exitProcess
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*
import java.util.*
import kotlin.system.exitProcess
class SettingsActivity : SimpleActivity() { class SettingsActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
setupOptionsMenu()
} }
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
setupToolbar(settings_toolbar, NavigationIcon.Arrow) setupToolbar(settings_toolbar, NavigationIcon.Arrow)
setupPurchaseThankYou() setupPurchaseThankYou()
setupCustomizeColors() setupCustomizeColors()
setupUseEnglish() setupUseEnglish()
@ -39,7 +39,6 @@ class SettingsActivity : SimpleActivity() {
setupSavePhotosFolder() setupSavePhotosFolder()
setupPhotoQuality() setupPhotoQuality()
updateTextColors(settings_holder) updateTextColors(settings_holder)
invalidateOptionsMenu()
val properPrimaryColor = getProperPrimaryColor() val properPrimaryColor = getProperPrimaryColor()
arrayListOf( arrayListOf(
@ -61,18 +60,14 @@ class SettingsActivity : SimpleActivity() {
} }
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean { private fun setupOptionsMenu() {
menuInflater.inflate(R.menu.menu, menu) settings_toolbar.setOnMenuItemClickListener { menuItem ->
updateMenuItemColors(menu) when (menuItem.itemId) {
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.about -> launchAbout() R.id.about -> launchAbout()
else -> super.onOptionsItemSelected(item) else -> return@setOnMenuItemClickListener false
}
return@setOnMenuItemClickListener true
} }
return true
} }
private fun setupPurchaseThankYou() { private fun setupPurchaseThankYou() {

View File

@ -16,6 +16,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary" android:background="@color/color_primary"
app:menu="@menu/menu"
app:title="@string/settings" app:title="@string/settings"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" /> app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />