update commons to 3.18.9

This commit is contained in:
tibbi 2018-04-05 15:18:52 +02:00
parent bbef3b5fa1
commit c77ac1a5dd
6 changed files with 59 additions and 31 deletions

View File

@ -41,7 +41,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:3.8.7' implementation 'com.simplemobiletools:commons:3.18.9'
} }
Properties props = new Properties() Properties props = new Properties()

View File

@ -49,6 +49,11 @@
android:label="@string/customize_colors" android:label="@string/customize_colors"
android:parentActivityName=".activities.SettingsActivity"/> android:parentActivityName=".activities.SettingsActivity"/>
<activity
android:name="com.simplemobiletools.commons.activities.FAQActivity"
android:label="@string/frequently_asked_questions"
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/>
<provider <provider
android:name=".contentproviders.MyContentProvider" android:name=".contentproviders.MyContentProvider"
android:authorities="com.simplemobiletools.commons.provider" android:authorities="com.simplemobiletools.commons.provider"

View File

@ -6,41 +6,26 @@ import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import com.simplemobiletools.commons.extensions.appLaunched import com.simplemobiletools.commons.extensions.appLaunched
import com.simplemobiletools.commons.extensions.checkWhatsNew import com.simplemobiletools.commons.extensions.checkWhatsNew
import com.simplemobiletools.commons.extensions.restartActivity
import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN 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 com.simplemobiletools.thankyou.extensions.config
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : SimpleActivity() { class MainActivity : SimpleActivity() {
var storedUseEnglish = false
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
appLaunched() appLaunched()
checkWhatsNewDialog() checkWhatsNewDialog()
storeStateVariables()
} }
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
if (storedUseEnglish != config.useEnglish) {
restartActivity()
return
}
updateTextColors(activity_main) updateTextColors(activity_main)
} }
override fun onPause() {
super.onPause()
storeStateVariables()
}
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_main, menu) menuInflater.inflate(R.menu.menu_main, menu)
return true return true
@ -55,18 +40,16 @@ class MainActivity : SimpleActivity() {
return true return true
} }
private fun storeStateVariables() {
config.apply {
storedUseEnglish = useEnglish
}
}
private fun launchSettings() { private fun launchSettings() {
startActivity(Intent(this, SettingsActivity::class.java)) startActivity(Intent(this, SettingsActivity::class.java))
} }
private fun launchAbout() { private fun launchAbout() {
startAboutActivity(R.string.app_name, LICENSE_KOTLIN, BuildConfig.VERSION_NAME) val faqItems = arrayListOf(
FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons)
)
startAboutActivity(R.string.app_name, 0, BuildConfig.VERSION_NAME, faqItems)
} }
private fun checkWhatsNewDialog() { private fun checkWhatsNewDialog() {

View File

@ -6,7 +6,6 @@ import android.os.Bundle
import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.commons.extensions.useEnglishToggled
import com.simplemobiletools.thankyou.R import com.simplemobiletools.thankyou.R
import com.simplemobiletools.thankyou.extensions.config import com.simplemobiletools.thankyou.extensions.config
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*
@ -24,6 +23,7 @@ class SettingsActivity : SimpleActivity() {
setupCustomizeColors() setupCustomizeColors()
setupUseEnglish() setupUseEnglish()
setupAvoidWhatsNew()
setupHideLauncherIcon() setupHideLauncherIcon()
updateTextColors(settings_holder) updateTextColors(settings_holder)
} }
@ -40,7 +40,15 @@ class SettingsActivity : SimpleActivity() {
settings_use_english_holder.setOnClickListener { settings_use_english_holder.setOnClickListener {
settings_use_english.toggle() settings_use_english.toggle()
config.useEnglish = settings_use_english.isChecked config.useEnglish = settings_use_english.isChecked
useEnglishToggled() System.exit(0)
}
}
private fun setupAvoidWhatsNew() {
settings_avoid_whats_new.isChecked = config.avoidWhatsNew
settings_avoid_whats_new_holder.setOnClickListener {
settings_avoid_whats_new.toggle()
config.avoidWhatsNew = settings_avoid_whats_new.isChecked
} }
} }

View File

@ -17,7 +17,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin"> android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/normal_margin"
android:paddingRight="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_customize_colors" android:id="@+id/settings_customize_colors"
@ -36,7 +39,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin"> android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/normal_margin"
android:paddingRight="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat <com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_use_english" android:id="@+id/settings_use_english"
@ -50,13 +56,39 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_avoid_whats_new_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/normal_margin"
android:paddingRight="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_avoid_whats_new"
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/avoid_whats_new"/>
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/settings_hide_launcher_icon_holder" android:id="@+id/settings_hide_launcher_icon_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin"> android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/normal_margin"
android:paddingRight="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat <com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_hide_launcher_icon" android:id="@+id/settings_hide_launcher_icon"

View File

@ -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.2.10' ext.kotlin_version = '1.2.31'
repositories { repositories {
jcenter() jcenter()
@ -9,7 +9,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.android.tools.build:gradle:3.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