forked from upstream-mirrors/quik
Compose contact selection (#7)
* Create empty compose activity * Display all contacts in compose activity * Remove unused method * Updated design in MessagesActivity * Show detailed contacts in compose suggestions * Add observable EditText to Compose Toolbar * Allow querying the list of contacts in Compose * Add remaining fields from mms-sms contentprovider * Update gradle build tools * Added support for contact selection chips
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath "io.realm:realm-gradle-plugin:4.1.1"
|
classpath "io.realm:realm-gradle-plugin:4.1.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ dependencies {
|
|||||||
compile 'com.android.support:design:26.1.0'
|
compile 'com.android.support:design:26.1.0'
|
||||||
compile 'com.bugsnag:bugsnag-android:4.1.1'
|
compile 'com.bugsnag:bugsnag-android:4.1.1'
|
||||||
compile 'com.github.bumptech.glide:glide:4.3.0'
|
compile 'com.github.bumptech.glide:glide:4.3.0'
|
||||||
|
compile 'com.google.android:flexbox:0.3.1'
|
||||||
compile "com.google.dagger:dagger:2.11"
|
compile "com.google.dagger:dagger:2.11"
|
||||||
compile 'com.jakewharton.rxbinding2:rxbinding-kotlin:2.0.0'
|
compile 'com.jakewharton.rxbinding2:rxbinding-kotlin:2.0.0'
|
||||||
compile 'com.jakewharton.rxbinding2:rxbinding-support-v4-kotlin:2.0.0'
|
compile 'com.jakewharton.rxbinding2:rxbinding-support-v4-kotlin:2.0.0'
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.moez.QKSMS.presentation.messages.MessagesActivity" />
|
<activity android:name="com.moez.QKSMS.presentation.messages.MessagesActivity" />
|
||||||
<activity android:name=".presentation.settings.SettingsActivity" />
|
<activity android:name=".presentation.settings.SettingsActivity" />
|
||||||
|
<activity android:name=".presentation.compose.ComposeActivity" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".receiver.SmsReceiver"
|
android:name=".receiver.SmsReceiver"
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package com.moez.QKSMS.common.di
|
package com.moez.QKSMS.common.di
|
||||||
|
|
||||||
import com.moez.QKSMS.common.util.ContactImageLoader
|
import com.moez.QKSMS.common.util.ContactImageLoader
|
||||||
import com.moez.QKSMS.common.util.NotificationManager
|
import com.moez.QKSMS.presentation.compose.ComposeViewModel
|
||||||
|
import com.moez.QKSMS.presentation.compose.DetailedChipView
|
||||||
import com.moez.QKSMS.presentation.main.ConversationsAdapter
|
import com.moez.QKSMS.presentation.main.ConversationsAdapter
|
||||||
import com.moez.QKSMS.presentation.main.MainActivity
|
import com.moez.QKSMS.presentation.main.MainActivity
|
||||||
import com.moez.QKSMS.presentation.main.MainViewModel
|
import com.moez.QKSMS.presentation.main.MainViewModel
|
||||||
@@ -24,8 +25,6 @@ interface AppComponent {
|
|||||||
fun inject(adapter: ConversationsAdapter)
|
fun inject(adapter: ConversationsAdapter)
|
||||||
fun inject(adapter: MessagesAdapter)
|
fun inject(adapter: MessagesAdapter)
|
||||||
|
|
||||||
fun inject(manager: NotificationManager)
|
|
||||||
|
|
||||||
fun inject(receiver: SmsReceiver)
|
fun inject(receiver: SmsReceiver)
|
||||||
fun inject(receiver: MessageDeliveredReceiver)
|
fun inject(receiver: MessageDeliveredReceiver)
|
||||||
fun inject(receiver: MessageSentReceiver)
|
fun inject(receiver: MessageSentReceiver)
|
||||||
@@ -36,9 +35,12 @@ interface AppComponent {
|
|||||||
fun inject(view: AvatarView)
|
fun inject(view: AvatarView)
|
||||||
|
|
||||||
fun inject(viewModel: MainViewModel)
|
fun inject(viewModel: MainViewModel)
|
||||||
|
fun inject(viewModel: ComposeViewModel)
|
||||||
fun inject(viewModel: MessagesViewModel)
|
fun inject(viewModel: MessagesViewModel)
|
||||||
fun inject(viewModel: SettingsViewModel)
|
fun inject(viewModel: SettingsViewModel)
|
||||||
|
|
||||||
fun inject(fetcher: ContactImageLoader.ContactImageFetcher)
|
fun inject(fetcher: ContactImageLoader.ContactImageFetcher)
|
||||||
|
|
||||||
|
fun inject(view: DetailedChipView)
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,8 @@ open class Contact() : RealmObject() {
|
|||||||
var address: String = ""
|
var address: String = ""
|
||||||
var name: String = ""
|
var name: String = ""
|
||||||
|
|
||||||
|
var inContactsTable: Boolean = false
|
||||||
|
|
||||||
constructor(id: Long, address: String) : this() {
|
constructor(id: Long, address: String) : this() {
|
||||||
this.recipientId = id
|
this.recipientId = id
|
||||||
this.address = address
|
this.address = address
|
||||||
|
|||||||
@@ -30,6 +30,17 @@ class ContactRepository @Inject constructor(val context: Context) {
|
|||||||
.map { id -> Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, id) }
|
.map { id -> Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, id) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getContacts(): List<Contact> {
|
||||||
|
val realm = Realm.getDefaultInstance()
|
||||||
|
val results = realm.copyFromRealm(realm
|
||||||
|
.where(Contact::class.java)
|
||||||
|
.equalTo("inContactsTable", true)
|
||||||
|
.findAllSorted("name"))
|
||||||
|
realm.close()
|
||||||
|
|
||||||
|
return results
|
||||||
|
}
|
||||||
|
|
||||||
fun getContact(recipientId: Long): Flowable<Contact> {
|
fun getContact(recipientId: Long): Flowable<Contact> {
|
||||||
return Flowable.fromPublisher<Contact> { emitter ->
|
return Flowable.fromPublisher<Contact> { emitter ->
|
||||||
val contact = getContactFromRealm(recipientId) ?: getContactFromDb(recipientId)
|
val contact = getContactFromRealm(recipientId) ?: getContactFromDb(recipientId)
|
||||||
@@ -58,7 +69,8 @@ class ContactRepository @Inject constructor(val context: Context) {
|
|||||||
try {
|
try {
|
||||||
context.contentResolver.query(contactUri, projection, null, null, null).use { contactCursor ->
|
context.contentResolver.query(contactUri, projection, null, null, null).use { contactCursor ->
|
||||||
if (contactCursor.moveToFirst()) {
|
if (contactCursor.moveToFirst()) {
|
||||||
contact.name = contactCursor.getString(contactCursor.getColumnIndex(ContactsContract.Data.DISPLAY_NAME)).orEmpty()
|
contact.inContactsTable = true
|
||||||
|
contact.name = contactCursor.getString(contactCursor.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME)).orEmpty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -71,13 +83,4 @@ class ContactRepository @Inject constructor(val context: Context) {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getContactFromCache(address: String): Contact? {
|
|
||||||
val realm = Realm.getDefaultInstance()
|
|
||||||
val contact = realm.where(Contact::class.java)
|
|
||||||
.equalTo("contactUri", address)
|
|
||||||
.findFirst()
|
|
||||||
realm.close()
|
|
||||||
return contact
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,8 @@ import android.arch.lifecycle.ViewModel
|
|||||||
import android.arch.lifecycle.ViewModelProvider
|
import android.arch.lifecycle.ViewModelProvider
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import com.moez.QKSMS.presentation.compose.ComposeActivity
|
||||||
|
import com.moez.QKSMS.presentation.compose.ComposeViewModel
|
||||||
import com.moez.QKSMS.presentation.main.MainViewModel
|
import com.moez.QKSMS.presentation.main.MainViewModel
|
||||||
import com.moez.QKSMS.presentation.messages.MessagesActivity
|
import com.moez.QKSMS.presentation.messages.MessagesActivity
|
||||||
import com.moez.QKSMS.presentation.messages.MessagesViewModel
|
import com.moez.QKSMS.presentation.messages.MessagesViewModel
|
||||||
@@ -20,6 +22,11 @@ class Navigator @Inject constructor(val context: Context) {
|
|||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun showCompose() {
|
||||||
|
val intent = Intent(context, ComposeActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
fun showConversation(threadId: Long) {
|
fun showConversation(threadId: Long) {
|
||||||
val intent = Intent(context, MessagesActivity::class.java)
|
val intent = Intent(context, MessagesActivity::class.java)
|
||||||
intent.putExtra("threadId", threadId)
|
intent.putExtra("threadId", threadId)
|
||||||
@@ -41,6 +48,10 @@ class Navigator @Inject constructor(val context: Context) {
|
|||||||
MainViewModel()
|
MainViewModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ComposeViewModel::class.java -> {
|
||||||
|
ComposeViewModel()
|
||||||
|
}
|
||||||
|
|
||||||
MessagesViewModel::class.java -> {
|
MessagesViewModel::class.java -> {
|
||||||
val threadId = intent.getLongExtra("threadId", 0)
|
val threadId = intent.getLongExtra("threadId", 0)
|
||||||
MessagesViewModel(threadId)
|
MessagesViewModel(threadId)
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ abstract class QkAdapter<T, VH : RecyclerView.ViewHolder>(private val flowable:
|
|||||||
override fun onAttachedToRecyclerView(recyclerView: RecyclerView?) {
|
override fun onAttachedToRecyclerView(recyclerView: RecyclerView?) {
|
||||||
super.onAttachedToRecyclerView(recyclerView)
|
super.onAttachedToRecyclerView(recyclerView)
|
||||||
disposable = flowable.subscribe { data = it }
|
disposable = flowable.subscribe { data = it }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDetachedFromRecyclerView(recyclerView: RecyclerView?) {
|
override fun onDetachedFromRecyclerView(recyclerView: RecyclerView?) {
|
||||||
@@ -37,7 +36,7 @@ abstract class QkAdapter<T, VH : RecyclerView.ViewHolder>(private val flowable:
|
|||||||
disposable?.dispose()
|
disposable?.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
override final fun getItemCount(): Int {
|
override fun getItemCount(): Int {
|
||||||
return data.size
|
return data.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,124 @@
|
|||||||
|
package com.moez.QKSMS.presentation.compose
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.support.v4.content.ContextCompat
|
||||||
|
import android.support.v7.widget.AppCompatEditText
|
||||||
|
import android.support.v7.widget.RecyclerView
|
||||||
|
import android.text.InputType
|
||||||
|
import android.view.KeyEvent
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
|
import android.widget.EditText
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import com.google.android.flexbox.FlexboxLayoutManager
|
||||||
|
import com.jakewharton.rxbinding2.view.keys
|
||||||
|
import com.jakewharton.rxbinding2.widget.textChanges
|
||||||
|
import com.moez.QKSMS.R
|
||||||
|
import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||||
|
import com.moez.QKSMS.data.model.Contact
|
||||||
|
import com.moez.QKSMS.presentation.base.QkAdapter
|
||||||
|
import com.moez.QKSMS.presentation.base.QkViewHolder
|
||||||
|
import io.reactivex.Flowable
|
||||||
|
import io.reactivex.subjects.PublishSubject
|
||||||
|
import kotlinx.android.synthetic.main.contact_chip.view.*
|
||||||
|
|
||||||
|
class ChipsAdapter(
|
||||||
|
private val context: Context,
|
||||||
|
private val view: RecyclerView,
|
||||||
|
data: Flowable<List<Contact>>) : QkAdapter<Contact, QkViewHolder>(data) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val TYPE_EDIT_TEXT = 0
|
||||||
|
private val TYPE_ITEM = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
private val hint: String = context.getString(R.string.title_compose)
|
||||||
|
private val editText: EditText = AppCompatEditText(context)
|
||||||
|
|
||||||
|
val chipDeleted: PublishSubject<Contact> = PublishSubject.create<Contact>()
|
||||||
|
val textChanges = editText.textChanges()
|
||||||
|
|
||||||
|
init {
|
||||||
|
val wrap = ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
editText.layoutParams = FlexboxLayoutManager.LayoutParams(wrap, wrap).apply {
|
||||||
|
minWidth = 56.dpToPx(context)
|
||||||
|
flexGrow = 8f
|
||||||
|
}
|
||||||
|
|
||||||
|
editText.hint = hint
|
||||||
|
editText.textSize = 16f
|
||||||
|
editText.setTextColor(ContextCompat.getColor(context, R.color.textPrimary))
|
||||||
|
editText.setHintTextColor(ContextCompat.getColor(context, R.color.textTertiary))
|
||||||
|
editText.setBackgroundResource(android.R.color.transparent)
|
||||||
|
editText.inputType = InputType.TYPE_TEXT_VARIATION_FILTER or InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
|
||||||
|
editText.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
|
||||||
|
editText.privateImeOptions = "nm"
|
||||||
|
|
||||||
|
editText.keys()
|
||||||
|
.filter { event -> event.action == KeyEvent.ACTION_DOWN }
|
||||||
|
.filter { event -> event.keyCode == KeyEvent.KEYCODE_DEL }
|
||||||
|
.subscribe {
|
||||||
|
if (itemCount > 1 && editText.text.isEmpty()) {
|
||||||
|
chipDeleted.onNext(getItem(itemCount - 2))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = when (viewType) {
|
||||||
|
TYPE_EDIT_TEXT -> QkViewHolder(editText)
|
||||||
|
else -> QkViewHolder(LayoutInflater.from(context).inflate(R.layout.contact_chip, parent, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
|
||||||
|
when (getItemViewType(position)) {
|
||||||
|
TYPE_EDIT_TEXT -> {
|
||||||
|
if (itemCount == 1) {
|
||||||
|
editText.hint = hint
|
||||||
|
} else {
|
||||||
|
editText.hint = null
|
||||||
|
editText.text = null
|
||||||
|
}
|
||||||
|
|
||||||
|
editText.requestFocus()
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
val contact = getItem(position)
|
||||||
|
val view = holder.itemView
|
||||||
|
|
||||||
|
view.avatar.contact = contact
|
||||||
|
view.name.text = contact.name
|
||||||
|
|
||||||
|
view.setOnClickListener { showDetailedChip(contact) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() = super.getItemCount() + 1
|
||||||
|
|
||||||
|
override fun getItemViewType(position: Int) = if (position == itemCount - 1) TYPE_EDIT_TEXT else TYPE_ITEM
|
||||||
|
|
||||||
|
private fun showDetailedChip(contact: Contact) {
|
||||||
|
val detailedChipView = DetailedChipView(context)
|
||||||
|
detailedChipView.setContact(contact)
|
||||||
|
|
||||||
|
val rootView = view.rootView as ViewGroup
|
||||||
|
|
||||||
|
val layoutParams = RelativeLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
||||||
|
layoutParams.topMargin = 24.dpToPx(context)
|
||||||
|
layoutParams.marginStart = 56.dpToPx(context)
|
||||||
|
|
||||||
|
rootView.addView(detailedChipView, layoutParams)
|
||||||
|
detailedChipView.show()
|
||||||
|
|
||||||
|
detailedChipView.setOnDeleteListener {
|
||||||
|
chipDeleted.onNext(contact)
|
||||||
|
detailedChipView.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.moez.QKSMS.presentation.compose
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.support.v7.widget.LinearLayoutManager
|
||||||
|
import com.google.android.flexbox.FlexboxLayoutManager
|
||||||
|
import com.moez.QKSMS.R
|
||||||
|
import com.moez.QKSMS.data.model.Contact
|
||||||
|
import com.moez.QKSMS.presentation.base.QkActivity
|
||||||
|
import io.reactivex.subjects.PublishSubject
|
||||||
|
import io.reactivex.subjects.Subject
|
||||||
|
import kotlinx.android.synthetic.main.compose_activity.*
|
||||||
|
import kotlinx.android.synthetic.main.toolbar_chips.*
|
||||||
|
|
||||||
|
class ComposeActivity : QkActivity<ComposeViewModel, ComposeState>(), ComposeView {
|
||||||
|
|
||||||
|
override val viewModelClass = ComposeViewModel::class
|
||||||
|
|
||||||
|
override val queryChangedIntent: Subject<CharSequence> = PublishSubject.create()
|
||||||
|
override val chipSelectedIntent: Subject<Contact> = PublishSubject.create()
|
||||||
|
override val chipDeletedIntent: Subject<Contact> = PublishSubject.create()
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.compose_activity)
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
viewModel.setView(this)
|
||||||
|
|
||||||
|
chips.layoutManager = FlexboxLayoutManager(this)
|
||||||
|
contacts.layoutManager = LinearLayoutManager(this)
|
||||||
|
|
||||||
|
window.callback = ComposeWindowCallback(window.callback, this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun render(state: ComposeState) {
|
||||||
|
if (chips.adapter == null && state.selectedContacts != null) {
|
||||||
|
val adapter = ChipsAdapter(this, chips, state.selectedContacts)
|
||||||
|
adapter.chipDeleted.subscribe { chipDeletedIntent.onNext(it) }
|
||||||
|
adapter.textChanges.subscribe { queryChangedIntent.onNext(it) }
|
||||||
|
|
||||||
|
chips.adapter = adapter
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contacts.adapter == null && state.contacts != null) {
|
||||||
|
val adapter = ContactAdapter(this, state.contacts)
|
||||||
|
adapter.contactSelected.subscribe { chipSelectedIntent.onNext(it) }
|
||||||
|
|
||||||
|
contacts.adapter = adapter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.moez.QKSMS.presentation.compose
|
||||||
|
|
||||||
|
import com.moez.QKSMS.data.model.Contact
|
||||||
|
import io.reactivex.Flowable
|
||||||
|
|
||||||
|
data class ComposeState(
|
||||||
|
val contacts: Flowable<List<Contact>>? = null,
|
||||||
|
val selectedContacts: Flowable<List<Contact>>? = null
|
||||||
|
)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.moez.QKSMS.presentation.compose
|
||||||
|
|
||||||
|
import com.moez.QKSMS.data.model.Contact
|
||||||
|
import com.moez.QKSMS.presentation.base.QkView
|
||||||
|
import io.reactivex.subjects.Subject
|
||||||
|
|
||||||
|
interface ComposeView : QkView<ComposeState> {
|
||||||
|
|
||||||
|
val queryChangedIntent: Subject<CharSequence>
|
||||||
|
val chipSelectedIntent: Subject<Contact>
|
||||||
|
val chipDeletedIntent: Subject<Contact>
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.moez.QKSMS.presentation.compose
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.telephony.PhoneNumberUtils
|
||||||
|
import com.moez.QKSMS.common.di.AppComponentManager
|
||||||
|
import com.moez.QKSMS.data.model.Contact
|
||||||
|
import com.moez.QKSMS.data.repository.ContactRepository
|
||||||
|
import com.moez.QKSMS.presentation.base.QkViewModel
|
||||||
|
import io.reactivex.BackpressureStrategy
|
||||||
|
import io.reactivex.Flowable
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.rxkotlin.plusAssign
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
import io.reactivex.subjects.BehaviorSubject
|
||||||
|
import io.reactivex.subjects.Subject
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
|
class ComposeViewModel : QkViewModel<ComposeView, ComposeState>(ComposeState()) {
|
||||||
|
|
||||||
|
@Inject lateinit var context: Context
|
||||||
|
@Inject lateinit var contactsRepo: ContactRepository
|
||||||
|
|
||||||
|
private val contactsSubject: Subject<List<Contact>> = BehaviorSubject.create()
|
||||||
|
private val selectedContactsReducer: Subject<(List<Contact>) -> List<Contact>> = BehaviorSubject.create()
|
||||||
|
|
||||||
|
private val contacts: List<Contact>
|
||||||
|
|
||||||
|
init {
|
||||||
|
AppComponentManager.appComponent.inject(this)
|
||||||
|
|
||||||
|
contacts = contactsRepo.getContacts()
|
||||||
|
|
||||||
|
val contactsFlowable = contactsSubject.toFlowable(BackpressureStrategy.BUFFER)
|
||||||
|
|
||||||
|
val selectedContacts: Flowable<List<Contact>> = selectedContactsReducer
|
||||||
|
.scan(listOf<Contact>(), { previousState, reducer -> reducer(previousState) })
|
||||||
|
.toFlowable(BackpressureStrategy.BUFFER)
|
||||||
|
|
||||||
|
newState { it.copy(contacts = contactsFlowable, selectedContacts = selectedContacts) }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindIntents(view: ComposeView) {
|
||||||
|
super.bindIntents(view)
|
||||||
|
|
||||||
|
intents += view.queryChangedIntent
|
||||||
|
.toFlowable(BackpressureStrategy.LATEST)
|
||||||
|
.map { query -> query.toString() }
|
||||||
|
.map { query ->
|
||||||
|
contacts.filter { contact ->
|
||||||
|
contact.name.contains(query, true) || PhoneNumberUtils.compare(contact.address, query)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.subscribeOn(Schedulers.computation())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe { contacts -> contactsSubject.onNext(contacts) }
|
||||||
|
|
||||||
|
intents += view.chipSelectedIntent.subscribe { contact ->
|
||||||
|
selectedContactsReducer.onNext { it.toMutableList().apply { add(contact) } }
|
||||||
|
}
|
||||||
|
|
||||||
|
intents += view.chipDeletedIntent.subscribe { contact ->
|
||||||
|
selectedContactsReducer.onNext { it.filterNot { it == contact } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+117
@@ -0,0 +1,117 @@
|
|||||||
|
package com.moez.QKSMS.presentation.compose
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.graphics.Rect
|
||||||
|
import android.os.Build
|
||||||
|
import android.support.annotation.RequiresApi
|
||||||
|
import android.view.*
|
||||||
|
import android.view.accessibility.AccessibilityEvent
|
||||||
|
|
||||||
|
class ComposeWindowCallback(private val localCallback: Window.Callback, private val activity: Activity) : Window.Callback {
|
||||||
|
|
||||||
|
override fun dispatchKeyEvent(keyEvent: KeyEvent): Boolean {
|
||||||
|
return localCallback.dispatchKeyEvent(keyEvent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispatchKeyShortcutEvent(keyEvent: KeyEvent): Boolean {
|
||||||
|
return localCallback.dispatchKeyShortcutEvent(keyEvent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispatchTouchEvent(motionEvent: MotionEvent): Boolean {
|
||||||
|
if (motionEvent.action == MotionEvent.ACTION_DOWN) {
|
||||||
|
val v = activity.currentFocus
|
||||||
|
when (v) {
|
||||||
|
is DetailedChipView -> {
|
||||||
|
val rect = Rect().apply { v.getGlobalVisibleRect(this) }
|
||||||
|
if (!rect.contains(motionEvent.rawX.toInt(), motionEvent.rawY.toInt())) {
|
||||||
|
v.hide()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return localCallback.dispatchTouchEvent(motionEvent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispatchTrackballEvent(motionEvent: MotionEvent): Boolean {
|
||||||
|
return localCallback.dispatchTrackballEvent(motionEvent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispatchGenericMotionEvent(motionEvent: MotionEvent): Boolean {
|
||||||
|
return localCallback.dispatchGenericMotionEvent(motionEvent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispatchPopulateAccessibilityEvent(accessibilityEvent: AccessibilityEvent): Boolean {
|
||||||
|
return localCallback.dispatchPopulateAccessibilityEvent(accessibilityEvent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreatePanelView(i: Int): View? {
|
||||||
|
return localCallback.onCreatePanelView(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreatePanelMenu(i: Int, menu: Menu): Boolean {
|
||||||
|
return localCallback.onCreatePanelMenu(i, menu)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPreparePanel(i: Int, view: View, menu: Menu): Boolean {
|
||||||
|
return localCallback.onPreparePanel(i, view, menu)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onMenuOpened(i: Int, menu: Menu): Boolean {
|
||||||
|
return localCallback.onMenuOpened(i, menu)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onMenuItemSelected(i: Int, menuItem: MenuItem): Boolean {
|
||||||
|
return localCallback.onMenuItemSelected(i, menuItem)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onWindowAttributesChanged(layoutParams: WindowManager.LayoutParams) {
|
||||||
|
localCallback.onWindowAttributesChanged(layoutParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onContentChanged() {
|
||||||
|
localCallback.onContentChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onWindowFocusChanged(b: Boolean) {
|
||||||
|
localCallback.onWindowFocusChanged(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAttachedToWindow() {
|
||||||
|
localCallback.onAttachedToWindow()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDetachedFromWindow() {
|
||||||
|
localCallback.onDetachedFromWindow()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPanelClosed(i: Int, menu: Menu) {
|
||||||
|
localCallback.onPanelClosed(i, menu)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSearchRequested(): Boolean {
|
||||||
|
return localCallback.onSearchRequested()
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||||
|
override fun onSearchRequested(searchEvent: SearchEvent): Boolean {
|
||||||
|
return localCallback.onSearchRequested(searchEvent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onWindowStartingActionMode(callback: ActionMode.Callback): ActionMode? {
|
||||||
|
return localCallback.onWindowStartingActionMode(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||||
|
override fun onWindowStartingActionMode(callback: ActionMode.Callback, i: Int): ActionMode? {
|
||||||
|
return localCallback.onWindowStartingActionMode(callback, i)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onActionModeStarted(actionMode: ActionMode) {
|
||||||
|
localCallback.onActionModeStarted(actionMode)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onActionModeFinished(actionMode: ActionMode) {
|
||||||
|
localCallback.onActionModeFinished(actionMode)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.moez.QKSMS.presentation.compose
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.jakewharton.rxbinding2.view.clicks
|
||||||
|
import com.moez.QKSMS.R
|
||||||
|
import com.moez.QKSMS.data.model.Contact
|
||||||
|
import com.moez.QKSMS.presentation.base.QkAdapter
|
||||||
|
import com.moez.QKSMS.presentation.base.QkViewHolder
|
||||||
|
import io.reactivex.Flowable
|
||||||
|
import io.reactivex.subjects.PublishSubject
|
||||||
|
import io.reactivex.subjects.Subject
|
||||||
|
import kotlinx.android.synthetic.main.contact_list_item.view.*
|
||||||
|
|
||||||
|
class ContactAdapter(private val context: Context, data: Flowable<List<Contact>>) : QkAdapter<Contact, QkViewHolder>(data) {
|
||||||
|
|
||||||
|
val contactSelected: Subject<Contact> = PublishSubject.create()
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): QkViewHolder {
|
||||||
|
val layoutRes = R.layout.contact_list_item
|
||||||
|
val layoutInflater = LayoutInflater.from(context)
|
||||||
|
val view = layoutInflater.inflate(layoutRes, parent, false)
|
||||||
|
return QkViewHolder(view)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: QkViewHolder, position: Int) {
|
||||||
|
val contact = getItem(position)
|
||||||
|
val view = holder.itemView
|
||||||
|
|
||||||
|
view.clicks().subscribe { contactSelected.onNext(contact) }
|
||||||
|
|
||||||
|
view.avatar.contact = contact
|
||||||
|
view.name.text = contact.name
|
||||||
|
view.address.text = contact.address
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
package com.moez.QKSMS.presentation.compose
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.View
|
||||||
|
import android.view.animation.AlphaAnimation
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import com.moez.QKSMS.R
|
||||||
|
import com.moez.QKSMS.common.di.AppComponentManager
|
||||||
|
import com.moez.QKSMS.common.util.ThemeManager
|
||||||
|
import com.moez.QKSMS.common.util.extensions.setBackgroundTint
|
||||||
|
import com.moez.QKSMS.data.model.Contact
|
||||||
|
import kotlinx.android.synthetic.main.contact_chip_detailed.view.*
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
|
class DetailedChipView(context: Context) : RelativeLayout(context) {
|
||||||
|
|
||||||
|
@Inject lateinit var themeManager: ThemeManager
|
||||||
|
|
||||||
|
init {
|
||||||
|
View.inflate(context, R.layout.contact_chip_detailed, this)
|
||||||
|
AppComponentManager.appComponent.inject(this)
|
||||||
|
|
||||||
|
card.setBackgroundTint(themeManager.color)
|
||||||
|
setOnClickListener { hide() }
|
||||||
|
|
||||||
|
visibility = View.GONE
|
||||||
|
|
||||||
|
isFocusable = true
|
||||||
|
isFocusableInTouchMode = true
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setContact(contact: Contact) {
|
||||||
|
avatar.contact = contact
|
||||||
|
name.text = contact.name
|
||||||
|
info.text = contact.address
|
||||||
|
}
|
||||||
|
|
||||||
|
fun show() {
|
||||||
|
startAnimation(AlphaAnimation(0f, 1f).apply { duration = 200 })
|
||||||
|
|
||||||
|
visibility = View.VISIBLE
|
||||||
|
requestFocus()
|
||||||
|
isClickable = true
|
||||||
|
}
|
||||||
|
|
||||||
|
fun hide() {
|
||||||
|
startAnimation(AlphaAnimation(1f, 0f).apply { duration = 200 })
|
||||||
|
|
||||||
|
visibility = View.GONE
|
||||||
|
clearFocus()
|
||||||
|
isClickable = false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnDeleteListener(listener: (View) -> Unit) {
|
||||||
|
delete.setOnClickListener(listener)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ class MainViewModel : QkViewModel<MainView, MainState>(MainState()) {
|
|||||||
super.bindIntents(view)
|
super.bindIntents(view)
|
||||||
|
|
||||||
intents += view.composeIntent.subscribe {
|
intents += view.composeIntent.subscribe {
|
||||||
|
navigator.showCompose()
|
||||||
newState { it.copy(drawerOpen = false) }
|
newState { it.copy(drawerOpen = false) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:color="?android:attr/colorControlHighlight">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
<corners android:radius="16dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<shape
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@color/list_separator"/>
|
||||||
|
<corners android:radius="18dp"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</ripple>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#000"
|
||||||
|
android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM17,15.59L15.59,17 12,13.41 8.41,17 7,15.59 10.59,12 7,8.41 8.41,7 12,10.59 15.59,7 17,8.41 13.41,12 17,15.59z" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
<corners android:radius="2dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<include layout="@layout/toolbar_chips" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/contacts"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:paddingTop="8dp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="8dp"
|
||||||
|
android:background="@drawable/ab_shadow" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout android:id="@+id/container"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:layout_margin="4dp"
|
||||||
|
android:background="@drawable/chip_background"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<com.moez.QKSMS.presentation.view.AvatarView
|
||||||
|
android:id="@+id/avatar"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="12dp"
|
||||||
|
android:textColor="@color/textPrimary"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="Moez Bhatti" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
+66
@@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/card"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:background="@drawable/rounded_rectangle_2dp"
|
||||||
|
android:backgroundTint="@color/textSecondary"
|
||||||
|
android:elevation="8dp"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<com.moez.QKSMS.presentation.view.AvatarView
|
||||||
|
android:id="@+id/avatar"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_margin="16dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:textColor="@color/textPrimaryLight"
|
||||||
|
android:textSize="16sp"
|
||||||
|
tools:text="Moez Bhatti" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/info"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:textColor="@color/textSecondaryLight"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:text="(123) 456-7890" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/delete"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:background="@drawable/ripple"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:src="@drawable/ic_cancel_black_24dp"
|
||||||
|
android:tint="@color/white" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:paddingTop="8dp">
|
||||||
|
|
||||||
|
<com.moez.QKSMS.presentation.view.AvatarView
|
||||||
|
android:id="@+id/avatar"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginRight="16dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/textPrimary"
|
||||||
|
tools:text="Moez Bhatti" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/address"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/textTertiary"
|
||||||
|
tools:text="(123) 456-7890" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
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="56dp"
|
android:layout_height="56dp"
|
||||||
|
android:background="@color/white"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
android:minHeight="56dp">
|
android:minHeight="56dp">
|
||||||
@@ -12,10 +13,12 @@
|
|||||||
android:id="@+id/toolbarTitle"
|
android:id="@+id/toolbarTitle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="@null"
|
||||||
android:gravity="left|center_vertical"
|
android:gravity="left|center_vertical"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="@color/textPrimary"
|
android:textColor="@color/textPrimary"
|
||||||
|
android:textColorHint="@color/textTertiary"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
tools:text="Conversations" />
|
tools:text="Conversations" />
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="56dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/toolbarTitle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp" />
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/chips"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</android.support.v7.widget.Toolbar>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="56dp">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/toolbarTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@null"
|
||||||
|
android:gravity="left|center_vertical"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/textPrimary"
|
||||||
|
android:textColorHint="@color/textTertiary"
|
||||||
|
android:textSize="16sp"
|
||||||
|
tools:hint="Search something" />
|
||||||
|
|
||||||
|
</android.support.v7.widget.Toolbar>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
<string name="app_name">QKSMS</string>
|
<string name="app_name">QKSMS</string>
|
||||||
|
|
||||||
<string name="title_settings">Settings</string>
|
<string name="title_settings">Settings</string>
|
||||||
|
<string name="title_compose">Type a name or number</string>
|
||||||
|
|
||||||
<string name="compose_hint">Write a message</string>
|
<string name="compose_hint">Write a message</string>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user