diff --git a/app/build.gradle b/app/build.gradle index 119700d4..f236b425 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -34,8 +34,9 @@ android { applicationId "com.lagradost.cloudstream3" minSdkVersion 21 targetSdkVersion 31 - versionCode 32 - versionName "2.1.2" + + versionCode 33 + versionName "2.2.2" resValue "string", "app_version", "${defaultConfig.versionName}${versionNameSuffix ?: ""}" diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt index 1f82890a..1291dbd8 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt @@ -365,6 +365,30 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener { R.style.LoadedStyle, true ) // THEME IS SET BEFORE VIEW IS CREATED TO APPLY THE THEME TO THE MAIN VIEW + + val settingsManager = PreferenceManager.getDefaultSharedPreferences(this) + + val currentTheme = when (settingsManager.getString("theme", "")) { + "Black" -> R.style.AppTheme + "Light" -> R.style.LightMode + else -> R.style.AppTheme + } + + val currentOverlayTheme = when (settingsManager.getString(getString(R.string.primary_color_key), "Normal")) { + "Normal" -> R.style.OverlayPrimaryColorNormal + "Blue" -> R.style.OverlayPrimaryColorBlue + "Purple" -> R.style.OverlayPrimaryColorPurple + "Green" -> R.style.OverlayPrimaryColorGreen + "GreenApple" -> R.style.OverlayPrimaryColorGreenApple + "Red" -> R.style.OverlayPrimaryColorRed + "Banana" -> R.style.OverlayPrimaryColorBanana + "Party" -> R.style.OverlayPrimaryColorParty + else -> R.style.OverlayPrimaryColorNormal + } + + //theme.applyStyle(currentTheme, true) + theme.applyStyle(currentOverlayTheme, true) + updateLocale() initRequestClient() super.onCreate(savedInstanceState) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt index 72d3bfcb..3d29c87b 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt @@ -89,6 +89,7 @@ import com.lagradost.cloudstream3.utils.DataStore.setKey import com.lagradost.cloudstream3.utils.DataStoreHelper.setLastWatched import com.lagradost.cloudstream3.utils.DataStoreHelper.setViewPos import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog +import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute import com.lagradost.cloudstream3.utils.UIHelper.getNavigationBarHeight import com.lagradost.cloudstream3.utils.UIHelper.getStatusBarHeight import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard @@ -869,11 +870,13 @@ class PlayerFragment : Fragment() { private fun updateLock() { video_locked_img?.setImageResource(if (isLocked) R.drawable.video_locked else R.drawable.video_unlocked) - val color = if (isLocked) ContextCompat.getColor(requireContext(), R.color.videoColorPrimary) + val color = if (isLocked) context?.colorFromAttribute(R.attr.colorPrimary) else Color.WHITE - video_locked_text?.setTextColor(color) - video_locked_img?.setColorFilter(color) + if(color != null) { + video_locked_text?.setTextColor(color) + video_locked_img?.setColorFilter(color) + } val isClick = !isLocked diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt index 8752a17c..b14b0712 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt @@ -18,7 +18,6 @@ import android.view.ViewGroup import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.coordinatorlayout.widget.CoordinatorLayout -import androidx.core.content.ContextCompat import androidx.core.content.FileProvider import androidx.core.text.color import androidx.core.view.isVisible @@ -196,7 +195,7 @@ class ResultFragment : Fragment() { super.onDestroy() activity?.let { it.window?.navigationBarColor = - it.colorFromAttribute(R.attr.darkBackground) + it.colorFromAttribute(R.attr.primaryGrayBackground) } } @@ -959,20 +958,23 @@ class ResultFragment : Fragment() { metadataInfoArray.add(Pair(R.string.site, d.apiName)) - if (metadataInfoArray.size > 0) { - result_metadata.visibility = VISIBLE - val text = SpannableStringBuilder() - val grayColor = ContextCompat.getColor(requireContext(), R.color.grayTextColor) - val textColor = ContextCompat.getColor(requireContext(), R.color.textColor) - for (meta in metadataInfoArray) { - text.color(grayColor) { append(getString(meta.first) + ": ") } - .color(textColor) { append("${meta.second}\n") } + context?.let { ctx -> + if (metadataInfoArray.size > 0) { + result_metadata.visibility = VISIBLE + val text = SpannableStringBuilder() + val grayColor = ctx.colorFromAttribute(R.attr.grayTextColor) //ContextCompat.getColor(requireContext(), R.color.grayTextColor) + val textColor = ctx.colorFromAttribute(R.attr.textColor) //ContextCompat.getColor(requireContext(), R.color.textColor) + for (meta in metadataInfoArray) { + text.color(grayColor) { append(getString(meta.first) + ": ") } + .color(textColor) { append("${meta.second}\n") } + } + result_metadata.text = text + } else { + result_metadata.visibility = GONE } - result_metadata.text = text - } else { - result_metadata.visibility = GONE } + result_poster?.setImage(d.posterUrl) result_poster_holder?.visibility = if (d.posterUrl.isNullOrBlank()) GONE else VISIBLE diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt index f4fe9923..89e5d65f 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt @@ -81,6 +81,7 @@ class SettingsFragment : PreferenceFragmentCompat() { val subdubPreference = findPreference(getString(R.string.display_sub_key))!! val providerLangPreference = findPreference(getString(R.string.provider_lang_key))!! val allLayoutPreference = findPreference(getString(R.string.app_layout_key))!! + val colorPrimaryPreference = findPreference(getString(R.string.primary_color_key))!! legalPreference.setOnPreferenceClickListener { val builder: AlertDialog.Builder = AlertDialog.Builder(it.context) @@ -184,6 +185,28 @@ class SettingsFragment : PreferenceFragmentCompat() { return@setOnPreferenceClickListener true } + colorPrimaryPreference.setOnPreferenceClickListener { + val prefNames = resources.getStringArray(R.array.themes_overlay_names) + val prefValues = resources.getStringArray(R.array.themes_overlay_names_values) + val settingsManager = PreferenceManager.getDefaultSharedPreferences(context) + + val currentLayout = settingsManager.getString( getString(R.string.primary_color_key),prefValues.first()) + context?.showBottomDialog( + prefNames.toList(), + prefValues.indexOf(currentLayout), + getString(R.string.primary_color_settings), + true, + {}) { + try { + settingsManager.edit().putString(getString(R.string.primary_color_key), prefValues[it]).apply() + activity?.recreate() + } catch (e : Exception) { + logError(e) + } + } + return@setOnPreferenceClickListener true + } + watchQualityPreference.setOnPreferenceClickListener { val prefNames = resources.getStringArray(R.array.quality_pref) val prefValues = resources.getIntArray(R.array.quality_pref_values) diff --git a/app/src/main/res/drawable/ic_baseline_color_lens_24.xml b/app/src/main/res/drawable/ic_baseline_color_lens_24.xml new file mode 100644 index 00000000..b87ca001 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_color_lens_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/outline_card.xml b/app/src/main/res/drawable/outline_card.xml index 442c662e..02116bb8 100644 --- a/app/src/main/res/drawable/outline_card.xml +++ b/app/src/main/res/drawable/outline_card.xml @@ -14,7 +14,7 @@ - + diff --git a/app/src/main/res/drawable/tab_selector.xml b/app/src/main/res/drawable/tab_selector.xml index ab31dbf8..92bb27dd 100644 --- a/app/src/main/res/drawable/tab_selector.xml +++ b/app/src/main/res/drawable/tab_selector.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 17903e53..078e52f9 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -15,7 +15,7 @@ android:id="@+id/nav_view" android:layout_width="0dp" android:layout_height="wrap_content" - android:background="?attr/darkBackground" + android:background="?attr/primaryGrayBackground" app:labelVisibilityMode="labeled" @@ -41,7 +41,7 @@ > - + android:layout_height="match_parent"> + - + @@ -71,7 +71,7 @@ android:layout_gravity="center_vertical" android:gravity="center_vertical" tools:text="128MB / 237MB" - android:textColor="@color/grayTextColor" + android:textColor="?attr/grayTextColor" android:layout_width="wrap_content" android:layout_height="match_parent"> @@ -111,6 +111,7 @@ android:layout_width="30dp" android:background="?selectableItemBackgroundBorderless" android:src="@drawable/ic_baseline_play_arrow_24" + android:tint="?attr/textColor" android:contentDescription="@string/download"/> diff --git a/app/src/main/res/layout/download_header_episode.xml b/app/src/main/res/layout/download_header_episode.xml index ff4c62cf..cc52646a 100644 --- a/app/src/main/res/layout/download_header_episode.xml +++ b/app/src/main/res/layout/download_header_episode.xml @@ -6,7 +6,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" app:cardCornerRadius="@dimen/roundedImageRadius" - app:cardBackgroundColor="@color/itemBackground" + app:cardBackgroundColor="?attr/boxItemBackground" android:id="@+id/episode_holder" android:foreground="@drawable/outline_drawable" android:layout_marginBottom="10dp" @@ -41,14 +41,14 @@ android:id="@+id/download_header_title" tools:text="Perfect Run" android:textStyle="bold" - android:textColor="@color/textColor" + android:textColor="?attr/textColor" android:layout_width="wrap_content" android:layout_height="wrap_content"> diff --git a/app/src/main/res/layout/fragment_child_downloads.xml b/app/src/main/res/layout/fragment_child_downloads.xml index 7f914cb6..6ad31711 100644 --- a/app/src/main/res/layout/fragment_child_downloads.xml +++ b/app/src/main/res/layout/fragment_child_downloads.xml @@ -1,6 +1,6 @@ - #1E1E32 #F53B66 #3700B3 #3b65f5 @@ -11,12 +10,11 @@ #2B2C30 #111111 #1C1C20 - #161616 + #161616 #e9eaee #9ba0a4 - @color/textColor #1AFFFFFF #00000000 @@ -34,10 +32,27 @@ #121212 #66B5B5B5 - @color/colorPrimary #9ba0a6 #FFF #676767 + + + #fff + #EFEFEF + #FFF + #EDEDED + #202125 + #5f6267 + #5f6267 + + + #5664B7 + #D50000 + #6200EA + #00BFA5 + #48E484 + #E4D448 + #ea596e \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f0da348f..39ba9ec3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -25,6 +25,7 @@ provider_lang_key dns_key app_layout_key + primary_color_key %d %s | %sMB @@ -299,4 +300,6 @@ Auto Tv Layout Phone Layout + + Primary Color diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 7e577030..da07f6dc 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -8,8 +8,8 @@ ?attr/iconGrayBackground - @color/searchColor - @color/textColor + ?attr/textColor + ?attr/textColor @null @null @@ -37,17 +37,102 @@ @color/colorPrimaryDark @color/colorAccent @color/textColor - @color/colorItemSeen @color/grayTextColor - @color/primaryGrayBackground + @color/primaryGrayBackground @color/primaryBlackBackground @color/iconGrayBackground - @color/itemBackground + @color/boxItemBackground @color/iconColor #FFF + + + + + + + + + + + + + + + + + + +