fixed rtl not working with multiple search
This commit is contained in:
parent
b75643c697
commit
daac3fd241
5 changed files with 20 additions and 8 deletions
|
|
@ -22,7 +22,7 @@ android {
|
|||
keyPassword properties["signingConfig.keyPassword"]
|
||||
}
|
||||
}
|
||||
compileSdkVersion 33
|
||||
compileSdkVersion "android-UpsideDownCake"
|
||||
defaultConfig {
|
||||
applicationId "com.deniscerri.ytdl"
|
||||
minSdkVersion 23
|
||||
|
|
@ -119,7 +119,7 @@ dependencies {
|
|||
|
||||
implementation "androidx.appcompat:appcompat:$appCompatVer"
|
||||
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
|
||||
implementation 'com.google.android.material:material:1.9.0-beta01'
|
||||
implementation 'com.google.android.material:material:1.10.0-alpha01'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.core:core:1.9.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.3.0'
|
||||
|
|
@ -135,7 +135,7 @@ dependencies {
|
|||
androidTestImplementation "junit:junit:$junitVer"
|
||||
androidTestImplementation "androidx.test.ext:junit:$androidJunitVer"
|
||||
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVer"
|
||||
androidTestImplementation "androidx.benchmark:benchmark-macro-junit4:1.2.0-alpha11"
|
||||
androidTestImplementation "androidx.benchmark:benchmark-macro-junit4:1.2.0-alpha12"
|
||||
androidTestImplementation "androidx.test:runner:1.5.2"
|
||||
androidTestImplementation "androidx.test:core:1.5.0"
|
||||
androidTestImplementation "androidx.test:rules:1.5.0"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import android.view.View.*
|
|||
import android.widget.*
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.core.text.TextUtilsCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.children
|
||||
import androidx.core.view.forEach
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
|
|
@ -207,6 +209,8 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
|
|||
val searchView = requireView().findViewById<SearchView>(R.id.search_view)
|
||||
val queriesConstraint = requireView().findViewById<ConstraintLayout>(R.id.queries_constraint)
|
||||
val queriesInitStartBtn = queriesConstraint.findViewById<MaterialButton>(R.id.init_search_query)
|
||||
val isRightToLeft = resources.getBoolean(R.bool.is_right_to_left)
|
||||
|
||||
|
||||
infoUtil = InfoUtil(requireContext())
|
||||
val linkYouCopied = searchView.findViewById<ConstraintLayout>(R.id.link_you_copied)
|
||||
|
|
@ -337,8 +341,11 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
|
|||
val drawableRight = 2
|
||||
val drawableBottom = 3
|
||||
if (event.action == MotionEvent.ACTION_UP) {
|
||||
if (event.x > searchView.editText.right - searchView.editText.compoundDrawables[drawableRight].bounds.width()
|
||||
) {
|
||||
if (
|
||||
(isRightToLeft && (event.x < (searchView.editText.left - searchView.editText.compoundDrawables[drawableLeft].bounds.width()))) ||
|
||||
(!isRightToLeft && (event.x > (searchView.editText.right - searchView.editText.compoundDrawables[drawableRight].bounds.width())))
|
||||
){
|
||||
|
||||
val present = queriesChipGroup!!.children.firstOrNull { (it as Chip).text.toString() == searchView.editText.text.toString() }
|
||||
if (present == null) {
|
||||
val chip = layoutinflater!!.inflate(R.layout.input_chip, queriesChipGroup, false) as Chip
|
||||
|
|
@ -352,6 +359,7 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
|
|||
else queriesConstraint.visibility = VISIBLE
|
||||
searchView.editText.setText("")
|
||||
return@OnTouchListener true
|
||||
|
||||
}
|
||||
}
|
||||
}catch (ignored: Exception){}
|
||||
|
|
@ -368,7 +376,7 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
|
|||
R.id.delete_results -> {
|
||||
resultViewModel.getTrending()
|
||||
selectedObjects = ArrayList()
|
||||
searchBar!!.text = ""
|
||||
searchBar!!.setText("")
|
||||
downloadAllFabCoordinator!!.visibility = GONE
|
||||
downloadFabs!!.visibility = GONE
|
||||
}
|
||||
|
|
@ -408,7 +416,7 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
|
|||
|
||||
if (queryList.isEmpty()) return
|
||||
if (queryList.size == 1){
|
||||
searchBar!!.text = searchView.text
|
||||
searchBar!!.setText(searchView.text)
|
||||
}
|
||||
|
||||
searchView.hide()
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
android:paddingEnd="20dp"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:drawableLeftCompat="@drawable/ic_search" />
|
||||
app:drawableStartCompat="@drawable/ic_search" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/set_search_query_button"
|
||||
|
|
|
|||
3
app/src/main/res/values-ldrtl/attrs.xml
Normal file
3
app/src/main/res/values-ldrtl/attrs.xml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<resources>
|
||||
<bool name="is_right_to_left">true</bool>
|
||||
</resources>
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
<resources>
|
||||
<bool name="isTablet">false</bool>
|
||||
<bool name="is_right_to_left">false</bool>
|
||||
</resources>
|
||||
Loading…
Reference in a new issue