Merge pull request #379 from vector-im/feature/small_fixes

Fix bad View used for searching in room directory.
This commit is contained in:
Benoit Marty 2019-07-17 14:19:37 +02:00 committed by GitHub
commit 8a5fddd952
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 66 additions and 34 deletions

View file

@ -10,12 +10,13 @@ Improvements:
- Improve edit of replies - Improve edit of replies
Other changes: Other changes:
- - migrate from rxbinding 2 to rxbinding 3
Bugfix: Bugfix:
- Fix regression on permalink click - Fix regression on permalink click
- Fix crash reported by the PlayStore (#341) - Fix crash reported by the PlayStore (#341)
- Fix Chat composer separator color in dark/black theme - Fix Chat composer separator color in dark/black theme
- Fix bad layout for room directory filter (#349)
Translations: Translations:
- -

View file

@ -1,3 +1,5 @@
import javax.tools.JavaCompiler
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
@ -52,6 +54,19 @@ allprojects {
} }
} }
} }
tasks.withType(JavaCompile).all {
options.compilerArgs += [
'-Adagger.gradle.incremental=enabled'
]
}
afterEvaluate {
extensions.findByName("kapt")?.arguments {
arg("dagger.gradle.incremental", "enabled")
}
}
} }
task clean(type: Delete) { task clean(type: Delete) {

View file

@ -17,7 +17,7 @@ package im.vector.matrix.android.api.session.events.model
/** /**
* Constants defining known event relation types from Matrix specifications. * Constants defining known event relation types from Matrix specifications
*/ */
object RelationType { object RelationType {
@ -25,7 +25,7 @@ object RelationType {
const val ANNOTATION = "m.annotation" const val ANNOTATION = "m.annotation"
/** Lets you define an event which replaces an existing event.*/ /** Lets you define an event which replaces an existing event.*/
const val REPLACE = "m.replace" const val REPLACE = "m.replace"
/** ets you define an event which references an existing event.*/ /** Lets you define an event which references an existing event.*/
const val REFERENCE = "m.reference" const val REFERENCE = "m.reference"
} }

View file

@ -16,7 +16,10 @@
package im.vector.matrix.android.api.session.room.model.relation package im.vector.matrix.android.api.session.room.model.relation
import im.vector.matrix.android.api.session.events.model.RelationType
interface RelationContent { interface RelationContent {
/** See [RelationType] for known possible values */
val type: String? val type: String?
val eventId: String? val eventId: String?
val inReplyTo: ReplyToContent? val inReplyTo: ReplyToContent?

View file

@ -187,8 +187,9 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0' implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0' implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.0' implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.0'
// TODO RxBindings3 exists // RXBinding
implementation 'com.jakewharton.rxbinding2:rxbinding:2.2.0' 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") implementation("com.airbnb.android:epoxy:$epoxy_version")
kapt "com.airbnb.android:epoxy-processor:$epoxy_version" kapt "com.airbnb.android:epoxy-processor:$epoxy_version"

View file

@ -22,7 +22,7 @@ import android.os.Bundle
import android.widget.Toast import android.widget.Toast
import androidx.core.view.isVisible import androidx.core.view.isVisible
import arrow.core.Try 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.MatrixCallback
import im.vector.matrix.android.api.auth.Authenticator import im.vector.matrix.android.api.auth.Authenticator
import im.vector.matrix.android.api.auth.data.HomeServerConnectionConfig import im.vector.matrix.android.api.auth.data.HomeServerConnectionConfig
@ -127,9 +127,9 @@ class LoginActivity : VectorBaseActivity() {
private fun setupAuthButton() { private fun setupAuthButton() {
Observable Observable
.combineLatest( .combineLatest(
RxTextView.textChanges(loginField).map { it.trim().isNotEmpty() }, loginField.textChanges().map { it.trim().isNotEmpty() },
RxTextView.textChanges(passwordField).map { it.trim().isNotEmpty() }, passwordField.textChanges().map { it.trim().isNotEmpty() },
RxTextView.textChanges(homeServerField).map { it.trim().isNotEmpty() }, homeServerField.textChanges().map { it.trim().isNotEmpty() },
Function3<Boolean, Boolean, Boolean, Boolean> { isLoginNotEmpty, isPasswordNotEmpty, isHomeServerNotEmpty -> Function3<Boolean, Boolean, Boolean, Boolean> { isLoginNotEmpty, isPasswordNotEmpty, isHomeServerNotEmpty ->
isLoginNotEmpty && isPasswordNotEmpty && isHomeServerNotEmpty isLoginNotEmpty && isPasswordNotEmpty && isHomeServerNotEmpty
} }

View file

@ -25,14 +25,13 @@ import com.airbnb.epoxy.EpoxyVisibilityTracker
import com.airbnb.mvrx.activityViewModel import com.airbnb.mvrx.activityViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.snackbar.Snackbar 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.matrix.android.api.session.room.model.roomdirectory.PublicRoom
import im.vector.riotx.R import im.vector.riotx.R
import im.vector.riotx.core.di.ScreenComponent import im.vector.riotx.core.di.ScreenComponent
import im.vector.riotx.core.error.ErrorFormatter import im.vector.riotx.core.error.ErrorFormatter
import im.vector.riotx.core.extensions.observeEvent import im.vector.riotx.core.extensions.observeEvent
import im.vector.riotx.core.platform.VectorBaseFragment import im.vector.riotx.core.platform.VectorBaseFragment
import im.vector.riotx.features.themes.ThemeUtils
import io.reactivex.rxkotlin.subscribeBy import io.reactivex.rxkotlin.subscribeBy
import kotlinx.android.synthetic.main.fragment_public_rooms.* import kotlinx.android.synthetic.main.fragment_public_rooms.*
import timber.log.Timber import timber.log.Timber
@ -70,9 +69,7 @@ class PublicRoomsFragment : VectorBaseFragment(), PublicRoomsController.Callback
it.setDisplayHomeAsUpEnabled(true) it.setDisplayHomeAsUpEnabled(true)
} }
publicRoomsFilter.setBackgroundResource(ThemeUtils.getResourceId(requireContext(), R.drawable.bg_search_edit_text_light)) publicRoomsFilter.queryTextChanges()
RxTextView.textChanges(publicRoomsFilter)
.debounce(500, TimeUnit.MILLISECONDS) .debounce(500, TimeUnit.MILLISECONDS)
.subscribeBy { .subscribeBy {
viewModel.filterWith(it.toString()) viewModel.filterWith(it.toString())

View 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>

View file

@ -20,10 +20,9 @@
<androidx.appcompat.widget.SearchView <androidx.appcompat.widget.SearchView
android:id="@+id/filteredRoomsSearchView" android:id="@+id/filteredRoomsSearchView"
style="@style/VectorSearchView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:closeIcon="@drawable/ic_x_green"
app:iconifiedByDefault="false"
app:queryHint="@string/room_filtering_filter_hint" app:queryHint="@string/room_filtering_filter_hint"
app:searchIcon="@drawable/ic_filter" /> app:searchIcon="@drawable/ic_filter" />

View file

@ -33,26 +33,12 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap|enterAlways"> app:layout_scrollFlags="scroll|exitUntilCollapsed|snap|enterAlways">
<!-- Note: Background is modified in the code for other themes --> <androidx.appcompat.widget.SearchView
<EditText
android:id="@+id/publicRoomsFilter" android:id="@+id/publicRoomsFilter"
style="@style/VectorSearchView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="32dp" android:layout_height="wrap_content"
android:layout_marginStart="8dp" app:queryHint="@string/room_directory_search_hint" />
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" />
</androidx.appcompat.widget.Toolbar> </androidx.appcompat.widget.Toolbar>

View file

@ -32,5 +32,7 @@
<string name="room_filtering_footer_create_new_direct_message">Send a new direct message</string> <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_filtering_footer_open_room_directory">View the room directory</string>
<string name="room_directory_search_hint">Name or ID (#example:matrix.org)</string>
</resources> </resources>

View file

@ -160,6 +160,12 @@
<item name="colorControlHighlight">@android:color/white</item> <item name="colorControlHighlight">@android:color/white</item>
</style> </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>
<style name="VectorSearches.EditText" parent="Widget.AppCompat.EditText"> <style name="VectorSearches.EditText" parent="Widget.AppCompat.EditText">
<item name="android:textCursorDrawable">@drawable/searches_cursor_background</item> <item name="android:textCursorDrawable">@drawable/searches_cursor_background</item>
<item name="android:background">@android:color/transparent</item> <item name="android:background">@android:color/transparent</item>