Fix shortcuts behavior when FileManager is already open.
Repro:
1) Open FileManager
2) Create shortcut for folder
3) Navigate to another folder (not including new folder)
4) Switch to homescreen (launcher)
5) Select the shortcut created in step 2
Expected behavior:
Navigate to shortcut folder
Observed behavior:
FileManager shows last navigated directory (before going to launcher)
Change-Id: I1db814a8990073f8d2de88f90b23b51a1e77cf8e
Ticket: QRDL-1034
*/
@Override
protected void onNewIntent(Intent intent) {
+ // If no directory specified, restore current directory
+ final String navigateTo = intent.getStringExtra(EXTRA_NAVIGATE_TO);
+ final boolean restore = TextUtils.isEmpty(navigateTo);
+
//Initialize navigation
- initNavigation(this.mCurrentNavigationView, true, intent);
+ initNavigation(this.mCurrentNavigationView, restore, intent);
//Check the intent action
checkIntent(intent);
import android.os.Parcel;
import android.os.Parcelable;
+import android.text.TextUtils;
import com.cyanogenmod.filemanager.FileManagerApplication;
import com.cyanogenmod.filemanager.R;
*/
@Override
public String getTitle() {
- if (this.mCurrentDir.compareTo(FileHelper.ROOT_DIRECTORY) == 0) {
- FileManagerApplication.getInstance().getResources().getString(
- R.string.root_directory_name);
+ if (!TextUtils.isEmpty(mCurrentDir)) {
+ return new File(this.mCurrentDir).getName();
}
- return new File(this.mCurrentDir).getName();
+ return null;
}
/**
final String newDir, final boolean addToHistory,
final boolean reload, final boolean useCurrent,
final SearchInfoParcelable searchInfo, final FileSystemObject scrollTo) {
+ if (mNavigationTask != null) {
+ this.mCurrentDir = this.mPreviousDir;
+ this.mPreviousDir = null;
+ mNavigationTask.cancel(true);
+ mNavigationTask = null;
+ }
+
this.mPreviousDir = this.mCurrentDir;
this.mCurrentDir = newDir;
mNavigationTask = new NavigationTask(useCurrent, addToHistory, reload,