Skip to content

Commit a03079e

Browse files
authored
Fix: Contrast issues on light themes, Closes #2049
1 parent b3054e9 commit a03079e

File tree

6 files changed

+79
-75
lines changed

6 files changed

+79
-75
lines changed

app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeParentItemAdapterPreview.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package com.lagradost.cloudstream3.ui.home
33
import android.content.Context
44
import android.os.Bundle
55
import android.os.Parcelable
6+
import android.util.TypedValue
67
import android.view.LayoutInflater
78
import android.view.View
89
import android.view.ViewGroup
910
import android.widget.ImageView
10-
import android.widget.Toast
1111
import androidx.appcompat.app.AlertDialog
1212
import androidx.appcompat.widget.SearchView
1313
import androidx.core.content.ContextCompat
@@ -23,7 +23,6 @@ import com.google.android.material.chip.ChipGroup
2323
import com.google.android.material.navigation.NavigationBarItemView
2424
import com.lagradost.cloudstream3.AcraApplication.Companion.getActivity
2525
import com.lagradost.cloudstream3.CommonActivity.activity
26-
import com.lagradost.cloudstream3.CommonActivity.showToast
2726
import com.lagradost.cloudstream3.HomePageList
2827
import com.lagradost.cloudstream3.LoadResponse
2928
import com.lagradost.cloudstream3.MainActivity
@@ -35,13 +34,11 @@ import com.lagradost.cloudstream3.mvvm.Resource
3534
import com.lagradost.cloudstream3.mvvm.debugException
3635
import com.lagradost.cloudstream3.mvvm.logError
3736
import com.lagradost.cloudstream3.mvvm.observe
38-
import com.lagradost.cloudstream3.ui.APIRepository.Companion.noneApi
3937
import com.lagradost.cloudstream3.ui.ViewHolderState
4038
import com.lagradost.cloudstream3.ui.WatchType
4139
import com.lagradost.cloudstream3.ui.account.AccountHelper.showAccountEditDialog
4240
import com.lagradost.cloudstream3.ui.account.AccountHelper.showAccountSelectLinear
4341
import com.lagradost.cloudstream3.ui.account.AccountViewModel
44-
import com.lagradost.cloudstream3.ui.home.HomeFragment.Companion.selectHomepage
4542
import com.lagradost.cloudstream3.ui.result.FOCUS_SELF
4643
import com.lagradost.cloudstream3.ui.result.ResultViewModel2
4744
import com.lagradost.cloudstream3.ui.result.START_ACTION_RESUME_LATEST
@@ -577,6 +574,13 @@ class HomeParentItemAdapterPreview(
577574
}
578575

