moving About menu item into the settings

This commit is contained in:
tibbi 2022-08-08 23:15:22 +02:00
parent 0ff3a97f20
commit 029c11c2da
6 changed files with 39 additions and 20 deletions

View File

@ -50,7 +50,7 @@
android:name="com.simplemobiletools.commons.activities.AboutActivity" android:name="com.simplemobiletools.commons.activities.AboutActivity"
android:exported="false" android:exported="false"
android:label="@string/about" android:label="@string/about"
android:parentActivityName=".activities.MainActivity" /> android:parentActivityName=".activities.SettingsActivity" />
<activity <activity
android:name="com.simplemobiletools.commons.activities.CustomizationActivity" android:name="com.simplemobiletools.commons.activities.CustomizationActivity"

View File

@ -36,7 +36,6 @@ class MainActivity : SimpleActivity() {
main_toolbar.setOnMenuItemClickListener { menuItem -> main_toolbar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) { when (menuItem.itemId) {
R.id.settings -> launchSettings() R.id.settings -> launchSettings()
R.id.about -> launchAbout()
else -> return@setOnMenuItemClickListener false else -> return@setOnMenuItemClickListener false
} }
return@setOnMenuItemClickListener true return@setOnMenuItemClickListener true
@ -103,16 +102,4 @@ class MainActivity : SimpleActivity() {
hideKeyboard() hideKeyboard()
startActivity(Intent(applicationContext, SettingsActivity::class.java)) startActivity(Intent(applicationContext, SettingsActivity::class.java))
} }
private fun launchAbout() {
val licenses = 0L
val faqItems = ArrayList<FAQItem>()
if (!resources.getBoolean(R.bool.hide_google_relations)) {
faqItems.add(FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons))
faqItems.add(FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons))
}
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
}
} }

View File

@ -3,6 +3,8 @@ package com.simplemobiletools.launcher.activities
import android.os.Bundle import android.os.Bundle
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.NavigationIcon import com.simplemobiletools.commons.helpers.NavigationIcon
import com.simplemobiletools.commons.models.FAQItem
import com.simplemobiletools.launcher.BuildConfig
import com.simplemobiletools.launcher.R import com.simplemobiletools.launcher.R
import com.simplemobiletools.launcher.extensions.config import com.simplemobiletools.launcher.extensions.config
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*
@ -12,6 +14,7 @@ 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() {
@ -35,6 +38,16 @@ class SettingsActivity : SimpleActivity() {
} }
} }
private fun setupOptionsMenu() {
settings_toolbar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.about -> launchAbout()
else -> return@setOnMenuItemClickListener false
}
return@setOnMenuItemClickListener true
}
}
private fun setupPurchaseThankYou() { private fun setupPurchaseThankYou() {
settings_purchase_thank_you_holder.beGoneIf(isOrWasThankYouInstalled()) settings_purchase_thank_you_holder.beGoneIf(isOrWasThankYouInstalled())
@ -64,4 +77,16 @@ class SettingsActivity : SimpleActivity() {
System.exit(0) System.exit(0)
} }
} }
private fun launchAbout() {
val licenses = 0L
val faqItems = ArrayList<FAQItem>()
if (!resources.getBoolean(R.bool.hide_google_relations)) {
faqItems.add(FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons))
faqItems.add(FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons))
}
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
}
} }

View File

@ -15,6 +15,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_settings"
app:title="@string/settings" app:title="@string/settings"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" /> app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />

View File

@ -7,10 +7,5 @@
android:id="@+id/settings" android:id="@+id/settings"
android:icon="@drawable/ic_settings_cog_vector" android:icon="@drawable/ic_settings_cog_vector"
android:title="@string/settings" android:title="@string/settings"
app:showAsAction="ifRoom" /> app:showAsAction="always" />
<item
android:id="@+id/about"
android:icon="@drawable/ic_info_vector"
android:title="@string/about"
app:showAsAction="ifRoom" />
</menu> </menu>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="AppCompatResource">
<item
android:id="@+id/about"
android:icon="@drawable/ic_info_vector"
android:title="@string/about"
app:showAsAction="always" />
</menu>