Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aef98bcd authored by Tony Huang's avatar Tony Huang
Browse files

Update contents after renaming a item

In some cases, for example: rename a item after global search,
it can't update contents so file name didn't change.
Add a refresh call after renaming the item to fix it.

Fix: 137053587
Test: manual
Change-Id: Iff93e248d0af45ddf4f297089d22ac907bc00ebc
parent 31c44df8
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -646,8 +646,14 @@ public abstract class BaseActivity
        mSortController.onViewModeChanged(mode);
    }

    public void setPending(boolean pending) {
        // TODO: Isolate this behavior to PickActivity.
    /**
     * Reload documnets by current stack in certain situation.
     */
    public void reloadDocumentsIfNeeded() {
        if (isInRecents() || mSearchManager.isSearching()) {
            // Both using MultiRootDocumentsLoader which have not ContentObserver.
            mInjector.actions.loadDocumentsForCurrentStack();
        }
    }

    public void expandAppBar() {
+0 −6
Original line number Diff line number Diff line
@@ -137,11 +137,6 @@ public class CreateDirectoryFragment extends DialogFragment {
            mDisplayName = displayName;
        }

        @Override
        protected void onPreExecute() {
            mActivity.setPending(true);
        }

        @Override
        protected DocumentInfo doInBackground(Void... params) {
            final ContentResolver resolver = mActivity.getContentResolver();
@@ -172,7 +167,6 @@ public class CreateDirectoryFragment extends DialogFragment {
                        .show();
                Metrics.logCreateDirError();
            }
            mActivity.setPending(false);
        }
    }
}
+1 −6
Original line number Diff line number Diff line
@@ -212,11 +212,6 @@ public class RenameDocumentFragment extends DialogFragment {
            mNewDisplayName = newDisplayName;
        }

        @Override
        protected void onPreExecute() {
            mActivity.setPending(true);
        }

        @Override
        protected DocumentInfo doInBackground(DocumentInfo... document) {
            assert(document.length == 1);
@@ -235,7 +230,7 @@ public class RenameDocumentFragment extends DialogFragment {
            if (mDialog != null) {
                mDialog.dismiss();
            }
            mActivity.setPending(false);
            mActivity.reloadDocumentsIfNeeded();
        }
    }
}