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

@ -6,14 +6,14 @@
android:viewportHeight="512">
<path
android:fillColor="#FF000000"
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="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" />
<path
android:fillColor="#FF000000"
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="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" />
<path
android:fillColor="#FF000000"
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,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" />
<path
android:fillColor="#FF000000"
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"/>
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" />
</vector>

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"