Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 062adb76 authored by Moez Bhatti's avatar Moez Bhatti
Browse files

Revert "Implement ViewBinding"

This reverts commit 37d8c453.

# Conflicts:
#	build.gradle
#	presentation/src/main/java/com/moez/QKSMS/common/widget/AvatarView.kt
#	presentation/src/main/java/com/moez/QKSMS/common/widget/TextInputDialog.kt
#	presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt
#	presentation/src/main/java/com/moez/QKSMS/feature/compose/MessagesAdapter.kt
#	presentation/src/main/java/com/moez/QKSMS/feature/conversationinfo/ConversationInfoController.kt
#	presentation/src/main/java/com/moez/QKSMS/feature/conversations/ConversationsAdapter.kt
#	presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt
#	presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsController.kt
parent 03606c05
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ buildscript {
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath 'com.android.tools.build:gradle:3.5.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+2 −2
Original line number Diff line number Diff line
#Tue Mar 03 19:56:50 EST 2020
#Tue Dec 03 23:30:52 EST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
+5 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
apply plugin: 'com.android.application'
apply plugin: 'realm-android' // Realm needs to be before Kotlin or the build will fail
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
@@ -69,10 +70,6 @@ android {
        noAnalytics { dimension "analytics" }
    }

    viewBinding {
        enabled = true
    }

    if (System.getenv("CI") == "true") {
        signingConfigs.release.storeFile = file("../keystore")
        signingConfigs.release.storePassword = System.getenv("keystore_password")
@@ -81,6 +78,10 @@ android {
    }
}

androidExtensions {
    experimental = true
}

configurations {
    noAnalyticsDebug
    noAnalyticsRelease
+24 −21
Original line number Diff line number Diff line
@@ -20,26 +20,26 @@ package com.moez.QKSMS.common

import android.content.Context
import android.content.res.ColorStateList
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.annotation.ArrayRes
import androidx.recyclerview.widget.RecyclerView
import com.moez.QKSMS.R
import com.moez.QKSMS.common.base.QkAdapter
import com.moez.QKSMS.common.base.QkViewHolder
import com.moez.QKSMS.common.util.Colors
import com.moez.QKSMS.common.util.extensions.resolveThemeColor
import com.moez.QKSMS.common.util.extensions.setVisible
import com.moez.QKSMS.databinding.MenuListItemBinding
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.subjects.PublishSubject
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

data class MenuItem(val title: String, val actionId: Int)

class MenuItemAdapter @Inject constructor(
    private val context: Context,
    private val colors: Colors
) : QkAdapter<MenuItem, MenuListItemBinding>() {
class MenuItemAdapter @Inject constructor(private val context: Context, private val colors: Colors) : QkAdapter<MenuItem>() {

    val menuItemClicks: Subject<Int> = PublishSubject.create()

@@ -47,13 +47,13 @@ class MenuItemAdapter @Inject constructor(

    var selectedItem: Int? = null
        set(value) {
            val old = data.map { it.actionId }.indexOfFirst { it == field }.takeIf { it != -1 }
            val new = data.map { it.actionId }.indexOfFirst { it == value }.takeIf { it != -1 }
            val old = data.map { it.actionId }.indexOfFirst { it == field }
            val new = data.map { it.actionId }.indexOfFirst { it == value }

            field = value

            old?.let(::notifyItemChanged)
            new?.let(::notifyItemChanged)
            old.let { notifyItemChanged(it) }
            new.let { notifyItemChanged(it) }
        }

    fun setData(@ArrayRes titles: Int, @ArrayRes values: Int = -1) {
@@ -63,28 +63,31 @@ class MenuItemAdapter @Inject constructor(
                .mapIndexed { index, title -> MenuItem(title, valueInts?.getOrNull(index) ?: index) }
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder<MenuListItemBinding> {
        return QkViewHolder(parent, MenuListItemBinding::inflate).apply {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder {
        val layoutInflater = LayoutInflater.from(parent.context)
        val view = layoutInflater.inflate(R.layout.menu_list_item, parent, false)

        val states = arrayOf(
                intArrayOf(android.R.attr.state_activated),
                intArrayOf(-android.R.attr.state_activated))

        val text = parent.context.resolveThemeColor(android.R.attr.textColorTertiary)
            binding.check.imageTintList = ColorStateList(states, intArrayOf(colors.theme().theme, text))
        view.check.imageTintList = ColorStateList(states, intArrayOf(colors.theme().theme, text))

            binding.root.setOnClickListener {
        return QkViewHolder(view).apply {
            view.setOnClickListener {
                val menuItem = getItem(adapterPosition)
                menuItemClicks.onNext(menuItem.actionId)
            }
        }
    }

    override fun onBindViewHolder(holder: QkViewHolder<MenuListItemBinding>, position: Int) {
    override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
        val menuItem = getItem(position)

        holder.binding.title.text = menuItem.title
        holder.binding.check.isActivated = (menuItem.actionId == selectedItem)
        holder.binding.check.setVisible(selectedItem != null)
        holder.title.text = menuItem.title
        holder.check.isActivated = (menuItem.actionId == selectedItem)
        holder.check.setVisible(selectedItem != null)
    }

    override fun onDetachedFromRecyclerView(recyclerView: RecyclerView) {
+1 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ package com.moez.QKSMS.common.base

import androidx.annotation.CallSuper
import androidx.recyclerview.widget.RecyclerView
import androidx.viewbinding.ViewBinding
import io.reactivex.Flowable
import io.reactivex.disposables.Disposable

@@ -28,7 +27,7 @@ import io.reactivex.disposables.Disposable
 * Base RecyclerView.Adapter that provides some convenience when creating a new Adapter, such as
 * data list handing and item animations
 */
abstract class FlowableAdapter<T, Binding: ViewBinding> : QkAdapter<T, Binding>() {
abstract class FlowableAdapter<T> : QkAdapter<T>() {

    var flowable: Flowable<List<T>>? = null
        set(value) {
Loading