Skip to content

Commit

Permalink
bump v1.50 release
Browse files Browse the repository at this point in the history
update libs / appCategorizer and possible recency sort fix
  • Loading branch information
tsynik committed Nov 6, 2021
1 parent 6eb6230 commit f4ae5e4
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 25 deletions.
15 changes: 8 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'com.google.firebase.crashlytics' // Apply the Crashlytics Gradle
apply plugin: 'kotlin-android'

android {
compileSdkVersion 30
compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
Expand All @@ -15,9 +15,10 @@ android {
defaultConfig {
applicationId "com.amazon.tv.leanbacklauncher"
minSdkVersion 22
//noinspection OldTargetApi
targetSdkVersion 30
versionCode 49
versionName "1.49"
versionCode 50
versionName "1.50"
vectorDrawables.useSupportLibrary = true
resConfigs "en", "ru", "uk", "it", "fr", "es", "de", "pl"
setProperty("archivesBaseName", "LeanbackOnFire_v" + versionName)
Expand Down Expand Up @@ -45,13 +46,13 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1-native-mt'
implementation 'androidx.appcompat:appcompat:1.3.1' // fix on 1.2.0 - 1.3.0 broke leanback settings animations
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.leanback:leanback:$leanback_version"
implementation "androidx.leanback:leanback-preference:$leanback_version"
implementation 'androidx.lifecycle:lifecycle-process:2.3.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-process:2.4.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'com.google.android.exoplayer:exoplayer:2.15.0'
implementation 'com.google.android.exoplayer:exoplayer:2.16.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation 'com.google.guava:guava:30.1.1-jre'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ object AppCategorizer {
"ru.rutube",
"ru.start",
"ru.tv1",
"ru.twicker.lampa",
"ru.yourok",
"schabi",
"serials",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,17 @@ class AppsManager private constructor(private val mContext: Context) :
}

@JvmStatic
fun getSavedSortingMode(context: Context?): SortingMode {
fun getSavedSortingMode(context: Context): SortingMode {
return SortingMode.valueOf(
PreferenceManager.getDefaultSharedPreferences(context).getString(
"apps_ranker_sorting_mode",
Partner.get(context).appSortingMode.toString()
)!!
Partner.get(context).appSortingMode.toString(),
) ?: "FIXED"
)
}

@JvmStatic
fun saveSortingMode(context: Context?, mode: SortingMode) {
fun saveSortingMode(context: Context, mode: SortingMode) {
PreferenceManager.getDefaultSharedPreferences(context).edit()
.putString("apps_ranker_sorting_mode", mode.toString()).apply()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class LegacyAppOrderPreferenceFragment : GuidedStepSupportFragment() {

override fun onCreateActions(actions: MutableList<GuidedAction>, savedInstanceState: Bundle?) {
var z = true
val sortingMode = getSavedSortingMode(activity)
val sortingMode = getSavedSortingMode(requireContext())
actions.add(
GuidedAction.Builder(activity)
.id(1)
Expand Down Expand Up @@ -50,11 +50,11 @@ class LegacyAppOrderPreferenceFragment : GuidedStepSupportFragment() {
override fun onGuidedActionClicked(action: GuidedAction) {
when (action.id.toInt()) {
1 -> {
saveSortingMode(activity, SortingMode.RECENCY)
saveSortingMode(requireContext(), SortingMode.RECENCY)
return
}
2 -> {
saveSortingMode(activity, SortingMode.FIXED)
saveSortingMode(requireContext(), SortingMode.FIXED)
return
}
else -> return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LegacyAppsAndGamesPreferenceFragment : GuidedStepSupportFragment() {
override fun onResume() {
super.onResume()
val actions = ArrayList<GuidedAction>()
val sortingMode = getSavedSortingMode(activity)
val sortingMode = getSavedSortingMode(requireContext())
actions.add(
GuidedAction.Builder(activity).id(1).title(R.string.edit_row_title)
.description(R.string.select_app_customize_rows_title).build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,27 +186,26 @@ class VersionPreferenceFragment : LeanbackPreferenceFragmentCompat() {
* The fragment that is defined in prefs.xml
*/
class HomePreferenceFragment : LeanbackPreferenceFragmentCompat() {

private val appContext = App.getContext()
private val sortingMode = AppsManager.getSavedSortingMode(appContext)
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
// Load the prefs from an XML resource
setPreferencesFromResource(R.xml.home_prefs, rootKey)

val sortingMode = AppsManager.getSavedSortingMode(context)
findPreference<Preference>("apps_order")?.apply {
this.summary =
if (sortingMode == AppsManager.SortingMode.FIXED) getString(R.string.fixed_order_action_description)
if (sortingMode === AppsManager.SortingMode.FIXED) getString(R.string.fixed_order_action_description)
else getString(R.string.recency_order_action_description)
}
}

override fun onPreferenceTreeClick(preference: Preference?): Boolean {
if (preference?.key == "apps_order") {
val mode = AppsManager.getSavedSortingMode(context)
if (mode == AppsManager.SortingMode.FIXED) {
AppsManager.saveSortingMode(context, AppsManager.SortingMode.RECENCY)
val curMode = AppsManager.getSavedSortingMode(appContext)
if (curMode === AppsManager.SortingMode.FIXED) {
AppsManager.saveSortingMode(appContext, AppsManager.SortingMode.RECENCY)
preference.summary = getString(R.string.recency_order_action_description)
} else {
AppsManager.saveSortingMode(context, AppsManager.SortingMode.FIXED)
AppsManager.saveSortingMode(appContext, AppsManager.SortingMode.FIXED)
preference.summary = getString(R.string.fixed_order_action_description)

}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.5.30'
ext.kotlin_version = '1.5.31'

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.1'
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1' // Firebase for Crashlytics
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Expand Down

0 comments on commit f4ae5e4

Please sign in to comment.