Loading packages/DocumentsUI/res/layout/fragment_directory.xml +52 −43 Original line number Diff line number Diff line Loading @@ -17,21 +17,7 @@ <com.android.documentsui.DirectoryView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/material_grey_50"> <TextView android:id="@android:id/empty" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="@string/empty" android:visibility="gone" style="@android:style/TextAppearance.Material.Subhead" /> <LinearLayout android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/material_grey_50" android:orientation="vertical" android:animateLayoutChanges="true"> Loading @@ -51,6 +37,31 @@ android:background="@color/material_grey_50" android:visibility="gone"/> <!-- The empty directory view --> <LinearLayout android:id="@android:id/empty" android:gravity="center" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:visibility="gone"> <TextView android:id="@+id/message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/empty" style="@android:style/TextAppearance.Material.Subhead" /> <Button android:id="@+id/button_retry" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_retry" style="?android:attr/buttonBarPositiveButtonStyle" /> </LinearLayout> <!-- This FrameLayout works around b/24189541 --> <FrameLayout android:layout_width="match_parent" Loading @@ -72,6 +83,4 @@ </FrameLayout> </LinearLayout> </com.android.documentsui.DirectoryView> packages/DocumentsUI/res/values/strings.xml +2 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ <string name="button_move">Move</string> <!-- Button label that hides the error bar [CHAR LIMIT=24] --> <string name="button_dismiss">Dismiss</string> <string name="button_retry">Try Again</string> <!-- Mode that sorts documents by their display name alphabetically [CHAR LIMIT=24] --> <string name="sort_name">By name</string> Loading packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java +27 −24 Original line number Diff line number Diff line Loading @@ -367,21 +367,6 @@ public class DirectoryFragment extends Fragment { @Override public void onLoadFinished(Loader<DirectoryResult> loader, DirectoryResult result) { if (result == null || result.exception != null) { // onBackPressed does a fragment transaction, which can't be done inside // onLoadFinished mHandler.post(new Runnable() { @Override public void run() { final Activity activity = getActivity(); if (activity != null) { activity.onBackPressed(); } } }); return; } if (!isAdded()) return; mModel.update(result); Loading Loading @@ -898,6 +883,29 @@ public class DirectoryFragment extends Fragment { } } void showEmptyView() { mEmptyView.setVisibility(View.VISIBLE); mRecView.setVisibility(View.GONE); TextView msg = (TextView) mEmptyView.findViewById(R.id.message); msg.setText(R.string.empty); // No retry button for the empty view. mEmptyView.findViewById(R.id.button_retry).setVisibility(View.GONE); } void showErrorView() { mEmptyView.setVisibility(View.VISIBLE); mRecView.setVisibility(View.GONE); TextView msg = (TextView) mEmptyView.findViewById(R.id.message); msg.setText(R.string.query_error); // TODO: Enable this once the retry button does something. mEmptyView.findViewById(R.id.button_retry).setVisibility(View.GONE); } void showRecyclerView() { mEmptyView.setVisibility(View.GONE); mRecView.setVisibility(View.VISIBLE); } private final class DocumentsAdapter extends RecyclerView.Adapter<DocumentHolder> { private final Context mContext; Loading Loading @@ -1950,21 +1958,16 @@ public class DirectoryFragment extends Fragment { mProgressBar.setVisibility(model.isLoading() ? View.VISIBLE : View.GONE); if (model.isEmpty()) { mEmptyView.setVisibility(View.VISIBLE); mRecView.setVisibility(View.GONE); showEmptyView(); } else { mEmptyView.setVisibility(View.GONE); mRecView.setVisibility(View.VISIBLE); } showRecyclerView(); mAdapter.notifyDataSetChanged(); } } @Override public void onModelUpdateFailed(Exception e) { // TODO: deal with catastrophic update failures String error = getString(R.string.query_error); mAdapter.notifyDataSetChanged(); showErrorView(); } } } packages/DocumentsUI/src/com/android/documentsui/DirectoryView.java +2 −2 Original line number Diff line number Diff line Loading @@ -18,9 +18,9 @@ package com.android.documentsui; import android.content.Context; import android.util.AttributeSet; import android.widget.FrameLayout; import android.widget.LinearLayout; public class DirectoryView extends FrameLayout { public class DirectoryView extends LinearLayout { private float mPosition = 0f; private int mWidth; Loading Loading
packages/DocumentsUI/res/layout/fragment_directory.xml +52 −43 Original line number Diff line number Diff line Loading @@ -17,21 +17,7 @@ <com.android.documentsui.DirectoryView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/material_grey_50"> <TextView android:id="@android:id/empty" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="@string/empty" android:visibility="gone" style="@android:style/TextAppearance.Material.Subhead" /> <LinearLayout android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/material_grey_50" android:orientation="vertical" android:animateLayoutChanges="true"> Loading @@ -51,6 +37,31 @@ android:background="@color/material_grey_50" android:visibility="gone"/> <!-- The empty directory view --> <LinearLayout android:id="@android:id/empty" android:gravity="center" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:visibility="gone"> <TextView android:id="@+id/message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/empty" style="@android:style/TextAppearance.Material.Subhead" /> <Button android:id="@+id/button_retry" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_retry" style="?android:attr/buttonBarPositiveButtonStyle" /> </LinearLayout> <!-- This FrameLayout works around b/24189541 --> <FrameLayout android:layout_width="match_parent" Loading @@ -72,6 +83,4 @@ </FrameLayout> </LinearLayout> </com.android.documentsui.DirectoryView>
packages/DocumentsUI/res/values/strings.xml +2 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ <string name="button_move">Move</string> <!-- Button label that hides the error bar [CHAR LIMIT=24] --> <string name="button_dismiss">Dismiss</string> <string name="button_retry">Try Again</string> <!-- Mode that sorts documents by their display name alphabetically [CHAR LIMIT=24] --> <string name="sort_name">By name</string> Loading
packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java +27 −24 Original line number Diff line number Diff line Loading @@ -367,21 +367,6 @@ public class DirectoryFragment extends Fragment { @Override public void onLoadFinished(Loader<DirectoryResult> loader, DirectoryResult result) { if (result == null || result.exception != null) { // onBackPressed does a fragment transaction, which can't be done inside // onLoadFinished mHandler.post(new Runnable() { @Override public void run() { final Activity activity = getActivity(); if (activity != null) { activity.onBackPressed(); } } }); return; } if (!isAdded()) return; mModel.update(result); Loading Loading @@ -898,6 +883,29 @@ public class DirectoryFragment extends Fragment { } } void showEmptyView() { mEmptyView.setVisibility(View.VISIBLE); mRecView.setVisibility(View.GONE); TextView msg = (TextView) mEmptyView.findViewById(R.id.message); msg.setText(R.string.empty); // No retry button for the empty view. mEmptyView.findViewById(R.id.button_retry).setVisibility(View.GONE); } void showErrorView() { mEmptyView.setVisibility(View.VISIBLE); mRecView.setVisibility(View.GONE); TextView msg = (TextView) mEmptyView.findViewById(R.id.message); msg.setText(R.string.query_error); // TODO: Enable this once the retry button does something. mEmptyView.findViewById(R.id.button_retry).setVisibility(View.GONE); } void showRecyclerView() { mEmptyView.setVisibility(View.GONE); mRecView.setVisibility(View.VISIBLE); } private final class DocumentsAdapter extends RecyclerView.Adapter<DocumentHolder> { private final Context mContext; Loading Loading @@ -1950,21 +1958,16 @@ public class DirectoryFragment extends Fragment { mProgressBar.setVisibility(model.isLoading() ? View.VISIBLE : View.GONE); if (model.isEmpty()) { mEmptyView.setVisibility(View.VISIBLE); mRecView.setVisibility(View.GONE); showEmptyView(); } else { mEmptyView.setVisibility(View.GONE); mRecView.setVisibility(View.VISIBLE); } showRecyclerView(); mAdapter.notifyDataSetChanged(); } } @Override public void onModelUpdateFailed(Exception e) { // TODO: deal with catastrophic update failures String error = getString(R.string.query_error); mAdapter.notifyDataSetChanged(); showErrorView(); } } }
packages/DocumentsUI/src/com/android/documentsui/DirectoryView.java +2 −2 Original line number Diff line number Diff line Loading @@ -18,9 +18,9 @@ package com.android.documentsui; import android.content.Context; import android.util.AttributeSet; import android.widget.FrameLayout; import android.widget.LinearLayout; public class DirectoryView extends FrameLayout { public class DirectoryView extends LinearLayout { private float mPosition = 0f; private int mWidth; Loading