首页 > 代码库 > android 当文件夹路径从n层按back键退回到n-19层的时候,file manager自动退出
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;
android 当文件夹路径从n层按back键退回到n-19层的时候,file manager自动退出
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。