mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Migrate to rxbinding 3 and fix bad layout for room directory filter (Fixes #349)
This commit is contained in:
parent
896e582a9c
commit
0ddef67cc9
@ -10,12 +10,13 @@ Improvements:
|
||||
- Improve edit of replies
|
||||
|
||||
Other changes:
|
||||
-
|
||||
- migrate from rxbinding 2 to rxbinding 3
|
||||
|
||||
Bugfix:
|
||||
- Fix regression on permalink click
|
||||
- Fix crash reported by the PlayStore (#341)
|
||||
- Fix Chat composer separator color in dark/black theme
|
||||
- Fix bad layout for room directory filter (#349)
|
||||
|
||||
Translations:
|
||||
-
|
||||
|
@ -187,8 +187,9 @@ dependencies {
|
||||
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
|
||||
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.0'
|
||||
// TODO RxBindings3 exists
|
||||
implementation 'com.jakewharton.rxbinding2:rxbinding:2.2.0'
|
||||
// RXBinding
|
||||
implementation 'com.jakewharton.rxbinding3:rxbinding:3.0.0-alpha2'
|
||||
implementation 'com.jakewharton.rxbinding3:rxbinding-appcompat:3.0.0-alpha2'
|
||||
|
||||
implementation("com.airbnb.android:epoxy:$epoxy_version")
|
||||
kapt "com.airbnb.android:epoxy-processor:$epoxy_version"
|
||||
|
@ -22,7 +22,7 @@ import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.isVisible
|
||||
import arrow.core.Try
|
||||
import com.jakewharton.rxbinding2.widget.RxTextView
|
||||
import com.jakewharton.rxbinding3.widget.textChanges
|
||||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.auth.Authenticator
|
||||
import im.vector.matrix.android.api.auth.data.HomeServerConnectionConfig
|
||||
@ -127,9 +127,9 @@ class LoginActivity : VectorBaseActivity() {
|
||||
private fun setupAuthButton() {
|
||||
Observable
|
||||
.combineLatest(
|
||||
RxTextView.textChanges(loginField).map { it.trim().isNotEmpty() },
|
||||
RxTextView.textChanges(passwordField).map { it.trim().isNotEmpty() },
|
||||
RxTextView.textChanges(homeServerField).map { it.trim().isNotEmpty() },
|
||||
loginField.textChanges().map { it.trim().isNotEmpty() },
|
||||
passwordField.textChanges().map { it.trim().isNotEmpty() },
|
||||
homeServerField.textChanges().map { it.trim().isNotEmpty() },
|
||||
Function3<Boolean, Boolean, Boolean, Boolean> { isLoginNotEmpty, isPasswordNotEmpty, isHomeServerNotEmpty ->
|
||||
isLoginNotEmpty && isPasswordNotEmpty && isHomeServerNotEmpty
|
||||
}
|
||||
|
@ -25,14 +25,13 @@ import com.airbnb.epoxy.EpoxyVisibilityTracker
|
||||
import com.airbnb.mvrx.activityViewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.jakewharton.rxbinding2.widget.RxTextView
|
||||
import com.jakewharton.rxbinding3.appcompat.queryTextChanges
|
||||
import im.vector.matrix.android.api.session.room.model.roomdirectory.PublicRoom
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.di.ScreenComponent
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.observeEvent
|
||||
import im.vector.riotx.core.platform.VectorBaseFragment
|
||||
import im.vector.riotx.features.themes.ThemeUtils
|
||||
import io.reactivex.rxkotlin.subscribeBy
|
||||
import kotlinx.android.synthetic.main.fragment_public_rooms.*
|
||||
import timber.log.Timber
|
||||
@ -70,9 +69,7 @@ class PublicRoomsFragment : VectorBaseFragment(), PublicRoomsController.Callback
|
||||
it.setDisplayHomeAsUpEnabled(true)
|
||||
}
|
||||
|
||||
publicRoomsFilter.setBackgroundResource(ThemeUtils.getResourceId(requireContext(), R.drawable.bg_search_edit_text_light))
|
||||
|
||||
RxTextView.textChanges(publicRoomsFilter)
|
||||
publicRoomsFilter.queryTextChanges()
|
||||
.debounce(500, TimeUnit.MILLISECONDS)
|
||||
.subscribeBy {
|
||||
viewModel.filterWith(it.toString())
|
||||
|
22
vector/src/main/res/drawable/ic_search.xml
Normal file
22
vector/src/main/res/drawable/ic_search.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M9,9m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#03B381"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M19,19l-4.35,-4.35"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#03B381"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
@ -33,26 +33,12 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap|enterAlways">
|
||||
|
||||
<!-- Note: Background is modified in the code for other themes -->
|
||||
<EditText
|
||||
<androidx.appcompat.widget.SearchView
|
||||
android:id="@+id/publicRoomsFilter"
|
||||
style="@style/VectorSearchView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="@dimen/layout_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/layout_horizontal_margin"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@drawable/bg_search_edit_text_light"
|
||||
android:drawableStart="@drawable/ic_search_white"
|
||||
android:drawableLeft="@drawable/ic_search_white"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableTint="?riotx_text_secondary"
|
||||
android:hint="@string/home_filter_placeholder_rooms"
|
||||
android:lines="1"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp" />
|
||||
android:layout_height="wrap_content"
|
||||
app:queryHint="@string/room_directory_search_hint" />
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
|
@ -32,5 +32,7 @@
|
||||
<string name="room_filtering_footer_create_new_direct_message">Send a new direct message</string>
|
||||
<string name="room_filtering_footer_open_room_directory">View the room directory</string>
|
||||
|
||||
<string name="room_directory_search_hint">Name or ID (#example:matrix.org)</string>
|
||||
|
||||
|
||||
</resources>
|
@ -161,6 +161,7 @@
|
||||
</style>
|
||||
|
||||
<style name="VectorSearchView" parent="Widget.AppCompat.SearchView">
|
||||
<item name="searchIcon">@drawable/ic_search</item>
|
||||
<item name="closeIcon">@drawable/ic_x_green</item>
|
||||
<item name="iconifiedByDefault">false</item>
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user