mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 02:17:43 +03:00
Add toggle functionality for action bar
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
4930d6cb97
commit
7959a1d266
2 changed files with 22 additions and 1 deletions
|
@ -100,6 +100,8 @@ public class PreviewImageActivity extends FileActivity implements
|
|||
@Inject AppPreferences preferences;
|
||||
@Inject LocalBroadcastManager localBroadcastManager;
|
||||
|
||||
private ActionBar actionBar;
|
||||
|
||||
public static Intent previewFileIntent(Context context, User user, OCFile file) {
|
||||
final Intent intent = new Intent(context, PreviewImageActivity.class);
|
||||
intent.putExtra(FileActivity.EXTRA_FILE, file);
|
||||
|
@ -111,7 +113,7 @@ public class PreviewImageActivity extends FileActivity implements
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
actionBar = getSupportActionBar();
|
||||
|
||||
if (savedInstanceState != null && !savedInstanceState.getBoolean(KEY_SYSTEM_VISIBLE, true) &&
|
||||
actionBar != null) {
|
||||
|
@ -144,6 +146,18 @@ public class PreviewImageActivity extends FileActivity implements
|
|||
}
|
||||
}
|
||||
|
||||
public void toggleActionBarVisibility(boolean hide) {
|
||||
if (actionBar == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hide) {
|
||||
actionBar.hide();
|
||||
} else {
|
||||
actionBar.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void initViewPager(User user) {
|
||||
// virtual folder
|
||||
final Serializable virtualFolderType = getIntent().getSerializableExtra(EXTRA_VIRTUAL_TYPE);
|
||||
|
|
|
@ -222,11 +222,18 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
|
|||
}
|
||||
}
|
||||
|
||||
private void toggleActionBarVisibility(boolean hide) {
|
||||
PreviewImageActivity activity = (PreviewImageActivity) requireActivity();
|
||||
activity.toggleActionBarVisibility(hide);
|
||||
}
|
||||
|
||||
private void playLivePhoto(OCFile file) {
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
toggleActionBarVisibility(true);
|
||||
|
||||
Fragment mediaFragment = PreviewMediaFragment.newInstance(file, accountManager.getUser(), 0, true);
|
||||
FragmentManager fragmentManager = requireActivity().getSupportFragmentManager();
|
||||
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
||||
|
|
Loading…
Reference in a new issue