List of usage examples for android.support.v4.app FragmentTransaction TRANSIT_FRAGMENT_CLOSE
int TRANSIT_FRAGMENT_CLOSE
To view the source code for android.support.v4.app FragmentTransaction TRANSIT_FRAGMENT_CLOSE.
Click Source Link
From source file:com.jefftharris.passwdsafe.PasswdSafe.java
/** * Update the view mode/* w ww. j ava 2 s .c om*/ */ private void doUpdateView(ViewMode mode, @NonNull PasswdLocation location) { PasswdSafeUtil.dbginfo(TAG, "doUpdateView: mode: %s, loc: %s", mode, location); itsLocation = location; itsFileDataFrag.setLocation(itsLocation); itsCurrViewMode = mode; FragmentManager fragMgr = getSupportFragmentManager(); boolean showLeftList = false; boolean queryVisibleForMode = false; PasswdSafeNavDrawerFragment.Mode drawerMode = PasswdSafeNavDrawerFragment.Mode.INIT; boolean fileTimeoutPaused = true; String fileNameUpdate = null; switch (mode) { case INIT: case FILE_OPEN: case FILE_NEW: { itsTitle = PasswdSafeApp.getAppTitle(null, this); fileNameUpdate = ""; break; } case VIEW_LIST: { showLeftList = true; queryVisibleForMode = true; drawerMode = PasswdSafeNavDrawerFragment.Mode.RECORDS_LIST; fileTimeoutPaused = false; itsTitle = null; String groups = itsLocation.getGroupPath(); if (TextUtils.isEmpty(groups)) { final ObjectHolder<String> fileNameVal = new ObjectHolder<>(); itsFileDataFrag.useFileData(new PasswdFileDataUser() { @Override public void useFileData(@NonNull PasswdFileData fileData) { PasswdFileUri uri = fileData.getUri(); itsTitle = PasswdSafeApp.getAppFileTitle(uri, PasswdSafe.this); fileNameVal.set(uri.getIdentifier(PasswdSafe.this, true)); } }); fileNameUpdate = fileNameVal.get(); } if (itsTitle == null) { itsTitle = PasswdSafeApp.getAppTitle(groups, this); } Fragment contentsFrag = fragMgr.findFragmentById(R.id.content); if (contentsFrag instanceof PasswdSafeListFragment) { PasswdSafeListFragment.Mode contentsMode = itsIsTwoPane ? PasswdSafeListFragment.Mode.RECORDS : PasswdSafeListFragment.Mode.ALL; ((PasswdSafeListFragment) contentsFrag).updateLocationView(itsLocation, contentsMode); } break; } case VIEW_RECORD: { showLeftList = true; drawerMode = itsIsTwoPane ? PasswdSafeNavDrawerFragment.Mode.RECORDS_LIST : PasswdSafeNavDrawerFragment.Mode.RECORDS_SINGLE; fileTimeoutPaused = false; itsTitle = null; itsFileDataFrag.useFileData(new PasswdFileDataUser() { @Override public void useFileData(@NonNull PasswdFileData fileData) { if (itsLocation.isRecord()) { PwsRecord rec = fileData.getRecord(itsLocation.getRecord()); itsTitle = fileData.getTitle(rec); } } }); if (itsTitle == null) { itsTitle = getString(R.string.new_entry); } break; } case EDIT_RECORD: { drawerMode = PasswdSafeNavDrawerFragment.Mode.RECORDS_ACTION; itsTitle = null; itsFileDataFrag.useFileData(new PasswdFileDataUser() { @Override public void useFileData(@NonNull PasswdFileData fileData) { if (itsLocation.isRecord()) { PwsRecord rec = fileData.getRecord(itsLocation.getRecord()); itsTitle = getString(R.string.edit_item, fileData.getTitle(rec)); } } }); if (itsTitle == null) { itsTitle = getString(R.string.new_entry); } break; } case CHANGING_PASSWORD: { itsTitle = getString(R.string.change_password); drawerMode = PasswdSafeNavDrawerFragment.Mode.RECORDS_ACTION; break; } case VIEW_ABOUT: { drawerMode = PasswdSafeNavDrawerFragment.Mode.ABOUT; fileTimeoutPaused = false; itsTitle = PasswdSafeApp.getAppTitle(getString(R.string.about), this); break; } case VIEW_EXPIRATION: { drawerMode = PasswdSafeNavDrawerFragment.Mode.EXPIRATIONS; fileTimeoutPaused = false; itsTitle = PasswdSafeApp.getAppTitle(getString(R.string.password_expiration), this); break; } case VIEW_POLICY_LIST: { drawerMode = PasswdSafeNavDrawerFragment.Mode.POLICIES; fileTimeoutPaused = false; itsTitle = PasswdSafeApp.getAppTitle(getString(R.string.password_policies), this); break; } case VIEW_PREFERENCES: { drawerMode = PasswdSafeNavDrawerFragment.Mode.PREFERENCES; fileTimeoutPaused = false; itsTitle = PasswdSafeApp.getAppTitle(getString(R.string.preferences), this); break; } } GuiUtils.invalidateOptionsMenu(this); boolean fileOpen = isFileOpen(); itsNavDrawerFrag.updateView(drawerMode, fileNameUpdate, fileOpen); restoreActionBar(); itsTimeoutReceiver.updateTimeout(fileTimeoutPaused); PasswdFileDataView fileDataView = itsFileDataFrag.getFileDataView(); GuiUtils.setVisible(itsQueryPanel, queryVisibleForMode && (fileDataView.getRecordFilter() != null)); if (fileOpen) { if (fileDataView.checkExpiryChanged()) { GuiUtils.setVisible(itsExpiryPanel, fileDataView.hasExpiredRecords()); itsExpiry.setText(fileDataView.getExpiredRecordsStr(this)); } } else { GuiUtils.setVisible(itsExpiryPanel, false); } if (itsIsTwoPane) { PasswdSafeListFragment.Mode listMode = itsLocation.isRecord() ? PasswdSafeListFragment.Mode.ALL : PasswdSafeListFragment.Mode.GROUPS; Fragment listFrag = fragMgr.findFragmentById(R.id.content_list); if (listFrag instanceof PasswdSafeListFragment) { ((PasswdSafeListFragment) listFrag).updateLocationView(itsLocation, listMode); } if (listFrag != null) { FragmentTransaction txn = fragMgr.beginTransaction(); if (showLeftList) { txn.setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); txn.show(listFrag); } else { txn.setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE); txn.hide(listFrag); } txn.commit(); } } }
From source file:net.tjado.passwdsafe.PasswdSafe.java
/** * Update the view mode// w ww .ja v a 2 s .c o m */ private void doUpdateView(ViewMode mode, @NonNull PasswdLocation location) { PasswdSafeUtil.dbginfo(TAG, "doUpdateView: mode: %s, loc: %s", mode, location); itsLocation = location; itsFileDataFrag.setLocation(itsLocation); itsCurrViewMode = mode; FragmentManager fragMgr = getSupportFragmentManager(); boolean showLeftList = false; boolean queryVisibleForMode = false; PasswdSafeNavDrawerFragment.Mode drawerMode = PasswdSafeNavDrawerFragment.Mode.INIT; boolean fileTimeoutPaused = true; String fileNameUpdate = null; switch (mode) { case INIT: case FILE_OPEN: case FILE_NEW: { itsTitle = PasswdSafeApp.getAppTitle(null, this); fileNameUpdate = ""; break; } case VIEW_LIST: { showLeftList = true; queryVisibleForMode = true; drawerMode = PasswdSafeNavDrawerFragment.Mode.RECORDS_LIST; fileTimeoutPaused = false; itsTitle = null; String groups = itsLocation.getGroupPath(); if (TextUtils.isEmpty(groups)) { final ObjectHolder<String> fileNameVal = new ObjectHolder<>(); itsFileDataFrag.useFileData(new PasswdFileDataUser() { @Override public void useFileData(@NonNull PasswdFileData fileData) { PasswdFileUri uri = fileData.getUri(); itsTitle = PasswdSafeApp.getAppFileTitle(uri, PasswdSafe.this); fileNameVal.set(uri.getIdentifier(PasswdSafe.this, true)); } }); fileNameUpdate = fileNameVal.get(); } if (itsTitle == null) { itsTitle = PasswdSafeApp.getAppTitle(groups, this); } Fragment contentsFrag = fragMgr.findFragmentById(R.id.content); if (itsIsDisplayListTreeView) { if (contentsFrag instanceof PasswdSafeListFragmentTree) { PasswdSafeListFragmentTree.Mode contentsMode = itsIsTwoPane ? PasswdSafeListFragmentTree.Mode.RECORDS : PasswdSafeListFragmentTree.Mode.ALL; } } else { if (contentsFrag instanceof PasswdSafeListFragment) { PasswdSafeListFragment.Mode contentsMode = itsIsTwoPane ? PasswdSafeListFragment.Mode.RECORDS : PasswdSafeListFragment.Mode.ALL; ((PasswdSafeListFragment) contentsFrag).updateLocationView(itsLocation, contentsMode); } } break; } case VIEW_RECORD: { showLeftList = true; drawerMode = itsIsTwoPane ? PasswdSafeNavDrawerFragment.Mode.RECORDS_LIST : PasswdSafeNavDrawerFragment.Mode.RECORDS_SINGLE; fileTimeoutPaused = false; itsTitle = null; itsFileDataFrag.useFileData(new PasswdFileDataUser() { @Override public void useFileData(@NonNull PasswdFileData fileData) { if (itsLocation.isRecord()) { PwsRecord rec = fileData.getRecord(itsLocation.getRecord()); itsTitle = fileData.getTitle(rec); } } }); if (itsTitle == null) { itsTitle = getString(R.string.new_entry); } break; } case EDIT_RECORD: { drawerMode = PasswdSafeNavDrawerFragment.Mode.RECORDS_ACTION; itsTitle = null; itsFileDataFrag.useFileData(new PasswdFileDataUser() { @Override public void useFileData(@NonNull PasswdFileData fileData) { if (itsLocation.isRecord()) { PwsRecord rec = fileData.getRecord(itsLocation.getRecord()); itsTitle = getString(R.string.edit_item, fileData.getTitle(rec)); } } }); if (itsTitle == null) { itsTitle = getString(R.string.new_entry); } break; } case CHANGING_PASSWORD: { itsTitle = getString(R.string.change_password); drawerMode = PasswdSafeNavDrawerFragment.Mode.RECORDS_ACTION; break; } case VIEW_ABOUT: { drawerMode = PasswdSafeNavDrawerFragment.Mode.ABOUT; fileTimeoutPaused = false; itsTitle = PasswdSafeApp.getAppTitle(getString(R.string.about), this); break; } case VIEW_EXPIRATION: { drawerMode = PasswdSafeNavDrawerFragment.Mode.EXPIRATIONS; fileTimeoutPaused = false; itsTitle = PasswdSafeApp.getAppTitle(getString(R.string.password_expiration), this); break; } case VIEW_POLICY_LIST: { drawerMode = PasswdSafeNavDrawerFragment.Mode.POLICIES; fileTimeoutPaused = false; itsTitle = PasswdSafeApp.getAppTitle(getString(R.string.password_policies), this); break; } case VIEW_PREFERENCES: { drawerMode = PasswdSafeNavDrawerFragment.Mode.PREFERENCES; fileTimeoutPaused = false; itsTitle = PasswdSafeApp.getAppTitle(getString(R.string.preferences), this); break; } } GuiUtils.invalidateOptionsMenu(this); boolean fileOpen = isFileOpen(); itsNavDrawerFrag.updateView(drawerMode, fileNameUpdate, fileOpen); restoreActionBar(); itsTimeoutReceiver.updateTimeout(fileTimeoutPaused); PasswdFileDataView fileDataView = itsFileDataFrag.getFileDataView(); GuiUtils.setVisible(itsQueryPanel, queryVisibleForMode && (fileDataView.getRecordFilter() != null)); if (fileOpen) { if (fileDataView.checkExpiryChanged()) { GuiUtils.setVisible(itsExpiryPanel, fileDataView.hasExpiredRecords()); itsExpiry.setText(fileDataView.getExpiredRecordsStr(this)); } } else { GuiUtils.setVisible(itsExpiryPanel, false); } if (itsIsTwoPane) { PasswdSafeListFragment.Mode listMode = itsLocation.isRecord() ? PasswdSafeListFragment.Mode.ALL : PasswdSafeListFragment.Mode.GROUPS; Fragment listFrag = fragMgr.findFragmentById(R.id.content_list); if (listFrag instanceof PasswdSafeListFragment) { ((PasswdSafeListFragment) listFrag).updateLocationView(itsLocation, listMode); } if (listFrag != null) { FragmentTransaction txn = fragMgr.beginTransaction(); if (showLeftList) { txn.setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); txn.show(listFrag); } else { txn.setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE); txn.hide(listFrag); } txn.commit(); } } }
From source file:com.ichi2.anki2.DeckPicker.java
public void setStudyContentView(long deckId, Bundle cramConfig) { Fragment frag = (Fragment) getSupportFragmentManager().findFragmentById(R.id.studyoptions_fragment); if (frag == null || !(frag instanceof StudyOptionsFragment) || ((StudyOptionsFragment) frag).getShownIndex() != deckId) { StudyOptionsFragment details = StudyOptionsFragment.newInstance(deckId, false, cramConfig); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); // ft.setCustomAnimations(R.anim.fade_in, R.anim.fade_out); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE); ft.replace(R.id.studyoptions_fragment, details); ft.commit();/* w w w . ja v a 2s. c o m*/ } }
From source file:com.hichinaschool.flashcards.anki.DeckPicker.java
public void setStudyContentView(long deckId, Bundle cramConfig) { StudyOptionsFragment details = StudyOptionsFragment.newInstance(deckId, false, cramConfig); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); // ft.setCustomAnimations(R.anim.fade_in, R.anim.fade_out); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE); ft.replace(R.id.studyoptions_fragment, details); ft.commit();//from w w w . jav a 2s. c o m }