fix orientation issue

rework_peertube_api
Thomas 2 years ago
parent 47b767e8ce
commit a8f8f33a74

@ -163,7 +163,7 @@ public class BaseActivity extends AppCompatActivity {
@Override @Override
protected void attachBaseContext(Context newBase) { protected void attachBaseContext(Context newBase) {
if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.N) { if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {
final Configuration override = new Configuration(newBase.getResources().getConfiguration()); final Configuration override = new Configuration();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(newBase); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(newBase);
override.fontScale = prefs.getFloat(newBase.getString(R.string.SET_FONT_SCALE), 1.1f); override.fontScale = prefs.getFloat(newBase.getString(R.string.SET_FONT_SCALE), 1.1f);
applyOverrideConfiguration(override); applyOverrideConfiguration(override);

@ -149,7 +149,7 @@ public class BaseBarActivity extends AppCompatActivity {
protected void attachBaseContext(Context newBase) { protected void attachBaseContext(Context newBase) {
if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.N) { if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {
final Configuration override = new Configuration(newBase.getResources().getConfiguration()); final Configuration override = new Configuration();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(newBase); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(newBase);
override.fontScale = prefs.getFloat(newBase.getString(R.string.SET_FONT_SCALE), 1.1f); override.fontScale = prefs.getFloat(newBase.getString(R.string.SET_FONT_SCALE), 1.1f);
applyOverrideConfiguration(override); applyOverrideConfiguration(override);

@ -149,7 +149,7 @@ public class BaseTransparentActivity extends AppCompatActivity {
protected void attachBaseContext(Context newBase) { protected void attachBaseContext(Context newBase) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {
final Configuration override = new Configuration(newBase.getResources().getConfiguration()); final Configuration override = new Configuration();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(newBase); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(newBase);
override.fontScale = prefs.getFloat(newBase.getString(R.string.SET_FONT_SCALE), 1.1f); override.fontScale = prefs.getFloat(newBase.getString(R.string.SET_FONT_SCALE), 1.1f);
applyOverrideConfiguration(override); applyOverrideConfiguration(override);

@ -19,7 +19,6 @@ import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.BaseMainActivity.currentInstance; import static app.fedilab.android.BaseMainActivity.currentInstance;
import static app.fedilab.android.BaseMainActivity.currentToken; import static app.fedilab.android.BaseMainActivity.currentToken;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN;
import static app.fedilab.android.mastodon.helper.Helper.TAG;
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.typeOfConnection; import static app.fedilab.android.peertube.activities.PeertubeMainActivity.typeOfConnection;
import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType.ADD_COMMENT; import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType.ADD_COMMENT;
import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType.RATEVIDEO; import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType.RATEVIDEO;
@ -60,7 +59,6 @@ import android.text.TextPaint;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan; import android.text.style.ClickableSpan;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -1500,8 +1498,6 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
if (binding.minController.castMiniController.getVisibility() == View.VISIBLE) { if (binding.minController.castMiniController.getVisibility() == View.VISIBLE) {
return; return;
} }
Log.v(TAG, "newConfig.orientation: " + newConfig.orientation);
Log.v(TAG, "humanInteraction: " + humanInteraction);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
if (mode != Helper.VIDEO_MODE_WEBVIEW && !humanInteraction) { if (mode != Helper.VIDEO_MODE_WEBVIEW && !humanInteraction) {
@ -1672,7 +1668,6 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
public void toggleFullScreen() { public void toggleFullScreen() {
fullScreenMode = !fullScreenMode; fullScreenMode = !fullScreenMode;
humanInteraction = true; humanInteraction = true;
Log.v(TAG, "toggleFullScreen: " + fullScreenMode);
if (fullScreenMode) { if (fullScreenMode) {
if (getResources().getConfiguration().orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE && videoOrientationType == videoOrientation.PORTRAIT) { if (getResources().getConfiguration().orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE && videoOrientationType == videoOrientation.PORTRAIT) {
setRequestedOrientationCustom(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); setRequestedOrientationCustom(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
@ -1691,11 +1686,8 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
} }
private void setFullScreen() { private void setFullScreen() {
Log.v(TAG, "setFullScreen");
fullScreenMode = true; fullScreenMode = true;
fullScreenIcon.setImageDrawable(ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_baseline_fullscreen_exit_24)); fullScreenIcon.setImageDrawable(ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_baseline_fullscreen_exit_24));
Log.v(TAG, "getResources().getConfiguration().orientation: " + getResources().getConfiguration().orientation);
Log.v(TAG, "videoOrientationType: " + videoOrientationType);
// Enables regular immersive mode. // Enables regular immersive mode.
// For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE. // For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE.
@ -1717,7 +1709,6 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
} }
private void disableFullScreen() { private void disableFullScreen() {
Log.v(TAG, "disableFullScreen");
fullScreenMode = false; fullScreenMode = false;
binding.bottomVideo.setVisibility(View.VISIBLE); binding.bottomVideo.setVisibility(View.VISIBLE);
fullScreenIcon.setImageDrawable(ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_baseline_fullscreen_24)); fullScreenIcon.setImageDrawable(ContextCompat.getDrawable(PeertubeActivity.this, R.drawable.ic_baseline_fullscreen_24));

Loading…
Cancel
Save