diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 74938e7..da25b52 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -50,7 +50,7 @@ android:name="com.simplemobiletools.commons.activities.AboutActivity" android:exported="false" android:label="@string/about" - android:parentActivityName=".activities.MainActivity" /> + android:parentActivityName=".activities.SettingsActivity" /> when (menuItem.itemId) { R.id.settings -> launchSettings() - R.id.about -> launchAbout() else -> return@setOnMenuItemClickListener false } return@setOnMenuItemClickListener true @@ -103,16 +102,4 @@ class MainActivity : SimpleActivity() { hideKeyboard() startActivity(Intent(applicationContext, SettingsActivity::class.java)) } - - private fun launchAbout() { - val licenses = 0L - val faqItems = ArrayList() - - 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) - } } diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt index 8ad7464..4730bff 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt @@ -3,6 +3,8 @@ package com.simplemobiletools.launcher.activities import android.os.Bundle import com.simplemobiletools.commons.extensions.* 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.extensions.config import kotlinx.android.synthetic.main.activity_settings.* @@ -12,6 +14,7 @@ class SettingsActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_settings) + setupOptionsMenu() } 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() { settings_purchase_thank_you_holder.beGoneIf(isOrWasThankYouInstalled()) @@ -64,4 +77,16 @@ class SettingsActivity : SimpleActivity() { System.exit(0) } } + + private fun launchAbout() { + val licenses = 0L + val faqItems = ArrayList() + + 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) + } } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 5e34919..2a857f5 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -15,6 +15,7 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/color_primary" + app:menu="@menu/menu_settings" app:title="@string/settings" app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" /> diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 49e488f..4fae7a8 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -7,10 +7,5 @@ android:id="@+id/settings" android:icon="@drawable/ic_settings_cog_vector" android:title="@string/settings" - app:showAsAction="ifRoom" /> - + app:showAsAction="always" /> diff --git a/app/src/main/res/menu/menu_settings.xml b/app/src/main/res/menu/menu_settings.xml new file mode 100644 index 0000000..ed7bfec --- /dev/null +++ b/app/src/main/res/menu/menu_settings.xml @@ -0,0 +1,11 @@ + + + +