android 当目录路径从n层按back键退回到n-19层的时候,file manager自己主动退出
当目录路径从n层按back键退回到n-19层的时候,file manager自己主动退出,比方在63层按back 键退回到44层的时候,file manager自己主动退出。
1.FileManager默认设计, FileManager种仅仅记录最多20条操作路径的记录, 假设超出就会把最早增加的记录删除. 贵司能够參考alps/mediatek/packages/apps/FileManager/src/com/mediatek/filemanager/FileInfoManager.java中这部分的代码.
/** Max history size */
private static final int MAX_LIST_SIZE = 20;
private final List<NavigationRecord> mNavigationList = new LinkedList<NavigationRecord>();
/**
* This method gets the previous navigation directory path
*
* @return the previous navigation path
*/
protected NavigationRecord getPrevNavigation() {
while (!mNavigationList.isEmpty()) {
NavigationRecord navRecord = mNavigationList.get(mNavigationList.size() - 1);
removeFromNavigationList();
String path = navRecord.getRecordPath();
if (!TextUtils.isEmpty(path)) {
if (new File(path).exists() || MountPointManager.getInstance().isRootPath(path)) {
return navRecord;
}
}
}
return null;
}
/**
* This method adds a navigationRecord to the navigation history
*
* @param navigationRecord the Record
*/
protected void addToNavigationList(NavigationRecord navigationRecord) {
if (mNavigationList.size() <= MAX_LIST_SIZE) {
mNavigationList.add(navigationRecord);
} else {
mNavigationList.remove(0);
mNavigationList.add(navigationRecord);
}
}
/**
* This method removes a directory path from the navigation history
*/
protected void removeFromNavigationList() {
if (!mNavigationList.isEmpty()) {
mNavigationList.remove(mNavigationList.size() - 1);
}
}
2.对于20条操作路径的history record, 贵司能够改动,仅仅须要把FileInfo.Manager.java中的MAX_LIST_SIZE设为须要的最大路径记录数。这样改动带来的影响是,file manager APK可能会用到很多其它的内存,由于List<NavigationRecord> mNavigationList须要记录很多其它的路径数。
alps/mediatek/packages/apps/FileManager/src/com/mediatek/filemanager/FileInfoManager.java中这部分的代码.
/** Max history size */
private static final int MAX_LIST_SIZE = xxx;
1.FileManager默认设计, FileManager种仅仅记录最多20条操作路径的记录, 假设超出就会把最早增加的记录删除. 贵司能够參考alps/mediatek/packages/apps/FileManager/src/com/mediatek/filemanager/FileInfoManager.java中这部分的代码.
/** Max history size */
private static final int MAX_LIST_SIZE = 20;
private final List<NavigationRecord> mNavigationList = new LinkedList<NavigationRecord>();
/**
* This method gets the previous navigation directory path
*
* @return the previous navigation path
*/
protected NavigationRecord getPrevNavigation() {
while (!mNavigationList.isEmpty()) {
NavigationRecord navRecord = mNavigationList.get(mNavigationList.size() - 1);
removeFromNavigationList();
String path = navRecord.getRecordPath();
if (!TextUtils.isEmpty(path)) {
if (new File(path).exists() || MountPointManager.getInstance().isRootPath(path)) {
return navRecord;
}
}
}
return null;
}
/**
* This method adds a navigationRecord to the navigation history
*
* @param navigationRecord the Record
*/
protected void addToNavigationList(NavigationRecord navigationRecord) {
if (mNavigationList.size() <= MAX_LIST_SIZE) {
mNavigationList.add(navigationRecord);
} else {
mNavigationList.remove(0);
mNavigationList.add(navigationRecord);
}
}
/**
* This method removes a directory path from the navigation history
*/
protected void removeFromNavigationList() {
if (!mNavigationList.isEmpty()) {
mNavigationList.remove(mNavigationList.size() - 1);
}
}
2.对于20条操作路径的history record, 贵司能够改动,仅仅须要把FileInfo.Manager.java中的MAX_LIST_SIZE设为须要的最大路径记录数。这样改动带来的影响是,file manager APK可能会用到很多其它的内存,由于List<NavigationRecord> mNavigationList须要记录很多其它的路径数。
alps/mediatek/packages/apps/FileManager/src/com/mediatek/filemanager/FileInfoManager.java中这部分的代码.
/** Max history size */
private static final int MAX_LIST_SIZE = xxx;