Some new features
This commit is contained in:
parent
825a74de4a
commit
0c048877e0
|
@ -12,6 +12,12 @@
|
||||||
<string name="set_fullscreen_choice" translatable="false">set_fullscreen_choice</string>
|
<string name="set_fullscreen_choice" translatable="false">set_fullscreen_choice</string>
|
||||||
<string name="set_autoplay_next_video_choice" translatable="false">set_autoplay_next_video_choice</string>
|
<string name="set_autoplay_next_video_choice" translatable="false">set_autoplay_next_video_choice</string>
|
||||||
<string name="set_store_in_history" translatable="false">set_store_in_history</string>
|
<string name="set_store_in_history" translatable="false">set_store_in_history</string>
|
||||||
|
<string name="set_play_screen_lock_choice" translatable="false">set_play_screen_lock_choice</string>
|
||||||
|
|
||||||
|
|
||||||
|
<string name="set_play_screen_lock">Verrouillage d\'écran</string>
|
||||||
|
<string name="set_play_screen_lock_description">Continuer à lire des vidéos lorsque l\'écran est verrouillé</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="change_profile_picture">Modifier la photo de profil</string>
|
<string name="change_profile_picture">Modifier la photo de profil</string>
|
||||||
<string name="account_updated">Le compte a été mis à jour !</string>
|
<string name="account_updated">Le compte a été mis à jour !</string>
|
||||||
|
|
|
@ -1,2 +1,10 @@
|
||||||
Added:
|
Added:
|
||||||
- Double tap video left/right to seek - or + 10 seconds
|
- Double tap video left/right to seek - or + 10 seconds
|
||||||
|
- Automatically adapt full-screen in portrait or landscape
|
||||||
|
- Incognito: Enable/disable reccords in history
|
||||||
|
- Video suggestions
|
||||||
|
- Enable/Disable playback when screen is off (default: disabled)
|
||||||
|
|
||||||
|
Fix:
|
||||||
|
- Enable to end playing with top back button
|
||||||
|
- Fix FP message with token
|
|
@ -11,6 +11,10 @@
|
||||||
<string name="set_autoplay_next_video_choice" translatable="false">set_autoplay_next_video_choice</string>
|
<string name="set_autoplay_next_video_choice" translatable="false">set_autoplay_next_video_choice</string>
|
||||||
<string name="set_theme_choice" translatable="false">set_theme_choice</string>
|
<string name="set_theme_choice" translatable="false">set_theme_choice</string>
|
||||||
<string name="set_fullscreen_choice" translatable="false">set_fullscreen_choice</string>
|
<string name="set_fullscreen_choice" translatable="false">set_fullscreen_choice</string>
|
||||||
|
<string name="set_play_screen_lock_choice" translatable="false">set_play_screen_lock_choice</string>
|
||||||
|
|
||||||
|
<string name="set_play_screen_lock">Screen lock</string>
|
||||||
|
<string name="set_play_screen_lock_description">Keep playing videos when the screen is locked</string>
|
||||||
|
|
||||||
<string name="save">Save</string>
|
<string name="save">Save</string>
|
||||||
<string name="enable_history">Enable history</string>
|
<string name="enable_history">Enable history</string>
|
||||||
|
|
|
@ -169,9 +169,10 @@ public class MainActivity extends AppCompatActivity {
|
||||||
if (active == null) {
|
if (active == null) {
|
||||||
active = overviewFragment;
|
active = overviewFragment;
|
||||||
}
|
}
|
||||||
fm.beginTransaction().add(R.id.nav_host_fragment, locaFragment, "5").hide(locaFragment).commit();
|
|
||||||
|
|
||||||
if (!Helper.isLoggedIn(MainActivity.this)) {
|
if (!Helper.isLoggedIn(MainActivity.this)) {
|
||||||
|
fm.beginTransaction().add(R.id.nav_host_fragment, locaFragment, "5").hide(locaFragment).commit();
|
||||||
fm.beginTransaction().add(R.id.nav_host_fragment, recentFragment, "4").hide(recentFragment).commit();
|
fm.beginTransaction().add(R.id.nav_host_fragment, recentFragment, "4").hide(recentFragment).commit();
|
||||||
fm.beginTransaction().add(R.id.nav_host_fragment, mostLikedFragment, "3").hide(mostLikedFragment).commit();
|
fm.beginTransaction().add(R.id.nav_host_fragment, mostLikedFragment, "3").hide(mostLikedFragment).commit();
|
||||||
fm.beginTransaction().add(R.id.nav_host_fragment, trendingFragment, "2").hide(trendingFragment).commit();
|
fm.beginTransaction().add(R.id.nav_host_fragment, trendingFragment, "2").hide(trendingFragment).commit();
|
||||||
|
@ -189,30 +190,35 @@ public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
navView.inflateMenu(R.menu.bottom_nav_menu_connected);
|
navView.inflateMenu(R.menu.bottom_nav_menu_connected);
|
||||||
|
new Thread(() -> {
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
String tokenStr = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
String tokenStr = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
||||||
String instance = Helper.getLiveInstance(MainActivity.this);
|
String instance = Helper.getLiveInstance(MainActivity.this);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
String instanceShar = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
|
String userIdShar = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
Account account = new AccountDAO(MainActivity.this, db).getAccountByToken(tokenStr);
|
Account account = new AccountDAO(MainActivity.this, db).getAccountByToken(tokenStr);
|
||||||
|
if( account == null) {
|
||||||
|
account = new AccountDAO(MainActivity.this, db).getAccountByIdInstance(userIdShar, instanceShar);
|
||||||
|
}
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
|
Account finalAccount = account;
|
||||||
OauthParams oauthParams = new OauthParams();
|
OauthParams oauthParams = new OauthParams();
|
||||||
oauthParams.setGrant_type("refresh_token");
|
oauthParams.setGrant_type("refresh_token");
|
||||||
oauthParams.setClient_id(account.getClient_id());
|
oauthParams.setClient_id(account.getClient_id());
|
||||||
oauthParams.setClient_secret(account.getClient_secret());
|
oauthParams.setClient_secret(account.getClient_secret());
|
||||||
oauthParams.setRefresh_token(account.getRefresh_token());
|
oauthParams.setRefresh_token(account.getRefresh_token());
|
||||||
oauthParams.setAccess_token(account.getToken());
|
oauthParams.setAccess_token(account.getToken());
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
try {
|
||||||
Token token = new RetrofitPeertubeAPI(MainActivity.this).manageToken(oauthParams);
|
Token token = new RetrofitPeertubeAPI(MainActivity.this).manageToken(oauthParams);
|
||||||
if (token == null) {
|
if (token == null && Helper.instanceOnline(instance)) {
|
||||||
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, account));
|
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, finalAccount));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
//To avoid a token issue with subscriptions, adding fragment is done when the token is refreshed.
|
//To avoid a token issue with subscriptions, adding fragment is done when the token is refreshed.
|
||||||
new Handler().post(() -> {
|
new Handler().post(() -> {
|
||||||
|
fm.beginTransaction().add(R.id.nav_host_fragment, locaFragment, "5").hide(locaFragment).commit();
|
||||||
fm.beginTransaction().add(R.id.nav_host_fragment, recentFragment, "4").hide(recentFragment).commitAllowingStateLoss();
|
fm.beginTransaction().add(R.id.nav_host_fragment, recentFragment, "4").hide(recentFragment).commitAllowingStateLoss();
|
||||||
fm.beginTransaction().add(R.id.nav_host_fragment, trendingFragment, "3").hide(trendingFragment).commitAllowingStateLoss();
|
fm.beginTransaction().add(R.id.nav_host_fragment, trendingFragment, "3").hide(trendingFragment).commitAllowingStateLoss();
|
||||||
fm.beginTransaction().add(R.id.nav_host_fragment, subscriptionFragment, "2").hide(subscriptionFragment).commitAllowingStateLoss();
|
fm.beginTransaction().add(R.id.nav_host_fragment, subscriptionFragment, "2").hide(subscriptionFragment).commitAllowingStateLoss();
|
||||||
|
@ -243,11 +249,10 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Error error) {
|
} catch (Error error) {
|
||||||
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, account));
|
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, finalAccount));
|
||||||
error.printStackTrace();
|
error.printStackTrace();
|
||||||
}
|
}
|
||||||
}).start();
|
}}).start();
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
navView.inflateMenu(R.menu.bottom_nav_menu);
|
navView.inflateMenu(R.menu.bottom_nav_menu);
|
||||||
|
|
|
@ -89,6 +89,7 @@ import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
||||||
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
|
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
|
||||||
import com.google.android.exoplayer2.util.MimeTypes;
|
import com.google.android.exoplayer2.util.MimeTypes;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
|
import com.google.android.exoplayer2.video.VideoListener;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@ -141,7 +142,7 @@ import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
||||||
import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_AUTO;
|
import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_AUTO;
|
||||||
|
|
||||||
|
|
||||||
public class PeertubeActivity extends AppCompatActivity implements CommentListAdapter.AllCommentRemoved, Player.EventListener {
|
public class PeertubeActivity extends AppCompatActivity implements CommentListAdapter.AllCommentRemoved, Player.EventListener, VideoListener {
|
||||||
|
|
||||||
public static String video_id;
|
public static String video_id;
|
||||||
private String peertubeInstance, videoUuid;
|
private String peertubeInstance, videoUuid;
|
||||||
|
@ -171,6 +172,22 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
public static List<String> playedVideos = new ArrayList<>();
|
public static List<String> playedVideos = new ArrayList<>();
|
||||||
private VideoData.Video nextVideo;
|
private VideoData.Video nextVideo;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
||||||
|
if(width < height){
|
||||||
|
videoOrientationType = videoOrientation.PORTRAIT;
|
||||||
|
}else{
|
||||||
|
videoOrientationType = videoOrientation.LANDSCAPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum videoOrientation {
|
||||||
|
LANDSCAPE,
|
||||||
|
PORTRAIT
|
||||||
|
}
|
||||||
|
|
||||||
|
private videoOrientation videoOrientationType;
|
||||||
|
|
||||||
public static void hideKeyboard(Activity activity) {
|
public static void hideKeyboard(Activity activity) {
|
||||||
if (activity != null && activity.getWindow() != null) {
|
if (activity != null && activity.getWindow() != null) {
|
||||||
activity.getWindow().getDecorView();
|
activity.getWindow().getDecorView();
|
||||||
|
@ -188,7 +205,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
binding = ActivityPeertubeBinding.inflate(getLayoutInflater());
|
binding = ActivityPeertubeBinding.inflate(getLayoutInflater());
|
||||||
View view = binding.getRoot();
|
View view = binding.getRoot();
|
||||||
setContentView(view);
|
setContentView(view);
|
||||||
|
videoOrientationType = videoOrientation.LANDSCAPE;
|
||||||
max_id = "0";
|
max_id = "0";
|
||||||
urlIntent = null;
|
urlIntent = null;
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
@ -258,7 +275,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
getWindow().setAttributes(attrs);
|
getWindow().setAttributes(attrs);
|
||||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
|
||||||
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
||||||
|
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
}else {
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
||||||
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
|
@ -341,7 +362,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
registBroadcastReceiver();
|
registBroadcastReceiver();
|
||||||
if( autoFullscreen && autoPlay) {
|
if( autoFullscreen && autoPlay) {
|
||||||
openFullscreenDialog();
|
openFullscreenDialog();
|
||||||
|
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
}else {
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +505,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
||||||
fullScreenMode = true;
|
fullScreenMode = true;
|
||||||
openFullscreenDialog();
|
openFullscreenDialog();
|
||||||
|
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
}else {
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fullscreen = FullScreenMediaController.fullscreen.OFF;
|
fullscreen = FullScreenMediaController.fullscreen.OFF;
|
||||||
setFullscreen(FullScreenMediaController.fullscreen.OFF);
|
setFullscreen(FullScreenMediaController.fullscreen.OFF);
|
||||||
|
@ -514,10 +543,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == android.R.id.home) {
|
if (item.getItemId() == android.R.id.home) {
|
||||||
if (playInMinimized && player != null) {
|
if (playInMinimized && player != null) {
|
||||||
enterVideoMode();
|
finishAndRemoveTask();
|
||||||
} else {
|
Intent intent = new Intent(PeertubeActivity.this, MainActivity.class);
|
||||||
finish();
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
finish();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
@ -749,6 +780,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
ProgressiveMediaSource videoSource;
|
ProgressiveMediaSource videoSource;
|
||||||
|
|
||||||
player = new SimpleExoPlayer.Builder(PeertubeActivity.this).build();
|
player = new SimpleExoPlayer.Builder(PeertubeActivity.this).build();
|
||||||
|
player.addVideoListener(PeertubeActivity.this);
|
||||||
player.addListener(this);
|
player.addListener(this);
|
||||||
binding.mediaVideo.player(player);
|
binding.mediaVideo.player(player);
|
||||||
binding.doubleTapPlayerView.setPlayer(player);
|
binding.doubleTapPlayerView.setPlayer(player);
|
||||||
|
@ -980,6 +1012,21 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
onStopCalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
onStopCalled = false;
|
||||||
|
if (player != null && !player.isPlaying()) {
|
||||||
|
player.setPlayWhenReady(autoPlay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
@ -987,25 +1034,30 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
updateHistory(player.getCurrentPosition()/1000);
|
updateHistory(player.getCurrentPosition()/1000);
|
||||||
}
|
}
|
||||||
if (player != null && !isPlayInMinimized) {
|
if (player != null && !isPlayInMinimized) {
|
||||||
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
if( !sharedpreferences.getBoolean(getString(R.string.set_play_screen_lock_choice), false)) {
|
||||||
player.setPlayWhenReady(false);
|
player.setPlayWhenReady(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void registBroadcastReceiver() {
|
private void registBroadcastReceiver() {
|
||||||
final IntentFilter theFilter = new IntentFilter();
|
final IntentFilter theFilter = new IntentFilter();
|
||||||
theFilter.addAction(Intent.ACTION_SCREEN_ON);
|
theFilter.addAction(Intent.ACTION_SCREEN_ON);
|
||||||
theFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
theFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
mPowerKeyReceiver = new BroadcastReceiver() {
|
mPowerKeyReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String strAction = intent.getAction();
|
String strAction = intent.getAction();
|
||||||
if (strAction.equals(Intent.ACTION_SCREEN_OFF)) {
|
if (strAction.equals(Intent.ACTION_SCREEN_OFF)) {
|
||||||
if (player != null && isPlayInMinimized) {
|
if (player != null && isPlayInMinimized) {
|
||||||
|
if( !sharedpreferences.getBoolean(getString(R.string.set_play_screen_lock_choice), false)) {
|
||||||
player.setPlayWhenReady(false);
|
player.setPlayWhenReady(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
getApplicationContext().registerReceiver(mPowerKeyReceiver, theFilter);
|
getApplicationContext().registerReceiver(mPowerKeyReceiver, theFilter);
|
||||||
}
|
}
|
||||||
|
@ -1075,20 +1127,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
onStopCalled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
onStopCalled = false;
|
|
||||||
if (player != null && !player.isPlaying()) {
|
|
||||||
player.setPlayWhenReady(autoPlay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void displayResolution() {
|
public void displayResolution() {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
@ -1295,7 +1333,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
fullScreenButton.setOnClickListener(v -> {
|
fullScreenButton.setOnClickListener(v -> {
|
||||||
if (!fullScreenMode) {
|
if (!fullScreenMode) {
|
||||||
openFullscreenDialog();
|
openFullscreenDialog();
|
||||||
|
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
}else {
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
closeFullscreenDialog();
|
closeFullscreenDialog();
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
@ -1308,7 +1350,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
playButton.setOnClickListener(v->{
|
playButton.setOnClickListener(v->{
|
||||||
if(autoFullscreen && !fullScreenMode) {
|
if(autoFullscreen && !fullScreenMode) {
|
||||||
openFullscreenDialog();
|
openFullscreenDialog();
|
||||||
|
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
}else {
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
player.setPlayWhenReady(true);
|
player.setPlayWhenReady(true);
|
||||||
});
|
});
|
||||||
|
@ -1485,6 +1531,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerError(ExoPlaybackException error) {
|
public void onPlayerError(ExoPlaybackException error) {
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,11 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (key.compareTo(getString(R.string.set_play_screen_lock_choice)) == 0) {
|
||||||
|
SwitchPreference set_play_screen_lock_choice = findPreference(getString(R.string.set_play_screen_lock_choice));
|
||||||
|
assert set_play_screen_lock_choice != null;
|
||||||
|
editor.putBoolean(getString(R.string.set_play_screen_lock_choice), set_play_screen_lock_choice.isChecked());
|
||||||
|
}
|
||||||
if (key.compareTo(getString(R.string.set_video_language_choice)) == 0) {
|
if (key.compareTo(getString(R.string.set_video_language_choice)) == 0) {
|
||||||
MultiSelectListPreference set_video_language_choice = findPreference(getString(R.string.set_video_language_choice));
|
MultiSelectListPreference set_video_language_choice = findPreference(getString(R.string.set_video_language_choice));
|
||||||
assert set_video_language_choice != null;
|
assert set_video_language_choice != null;
|
||||||
|
@ -332,6 +337,13 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
||||||
assert set_autoplay_next_video_choice != null;
|
assert set_autoplay_next_video_choice != null;
|
||||||
set_autoplay_next_video_choice.setChecked(autoplayNextVideo);
|
set_autoplay_next_video_choice.setChecked(autoplayNextVideo);
|
||||||
|
|
||||||
|
|
||||||
|
//****** Screen lock *******
|
||||||
|
boolean playScreenLock = sharedpref.getBoolean(getString(R.string.set_play_screen_lock_choice), false);
|
||||||
|
SwitchPreference set_play_screen_lock_choice = findPreference(getString(R.string.set_play_screen_lock_choice));
|
||||||
|
assert set_play_screen_lock_choice != null;
|
||||||
|
set_play_screen_lock_choice.setChecked(playScreenLock);
|
||||||
|
|
||||||
//****** Language filter *********
|
//****** Language filter *********
|
||||||
LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages());
|
LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages());
|
||||||
List<CharSequence> entriesLanguages = new ArrayList<>();
|
List<CharSequence> entriesLanguages = new ArrayList<>();
|
||||||
|
|
|
@ -49,6 +49,7 @@ import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -735,4 +736,15 @@ public class Helper {
|
||||||
activity.startActivity(chooserIntent);
|
activity.startActivity(chooserIntent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean instanceOnline(String host) {
|
||||||
|
try {
|
||||||
|
InetAddress ipAddr = InetAddress.getByName(host);
|
||||||
|
return ipAddr.toString().trim().compareTo("") != 0;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,23 @@ public class AccountDAO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an Account by id and instance
|
||||||
|
*
|
||||||
|
* @param id String
|
||||||
|
* @param instance String
|
||||||
|
* @return Account
|
||||||
|
*/
|
||||||
|
public Account getAccountByIdInstance(String id, String instance) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Cursor c = db.query(Sqlite.TABLE_USER_ACCOUNT, null, Sqlite.COL_USER_ID + " = \"" + id + "\" AND " + Sqlite.COL_INSTANCE + " = \"" + instance + "\"", null, null, null, null, "1");
|
||||||
|
return cursorToUser(c);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Test if the current user is already stored in data base
|
* Test if the current user is already stored in data base
|
||||||
*
|
*
|
||||||
|
|
|
@ -301,6 +301,7 @@ public class NotificationsWorker extends Worker {
|
||||||
NotificationChannel channel = new NotificationChannel(FETCH_NOTIFICATION_CHANNEL_ID,
|
NotificationChannel channel = new NotificationChannel(FETCH_NOTIFICATION_CHANNEL_ID,
|
||||||
getApplicationContext().getString(R.string.fetch_notification_channel_name),
|
getApplicationContext().getString(R.string.fetch_notification_channel_name),
|
||||||
NotificationManager.IMPORTANCE_DEFAULT);
|
NotificationManager.IMPORTANCE_DEFAULT);
|
||||||
|
channel.setSound(null, null);
|
||||||
notificationManager.createNotificationChannel(channel);
|
notificationManager.createNotificationChannel(channel);
|
||||||
}
|
}
|
||||||
Intent myIntent = new Intent(getApplicationContext(), MainActivity.class);
|
Intent myIntent = new Intent(getApplicationContext(), MainActivity.class);
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M10,16h4c0.55,0 1,-0.45 1,-1v-3c0,-0.55 -0.45,-1 -1,-1v-1c0,-1.11 -0.9,-2 -2,-2 -1.11,0 -2,0.9 -2,2v1c-0.55,0 -1,0.45 -1,1v3c0,0.55 0.45,1 1,1zM10.8,10c0,-0.66 0.54,-1.2 1.2,-1.2 0.66,0 1.2,0.54 1.2,1.2v1h-2.4v-1zM17,1L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2L19,3c0,-1.1 -0.9,-2 -2,-2zM17,19L7,19L7,5h10v14z"/>
|
||||||
|
</vector>
|
|
@ -47,6 +47,12 @@
|
||||||
android:summary="@string/set_autoplay_next_video_description"
|
android:summary="@string/set_autoplay_next_video_description"
|
||||||
android:title="@string/set_autoplay_next_video" />
|
android:title="@string/set_autoplay_next_video" />
|
||||||
|
|
||||||
|
<androidx.preference.SwitchPreference
|
||||||
|
android:icon="@drawable/ic_baseline_screen_lock_portrait_24"
|
||||||
|
android:key="@string/set_play_screen_lock_choice"
|
||||||
|
android:summary="@string/set_play_screen_lock_description"
|
||||||
|
android:title="@string/set_play_screen_lock" />
|
||||||
|
|
||||||
<androidx.preference.SeekBarPreference
|
<androidx.preference.SeekBarPreference
|
||||||
android:icon="@drawable/ic_baseline_storage_24"
|
android:icon="@drawable/ic_baseline_storage_24"
|
||||||
android:defaultValue="10"
|
android:defaultValue="10"
|
||||||
|
|
Loading…
Reference in New Issue