Move sort headers out of directory layout.
This allowed some simplification of the sort component lifecycle.
Also move progress bar.
Also, don't reset model when we get a loader-reset when last results
reported "loading". Fixes a bug where progress bar was being hidden too early.
Finally do a little pixel tweaking on sort headers and breadcrumb.
Change-Id: I49a2c70443edacfe911f692054e289bf1d5f6ecb
diff --git a/src/com/android/documentsui/dirlist/Model.java b/src/com/android/documentsui/dirlist/Model.java
index 1a171bd..5ddad31 100644
--- a/src/com/android/documentsui/dirlist/Model.java
+++ b/src/com/android/documentsui/dirlist/Model.java
@@ -79,21 +79,28 @@
}
}
- void update(DirectoryResult result) {
- if (DEBUG) Log.i(TAG, "Updating model with new result set.");
-
- if (result == null) {
- mCursor = null;
- mCursorCount = 0;
- mIds = new String[0];
- mPositions.clear();
- info = null;
- error = null;
- doc = null;
- mIsLoading = false;
- notifyUpdateListeners();
- return;
+ void onLoaderReset() {
+ if (mIsLoading) {
+ if (DEBUG) Log.w(TAG, "Received unexpected loader reset while in loading state.");
}
+ }
+
+ private void reset() {
+ mCursor = null;
+ mCursorCount = 0;
+ mIds = new String[0];
+ mPositions.clear();
+ info = null;
+ error = null;
+ doc = null;
+ mIsLoading = false;
+ notifyUpdateListeners();
+ }
+
+ void update(DirectoryResult result) {
+ assert(result != null);
+
+ if (DEBUG) Log.i(TAG, "Updating model with new result set.");
if (result.exception != null) {
Log.e(TAG, "Error while loading directory contents", result.exception);