adding a More Apps From Us menu button

This commit is contained in:
tibbi 2022-12-24 21:27:00 +01:00
parent 33ab62be22
commit 3875a26fcb
3 changed files with 20 additions and 1 deletions

View File

@ -29,10 +29,12 @@
<activity
android:name=".activities.MainActivity"
android:configChanges="orientation"
android:exported="false" />
<activity
android:name=".activities.ManageClipboardItemsActivity"
android:configChanges="orientation"
android:exported="false"
android:label="@string/manage_clipboard_items"
android:parentActivityName=".activities.SettingsActivity" />
@ -52,6 +54,7 @@
<activity
android:name=".activities.SettingsActivity"
android:configChanges="orientation"
android:exported="true"
android:label="@string/settings"
android:parentActivityName=".activities.MainActivity">
@ -68,11 +71,13 @@
<activity
android:name="com.simplemobiletools.commons.activities.AboutActivity"
android:configChanges="orientation"
android:label="@string/about"
android:parentActivityName=".activities.MainActivity" />
<activity
android:name="com.simplemobiletools.commons.activities.CustomizationActivity"
android:configChanges="orientation"
android:label="@string/customize_colors"
android:parentActivityName=".activities.SettingsActivity" />

View File

@ -18,8 +18,10 @@ class MainActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setupOptionsMenu()
appLaunched(BuildConfig.APPLICATION_ID)
setupOptionsMenu()
refreshMenuItems()
change_keyboard_holder.setOnClickListener {
(getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager).showInputMethodPicker()
}
@ -48,6 +50,7 @@ class MainActivity : SimpleActivity() {
private fun setupOptionsMenu() {
main_toolbar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
R.id.settings -> launchSettings()
R.id.about -> launchAbout()
else -> return@setOnMenuItemClickListener false
@ -56,6 +59,12 @@ class MainActivity : SimpleActivity() {
}
}
private fun refreshMenuItems() {
main_toolbar.menu.apply {
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
}
}
private fun launchSettings() {
hideKeyboard()
startActivity(Intent(applicationContext, SettingsActivity::class.java))

View File

@ -1,6 +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">
<item
android:id="@+id/more_apps_from_us"
android:icon="@drawable/ic_google_play_vector"
android:title="@string/more_apps_from_us"
app:showAsAction="always" />
<item
android:id="@+id/settings"
android:icon="@drawable/ic_settings_cog_vector"