android 當檔案夾路徑從n層按back鍵退回到n-19層的時候,file manager自動結束

來源:互聯網
上載者:User

標籤: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自動結束

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.