From: jabarros Date: Mon, 28 Jul 2014 11:06:29 +0000 (+0200) Subject: Save message in onSaveInstanceState when folder is empty for allowing that it disappe... X-Git-Tag: oc-android-1.7.0_signed~238^2~2 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/154a3949f21b1f9c96f23a08b6f48cfbcab7e770 Save message in onSaveInstanceState when folder is empty for allowing that it disappears if device orientation is changed --- diff --git a/AndroidManifest.xml b/AndroidManifest.xml index b14ea56b..5a86dcf5 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -51,7 +51,6 @@ diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 03aca99b..991ea306 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -38,7 +38,6 @@ import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.SharedPreferences; import android.content.SyncRequest; -import android.content.res.Configuration; import android.content.res.Resources.NotFoundException; import android.database.Cursor; import android.net.Uri; @@ -993,7 +992,7 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener // In case file list is empty message = R.string.file_list_empty; } - ocFileListFragment.setMessageforEmptyView(message); + ocFileListFragment.setMessageforEmptyView(getString(message)); } else { Log.e(TAG, "OCFileListFragment is null"); } @@ -1654,10 +1653,5 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener } onTransferStateChanged(file, false, false); } - - @Override - public void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); - } } diff --git a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java index 5cb737b5..917f7a55 100644 --- a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java +++ b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java @@ -167,11 +167,19 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic /** * Set message for empty list view */ - public void setMessageforEmptyView(int message) { + public void setMessageforEmptyView(String message) { if (mEmptyListMessage != null) { mEmptyListMessage.setText(message); } } - + + /** + * Get the text of EmptyListMessage TextView + * + * @return String + */ + public String getEmptyViewText() { + return (mEmptyListMessage != null) ? mEmptyListMessage.getText().toString() : ""; + } } diff --git a/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java b/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java index 9e212723..00aac244 100644 --- a/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java @@ -77,7 +77,7 @@ public class LocalFileListFragment extends ExtendedListFragment { View v = super.onCreateView(inflater, container, savedInstanceState); getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); disableSwipe(); // Disable pull refresh - setMessageforEmptyView(R.string.local_file_list_empty); + setMessageforEmptyView(getString(R.string.local_file_list_empty)); Log_OC.i(TAG, "onCreateView() end"); return v; } diff --git a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java index ebe9a913..77f50cd4 100644 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -62,6 +62,7 @@ public class OCFileListFragment extends ExtendedListFragment { private static final String KEY_FIRST_POSITIONS= "FIRST_POSITIONS"; private static final String KEY_TOPS = "TOPS"; private static final String KEY_HEIGHT_CELL = "HEIGHT_CELL"; + private static final String KEY_EMPTY_LIST_MESSAGE = "EMPTY_LIST_MESSAGE"; private FileFragment.ContainerActivity mContainerActivity; @@ -115,6 +116,7 @@ public class OCFileListFragment extends ExtendedListFragment { mFirstPositions = savedInstanceState.getIntegerArrayList(KEY_FIRST_POSITIONS); mTops = savedInstanceState.getIntegerArrayList(KEY_TOPS); mHeightCell = savedInstanceState.getInt(KEY_HEIGHT_CELL); + setMessageforEmptyView(savedInstanceState.getString(KEY_EMPTY_LIST_MESSAGE)); } else { mIndexes = new ArrayList(); @@ -143,6 +145,7 @@ public class OCFileListFragment extends ExtendedListFragment { outState.putIntegerArrayList(KEY_FIRST_POSITIONS, mFirstPositions); outState.putIntegerArrayList(KEY_TOPS, mTops); outState.putInt(KEY_HEIGHT_CELL, mHeightCell); + outState.putString(KEY_EMPTY_LIST_MESSAGE, getEmptyViewText()); } /**