forked from upstream-mirrors/quik
Update UI for compose bar
This commit is contained in:
@@ -2,6 +2,7 @@ package com.moez.QKSMS.presentation.compose
|
|||||||
|
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
|
import android.graphics.PorterDuff
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.v7.widget.LinearLayoutManager
|
import android.support.v7.widget.LinearLayoutManager
|
||||||
import android.support.v7.widget.RecyclerView
|
import android.support.v7.widget.RecyclerView
|
||||||
@@ -101,28 +102,30 @@ class ComposeActivity : QkActivity<ComposeViewModel>(), ComposeView {
|
|||||||
messageList.layoutManager = layoutManager
|
messageList.layoutManager = layoutManager
|
||||||
messageList.adapter = messageAdapter
|
messageList.adapter = messageAdapter
|
||||||
|
|
||||||
|
messageBackground.backgroundTintMode = PorterDuff.Mode.MULTIPLY
|
||||||
|
|
||||||
val states = arrayOf(
|
val states = arrayOf(
|
||||||
intArrayOf(android.R.attr.state_enabled),
|
intArrayOf(android.R.attr.state_enabled),
|
||||||
intArrayOf(-android.R.attr.state_enabled))
|
intArrayOf(-android.R.attr.state_enabled))
|
||||||
|
|
||||||
disposables += Observables
|
disposables += Observables
|
||||||
.combineLatest(colors.theme, colors.textTertiary, { theme, textTertiary ->
|
.combineLatest(colors.textPrimaryOnTheme, colors.textTertiaryOnTheme, { primary, tertiary ->
|
||||||
ColorStateList(states, intArrayOf(theme, textTertiary))
|
ColorStateList(states, intArrayOf(primary, tertiary))
|
||||||
})
|
})
|
||||||
.subscribe { tintList -> send.imageTintList = tintList }
|
.subscribe { tintList -> sendIcon.imageTintList = tintList }
|
||||||
|
|
||||||
|
disposables += colors.theme
|
||||||
|
.subscribe { color -> send.setBackgroundTint(color) }
|
||||||
|
|
||||||
disposables += colors.textSecondary
|
disposables += colors.textSecondary
|
||||||
.subscribe { color -> attach.setTint(color) }
|
.subscribe { color -> attach.setTint(color) }
|
||||||
|
|
||||||
disposables += colors.background
|
disposables += colors.bubble
|
||||||
.subscribe { color -> composeBar.setBackgroundColor(color) }
|
.subscribe { color -> messageBackground.setBackgroundTint(color) }
|
||||||
|
|
||||||
disposables += colors.composeBackground
|
disposables += colors.composeBackground
|
||||||
.subscribe { color -> window.decorView.setBackgroundColor(color) }
|
.subscribe { color -> window.decorView.setBackgroundColor(color) }
|
||||||
|
|
||||||
disposables += colors.field
|
|
||||||
.subscribe { color -> message.setBackgroundTint(color) }
|
|
||||||
|
|
||||||
window.callback = ComposeWindowCallback(window.callback, this)
|
window.callback = ComposeWindowCallback(window.callback, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +173,7 @@ class ComposeActivity : QkActivity<ComposeViewModel>(), ComposeView {
|
|||||||
if (message.text.toString() != state.draft) message.setText(state.draft)
|
if (message.text.toString() != state.draft) message.setText(state.draft)
|
||||||
|
|
||||||
send.isEnabled = state.canSend
|
send.isEnabled = state.canSend
|
||||||
|
sendIcon.isEnabled = state.canSend
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
@@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>
|
||||||
|
</vector>
|
||||||
@@ -4,7 +4,8 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
tools:background="@color/backgroundLight">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/toolbar_chips"
|
layout="@layout/toolbar_chips"
|
||||||
@@ -13,7 +14,9 @@
|
|||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1">
|
android:layout_weight="1"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/messageList"
|
android:id="@+id/messageList"
|
||||||
@@ -21,9 +24,9 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="60dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
tools:listitem="@layout/message_list_item_out" />
|
tools:listitem="@layout/message_list_item_in" />
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/contacts"
|
android:id="@+id/contacts"
|
||||||
@@ -41,52 +44,73 @@
|
|||||||
android:layout_height="8dp"
|
android:layout_height="8dp"
|
||||||
android:background="@drawable/ab_shadow" />
|
android:background="@drawable/ab_shadow" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/composeBar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/messageBackground"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/rounded_rectangle_shadow"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/attach"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/ic_insert_photo_black_24dp"
|
||||||
|
tools:tint="@color/textSecondary" />
|
||||||
|
|
||||||
|
<com.moez.QKSMS.presentation.common.widget.Separator
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:layout_marginTop="8dp" />
|
||||||
|
|
||||||
|
<com.moez.QKSMS.presentation.common.widget.QkEditText
|
||||||
|
android:id="@+id/message"
|
||||||
|
style="@style/TextPrimary"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@null"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:hint="@string/compose_hint"
|
||||||
|
android:minHeight="44dp"
|
||||||
|
android:padding="12dp"
|
||||||
|
app:textColorHint="tertiary" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/send"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:background="@drawable/circle"
|
||||||
|
android:elevation="4dp"
|
||||||
|
tools:backgroundTint="@color/tools_theme">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sendIcon"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/ic_send_black_24dp"
|
||||||
|
tools:tint="@color/textPrimaryDark" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<com.moez.QKSMS.presentation.common.widget.Separator
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/composeBar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/attach"
|
|
||||||
android:layout_width="56dp"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
android:background="@drawable/ripple"
|
|
||||||
android:padding="16dp"
|
|
||||||
android:src="@drawable/ic_add_circle_black_24dp" />
|
|
||||||
|
|
||||||
<com.moez.QKSMS.presentation.common.widget.QkEditText
|
|
||||||
android:id="@+id/message"
|
|
||||||
style="@style/TextPrimary"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="@drawable/field_background"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:hint="@string/compose_hint"
|
|
||||||
android:minHeight="36dp"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:paddingLeft="12dp"
|
|
||||||
android:paddingRight="12dp"
|
|
||||||
android:paddingTop="8dp"
|
|
||||||
app:textColorHint="tertiary" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/send"
|
|
||||||
android:layout_width="56dp"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
android:background="@drawable/ripple"
|
|
||||||
android:padding="16dp"
|
|
||||||
android:src="@drawable/ic_send_black_24dp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<color name="toolbarLight">#FFFFFF</color>
|
<color name="toolbarLight">#FFFFFF</color>
|
||||||
<color name="toolbarDark">#1d262b</color>
|
<color name="toolbarDark">#1d262b</color>
|
||||||
|
|
||||||
<color name="backgroundLight">#F2F2F2</color>
|
<color name="backgroundLight">#ECEFF1</color>
|
||||||
<color name="backgroundDark">#192025</color>
|
<color name="backgroundDark">#192025</color>
|
||||||
|
|
||||||
<color name="fieldLight">#0C000000</color>
|
<color name="fieldLight">#0C000000</color>
|
||||||
|
|||||||
Reference in New Issue
Block a user