579576
(binding as? FragmentHomeHeadBinding)?.apply {
577+
val searchExitIcon =
578+
homeSearch.findViewById<ImageView?>(androidx.appcompat.R.id.search_close_btn)
579+
// Set the color for the search exit icon to the correct theme text color
580+
val searchExitIconColor = TypedValue()
581+
activity?.theme?.resolveAttribute(R.attr.textColor, searchExitIconColor, true)
582+
searchExitIcon?.setColorFilter(searchExitIconColor.data)
583+
580584
homeSearch.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
581585
override fun onQueryTextSubmit(query: String): Boolean {
582586
viewModel.queryTextSubmit(query)

app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class LibraryFragment : Fragment() {
168168
binding?.mainSearch?.findViewById<ImageView>(androidx.appcompat.R.id.search_close_btn)
169169
val searchExitIconColor = TypedValue()
170170

171-
activity?.theme?.resolveAttribute(android.R.attr.textColor, searchExitIconColor, true)
171+
activity?.theme?.resolveAttribute(R.attr.textColor, searchExitIconColor, true)
172172
searchExitIcon?.setColorFilter(searchExitIconColor.data)
173173

174174
val searchCallback = Runnable {

app/src/main/java/com/lagradost/cloudstream3/ui/quicksearch/QuickSearchFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class QuickSearchFragment : Fragment() {
276276
// Set the color for the search exit icon to the correct theme text color
277277
val searchExitIconColor = TypedValue()
278278

279-
activity?.theme?.resolveAttribute(android.R.attr.textColor, searchExitIconColor, true)
279+
activity?.theme?.resolveAttribute(R.attr.textColor, searchExitIconColor, true)
280280
searchExitIcon?.setColorFilter(searchExitIconColor.data)
281281

282282
binding?.quickSearch?.setOnQueryTextListener(object : SearchView.OnQueryTextListener {

app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class SearchFragment : Fragment() {
285285
// Set the color for the search exit icon to the correct theme text color
286286
val searchExitIconColor = TypedValue()
287287

288-
activity?.theme?.resolveAttribute(android.R.attr.textColor, searchExitIconColor, true)
288+
activity?.theme?.resolveAttribute(R.attr.textColor, searchExitIconColor, true)
289289
searchExitIcon?.setColorFilter(searchExitIconColor.data)
290290

291291
selectedApis = DataStoreHelper.searchPreferenceProviders.toMutableSet()

app/src/main/res/layout/fragment_downloads.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@
342342
style="?attr/floatingActionButtonSmallStyle"
343343
android:backgroundTint="?attr/primaryGrayBackground"
344344
android:src="@drawable/netflix_play"
345+
app:tint="?attr/textColor"
345346
android:layout_marginEnd="16dp"
346347
android:tooltipText="@string/open_local_video"
347348
android:layout_gravity="bottom|end"
Lines changed: 67 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,72 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:app="http://schemas.android.com/apk/res-auto"
4-
style="@style/DarkFragment"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
55

6-
xmlns:tools="http://schemas.android.com/tools"
7-
android:id="@+id/quick_search_root"
8-
android:background="?attr/primaryGrayBackground"
9-
android:layout_width="match_parent"
10-
android:layout_height="match_parent"
11-
android:orientation="vertical">
6+
android:id="@+id/quick_search_root"
7+
style="@style/DarkFragment"
8+
android:layout_width="match_parent"
9+
android:layout_height="match_parent"
10+
android:background="?attr/primaryGrayBackground"
11+
android:orientation="vertical">
1212

1313
<LinearLayout
14-
android:visibility="visible"
15-
android:layout_margin="10dp"
16-
android:layout_width="match_parent"
17-
android:layout_height="wrap_content">
14+
android:layout_width="match_parent"
15+
android:layout_height="wrap_content"
16+
android:layout_margin="10dp"
17+
android:visibility="visible">
1818

1919
<ImageView
2020
android:id="@+id/quick_search_back"
21+
android:layout_width="25dp"
22+
android:layout_height="wrap_content"
2123
android:layout_gravity="center"
22-
android:foregroundGravity="center"
2324
android:background="?android:attr/selectableItemBackgroundBorderless"
25+
android:foregroundGravity="center"
2426
android:src="@drawable/ic_baseline_arrow_back_24"
25-
app:tint="@android:color/white"
2627
android:visibility="gone"
27-
android:layout_width="25dp"
28-
android:layout_height="wrap_content"
29-
tools:visibility="visible">
30-
</ImageView>
28+
app:tint="?attr/white"
29+
tools:visibility="visible" />
3130

3231
<FrameLayout
33-
android:layout_marginStart="10dp"
34-
android:background="@drawable/search_background"
35-
android:layout_gravity="center_vertical"
36-
android:layout_width="match_parent"
37-
android:layout_height="40dp">
32+
android:layout_width="match_parent"
33+
android:layout_height="40dp"
34+
android:layout_gravity="center_vertical"
35+
android:layout_marginStart="10dp"
36+
android:background="@drawable/search_background">
3837

3938
<androidx.appcompat.widget.SearchView
40-
android:nextFocusRight="@id/search_filter"
41-
android:nextFocusLeft="@id/search_filter"
42-
android:nextFocusDown="@id/search_autofit_results"
39+
android:id="@+id/quick_search"
40+
android:layout_width="match_parent"
41+
android:layout_height="match_parent"
4342

44-
android:imeOptions="actionSearch"
45-
android:inputType="text"
43+
android:layout_gravity="center_vertical"
44+
android:iconifiedByDefault="false"
4645

47-
android:id="@+id/quick_search"
48-
app:queryBackground="@color/transparent"
46+
android:imeOptions="actionSearch"
47+
android:inputType="text"
4948

50-
app:searchIcon="@drawable/search_icon"
51-
app:closeIcon="@drawable/ic_baseline_close_24"
49+
android:nextFocusLeft="@id/search_filter"
50+
android:nextFocusRight="@id/search_filter"
5251

53-
android:paddingStart="-10dp"
54-
android:iconifiedByDefault="false"
55-
app:queryHint="@string/search_hint"
56-
android:layout_width="match_parent"
57-
android:layout_height="match_parent"
58-
android:layout_gravity="center_vertical"
59-
app:iconifiedByDefault="false"
60-
tools:ignore="RtlSymmetry">
52+
android:nextFocusDown="@id/search_autofit_results"
53+
android:paddingStart="-10dp"
54+
app:closeIcon="@drawable/ic_baseline_close_24"
55+
app:iconifiedByDefault="false"
56+
app:queryBackground="@color/transparent"
57+
app:queryHint="@string/search_hint"
58+
app:searchIcon="@drawable/search_icon"
59+
tools:ignore="RtlSymmetry">
6160

6261
<androidx.core.widget.ContentLoadingProgressBar
63-
android:id="@+id/quick_search_loading_bar"
64-
android:layout_width="20dp"
65-
android:layout_height="20dp"
66-
android:layout_marginStart="-35dp"
67-
style="@style/Widget.AppCompat.ProgressBar"
68-
android:foregroundTint="@color/white"
69-
android:progressTint="@color/white"
70-
android:layout_gravity="center">
62+
android:id="@+id/quick_search_loading_bar"
63+
style="@style/Widget.AppCompat.ProgressBar"
64+
android:layout_width="20dp"
65+
android:layout_height="20dp"
66+
android:layout_gravity="center"
67+
android:layout_marginStart="-35dp"
68+
android:foregroundTint="@color/white"
69+
android:progressTint="@color/white">
7170

7271
</androidx.core.widget.ContentLoadingProgressBar>
7372
<!--app:queryHint="@string/search_hint"
@@ -79,28 +78,28 @@
7978
</LinearLayout>
8079

8180
<androidx.recyclerview.widget.RecyclerView
82-
android:descendantFocusability="afterDescendants"
81+
android:id="@+id/quick_search_master_recycler"
8382

84-
android:background="?attr/primaryBlackBackground"
85-
android:id="@+id/quick_search_master_recycler"
86-
android:layout_width="match_parent"
87-
android:layout_height="match_parent"
88-
tools:listitem="@layout/homepage_parent" />
83+
android:layout_width="match_parent"
84+
android:layout_height="match_parent"
85+
android:background="?attr/primaryBlackBackground"
86+
android:descendantFocusability="afterDescendants"
87+
tools:listitem="@layout/homepage_parent" />
8988

9089
<com.lagradost.cloudstream3.ui.AutofitRecyclerView
91-
android:visibility="gone"
92-
android:nextFocusLeft="@id/nav_rail_view"
93-
android:descendantFocusability="afterDescendants"
90+
android:id="@+id/quick_search_autofit_results"
91+
android:layout_width="match_parent"
92+
android:layout_height="match_parent"
9493

95-
android:background="?attr/primaryBlackBackground"
96-
android:layout_width="match_parent"
97-
android:layout_height="match_parent"
98-
android:clipToPadding="false"
99-
android:paddingStart="8dp"
100-
android:paddingTop="5dp"
101-
app:spanCount="3"
102-
android:paddingEnd="8dp"
103-
android:id="@+id/quick_search_autofit_results"
104-
tools:listitem="@layout/search_result_grid"
105-
android:orientation="vertical" />
94+
android:background="?attr/primaryBlackBackground"
95+
android:clipToPadding="false"
96+
android:descendantFocusability="afterDescendants"
97+
android:nextFocusLeft="@id/nav_rail_view"
98+
android:orientation="vertical"
99+
android:paddingStart="8dp"
100+
android:paddingTop="5dp"
101+
android:paddingEnd="8dp"
102+
android:visibility="gone"
103+
app:spanCount="3"
104+
tools:listitem="@layout/search_result_grid" />
106105
</LinearLayout>

0 commit comments

Comments
 (0)