From ff16e14b33356a1bfdb0f28748b7731c0a9995a8 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 25 Aug 2022 11:29:12 +0200 Subject: [PATCH 1/3] fix image cache --- app/src/main/java/com/github/libretube/util/ImageHelper.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/libretube/util/ImageHelper.kt b/app/src/main/java/com/github/libretube/util/ImageHelper.kt index f072dacd4..187886649 100644 --- a/app/src/main/java/com/github/libretube/util/ImageHelper.kt +++ b/app/src/main/java/com/github/libretube/util/ImageHelper.kt @@ -16,10 +16,10 @@ object ImageHelper { * Initialize the image loader */ fun initializeImageLoader(context: Context) { - val maxImageCacheSize = PreferenceHelper.getInt( + val maxImageCacheSize = PreferenceHelper.getString( PreferenceKeys.MAX_IMAGE_CACHE, - 128 - ) + "128" + ).toInt() val diskCache = DiskCache.Builder() .directory(context.filesDir.resolve("coil")) From 9f777b249366ac10e071e140c2071aa0c42884a3 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 25 Aug 2022 11:34:48 +0200 Subject: [PATCH 2/3] reformat --- .../com/github/libretube/fragments/PlayerFragment.kt | 3 ++- .../github/libretube/preferences/AppearanceSettings.kt | 6 ++++-- .../com/github/libretube/preferences/GeneralSettings.kt | 3 ++- .../com/github/libretube/preferences/MainSettings.kt | 9 ++++++--- app/src/main/res/drawable/ic_cache.xml | 8 ++++---- app/src/main/res/menu/action_bar.xml | 6 +++--- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index 4ff7a8835..8de78a041 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -979,7 +979,8 @@ class PlayerFragment : BaseFragment() { try { position = DatabaseHolder.db.watchPositionDao().findById(videoId!!).position if (position!! < streams.duration!! * 0.9) position = null - } catch (e: Exception) {} + } catch (e: Exception) { + } }.await() if (position != null) exoPlayer.seekTo(position!!) } diff --git a/app/src/main/java/com/github/libretube/preferences/AppearanceSettings.kt b/app/src/main/java/com/github/libretube/preferences/AppearanceSettings.kt index 3d4d5a335..a5dde2c12 100644 --- a/app/src/main/java/com/github/libretube/preferences/AppearanceSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/AppearanceSettings.kt @@ -78,8 +78,10 @@ class AppearanceSettings : MaterialPreferenceFragment() { true } - val legacySubscriptionView = findPreference(PreferenceKeys.LEGACY_SUBSCRIPTIONS) - val legacySubscriptionColumns = findPreference(PreferenceKeys.LEGACY_SUBSCRIPTIONS_COLUMNS) + val legacySubscriptionView = + findPreference(PreferenceKeys.LEGACY_SUBSCRIPTIONS) + val legacySubscriptionColumns = + findPreference(PreferenceKeys.LEGACY_SUBSCRIPTIONS_COLUMNS) legacySubscriptionColumns?.isVisible = legacySubscriptionView?.isChecked!! legacySubscriptionView.setOnPreferenceChangeListener { _, newValue -> legacySubscriptionColumns?.isVisible = newValue as Boolean diff --git a/app/src/main/java/com/github/libretube/preferences/GeneralSettings.kt b/app/src/main/java/com/github/libretube/preferences/GeneralSettings.kt index 5287ef3b8..e519e1b72 100644 --- a/app/src/main/java/com/github/libretube/preferences/GeneralSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/GeneralSettings.kt @@ -38,7 +38,8 @@ class GeneralSettings : MaterialPreferenceFragment() { true } - val breakReminder = findPreference(PreferenceKeys.BREAK_REMINDER_TOGGLE) + val breakReminder = + findPreference(PreferenceKeys.BREAK_REMINDER_TOGGLE) val breakReminderTime = findPreference(PreferenceKeys.BREAK_REMINDER) breakReminderTime?.isEnabled = PreferenceHelper.getBoolean( PreferenceKeys.BREAK_REMINDER_TOGGLE, diff --git a/app/src/main/java/com/github/libretube/preferences/MainSettings.kt b/app/src/main/java/com/github/libretube/preferences/MainSettings.kt index ec6e16927..e049e18c2 100644 --- a/app/src/main/java/com/github/libretube/preferences/MainSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/MainSettings.kt @@ -90,14 +90,16 @@ class MainSettings : MaterialPreferenceFragment() { update?.setOnPreferenceClickListener { CoroutineScope(Dispatchers.IO).launch { if (!NetworkHelper.isNetworkAvailable(requireContext())) { - (activity as? SettingsActivity)?.binding?.root?.getStyledSnackBar(R.string.unknown_error)?.show() + (activity as? SettingsActivity)?.binding?.root?.getStyledSnackBar(R.string.unknown_error) + ?.show() return@launch } // check for update val updateInfo = UpdateChecker.getLatestReleaseInfo() if (updateInfo?.name == null) { // request failed - (activity as? SettingsActivity)?.binding?.root?.getStyledSnackBar(R.string.unknown_error)?.show() + (activity as? SettingsActivity)?.binding?.root?.getStyledSnackBar(R.string.unknown_error) + ?.show() } else if (BuildConfig.VERSION_NAME != updateInfo.name) { // show the UpdateAvailableDialog if there's an update available val updateAvailableDialog = UpdateDialog(updateInfo) @@ -107,7 +109,8 @@ class MainSettings : MaterialPreferenceFragment() { ) } else { // otherwise show the no update available snackBar - (activity as? SettingsActivity)?.binding?.root?.getStyledSnackBar(R.string.app_uptodate)?.show() + (activity as? SettingsActivity)?.binding?.root?.getStyledSnackBar(R.string.app_uptodate) + ?.show() } } true diff --git a/app/src/main/res/drawable/ic_cache.xml b/app/src/main/res/drawable/ic_cache.xml index 018572f36..4242d62d8 100644 --- a/app/src/main/res/drawable/ic_cache.xml +++ b/app/src/main/res/drawable/ic_cache.xml @@ -6,14 +6,14 @@ android:viewportHeight="512"> + android:pathData="M256,428C203.65,428 144.61,416.39 98.07,397 81,389.81 66.38,378.18 54.43,369A4,4 0,0 0,48 372.18v12.58c0,28.07 23.49,53.22 66.14,70.82C152.29,471.33 202.67,480 256,480s103.7,-8.67 141.86,-24.42C440.51,438 464,412.83 464,384.76V372.18a4,4 0,0 0,-6.43 -3.18C445.62,378.17 431,389.81 413.92,397 367.38,416.39 308.35,428 256,428Z" /> + android:pathData="M464,126.51c-0.81,-27.65 -24.18,-52.4 -66,-69.85C359.74,40.76 309.34,32 256,32S152.26,40.76 114.09,56.66c-41.78,17.41 -65.15,42.11 -66,69.69L48,144c0,6.41 5.2,16.48 14.63,24.73 11.13,9.73 27.65,19.33 47.78,27.73C153.24,214.36 207.67,225 256,225s102.76,-10.68 145.59,-28.58c20.13,-8.4 36.65,-18 47.78,-27.73C458.8,160.49 464,150.42 464,144Z" /> + android:pathData="M413.92,226C367.39,245.43 308.35,257 256,257S144.61,245.43 98.07,226C81,218.85 66.38,207.21 54.43,198A4,4 0,0 0,48 201.22V232c0,6.41 5.2,14.48 14.63,22.73 11.13,9.74 27.65,19.33 47.78,27.74C153.24,300.34 207.67,311 256,311s102.76,-10.68 145.59,-28.57c20.13,-8.41 36.65,-18 47.78,-27.74C458.8,246.47 464,238.41 464,232V201.22a4,4 0,0 0,-6.43 -3.18C445.62,207.21 431,218.85 413.92,226Z" /> + android:pathData="M413.92,312C367.38,331.41 308.35,343 256,343S144.61,331.41 98.07,312C81,304.83 66.38,293.19 54.43,284A4,4 0,0 0,48 287.2V317c0,6.41 5.2,14.47 14.62,22.71 11.13,9.74 27.66,19.33 47.79,27.74C153.24,385.32 207.66,396 256,396s102.76,-10.68 145.59,-28.57c20.13,-8.41 36.65,-18 47.78,-27.74C458.8,331.44 464,323.37 464,317V287.2a4,4 0,0 0,-6.43 -3.18C445.62,293.19 431,304.83 413.92,312Z" /> \ No newline at end of file diff --git a/app/src/main/res/menu/action_bar.xml b/app/src/main/res/menu/action_bar.xml index f80b6ffca..960c25e58 100644 --- a/app/src/main/res/menu/action_bar.xml +++ b/app/src/main/res/menu/action_bar.xml @@ -1,7 +1,7 @@ - + Date: Thu, 25 Aug 2022 11:37:58 +0200 Subject: [PATCH 3/3] better split screen support --- app/src/main/res/layout/fragment_player.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/layout/fragment_player.xml b/app/src/main/res/layout/fragment_player.xml index 36de5c3d0..baf56d2b0 100644 --- a/app/src/main/res/layout/fragment_player.xml +++ b/app/src/main/res/layout/fragment_player.xml @@ -356,8 +356,8 @@ android:layout_width="match_parent" android:layout_height="0dp" android:background="?attr/colorSurface" + app:layout_constraintDimensionRatio="16:9" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHeight_percent="0.275" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" />