update commons to 3.17.24

This commit is contained in:
tibbi 2018-04-04 15:25:33 +02:00
parent 962801a3ed
commit eca9af3a3e
8 changed files with 40 additions and 49 deletions

View File

@ -42,9 +42,9 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:3.8.1' implementation 'com.simplemobiletools:commons:3.17.24'
implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.android.support:multidex:1.0.2' implementation 'com.android.support:multidex:1.0.3'
} }
Properties props = new Properties() Properties props = new Properties()

View File

@ -15,9 +15,7 @@ import com.simplemobiletools.applauncher.extensions.isAPredefinedApp
import com.simplemobiletools.applauncher.models.AppLauncher import com.simplemobiletools.applauncher.models.AppLauncher
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.helpers.LICENSE_MULTISELECT import com.simplemobiletools.commons.helpers.LICENSE_MULTISELECT
import com.simplemobiletools.commons.helpers.LICENSE_STETHO import com.simplemobiletools.commons.helpers.LICENSE_STETHO
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
@ -29,7 +27,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private var launchers = ArrayList<AppLauncher>() private var launchers = ArrayList<AppLauncher>()
private var mStoredPrimaryColor = 0 private var mStoredPrimaryColor = 0
private var mStoredTextColor = 0 private var mStoredTextColor = 0
private var mStoredUseEnglish = false
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -48,17 +45,15 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
if (mStoredUseEnglish != config.useEnglish) {
restartActivity()
return
}
if (mStoredTextColor != config.textColor) { if (mStoredTextColor != config.textColor) {
getGridAdapter()?.updateTextColor(config.textColor) getGridAdapter()?.updateTextColor(config.textColor)
} }
if (mStoredPrimaryColor != config.primaryColor) { if (mStoredPrimaryColor != config.primaryColor) {
getGridAdapter()?.updatePrimaryColor(config.primaryColor) getGridAdapter()?.apply {
updatePrimaryColor(config.primaryColor)
notifyDataSetChanged()
}
} }
updateTextColors(coordinator_layout) updateTextColors(coordinator_layout)
@ -88,7 +83,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
private fun launchAbout() { private fun launchAbout() {
startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_MULTISELECT or LICENSE_STETHO, BuildConfig.VERSION_NAME) startAboutActivity(R.string.app_name, LICENSE_MULTISELECT or LICENSE_STETHO, BuildConfig.VERSION_NAME)
} }
private fun getGridAdapter() = launchers_grid.adapter as? LaunchersAdapter private fun getGridAdapter() = launchers_grid.adapter as? LaunchersAdapter
@ -107,7 +102,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
startActivity(intent) startActivity(intent)
} }
} }
adapter.setupDragListener(true)
launchers_grid.adapter = adapter launchers_grid.adapter = adapter
} }
@ -127,7 +121,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
config.apply { config.apply {
mStoredPrimaryColor = primaryColor mStoredPrimaryColor = primaryColor
mStoredTextColor = textColor mStoredTextColor = textColor
mStoredUseEnglish = useEnglish
} }
} }

View File

@ -5,7 +5,6 @@ import com.simplemobiletools.applauncher.R
import com.simplemobiletools.applauncher.extensions.config import com.simplemobiletools.applauncher.extensions.config
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 kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*
import java.util.* import java.util.*
@ -36,7 +35,7 @@ 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)
} }
} }
} }

View File

