Skip to content

Commit 2dc20b3

Browse files
committed
show a More apps from us menu button at the top menu
1 parent 858533e commit 2dc20b3

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ android {
6262
}
6363

6464
dependencies {
65-
implementation 'com.github.SimpleMobileTools:Simple-Commons:9162225f33'
65+
implementation 'com.github.SimpleMobileTools:Simple-Commons:af11ea2e30'
6666
implementation 'org.greenrobot:eventbus:3.3.1'
6767
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
6868
}

app/src/main/kotlin/com/simplemobiletools/flashlight/activities/MainActivity.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class MainActivity : SimpleActivity() {
4343
setContentView(R.layout.activity_main)
4444
appLaunched(BuildConfig.APPLICATION_ID)
4545
setupOptionsMenu()
46+
refreshMenuItems()
4647

4748
mBus = EventBus.getDefault()
4849
changeIconColor(getContrastColor(), stroboscope_btn)
@@ -129,6 +130,7 @@ class MainActivity : SimpleActivity() {
129130
private fun setupOptionsMenu() {
130131
main_toolbar.setOnMenuItemClickListener { menuItem ->
131132
when (menuItem.itemId) {
133+
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
132134
R.id.settings -> launchSettings()
133135
R.id.about -> launchAbout()
134136
else -> return@setOnMenuItemClickListener false
@@ -137,6 +139,12 @@ class MainActivity : SimpleActivity() {
137139
}
138140
}
139141

142+
private fun refreshMenuItems() {
143+
main_toolbar.menu.apply {
144+
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
145+
}
146+
}
147+
140148
override fun onSaveInstanceState(outState: Bundle) {
141149
outState.putBoolean(FLASHLIGHT_STATE, mIsFlashlightOn)
142150
outState.putBoolean(STROBOSCOPE_STATE, stroboscope_bar.isVisible())

app/src/main/res/menu/menu.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<menu xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:app="http://schemas.android.com/apk/res-auto">
4+
<item
5+
android:id="@+id/more_apps_from_us"
6+
android:showAsAction="never"
7+
android:title="@string/more_apps_from_us"
8+
app:showAsAction="never" />
49
<item
510
android:id="@+id/settings"
611
android:icon="@drawable/ic_settings_cog_vector"

0 commit comments

Comments
 (0)