mirror of
https://github.com/SimpleMobileTools/Simple-Thank-You.git
synced 2025-06-05 22:09:28 +02:00
Merge pull request #131 from fatihergin/feature/viewbinding-and-sdk-34-migration
Feature/viewbinding and sdk 34 migration
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'kotlin-android-extensions'
|
|
||||||
|
|
||||||
def keystorePropertiesFile = rootProject.file("keystore.properties")
|
def keystorePropertiesFile = rootProject.file("keystore.properties")
|
||||||
def keystoreProperties = new Properties()
|
def keystoreProperties = new Properties()
|
||||||
@@ -9,12 +8,13 @@ if (keystorePropertiesFile.exists()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 33
|
namespace "com.simplemobiletools.thankyou"
|
||||||
|
compileSdk 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.simplemobiletools.thankyou"
|
applicationId "com.simplemobiletools.thankyou"
|
||||||
minSdkVersion 23
|
minSdk 23
|
||||||
targetSdkVersion 33
|
targetSdk 34
|
||||||
versionCode 30
|
versionCode 30
|
||||||
versionName "5.7.2"
|
versionName "5.7.2"
|
||||||
setProperty("archivesBaseName", "thank-you")
|
setProperty("archivesBaseName", "thank-you")
|
||||||
@@ -31,6 +31,11 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
buildConfig true
|
||||||
|
viewBinding true
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
applicationIdSuffix ".debug"
|
applicationIdSuffix ".debug"
|
||||||
@@ -44,7 +49,16 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions "variants"
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = '17'
|
||||||
|
}
|
||||||
|
|
||||||
|
flavorDimensions = ["variants"]
|
||||||
productFlavors {
|
productFlavors {
|
||||||
core {}
|
core {}
|
||||||
fdroid {}
|
fdroid {}
|
||||||
@@ -61,5 +75,5 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:4c83ec8740'
|
implementation 'com.github.SimpleMobileTools:Simple-Commons:d1629c7f1a'
|
||||||
}
|
}
|
||||||
|
@@ -7,35 +7,36 @@ import com.simplemobiletools.commons.models.FAQItem
|
|||||||
import com.simplemobiletools.commons.models.Release
|
import com.simplemobiletools.commons.models.Release
|
||||||
import com.simplemobiletools.thankyou.BuildConfig
|
import com.simplemobiletools.thankyou.BuildConfig
|
||||||
import com.simplemobiletools.thankyou.R
|
import com.simplemobiletools.thankyou.R
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import com.simplemobiletools.thankyou.databinding.ActivityMainBinding
|
||||||
|
|
||||||
class MainActivity : SimpleActivity() {
|
class MainActivity : SimpleActivity() {
|
||||||
|
private val binding by viewBinding(ActivityMainBinding::inflate)
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
isMaterialActivity = true
|
isMaterialActivity = true
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(binding.root)
|
||||||
appLaunched(BuildConfig.APPLICATION_ID)
|
appLaunched(BuildConfig.APPLICATION_ID)
|
||||||
refreshMenuItems()
|
refreshMenuItems()
|
||||||
setupOptionsMenu()
|
setupOptionsMenu()
|
||||||
checkWhatsNewDialog()
|
checkWhatsNewDialog()
|
||||||
updateMaterialActivityViews(main_coordinator, activity_main, useTransparentNavigation = true, useTopSearchMenu = false)
|
updateMaterialActivityViews(binding.mainCoordinator, binding.activityMain, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
updateTextColors(activity_main)
|
updateTextColors(binding.activityMain)
|
||||||
setupToolbar(main_toolbar, statusBarColor = getProperBackgroundColor())
|
setupToolbar(binding.mainToolbar, statusBarColor = getProperBackgroundColor())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun refreshMenuItems() {
|
private fun refreshMenuItems() {
|
||||||
main_toolbar.menu.apply {
|
binding.mainToolbar.menu.apply {
|
||||||
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
|
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupOptionsMenu() {
|
private fun setupOptionsMenu() {
|
||||||
main_toolbar.setOnMenuItemClickListener { menuItem ->
|
binding.mainToolbar.setOnMenuItemClickListener { menuItem ->
|
||||||
when (menuItem.itemId) {
|
when (menuItem.itemId) {
|
||||||
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
|
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
|
||||||
R.id.settings -> launchSettings()
|
R.id.settings -> launchSettings()
|
||||||
|
@@ -7,63 +7,72 @@ import com.simplemobiletools.commons.helpers.NavigationIcon
|
|||||||
import com.simplemobiletools.commons.helpers.isTiramisuPlus
|
import com.simplemobiletools.commons.helpers.isTiramisuPlus
|
||||||
import com.simplemobiletools.thankyou.BuildConfig
|
import com.simplemobiletools.thankyou.BuildConfig
|
||||||
import com.simplemobiletools.thankyou.R
|
import com.simplemobiletools.thankyou.R
|
||||||
|
import com.simplemobiletools.thankyou.databinding.ActivitySettingsBinding
|
||||||
import com.simplemobiletools.thankyou.extensions.config
|
import com.simplemobiletools.thankyou.extensions.config
|
||||||
import kotlinx.android.synthetic.main.activity_settings.*
|
import java.util.Locale
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class SettingsActivity : SimpleActivity() {
|
class SettingsActivity : SimpleActivity() {
|
||||||
|
private val binding by viewBinding(ActivitySettingsBinding::inflate)
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
isMaterialActivity = true
|
isMaterialActivity = true
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_settings)
|
setContentView(binding.root)
|
||||||
|
|
||||||
updateMaterialActivityViews(settings_coordinator, settings_holder, useTransparentNavigation = true, useTopSearchMenu = false)
|
binding.apply {
|
||||||
setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar)
|
updateMaterialActivityViews(settingsCoordinator, settingsHolder, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||||
|
setupMaterialScrollListener(settingsNestedScrollview, settingsToolbar)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
setupToolbar(settings_toolbar, NavigationIcon.Arrow)
|
setupToolbar(binding.settingsToolbar, NavigationIcon.Arrow)
|
||||||
|
|
||||||
setupCustomizeColors()
|
setupCustomizeColors()
|
||||||
setupUseEnglish()
|
setupUseEnglish()
|
||||||
setupLanguage()
|
setupLanguage()
|
||||||
setupHideLauncherIcon()
|
setupHideLauncherIcon()
|
||||||
updateTextColors(settings_nested_scrollview)
|
updateTextColors(binding.settingsNestedScrollview)
|
||||||
|
|
||||||
arrayOf(settings_color_customization_section_label, settings_general_settings_label).forEach {
|
binding.apply {
|
||||||
it.setTextColor(getProperPrimaryColor())
|
arrayOf(settingsColorCustomizationSectionLabel, settingsGeneralSettingsLabel).forEach {
|
||||||
|
it.setTextColor(getProperPrimaryColor())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupCustomizeColors() {
|
private fun setupCustomizeColors() {
|
||||||
settings_color_customization_holder.setOnClickListener {
|
binding.settingsColorCustomizationHolder.setOnClickListener {
|
||||||
startCustomizationActivity()
|
startCustomizationActivity()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupUseEnglish() {
|
private fun setupUseEnglish() {
|
||||||
settings_use_english_holder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus())
|
binding.apply {
|
||||||
settings_use_english.isChecked = config.useEnglish
|
settingsUseEnglishHolder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus())
|
||||||
settings_use_english_holder.setOnClickListener {
|
settingsUseEnglish.isChecked = config.useEnglish
|
||||||
settings_use_english.toggle()
|
settingsUseEnglishHolder.setOnClickListener {
|
||||||
config.useEnglish = settings_use_english.isChecked
|
settingsUseEnglish.toggle()
|
||||||
System.exit(0)
|
config.useEnglish = settingsUseEnglish.isChecked
|
||||||
|
System.exit(0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupLanguage() {
|
private fun setupLanguage() {
|
||||||
settings_language.text = Locale.getDefault().displayLanguage
|
binding.apply {
|
||||||
settings_language_holder.beVisibleIf(isTiramisuPlus())
|
settingsLanguage.text = Locale.getDefault().displayLanguage
|
||||||
settings_language_holder.setOnClickListener {
|
settingsLanguageHolder.beVisibleIf(isTiramisuPlus())
|
||||||
launchChangeAppLanguageIntent()
|
settingsLanguageHolder.setOnClickListener {
|
||||||
|
launchChangeAppLanguageIntent()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupHideLauncherIcon() {
|
private fun setupHideLauncherIcon() {
|
||||||
settings_hide_launcher_icon.isChecked = config.hideLauncherIcon
|
binding.settingsHideLauncherIcon.isChecked = config.hideLauncherIcon
|
||||||
settings_hide_launcher_icon_holder.setOnClickListener {
|
binding.settingsHideLauncherIconHolder.setOnClickListener {
|
||||||
if (config.hideLauncherIcon) {
|
if (config.hideLauncherIcon) {
|
||||||
toggleHideLauncherIcon()
|
toggleHideLauncherIcon()
|
||||||
} else {
|
} else {
|
||||||
@@ -75,8 +84,8 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun toggleHideLauncherIcon() {
|
private fun toggleHideLauncherIcon() {
|
||||||
settings_hide_launcher_icon.toggle()
|
binding.settingsHideLauncherIcon.toggle()
|
||||||
config.hideLauncherIcon = settings_hide_launcher_icon.isChecked
|
config.hideLauncherIcon = binding.settingsHideLauncherIcon.isChecked
|
||||||
|
|
||||||
val appId = BuildConfig.APPLICATION_ID
|
val appId = BuildConfig.APPLICATION_ID
|
||||||
getAppIconColors().forEachIndexed { index, color ->
|
getAppIconColors().forEachIndexed { index, color ->
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.7.10'
|
ext.kotlin_version = '1.9.0'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
@@ -9,7 +9,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.3.1'
|
classpath 'com.android.tools.build:gradle:8.1.0'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
@@ -9,9 +9,10 @@
|
|||||||
|
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
org.gradle.jvmargs=-Xmx1536m
|
org.gradle.jvmargs=-Xmx4g
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
|
android.nonTransitiveRClass=false
|
||||||
|
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||||
|
Reference in New Issue
Block a user