From 7061859112f531a849014fdb8faa930f8ff7b433 Mon Sep 17 00:00:00 2001 From: krlvm <51774833+krlvm@users.noreply.github.com> Date: Wed, 31 Mar 2021 20:17:58 +0300 Subject: [PATCH] Fix subscription picker colors on API 19 --- .../local/subscription/dialog/FeedGroupDialog.kt | 10 ++++++++++ app/src/main/res/layout/toolbar_search_layout.xml | 1 + 2 files changed, 11 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt index 908bea00c..2918bcd66 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt @@ -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 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( diff --git a/app/src/main/res/layout/toolbar_search_layout.xml b/app/src/main/res/layout/toolbar_search_layout.xml index 38128e2c7..ce77af6af 100644 --- a/app/src/main/res/layout/toolbar_search_layout.xml +++ b/app/src/main/res/layout/toolbar_search_layout.xml @@ -42,6 +42,7 @@ android:background="?attr/selectableItemBackgroundBorderless" />