forked from upstream-mirrors/quik
Styling for Compose bar
This commit is contained in:
@@ -40,6 +40,7 @@ dependencies {
|
||||
compile 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||
compile 'com.bugsnag:bugsnag-android:3.9.0'
|
||||
compile "com.google.dagger:dagger:2.9"
|
||||
compile 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
|
||||
compile 'com.jakewharton.timber:timber:4.5.1'
|
||||
compile 'com.karumi:dexter:4.1.0'
|
||||
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
|
||||
|
||||
@@ -4,9 +4,11 @@ import android.arch.lifecycle.Observer
|
||||
import android.arch.lifecycle.ViewModelProviders
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import com.jakewharton.rxbinding2.widget.RxTextView
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.ui.base.QkActivity
|
||||
import com.moez.QKSMS.util.observe
|
||||
import com.moez.QKSMS.util.setTint
|
||||
import kotlinx.android.synthetic.main.message_list_activity.*
|
||||
|
||||
class MessageListActivity : QkActivity(), Observer<MessageListViewState> {
|
||||
@@ -25,6 +27,14 @@ class MessageListActivity : QkActivity(), Observer<MessageListViewState> {
|
||||
layoutManager.stackFromEnd = true
|
||||
messageList.layoutManager = layoutManager
|
||||
|
||||
RxTextView.textChanges(message).subscribe { text ->
|
||||
val enabled = text.isNotEmpty()
|
||||
val color = if (enabled) R.color.colorPrimary else R.color.textTertiary
|
||||
send.setTint(resources.getColor(color))
|
||||
send.isEnabled = enabled
|
||||
}
|
||||
|
||||
attach.setOnClickListener {}
|
||||
send.setOnClickListener { viewModel.sendMessage(message.text.toString()) }
|
||||
|
||||
viewModel.state.observe(this)
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.moez.QKSMS.util
|
||||
import android.arch.lifecycle.LifecycleOwner
|
||||
import android.arch.lifecycle.LiveData
|
||||
import android.arch.lifecycle.Observer
|
||||
import android.content.res.ColorStateList
|
||||
import android.database.Cursor
|
||||
import android.widget.ImageView
|
||||
import io.reactivex.Flowable
|
||||
import java.util.*
|
||||
|
||||
@@ -56,3 +58,7 @@ fun Cursor.asFlowable(): Flowable<Cursor> {
|
||||
.doOnComplete { close() }
|
||||
}
|
||||
|
||||
fun ImageView.setTint(color: Int) {
|
||||
imageTintList = ColorStateList.valueOf(color)
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,14 @@
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:background="@drawable/bubble">
|
||||
android:background="@drawable/bubble"
|
||||
android:elevation="2dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/attach"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_add_black_24dp"
|
||||
android:tint="@color/colorPrimary" />
|
||||
@@ -50,9 +52,10 @@
|
||||
android:id="@+id/send"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/ic_send_black_24dp"
|
||||
android:tint="@color/textSecondary" />
|
||||
android:tint="@color/textTertiary" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user