use of dev.dworks.apps.anexplorer.fragment.SaveFragment in project AnExplorer by 1hakr.
the class DocumentsActivity method setPending.
public void setPending(boolean pending) {
final SaveFragment save = SaveFragment.get(getFragmentManager());
if (save != null) {
save.setPending(pending);
}
final RootInfo root = getCurrentRoot();
if (root != null && (root.isRootedStorage() || root.isUsbStorage())) {
refreshData();
}
}
use of dev.dworks.apps.anexplorer.fragment.SaveFragment in project AnExplorer by 1hakr.
the class DocumentsActivity method onCurrentDirectoryChanged.
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public void onCurrentDirectoryChanged(int anim) {
// FIX for java.lang.IllegalStateException ("Activity has been destroyed")
if (!Utils.isActivityAlive(DocumentsActivity.this)) {
return;
}
final FragmentManager fm = getFragmentManager();
final RootInfo root = getCurrentRoot();
DocumentInfo cwd = getCurrentDirectory();
// TODO : this has to be done nicely
if (cwd == null && (null != root && !root.isServerStorage())) {
final Uri uri = DocumentsContract.buildDocumentUri(root.authority, root.documentId);
DocumentInfo result;
try {
result = DocumentInfo.fromUri(getContentResolver(), uri);
if (result != null) {
mState.stack.push(result);
mState.stackTouched = true;
cwd = result;
}
} catch (FileNotFoundException e) {
CrashReportingManager.logException(e);
}
}
if (!SettingsActivity.getFolderAnimation(this)) {
anim = 0;
}
mDirectoryContainer.setDrawDisappearingFirst(anim == ANIM_DOWN);
if (cwd == null) {
// No directory means recents
if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
RecentsCreateFragment.show(fm);
} else {
if (root.isHome()) {
HomeFragment.show(fm);
} else if (root.isConnections()) {
ConnectionsFragment.show(fm);
} else if (root.isServerStorage()) {
ServerFragment.show(fm, root);
} else {
DirectoryFragment.showRecentsOpen(fm, anim);
// Start recents in grid when requesting visual things
// MimePredicate.mimeMatches(MimePredicate.VISUAL_MIMES, mState.acceptMimes);
final boolean visualMimes = true;
mState.userMode = visualMimes ? MODE_GRID : MODE_LIST;
mState.derivedMode = mState.userMode;
}
}
} else {
if (mState.currentSearch != null && mSearchResultShown) {
// Ongoing search
DirectoryFragment.showSearch(fm, root, cwd, mState.currentSearch, anim);
mSearchResultShown = false;
} else {
// Normal boring directory
DirectoryFragment.showNormal(fm, root, cwd, anim);
}
}
// Forget any replacement target
if (mState.action == ACTION_CREATE) {
final SaveFragment save = SaveFragment.get(fm);
if (save != null) {
save.setReplaceTarget(null);
}
}
if (mState.action == ACTION_OPEN_TREE) {
final PickFragment pick = PickFragment.get(fm);
if (pick != null) {
final CharSequence displayName = (mState.stack.size() <= 1) && null != root ? root.title : cwd.displayName;
pick.setPickTarget(cwd, displayName);
}
}
final MoveFragment move = MoveFragment.get(fm);
if (move != null) {
move.setReplaceTarget(cwd);
}
final RootsFragment roots = RootsFragment.get(fm);
if (roots != null) {
roots.onCurrentRootChanged();
}
updateActionBar();
invalidateMenu();
dumpStack();
if (!Utils.isOtherBuild() && !isTelevision()) {
AppRate.with(this, mRateContainer).listener(mOnShowListener).checkAndShow();
}
}
Aggregations