標籤:android io ar java 檔案 sp on 代碼 ad
當檔案夾路徑從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;
android 當檔案夾路徑從n層按back鍵退回到n-19層的時候,file manager自動結束