Loading build.gradle +2 −2 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ buildscript { ext.mockito_version = '2.18.3' ext.mockito_version = '2.18.3' ext.moshi_version = '1.8.0' ext.moshi_version = '1.8.0' ext.okhttp3_version = '4.1.0' ext.okhttp3_version = '4.1.0' ext.realm_version = '5.8.0' ext.realm_version = '6.1.0' ext.realm_adapters_version = '3.1.0' ext.realm_adapters_version = '3.1.0' ext.rxandroid_version = '2.0.1' ext.rxandroid_version = '2.0.1' ext.rxdogtag_version = '0.2.0' ext.rxdogtag_version = '0.2.0' Loading @@ -42,7 +42,7 @@ buildscript { } } dependencies { dependencies { classpath 'com.android.tools.build:gradle:3.5.2' classpath 'com.android.tools.build:gradle:3.6.1' classpath 'com.google.gms:google-services:4.2.0' classpath 'com.google.gms:google-services:4.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'io.fabric.tools:gradle:1.29.0' classpath 'io.fabric.tools:gradle:1.29.0' Loading gradle/wrapper/gradle-wrapper.properties +2 −2 Original line number Original line Diff line number Diff line #Tue Dec 03 23:30:52 EST 2019 #Tue Mar 03 19:56:50 EST 2020 distributionBase=GRADLE_USER_HOME 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-5.4.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip presentation/build.gradle +4 −5 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,6 @@ apply plugin: 'com.android.application' apply plugin: 'com.android.application' apply plugin: 'realm-android' // Realm needs to be before Kotlin or the build will fail apply plugin: 'realm-android' // Realm needs to be before Kotlin or the build will fail apply plugin: 'kotlin-android' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt' android { android { Loading Loading @@ -70,6 +69,10 @@ android { noAnalytics { dimension "analytics" } noAnalytics { dimension "analytics" } } } viewBinding { enabled = true } if (System.getenv("CI") == "true") { if (System.getenv("CI") == "true") { signingConfigs.release.storeFile = file("../keystore") signingConfigs.release.storeFile = file("../keystore") signingConfigs.release.storePassword = System.getenv("keystore_password") signingConfigs.release.storePassword = System.getenv("keystore_password") Loading @@ -78,10 +81,6 @@ android { } } } } androidExtensions { experimental = true } configurations { configurations { noAnalyticsDebug noAnalyticsDebug noAnalyticsRelease noAnalyticsRelease Loading presentation/src/main/java/com/moez/QKSMS/common/MenuItemAdapter.kt +21 −24 Original line number Original line Diff line number Diff line Loading @@ -20,26 +20,26 @@ package com.moez.QKSMS.common import android.content.Context import android.content.Context import android.content.res.ColorStateList import android.content.res.ColorStateList import android.view.LayoutInflater import android.view.ViewGroup import android.view.ViewGroup import androidx.annotation.ArrayRes import androidx.annotation.ArrayRes import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView import com.moez.QKSMS.R import com.moez.QKSMS.common.base.QkAdapter import com.moez.QKSMS.common.base.QkAdapter import com.moez.QKSMS.common.base.QkViewHolder import com.moez.QKSMS.common.base.QkViewHolder import com.moez.QKSMS.common.util.Colors import com.moez.QKSMS.common.util.Colors import com.moez.QKSMS.common.util.extensions.resolveThemeColor import com.moez.QKSMS.common.util.extensions.resolveThemeColor import com.moez.QKSMS.common.util.extensions.setVisible import com.moez.QKSMS.common.util.extensions.setVisible import com.moez.QKSMS.databinding.MenuListItemBinding import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.Subject import io.reactivex.subjects.Subject import kotlinx.android.synthetic.main.menu_list_item.* import kotlinx.android.synthetic.main.menu_list_item.view.* import javax.inject.Inject import javax.inject.Inject data class MenuItem(val title: String, val actionId: Int) data class MenuItem(val title: String, val actionId: Int) class MenuItemAdapter @Inject constructor(private val context: Context, private val colors: Colors) : QkAdapter<MenuItem>() { class MenuItemAdapter @Inject constructor( private val context: Context, private val colors: Colors ) : QkAdapter<MenuItem, MenuListItemBinding>() { val menuItemClicks: Subject<Int> = PublishSubject.create() val menuItemClicks: Subject<Int> = PublishSubject.create() Loading @@ -47,13 +47,13 @@ class MenuItemAdapter @Inject constructor(private val context: Context, private var selectedItem: Int? = null var selectedItem: Int? = null set(value) { set(value) { val old = data.map { it.actionId }.indexOfFirst { it == field } val old = data.map { it.actionId }.indexOfFirst { it == field }.takeIf { it != -1 } val new = data.map { it.actionId }.indexOfFirst { it == value } val new = data.map { it.actionId }.indexOfFirst { it == value }.takeIf { it != -1 } field = value field = value old.let { notifyItemChanged(it) } old?.let(::notifyItemChanged) new.let { notifyItemChanged(it) } new?.let(::notifyItemChanged) } } fun setData(@ArrayRes titles: Int, @ArrayRes values: Int = -1) { fun setData(@ArrayRes titles: Int, @ArrayRes values: Int = -1) { Loading @@ -63,31 +63,28 @@ class MenuItemAdapter @Inject constructor(private val context: Context, private .mapIndexed { index, title -> MenuItem(title, valueInts?.getOrNull(index) ?: index) } .mapIndexed { index, title -> MenuItem(title, valueInts?.getOrNull(index) ?: index) } } } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder<MenuListItemBinding> { val layoutInflater = LayoutInflater.from(parent.context) return QkViewHolder(parent, MenuListItemBinding::inflate).apply { val view = layoutInflater.inflate(R.layout.menu_list_item, parent, false) val states = arrayOf( val states = arrayOf( intArrayOf(android.R.attr.state_activated), intArrayOf(android.R.attr.state_activated), intArrayOf(-android.R.attr.state_activated)) intArrayOf(-android.R.attr.state_activated)) val text = parent.context.resolveThemeColor(android.R.attr.textColorTertiary) val text = parent.context.resolveThemeColor(android.R.attr.textColorTertiary) view.check.imageTintList = ColorStateList(states, intArrayOf(colors.theme().theme, text)) binding.check.imageTintList = ColorStateList(states, intArrayOf(colors.theme().theme, text)) return QkViewHolder(view).apply { binding.root.setOnClickListener { view.setOnClickListener { val menuItem = getItem(adapterPosition) val menuItem = getItem(adapterPosition) menuItemClicks.onNext(menuItem.actionId) menuItemClicks.onNext(menuItem.actionId) } } } } } } override fun onBindViewHolder(holder: QkViewHolder, position: Int) { override fun onBindViewHolder(holder: QkViewHolder<MenuListItemBinding>, position: Int) { val menuItem = getItem(position) val menuItem = getItem(position) holder.title.text = menuItem.title holder.binding.title.text = menuItem.title holder.check.isActivated = (menuItem.actionId == selectedItem) holder.binding.check.isActivated = (menuItem.actionId == selectedItem) holder.check.setVisible(selectedItem != null) holder.binding.check.setVisible(selectedItem != null) } } override fun onDetachedFromRecyclerView(recyclerView: RecyclerView) { override fun onDetachedFromRecyclerView(recyclerView: RecyclerView) { Loading presentation/src/main/java/com/moez/QKSMS/common/base/FlowableAdapter.kt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ package com.moez.QKSMS.common.base import androidx.annotation.CallSuper import androidx.annotation.CallSuper import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView import androidx.viewbinding.ViewBinding import io.reactivex.Flowable import io.reactivex.Flowable import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable Loading @@ -27,7 +28,7 @@ import io.reactivex.disposables.Disposable * Base RecyclerView.Adapter that provides some convenience when creating a new Adapter, such as * Base RecyclerView.Adapter that provides some convenience when creating a new Adapter, such as * data list handing and item animations * data list handing and item animations */ */ abstract class FlowableAdapter<T> : QkAdapter<T>() { abstract class FlowableAdapter<T, Binding: ViewBinding> : QkAdapter<T, Binding>() { var flowable: Flowable<List<T>>? = null var flowable: Flowable<List<T>>? = null set(value) { set(value) { Loading Loading
build.gradle +2 −2 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ buildscript { ext.mockito_version = '2.18.3' ext.mockito_version = '2.18.3' ext.moshi_version = '1.8.0' ext.moshi_version = '1.8.0' ext.okhttp3_version = '4.1.0' ext.okhttp3_version = '4.1.0' ext.realm_version = '5.8.0' ext.realm_version = '6.1.0' ext.realm_adapters_version = '3.1.0' ext.realm_adapters_version = '3.1.0' ext.rxandroid_version = '2.0.1' ext.rxandroid_version = '2.0.1' ext.rxdogtag_version = '0.2.0' ext.rxdogtag_version = '0.2.0' Loading @@ -42,7 +42,7 @@ buildscript { } } dependencies { dependencies { classpath 'com.android.tools.build:gradle:3.5.2' classpath 'com.android.tools.build:gradle:3.6.1' classpath 'com.google.gms:google-services:4.2.0' classpath 'com.google.gms:google-services:4.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'io.fabric.tools:gradle:1.29.0' classpath 'io.fabric.tools:gradle:1.29.0' Loading
gradle/wrapper/gradle-wrapper.properties +2 −2 Original line number Original line Diff line number Diff line #Tue Dec 03 23:30:52 EST 2019 #Tue Mar 03 19:56:50 EST 2020 distributionBase=GRADLE_USER_HOME 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-5.4.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
presentation/build.gradle +4 −5 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,6 @@ apply plugin: 'com.android.application' apply plugin: 'com.android.application' apply plugin: 'realm-android' // Realm needs to be before Kotlin or the build will fail apply plugin: 'realm-android' // Realm needs to be before Kotlin or the build will fail apply plugin: 'kotlin-android' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt' android { android { Loading Loading @@ -70,6 +69,10 @@ android { noAnalytics { dimension "analytics" } noAnalytics { dimension "analytics" } } } viewBinding { enabled = true } if (System.getenv("CI") == "true") { if (System.getenv("CI") == "true") { signingConfigs.release.storeFile = file("../keystore") signingConfigs.release.storeFile = file("../keystore") signingConfigs.release.storePassword = System.getenv("keystore_password") signingConfigs.release.storePassword = System.getenv("keystore_password") Loading @@ -78,10 +81,6 @@ android { } } } } androidExtensions { experimental = true } configurations { configurations { noAnalyticsDebug noAnalyticsDebug noAnalyticsRelease noAnalyticsRelease Loading
presentation/src/main/java/com/moez/QKSMS/common/MenuItemAdapter.kt +21 −24 Original line number Original line Diff line number Diff line Loading @@ -20,26 +20,26 @@ package com.moez.QKSMS.common import android.content.Context import android.content.Context import android.content.res.ColorStateList import android.content.res.ColorStateList import android.view.LayoutInflater import android.view.ViewGroup import android.view.ViewGroup import androidx.annotation.ArrayRes import androidx.annotation.ArrayRes import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView import com.moez.QKSMS.R import com.moez.QKSMS.common.base.QkAdapter import com.moez.QKSMS.common.base.QkAdapter import com.moez.QKSMS.common.base.QkViewHolder import com.moez.QKSMS.common.base.QkViewHolder import com.moez.QKSMS.common.util.Colors import com.moez.QKSMS.common.util.Colors import com.moez.QKSMS.common.util.extensions.resolveThemeColor import com.moez.QKSMS.common.util.extensions.resolveThemeColor import com.moez.QKSMS.common.util.extensions.setVisible import com.moez.QKSMS.common.util.extensions.setVisible import com.moez.QKSMS.databinding.MenuListItemBinding import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.Subject import io.reactivex.subjects.Subject import kotlinx.android.synthetic.main.menu_list_item.* import kotlinx.android.synthetic.main.menu_list_item.view.* import javax.inject.Inject import javax.inject.Inject data class MenuItem(val title: String, val actionId: Int) data class MenuItem(val title: String, val actionId: Int) class MenuItemAdapter @Inject constructor(private val context: Context, private val colors: Colors) : QkAdapter<MenuItem>() { class MenuItemAdapter @Inject constructor( private val context: Context, private val colors: Colors ) : QkAdapter<MenuItem, MenuListItemBinding>() { val menuItemClicks: Subject<Int> = PublishSubject.create() val menuItemClicks: Subject<Int> = PublishSubject.create() Loading @@ -47,13 +47,13 @@ class MenuItemAdapter @Inject constructor(private val context: Context, private var selectedItem: Int? = null var selectedItem: Int? = null set(value) { set(value) { val old = data.map { it.actionId }.indexOfFirst { it == field } val old = data.map { it.actionId }.indexOfFirst { it == field }.takeIf { it != -1 } val new = data.map { it.actionId }.indexOfFirst { it == value } val new = data.map { it.actionId }.indexOfFirst { it == value }.takeIf { it != -1 } field = value field = value old.let { notifyItemChanged(it) } old?.let(::notifyItemChanged) new.let { notifyItemChanged(it) } new?.let(::notifyItemChanged) } } fun setData(@ArrayRes titles: Int, @ArrayRes values: Int = -1) { fun setData(@ArrayRes titles: Int, @ArrayRes values: Int = -1) { Loading @@ -63,31 +63,28 @@ class MenuItemAdapter @Inject constructor(private val context: Context, private .mapIndexed { index, title -> MenuItem(title, valueInts?.getOrNull(index) ?: index) } .mapIndexed { index, title -> MenuItem(title, valueInts?.getOrNull(index) ?: index) } } } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder<MenuListItemBinding> { val layoutInflater = LayoutInflater.from(parent.context) return QkViewHolder(parent, MenuListItemBinding::inflate).apply { val view = layoutInflater.inflate(R.layout.menu_list_item, parent, false) val states = arrayOf( val states = arrayOf( intArrayOf(android.R.attr.state_activated), intArrayOf(android.R.attr.state_activated), intArrayOf(-android.R.attr.state_activated)) intArrayOf(-android.R.attr.state_activated)) val text = parent.context.resolveThemeColor(android.R.attr.textColorTertiary) val text = parent.context.resolveThemeColor(android.R.attr.textColorTertiary) view.check.imageTintList = ColorStateList(states, intArrayOf(colors.theme().theme, text)) binding.check.imageTintList = ColorStateList(states, intArrayOf(colors.theme().theme, text)) return QkViewHolder(view).apply { binding.root.setOnClickListener { view.setOnClickListener { val menuItem = getItem(adapterPosition) val menuItem = getItem(adapterPosition) menuItemClicks.onNext(menuItem.actionId) menuItemClicks.onNext(menuItem.actionId) } } } } } } override fun onBindViewHolder(holder: QkViewHolder, position: Int) { override fun onBindViewHolder(holder: QkViewHolder<MenuListItemBinding>, position: Int) { val menuItem = getItem(position) val menuItem = getItem(position) holder.title.text = menuItem.title holder.binding.title.text = menuItem.title holder.check.isActivated = (menuItem.actionId == selectedItem) holder.binding.check.isActivated = (menuItem.actionId == selectedItem) holder.check.setVisible(selectedItem != null) holder.binding.check.setVisible(selectedItem != null) } } override fun onDetachedFromRecyclerView(recyclerView: RecyclerView) { override fun onDetachedFromRecyclerView(recyclerView: RecyclerView) { Loading
presentation/src/main/java/com/moez/QKSMS/common/base/FlowableAdapter.kt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ package com.moez.QKSMS.common.base import androidx.annotation.CallSuper import androidx.annotation.CallSuper import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView import androidx.viewbinding.ViewBinding import io.reactivex.Flowable import io.reactivex.Flowable import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable Loading @@ -27,7 +28,7 @@ import io.reactivex.disposables.Disposable * Base RecyclerView.Adapter that provides some convenience when creating a new Adapter, such as * Base RecyclerView.Adapter that provides some convenience when creating a new Adapter, such as * data list handing and item animations * data list handing and item animations */ */ abstract class FlowableAdapter<T> : QkAdapter<T>() { abstract class FlowableAdapter<T, Binding: ViewBinding> : QkAdapter<T, Binding>() { var flowable: Flowable<List<T>>? = null var flowable: Flowable<List<T>>? = null set(value) { set(value) { Loading