mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
Merge branch '1475-status-bar-return-transition' into 'master'
Show the status bar when finishing ImageActivity See merge request briar/briar!1036
This commit is contained in:
@@ -67,6 +67,10 @@ public class ImageActivity extends BriarActivity
|
||||
final static String NAME = "name";
|
||||
final static String DATE = "date";
|
||||
|
||||
@RequiresApi(api = 16)
|
||||
private final static int UI_FLAGS_DEFAULT =
|
||||
SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
|
||||
@Inject
|
||||
ViewModelProvider.Factory viewModelFactory;
|
||||
|
||||
@@ -138,9 +142,7 @@ public class ImageActivity extends BriarActivity
|
||||
|
||||
if (SDK_INT >= 16) {
|
||||
viewModel.getOnImageClicked().observe(this, this::onImageClicked);
|
||||
window.getDecorView().setSystemUiVisibility(
|
||||
SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
window.getDecorView().setSystemUiVisibility(UI_FLAGS_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,9 +208,16 @@ public class ImageActivity extends BriarActivity
|
||||
|
||||
@Override
|
||||
public void onPullComplete() {
|
||||
showStatusBarBeforeFinishing();
|
||||
supportFinishAfterTransition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
showStatusBarBeforeFinishing();
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@RequiresApi(api = 16)
|
||||
private void onImageClicked(@Nullable Boolean clicked) {
|
||||
if (clicked != null && clicked) {
|
||||
@@ -229,9 +238,8 @@ public class ImageActivity extends BriarActivity
|
||||
|
||||
@RequiresApi(api = 16)
|
||||
private void hideSystemUi(View decorView) {
|
||||
decorView.setSystemUiVisibility(SYSTEM_UI_FLAG_FULLSCREEN |
|
||||
SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
);
|
||||
decorView.setSystemUiVisibility(
|
||||
SYSTEM_UI_FLAG_FULLSCREEN | UI_FLAGS_DEFAULT);
|
||||
appBarLayout.animate()
|
||||
.translationYBy(-1 * appBarLayout.getHeight())
|
||||
.alpha(0f)
|
||||
@@ -241,9 +249,7 @@ public class ImageActivity extends BriarActivity
|
||||
|
||||
@RequiresApi(api = 16)
|
||||
private void showSystemUi(View decorView) {
|
||||
decorView.setSystemUiVisibility(
|
||||
SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
);
|
||||
decorView.setSystemUiVisibility(UI_FLAGS_DEFAULT);
|
||||
appBarLayout.animate()
|
||||
.translationYBy(appBarLayout.getHeight())
|
||||
.alpha(1f)
|
||||
@@ -251,6 +257,18 @@ public class ImageActivity extends BriarActivity
|
||||
.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* If we don't show the status bar again before finishing this activity,
|
||||
* the return transition will "jump" down the size of the status bar
|
||||
* when the previous activity (with visible status bar) is shown.
|
||||
*/
|
||||
private void showStatusBarBeforeFinishing() {
|
||||
if (SDK_INT >= 16 && appBarLayout.getVisibility() == GONE) {
|
||||
View decorView = getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(UI_FLAGS_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
private void showSaveImageDialog() {
|
||||
OnClickListener okListener = (dialog, which) -> {
|
||||
if (SDK_INT >= 19) {
|
||||
|
||||
Reference in New Issue
Block a user