Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation back event fixes for landscape orientation #398

Merged
merged 2 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void onClickChatLandScapeWidth(View _view) {
updateSummaries();
},
landscapeWidth,
25,
10,
60,
getString(R.string.chat_landscape_width_dialog)
).show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public abstract class StreamActivity extends ThemeActivity implements StreamFrag
private Settings settings;
private boolean mBackstackLost;
private boolean onStopCalled;
private int initialOrientation;

protected abstract int getLayoutResource();

Expand All @@ -63,6 +64,8 @@ protected void onCreate(Bundle savedInstanceState) {
getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.black));
getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.black));

initialOrientation = getResources().getConfiguration().orientation;

if (savedInstanceState == null) {
FragmentManager fm = getSupportFragmentManager();

Expand Down Expand Up @@ -111,7 +114,9 @@ public void onBackPressed() {

// Eww >(
if (mStreamFragment != null) {
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
boolean isCurrentlyLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
boolean wasInitiallyLandscape = initialOrientation == Configuration.ORIENTATION_LANDSCAPE;
if (isCurrentlyLandscape && !wasInitiallyLandscape) {
mStreamFragment.toggleFullscreen();
} else if (mStreamFragment.chatOnlyViewVisible) {
this.finish();
Expand Down
Loading