This commit is contained in:
Bnyro 2022-08-25 11:34:48 +02:00
parent ff16e14b33
commit 9f777b2493
6 changed files with 21 additions and 14 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

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