@ -20,6 +20,10 @@ import java.util.*
class LaunchersAdapter(activity: SimpleActivity, val launchers: MutableList<AppLauncher>, val listener: RefreshRecyclerViewListener?, class LaunchersAdapter(activity: SimpleActivity, val launchers: MutableList<AppLauncher>, val listener: RefreshRecyclerViewListener?,
recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) { recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) {
init {
setupDragListener(true)
}
override fun getActionMenuId() = R.menu.cab override fun getActionMenuId() = R.menu.cab
override fun prepareItemSelection(view: View) { override fun prepareItemSelection(view: View) {
@ -30,7 +34,7 @@ class LaunchersAdapter(activity: SimpleActivity, val launchers: MutableList<AppL
view?.launcher_check?.beVisibleIf(select) view?.launcher_check?.beVisibleIf(select)
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int) = createViewHolder(R.layout.app_launcher_item, parent) override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = createViewHolder(R.layout.app_launcher_item, parent)
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) { override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
val launcher = launchers[position] val launcher = launchers[position]
@ -84,11 +88,6 @@ class LaunchersAdapter(activity: SimpleActivity, val launchers: MutableList<AppL
removeSelectedItems() removeSelectedItems()
} }
fun updatePrimaryColor(primaryColor: Int) {
this.primaryColor = primaryColor
notifyDataSetChanged()
}
private fun setupView(view: View, launcher: AppLauncher) { private fun setupView(view: View, launcher: AppLauncher) {
view.apply { view.apply {
launcher_label.text = launcher.name launcher_label.text = launcher.name

View File

@ -59,8 +59,8 @@ class LaunchersDialogAdapter(activity: Activity, val launchers: ArrayList<AppLau
toggleItemSelection(selectedPositions.contains(position), position) toggleItemSelection(selectedPositions.contains(position), position)
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent?.context).inflate(R.layout.app_launcher_item, parent, false) val view = LayoutInflater.from(parent.context).inflate(R.layout.app_launcher_item, parent, false)
return ViewHolder(view, adapterListener) return ViewHolder(view, adapterListener)
} }

View File

@ -25,15 +25,15 @@ class AddAppLauncherDialog(val activity: Activity, val displayedLaunchers: Array
.setPositiveButton(R.string.ok, { dialogInterface, i -> confirmSelection() }) .setPositiveButton(R.string.ok, { dialogInterface, i -> confirmSelection() })
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
activity.setupDialogStuff(view, this) { activity.setupDialogStuff(view, this) {
Thread { Thread {
adapter = LaunchersDialogAdapter(activity, getNotDisplayedLaunchers()) adapter = LaunchersDialogAdapter(activity, getNotDisplayedLaunchers())
activity.runOnUiThread { activity.runOnUiThread {
view.pick_launchers_holder.adapter = adapter view.pick_launchers_holder.adapter = adapter
}
}.start()
} }
}.start() }
}
}
} }
private fun confirmSelection() { private fun confirmSelection() {

View File

@ -3,11 +3,11 @@ package com.simplemobiletools.applauncher.dialogs
import android.app.Activity import android.app.Activity
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager
import com.simplemobiletools.applauncher.R import com.simplemobiletools.applauncher.R
import com.simplemobiletools.applauncher.extensions.dbHelper import com.simplemobiletools.applauncher.extensions.dbHelper
import com.simplemobiletools.applauncher.models.AppLauncher import com.simplemobiletools.applauncher.models.AppLauncher
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.showKeyboard
import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.extensions.value import com.simplemobiletools.commons.extensions.value
import kotlinx.android.synthetic.main.dialog_edit_launcher.view.* import kotlinx.android.synthetic.main.dialog_edit_launcher.view.*
@ -23,22 +23,22 @@ class EditDialog(val activity: Activity, val appLauncher: AppLauncher, val callb
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) activity.setupDialogStuff(view, this, R.string.rename) {
activity.setupDialogStuff(view, this, R.string.rename) { showKeyboard(view.edit_launcher_edittext)
getButton(android.app.AlertDialog.BUTTON_POSITIVE).setOnClickListener { getButton(android.app.AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val newName = view.edit_launcher_edittext.value val newName = view.edit_launcher_edittext.value
if (!newName.isEmpty()) { if (!newName.isEmpty()) {
if (activity.dbHelper.updateLauncherName(appLauncher.id, newName)) { if (activity.dbHelper.updateLauncherName(appLauncher.id, newName)) {
callback() callback()
dismiss() dismiss()
} else { } else {
activity.toast(R.string.unknown_error_occurred) activity.toast(R.string.unknown_error_occurred)
}
} else {
activity.toast(R.string.enter_launcher_name)
}
} }
} else {
activity.toast(R.string.enter_launcher_name)
} }
} }
}
}
} }
} }

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.20' 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