Merge pull request #104 from twain47/preferenceFilter-use-TextInputEditText

Use TextInputEditText instead of TextView to preference filter
This commit is contained in:
Milos Kozak 2020-12-09 21:45:56 +01:00 committed by GitHub
commit 1eb9a47ba0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 28 deletions

View file

@ -32,10 +32,6 @@ class PreferencesActivity : NoSplashAppCompatActivity(), PreferenceFragmentCompa
override fun afterTextChanged(s: Editable) {} override fun afterTextChanged(s: Editable) {}
}) })
pref_filter_clear.setOnClickListener {
pref_filter.setText("")
}
title = resourceHelper.gs(R.string.nav_preferences) title = resourceHelper.gs(R.string.nav_preferences)
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true)

View file

@ -5,40 +5,26 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:hint="@string/filter"
app:endIconMode="clear_text">
<TextView <com.google.android.material.textfield.TextInputEditText
android:layout_width="wrap_content" android:id="@+id/pref_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:text="@string/filter"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
android:textStyle="bold" />
<EditText
android:id="@+id/pref_filter"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:layout_gravity="center_vertical" android:autofillHints="@string/filter"
android:gravity="start"
android:textStyle="bold"
android:inputType="text" /> android:inputType="text" />
<ImageView </com.google.android.material.textfield.TextInputLayout>
android:id="@+id/pref_filter_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
app:srcCompat="@android:drawable/ic_menu_close_clear_cancel" />
</LinearLayout>
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"