zoukankan      html  css  js  c++  java
  • 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;
  • 相关阅读:
    phonegap开发入门
    [转] jQuery源码分析-如何做jQuery源码分析
    【转】HTML,CSS,font-family:中文字体的英文名称 (宋体 微软雅黑)
    iframe子页面与父页面通信
    5.10团队冲刺
    5.10日
    5.9日团队冲刺
    5.9日自学成果
    5.8日团队冲刺
    5.7日团队冲刺
  • 原文地址:https://www.cnblogs.com/mfrbuaa/p/4307037.html
Copyright © 2011-2022 走看看