From: jabarros Date: Fri, 25 Jul 2014 11:13:58 +0000 (+0200) Subject: Show message when the file list is being loading and when it is empty X-Git-Tag: oc-android-1.7.0_signed~238^2~4 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/89e7ad9e670c3534788f44fe593bd476458e16f7 Show message when the file list is being loading and when it is empty --- diff --git a/res/layout/list_fragment.xml b/res/layout/list_fragment.xml index d03aa322..95673e12 100644 --- a/res/layout/list_fragment.xml +++ b/res/layout/list_fragment.xml @@ -39,7 +39,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_vertical|center_horizontal" - android:text="@string/file_list_empty" + android:text="@string/empty" android:visibility="gone" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index c76ef4fa..9895b472 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -54,6 +54,7 @@ %1$s is not allowed to access the shared content Uploading Nothing in here. Upload something! + Loading... There are no files in this folder. Tap on a file to display additional information. Size: @@ -270,5 +271,6 @@ An error occurred while waiting for the server, the operation couldn\'t have been done An error occurred while waiting for the server, the operation couldn\'t have been done The operation couldn\'t be completed, server is unavailable + diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index e263b953..53fa1f18 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -196,6 +196,8 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/); // always AFTER setContentView(...) ; to work around bug in its implementation + showMessageView(); + Log_OC.d(TAG, "onCreate() end"); } @@ -960,6 +962,8 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener removeStickyBroadcast(intent); Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress); setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/); + + showMessageView(); } @@ -976,6 +980,23 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener } } + /** + * Show a text message on screen view for notifying user if content is + * loading or folder is empty + */ + private void showMessageView() { + OCFileListFragment ocFileListFragment = getListOfFilesFragment(); + if (ocFileListFragment != null) { + int message = R.string.file_list_loading; + if (!mSyncInProgress) { + // In case file list is empty + message = R.string.file_list_empty; + } + ocFileListFragment.setMessageforEmptyView(message); + } else { + Log.e(TAG, "OCFileListFragment is null"); + } + } /** * Once the file upload has finished -> update view @@ -1529,6 +1550,8 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener synchFolderOp.execute(getAccount(), this, null, null); setSupportProgressBarIndeterminateVisibility(true); + + showMessageView(); } /** diff --git a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java index 69704c9f..5cb737b5 100644 --- a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java +++ b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java @@ -168,7 +168,9 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic * Set message for empty list view */ public void setMessageforEmptyView(int message) { - mEmptyListMessage.setText(message); + if (mEmptyListMessage != null) { + mEmptyListMessage.setText(message); + } } diff --git a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java index 0c8ffcae..ebe9a913 100644 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -107,8 +107,6 @@ public class OCFileListFragment extends ExtendedListFragment { super.onActivityCreated(savedInstanceState); Log_OC.e(TAG, "onActivityCreated() start"); - setMessageforEmptyView(R.string.file_list_empty); - mAdapter = new FileListListAdapter(getSherlockActivity(), mContainerActivity); if (savedInstanceState != null) {