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 {
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!!)
}

View File

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

View File

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

View File

@ -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

View File

@ -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"))

View File

@ -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" />

View File

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