Fix subscription picker colors on API 19

This commit is contained in:
krlvm 2021-03-31 20:17:58 +03:00
parent 4fdc5ea646
commit 7061859112
No known key found for this signature in database
GPG Key ID: B8552A91FD265536
2 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package org.schabi.newpipe.local.subscription.dialog
import android.app.Dialog
import android.content.res.ColorStateList
import android.os.Bundle
import android.os.Parcelable
import android.view.LayoutInflater
@ -12,6 +13,7 @@ import androidx.core.content.getSystemService
import androidx.core.os.bundleOf
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.core.widget.ImageViewCompat
import androidx.core.widget.doOnTextChanged
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.Observer
@ -123,6 +125,14 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
_feedGroupCreateBinding = DialogFeedGroupCreateBinding.bind(view)
_searchLayoutBinding = feedGroupCreateBinding.subscriptionsHeaderSearchContainer
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
// KitKat doesn't apply container's theme to <include> content
val contrastColor = ColorStateList.valueOf(resources.getColor(R.color.contrastColor))
searchLayoutBinding.toolbarSearchEditText.setTextColor(contrastColor)
searchLayoutBinding.toolbarSearchEditText.setHintTextColor(contrastColor.withAlpha(128))
ImageViewCompat.setImageTintList(searchLayoutBinding.toolbarSearchClearIcon, contrastColor)
}
viewModel = ViewModelProvider(
this,
FeedGroupDialogViewModel.Factory(

View File

@ -42,6 +42,7 @@
android:background="?attr/selectableItemBackgroundBorderless" />
<ImageView
android:id="@+id/toolbar_search_clear_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"