forked from upstream-mirrors/quik
Squashed commit of the following:
commit 1f890b96beb893c866ed9b47d8e3a9ac6e20662f Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed Jan 31 17:41:22 2018 -0500 Clean up bindView in PlusViewModel commit c71f4853d385df66a79f9372ecf29507cb64152b Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed Jan 31 02:14:37 2018 -0500 Move QKSMS+ to sliding menu commit a23d1dd6d314935cd96c530e3419a3a2ca4cab27 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed Jan 31 00:28:42 2018 -0500 Make selected plan more visible commit 540cda206ede1d3b81d7d42438257f76f9f07cd4 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed Jan 31 00:27:03 2018 -0500 Allow changing dynamic textcolor programatically commit 859325dd5ffa7aa5958ae2eb5c9eac62bcb8f7bd Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Tue Jan 30 22:26:41 2018 -0500 Dark mode support for ripple selected state commit 6a1d5c387fe0a08ef05573f3f07a1cd82b1a37ec Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Tue Jan 30 22:18:27 2018 -0500 Remove explicit upgrade button, click plan to buy commit 4a6e85b0c513c8604f8993f78add2b3910c0b49d Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Tue Jan 30 20:43:09 2018 -0500 Show thank you UI if user has upgraded commit 080fccf40b4461b6a833ba77fce1267bd8251281 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Tue Jan 30 17:52:02 2018 -0500 Allow changing plans commit ac122f138b1840de39f7a7bd1fb36727056233e1 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Tue Jan 30 16:33:59 2018 -0500 Allow purchase of subscription commit 3e689443ec197a929308d9add270ae6777cdeae1 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 23:21:31 2018 -0500 Allow selection of different plans commit d51a90160898b39de5ba4e69fdc8351e2fe7093c Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 19:42:56 2018 -0500 Collapsing toolbar for QKSMS+ activity commit 06c0d5a834884f144ad7e149b7dea3b0ba38b643 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 18:02:05 2018 -0500 Display pricing information in QKSMS+ activity commit c0be51eec5e1b091dbe8ba69f28c48e5379011f3 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 17:26:16 2018 -0500 Add ability to view QKSMS+ activity from settings commit 51e7782a274503401d53a22ccbe55eab2523f200 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 15:41:40 2018 -0500 Indicate currently selected theme commit 0b3bb3e24b3c40ac517cf05404638061f9b520b8 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 15:19:28 2018 -0500 Move ThemeAdapter package commit 828b6fe10afd6493884ee8d1c472dcd39f5371d4 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 15:10:14 2018 -0500 Evenly space theme swatches with other items and borders commit 220499c0676f03c282b201dfd67faa10f20a546d Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 14:45:47 2018 -0500 Evenly distribute theme swatches commit 4d0995da773f720411b22091fc58d03497d38438 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 22:53:49 2018 -0500 Use separate activity for Theme picker commit 3886c1890a6320667f9999071213f181e4e2de79 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 20:00:17 2018 -0500 Update more text commit 3e3995fdf58ee849f6fedabd895aff42f521e473 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 19:56:04 2018 -0500 Update text for blocking commit b8ffbf30761105abe1150279994c8d0ebd7a68b7 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 19:49:11 2018 -0500 Build layout for QKSMS+ activity commit 90518ad8291d5028ceb765ca60fe1d36a5edb33a Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 19:48:59 2018 -0500 Improve layout preview support for some custom views commit 3b301b641e1b747d0ac7192bb50e51d494fe6ef8 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 02:22:54 2018 -0500 Use up-to-date material design colors commit e8c9cec67767c8702f1b6ccf7ee89c22e585132c Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 01:21:24 2018 -0500 Add strings and icons for QKSMS+ features
This commit is contained in:
@@ -28,7 +28,6 @@ import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import com.google.android.flexbox.FlexboxLayoutManager
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.R
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
@@ -37,7 +36,6 @@ import common.di.appComponent
|
||||
import common.util.extensions.dpToPx
|
||||
import common.util.extensions.setVisible
|
||||
import data.model.MenuItem
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
import kotlinx.android.synthetic.main.settings_activity.*
|
||||
@@ -53,7 +51,6 @@ class SettingsActivity : QkActivity<SettingsViewModel>(), SettingsView {
|
||||
|
||||
override val viewModelClass = SettingsViewModel::class
|
||||
override val preferenceClickIntent: Subject<PreferenceView> = PublishSubject.create()
|
||||
override val themeSelectedIntent: Observable<Int> by lazy { themeAdapter.colorSelected }
|
||||
override val ringtoneSelectedIntent: Subject<String> = PublishSubject.create()
|
||||
override val mmsSizeSelectedIntent: Subject<Int> by lazy { menuItemAdapter.menuItemClicks }
|
||||
|
||||
@@ -66,50 +63,6 @@ class SettingsActivity : QkActivity<SettingsViewModel>(), SettingsView {
|
||||
}
|
||||
}
|
||||
|
||||
private val themeDialog by lazy {
|
||||
AlertDialog.Builder(this)
|
||||
.setTitle(R.string.settings_dialog_theme_title)
|
||||
.setView(themeRecyclerView)
|
||||
.setCancelable(false)
|
||||
.create()
|
||||
}
|
||||
|
||||
private val themeRecyclerView by lazy {
|
||||
RecyclerView(this).apply {
|
||||
val padding = 8.dpToPx(context)
|
||||
setPadding(padding, padding, padding, padding)
|
||||
adapter = themeAdapter
|
||||
clipToPadding = false
|
||||
clipChildren = false
|
||||
layoutManager = FlexboxLayoutManager(this@SettingsActivity)
|
||||
}
|
||||
}
|
||||
|
||||
private val themeAdapter by lazy {
|
||||
ThemeAdapter(this@SettingsActivity).apply {
|
||||
data = listOf(
|
||||
-0x21f24, -0x64245, -0x96678, -0xc93a0, -0x17b1c0, -0x1ae3dd, -0x22e6e3, -0x2fe8ea, -0x3bebef, -0x4fedf6,
|
||||
-0x31b14, -0x74430, -0xb704f, -0xf9d6e, -0x13bf86, -0x16e19d, -0x27e4a0, -0x3de7a5, -0x52eba9, -0x77f1b1,
|
||||
-0xc1a0b, -0x1e4119, -0x316c28, -0x459738, -0x54b844, -0x63d850, -0x71db56, -0x84e05e, -0x95e466, -0xb5eb74,
|
||||
-0x12180a, -0x2e3b17, -0x4c6225, -0x6a8a33, -0x81a83e, -0x98c549, -0xa1ca4f, -0xaed258, -0xbad860, -0xcee46e,
|
||||
-0x17150a, -0x3a3517, -0x605726, -0x867935, -0xa39440, -0xc0ae4b, -0xc6b655, -0xcfc061, -0xd7ca6d, -0xe5dc82,
|
||||
-0x181603, -0x2f2601, -0x504001, -0x6e5801, -0x8c7002, -0xa98804, -0xb19311, -0xbaa122, -0xc4af32, -0xd5c94f,
|
||||
-0x1e0a02, -0x4c1a04, -0x7e2b06, -0xb03c09, -0xd6490a, -0xfc560c, -0xfc641b, -0xfd772f, -0xfd8843, -0xfea865,
|
||||
-0x1f0806, -0x4d140e, -0x7f2116, -0xb22f1f, -0xd93926, -0xff432c, -0xff533f, -0xff6859, -0xff7c71, -0xff9f9c,
|
||||
-0x1f0d0f, -0x4d2025, -0x7f343c, -0xb24954, -0xd95966, -0xff6978, -0xff7685, -0xff8695, -0xff96a4, -0xffb2c0,
|
||||
-0x2f0732, -0x5c165c, -0x8d2a8e, -0xbd42bf, -0xd450d5, -0xda64dc, -0xf570f8, -0xf581f9, -0xfa9100, -0xf2acfe,
|
||||
-0xe0717, -0x231238, -0x3a1e5b, -0x512a7f, -0x63339b, -0x743cb6, -0x834cbe, -0x9760c8, -0xaa74d1, -0xcc96e2,
|
||||
-0x60419, -0xf0b3d, -0x191164, -0x23188b, -0x2b1ea9, -0x3223c7, -0x3f35cd, -0x504bd5, -0x6162dc, -0x7d88e9,
|
||||
-0x219, -0x63c, -0xa63, -0xe8a, -0x11a8, -0x14c5, -0x227cb, -0x43fd3, -0x657db, -0xa80e9,
|
||||
-0x71f, -0x134d, -0x1f7e, -0x2ab1, -0x35d8, -0x3ef9, -0x4d00, -0x6000, -0x7100, -0x9100,
|
||||
-0xc20, -0x1f4e, -0x3380, -0x48b3, -0x58da, -0x6800, -0x47400, -0xa8400, -0x109400, -0x19af00,
|
||||
-0x41619, -0x3344, -0x546f, -0x759b, -0x8fbd, -0xa8de, -0xbaee2, -0x19b5e7, -0x27bceb, -0x40c9f4,
|
||||
-0x101417, -0x283338, -0x43555c, -0x5e7781, -0x72919d, -0x86aab8, -0x92b3bf, -0xa2bfc9, -0xb1cbd2,
|
||||
-0x50506, -0xa0a0b, -0x111112, -0x1f1f20, -0x424243, -0x616162, -0x8a8a8b, -0x9e9e9f, -0xbdbdbe, -0xdededf, -0x1000000, -0x1,
|
||||
-0x13100f, -0x13100f, -0x4f413b, -0x6f5b52, -0x876f64, -0x9f8275, -0xab9186, -0xbaa59c, -0xc8b8b1, -0xd9cdc8)
|
||||
}
|
||||
}
|
||||
|
||||
private val mmsSizeDialog by lazy {
|
||||
menuItemAdapter.data = arrayListOf(
|
||||
MenuItem(R.string.menu_mms_size_100kb, 100),
|
||||
@@ -161,9 +114,6 @@ class SettingsActivity : QkActivity<SettingsViewModel>(), SettingsView {
|
||||
}
|
||||
|
||||
override fun render(state: SettingsState) {
|
||||
if (themeDialog.isShowing && !state.selectingTheme) themeDialog.dismiss()
|
||||
else if (!themeDialog.isShowing && state.selectingTheme) themeDialog.show()
|
||||
|
||||
if (progressDialog.isShowing && !state.syncing) progressDialog.dismiss()
|
||||
else if (!progressDialog.isShowing && state.syncing) progressDialog.show()
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package presentation.feature.settings
|
||||
|
||||
data class SettingsState(
|
||||
val selectingTheme: Boolean = false,
|
||||
val syncing: Boolean = false,
|
||||
|
||||
val isDefaultSmsApp: Boolean = false,
|
||||
|
||||
@@ -27,7 +27,6 @@ import presentation.common.widget.PreferenceView
|
||||
interface SettingsView : QkView<SettingsState> {
|
||||
|
||||
val preferenceClickIntent: Subject<PreferenceView>
|
||||
val themeSelectedIntent: Observable<Int>
|
||||
val ringtoneSelectedIntent: Observable<String>
|
||||
val mmsSizeSelectedIntent: Observable<Int>
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState
|
||||
when (it.id) {
|
||||
R.id.defaultSms -> navigator.showDefaultSmsDialog()
|
||||
|
||||
R.id.theme -> newState { it.copy(selectingTheme = true) }
|
||||
R.id.theme -> navigator.showThemePicker()
|
||||
|
||||
R.id.dark -> prefs.dark.set(!prefs.dark.get())
|
||||
|
||||
@@ -125,13 +125,6 @@ class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState
|
||||
}
|
||||
}
|
||||
|
||||
view.themeSelectedIntent
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { color ->
|
||||
prefs.theme.set(color)
|
||||
newState { it.copy(selectingTheme = false) }
|
||||
}
|
||||
|
||||
view.ringtoneSelectedIntent
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { ringtone -> prefs.ringtone.set(ringtone) }
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package presentation.feature.settings
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.moez.QKSMS.R
|
||||
import common.util.extensions.setBackgroundTint
|
||||
import presentation.common.base.QkAdapter
|
||||
import presentation.common.base.QkViewHolder
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
import kotlinx.android.synthetic.main.theme_list_item.view.*
|
||||
|
||||
class ThemeAdapter(private val context: Context) : QkAdapter<Int>() {
|
||||
|
||||
val colorSelected: Subject<Int> = PublishSubject.create()
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder {
|
||||
val view = LayoutInflater.from(context).inflate(R.layout.theme_list_item, parent, false)
|
||||
return QkViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
|
||||
val theme = getItem(position)
|
||||
val view = holder.itemView
|
||||
|
||||
view.setOnClickListener { colorSelected.onNext(theme) }
|
||||
|
||||
view.theme.setBackgroundTint(theme)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user