-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make positions in list depend on watch history, remove confusing anim…
…ations The following is the list of all commits squashed together: Regain function for option `Positions in lists` use option `Resume playback` to control display of progress info in VideoDetailFragment, remove this (extra) function from option `Positions in lists`. remove extra check for live streams, live streams updates just as non-live streams. fix #8176 by eliminating exit delay Regain function for option `Positions in lists` update code with developer's comments apply static import to methods in util class DependentPreferenceHelper Regain function for option `Positions in lists` use option `Resume playback` to control display of progress info in VideoDetailFragment, remove this (extra) function from option `Positions in lists`. remove extra check for live streams, live streams updates just as non-live streams. fix behavior for displaying progress bar when autoplay off but video resume on not to retrieve unnecessary states when position in lists disabled fix mistake in code simplify conditional logic update doc comment and remove unused method Fix not showing duration if position indicators disabled Positions in lists only depends on watch history
- Loading branch information
Showing
8 changed files
with
98 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
app/src/main/java/org/schabi/newpipe/util/DependentPreferenceHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.schabi.newpipe.util; | ||
|
||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
|
||
import androidx.preference.PreferenceManager; | ||
|
||
import org.schabi.newpipe.R; | ||
|
||
/** | ||
* For preferences with dependencies and multiple use case, | ||
* this class can be used to reduce the lines of code. | ||
*/ | ||
public final class DependentPreferenceHelper { | ||
|
||
private DependentPreferenceHelper() { | ||
// no instance | ||
} | ||
|
||
/** | ||
* Option `Resume playback` depends on `Watch history`, this method can be used to retrieve if | ||
* `Resume playback` and its dependencies are all enabled. | ||
* | ||
* @param context the Android context | ||
* @return returns true if `Resume playback` and `Watch history` are both enabled | ||
*/ | ||
public static boolean getResumePlaybackEnabled(final Context context) { | ||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); | ||
|
||
return prefs.getBoolean(context.getString( | ||
R.string.enable_watch_history_key), true) | ||
&& prefs.getBoolean(context.getString( | ||
R.string.enable_playback_resume_key), true); | ||
} | ||
|
||
/** | ||
* Option `Position in lists` depends on `Watch history`, this method can be used to retrieve if | ||
* `Position in lists` and its dependencies are all enabled. | ||
* | ||
* @param context the Android context | ||
* @return returns true if `Positions in lists` and `Watch history` are both enabled | ||
*/ | ||
public static boolean getPositionsInListsEnabled(final Context context) { | ||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); | ||
|
||
return prefs.getBoolean(context.getString( | ||
R.string.enable_watch_history_key), true) | ||
&& prefs.getBoolean(context.getString( | ||
R.string.enable_playback_state_lists_key), true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters