adding an option to hide the launcher icon
This commit is contained in:
parent
7ec7bc70e4
commit
2420b7261d
|
@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
|
|||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.3"
|
||||
compileSdkVersion 26
|
||||
buildToolsVersion "26.0.2"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.simplemobiletools.thankyou"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 25
|
||||
targetSdkVersion 26
|
||||
versionCode 2
|
||||
versionName "2.0.0"
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.simplemobiletools:commons:2.32.0'
|
||||
compile 'com.simplemobiletools:commons:2.36.0'
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.simplemobiletools.thankyou.activities
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
import com.simplemobiletools.thankyou.R
|
||||
import com.simplemobiletools.thankyou.extensions.config
|
||||
import kotlinx.android.synthetic.main.activity_settings.*
|
||||
|
||||
class SettingsActivity : BaseSimpleActivity() {
|
||||
|
@ -15,7 +18,9 @@ class SettingsActivity : BaseSimpleActivity() {
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
setupCustomizeColors()
|
||||
setupHideLauncherIcon()
|
||||
updateTextColors(settings_holder)
|
||||
}
|
||||
|
||||
|
@ -24,4 +29,16 @@ class SettingsActivity : BaseSimpleActivity() {
|
|||
startCustomizationActivity()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupHideLauncherIcon() {
|
||||
settings_hide_launcher_icon.isChecked = config.hideLauncherIcon
|
||||
settings_hide_launcher_icon_holder.setOnClickListener {
|
||||
settings_hide_launcher_icon.toggle()
|
||||
config.hideLauncherIcon = settings_hide_launcher_icon.isChecked
|
||||
|
||||
val componentName = ComponentName(this, MainActivity::class.java)
|
||||
val state = if (config.hideLauncherIcon) PackageManager.COMPONENT_ENABLED_STATE_DISABLED else PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
||||
packageManager.setComponentEnabledSetting(componentName, state, PackageManager.DONT_KILL_APP)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package com.simplemobiletools.thankyou.extensions
|
||||
|
||||
import android.content.Context
|
||||
import com.simplemobiletools.thankyou.helpers.Config
|
||||
|
||||
val Context.config: Config get() = Config.newInstance(this)
|
|
@ -1,24 +1,14 @@
|
|||
package com.simplemobiletools.thankyou.helpers
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
|
||||
class Config(context: Context) {
|
||||
private val mPrefs: SharedPreferences
|
||||
import com.simplemobiletools.commons.helpers.BaseConfig
|
||||
|
||||
class Config(context: Context) : BaseConfig(context) {
|
||||
companion object {
|
||||
fun newInstance(context: Context) = Config(context)
|
||||
}
|
||||
|
||||
init {
|
||||
mPrefs = context.getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE)
|
||||
}
|
||||
|
||||
var isFirstRun: Boolean
|
||||
get() = mPrefs.getBoolean(IS_FIRST_RUN, true)
|
||||
set(firstRun) = mPrefs.edit().putBoolean(IS_FIRST_RUN, firstRun).apply()
|
||||
|
||||
var isDarkTheme: Boolean
|
||||
get() = mPrefs.getBoolean(IS_DARK_THEME, false)
|
||||
set(isDarkTheme) = mPrefs.edit().putBoolean(IS_DARK_THEME, isDarkTheme).apply()
|
||||
var hideLauncherIcon: Boolean
|
||||
get() = prefs.getBoolean(HIDE_LAUNCHER_ICON, false)
|
||||
set(hideLauncherIcon) = prefs.edit().putBoolean(HIDE_LAUNCHER_ICON, hideLauncherIcon).apply()
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
package com.simplemobiletools.thankyou.helpers
|
||||
|
||||
// Shared Preferences
|
||||
val PREFS_KEY = "Thank You"
|
||||
val IS_FIRST_RUN = "is_first_run"
|
||||
val IS_DARK_THEME = "is_dark_theme"
|
||||
val HIDE_LAUNCHER_ICON = "hide_launcher_icon"
|
||||
|
|
|
@ -29,5 +29,25 @@
|
|||
android:text="@string/customize_colors"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_hide_launcher_icon_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||
android:id="@+id/settings_hide_launcher_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingLeft="@dimen/medium_margin"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/hide_launcher_icon"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Dankeschön</string>
|
||||
<string name="main_text">Danke für deine Unterstützung!\nSchreibe uns doch an \n hello@simplemobiletools.com,\n wir hören dein Feedback und deine Vorschläge sehr gerne.\n\n(Bitte lasse diese App für mindestens einen Tag installiert, um eine automatische Rückerstattung zu unterbinden.)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">Eine kostenpflichtige App für alle, die uns unterstützen wollen.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Thank You</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Thank You</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Thank You</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Thank You</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Thank You</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Thank You</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Simple Thank You</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Obrigado</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Спасибо</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Ďakujem</string>
|
||||
<string name="main_text">Ďakujem za našu podporu!\nNapíšte nám na \n hello@simplemobiletools.com,\n chceme počuť každú spätnú väzbu a odporúčania.\n\n(Prosím ponechajte si aplikáciu nainštalovanú aspoň 1 deň, predídete tak automatickému vráteniu peňazí)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Skryť spúšťaciu ikonku</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">Platená aplikácia pre ľudí, ktorí nás chcú podporiť, veľa zatiaľ toho nerobí.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Tack</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Thank You</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Thank You</string>
|
||||
<string name="main_text">Thank you for supporting us!\nDrop us a line at \n hello@simplemobiletools.com,\n we\'d love to hear all your feedback and suggestions.\n\n(Please keep the app installed at least for a day, to avoid getting automatically refunded)</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="hide_launcher_icon">Hide the launcher icon</string>
|
||||
|
||||
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
|
||||
<!-- Short description has to have less than 80 chars -->
|
||||
<string name="app_short_description">A paid app for people who want to support us, not doing much yet.</string>
|
||||
|
|
Loading…
Reference in New Issue