mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 21:29:54 +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 NAME = "name";
|
||||||
final static String DATE = "date";
|
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
|
@Inject
|
||||||
ViewModelProvider.Factory viewModelFactory;
|
ViewModelProvider.Factory viewModelFactory;
|
||||||
|
|
||||||
@@ -138,9 +142,7 @@ public class ImageActivity extends BriarActivity
|
|||||||
|
|
||||||
if (SDK_INT >= 16) {
|
if (SDK_INT >= 16) {
|
||||||
viewModel.getOnImageClicked().observe(this, this::onImageClicked);
|
viewModel.getOnImageClicked().observe(this, this::onImageClicked);
|
||||||
window.getDecorView().setSystemUiVisibility(
|
window.getDecorView().setSystemUiVisibility(UI_FLAGS_DEFAULT);
|
||||||
SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
|
||||||
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,9 +208,16 @@ public class ImageActivity extends BriarActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPullComplete() {
|
public void onPullComplete() {
|
||||||
|
showStatusBarBeforeFinishing();
|
||||||
supportFinishAfterTransition();
|
supportFinishAfterTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
showStatusBarBeforeFinishing();
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
@RequiresApi(api = 16)
|
@RequiresApi(api = 16)
|
||||||
private void onImageClicked(@Nullable Boolean clicked) {
|
private void onImageClicked(@Nullable Boolean clicked) {
|
||||||
if (clicked != null && clicked) {
|
if (clicked != null && clicked) {
|
||||||
@@ -229,9 +238,8 @@ public class ImageActivity extends BriarActivity
|
|||||||
|
|
||||||
@RequiresApi(api = 16)
|
@RequiresApi(api = 16)
|
||||||
private void hideSystemUi(View decorView) {
|
private void hideSystemUi(View decorView) {
|
||||||
decorView.setSystemUiVisibility(SYSTEM_UI_FLAG_FULLSCREEN |
|
decorView.setSystemUiVisibility(
|
||||||
SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
SYSTEM_UI_FLAG_FULLSCREEN | UI_FLAGS_DEFAULT);
|
||||||
);
|
|
||||||
appBarLayout.animate()
|
appBarLayout.animate()
|
||||||
.translationYBy(-1 * appBarLayout.getHeight())
|
.translationYBy(-1 * appBarLayout.getHeight())
|
||||||
.alpha(0f)
|
.alpha(0f)
|
||||||
@@ -241,9 +249,7 @@ public class ImageActivity extends BriarActivity
|
|||||||
|
|
||||||
@RequiresApi(api = 16)
|
@RequiresApi(api = 16)
|
||||||
private void showSystemUi(View decorView) {
|
private void showSystemUi(View decorView) {
|
||||||
decorView.setSystemUiVisibility(
|
decorView.setSystemUiVisibility(UI_FLAGS_DEFAULT);
|
||||||
SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
||||||
);
|
|
||||||
appBarLayout.animate()
|
appBarLayout.animate()
|
||||||
.translationYBy(appBarLayout.getHeight())
|
.translationYBy(appBarLayout.getHeight())
|
||||||
.alpha(1f)
|
.alpha(1f)
|
||||||
@@ -251,6 +257,18 @@ public class ImageActivity extends BriarActivity
|
|||||||
.start();
|
.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() {
|
private void showSaveImageDialog() {
|
||||||
OnClickListener okListener = (dialog, which) -> {
|
OnClickListener okListener = (dialog, which) -> {
|
||||||
if (SDK_INT >= 19) {
|
if (SDK_INT >= 19) {
|
||||||
|
|||||||
Reference in New Issue
Block a user