Merge pull request #1152 from Bnyro/master

better split screen support
This commit is contained in:
Bnyro 2022-08-25 11:38:31 +02:00 committed by GitHub
commit e269be13a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 18 deletions

View File

@ -979,7 +979,8 @@ class PlayerFragment : BaseFragment() {
try { try {
position = DatabaseHolder.db.watchPositionDao().findById(videoId!!).position position = DatabaseHolder.db.watchPositionDao().findById(videoId!!).position
if (position!! < streams.duration!! * 0.9) position = null if (position!! < streams.duration!! * 0.9) position = null
} catch (e: Exception) {} } catch (e: Exception) {
}
}.await() }.await()
if (position != null) exoPlayer.seekTo(position!!) if (position != null) exoPlayer.seekTo(position!!)
} }

View File

@ -78,8 +78,10 @@ class AppearanceSettings : MaterialPreferenceFragment() {
true true
} }
val legacySubscriptionView = findPreference<SwitchPreferenceCompat>(PreferenceKeys.LEGACY_SUBSCRIPTIONS) val legacySubscriptionView =
val legacySubscriptionColumns = findPreference<ListPreference>(PreferenceKeys.LEGACY_SUBSCRIPTIONS_COLUMNS) findPreference<SwitchPreferenceCompat>(PreferenceKeys.LEGACY_SUBSCRIPTIONS)
val legacySubscriptionColumns =
findPreference<ListPreference>(PreferenceKeys.LEGACY_SUBSCRIPTIONS_COLUMNS)
legacySubscriptionColumns?.isVisible = legacySubscriptionView?.isChecked!! legacySubscriptionColumns?.isVisible = legacySubscriptionView?.isChecked!!
legacySubscriptionView.setOnPreferenceChangeListener { _, newValue -> legacySubscriptionView.setOnPreferenceChangeListener { _, newValue ->
legacySubscriptionColumns?.isVisible = newValue as Boolean legacySubscriptionColumns?.isVisible = newValue as Boolean

View File

@ -38,7 +38,8 @@ class GeneralSettings : MaterialPreferenceFragment() {
true true
} }
val breakReminder = findPreference<SwitchPreferenceCompat>(PreferenceKeys.BREAK_REMINDER_TOGGLE) val breakReminder =
findPreference<SwitchPreferenceCompat>(PreferenceKeys.BREAK_REMINDER_TOGGLE)
val breakReminderTime = findPreference<EditTextPreference>(PreferenceKeys.BREAK_REMINDER) val breakReminderTime = findPreference<EditTextPreference>(PreferenceKeys.BREAK_REMINDER)
breakReminderTime?.isEnabled = PreferenceHelper.getBoolean( breakReminderTime?.isEnabled = PreferenceHelper.getBoolean(
PreferenceKeys.BREAK_REMINDER_TOGGLE, PreferenceKeys.BREAK_REMINDER_TOGGLE,

View File

@ -90,14 +90,16 @@ class MainSettings : MaterialPreferenceFragment() {
update?.setOnPreferenceClickListener { update?.setOnPreferenceClickListener {
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {
if (!NetworkHelper.isNetworkAvailable(requireContext())) { 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 return@launch
} }
// check for update // check for update
val updateInfo = UpdateChecker.getLatestReleaseInfo() val updateInfo = UpdateChecker.getLatestReleaseInfo()
if (updateInfo?.name == null) { if (updateInfo?.name == null) {
// request failed // 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) { } else if (BuildConfig.VERSION_NAME != updateInfo.name) {
// show the UpdateAvailableDialog if there's an update available // show the UpdateAvailableDialog if there's an update available
val updateAvailableDialog = UpdateDialog(updateInfo) val updateAvailableDialog = UpdateDialog(updateInfo)
@ -107,7 +109,8 @@ class MainSettings : MaterialPreferenceFragment() {
) )
} else { } else {
// otherwise show the no update available snackBar // 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 true

View File

@ -16,10 +16,10 @@ object ImageHelper {
* Initialize the image loader * Initialize the image loader
*/ */
fun initializeImageLoader(context: Context) { fun initializeImageLoader(context: Context) {
val maxImageCacheSize = PreferenceHelper.getInt( val maxImageCacheSize = PreferenceHelper.getString(
PreferenceKeys.MAX_IMAGE_CACHE, PreferenceKeys.MAX_IMAGE_CACHE,
128 "128"
) ).toInt()
val diskCache = DiskCache.Builder() val diskCache = DiskCache.Builder()
.directory(context.filesDir.resolve("coil")) .directory(context.filesDir.resolve("coil"))

View File

@ -356,8 +356,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:background="?attr/colorSurface" android:background="?attr/colorSurface"
app:layout_constraintDimensionRatio="16:9"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_percent="0.275"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:tools="http://schemas.android.com/tools" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:tools="http://schemas.android.com/tools">
<item <item
android:id="@+id/action_search" android:id="@+id/action_search"