Save message in onSaveInstanceState when folder is empty for allowing that it disappe...
authorjabarros <jabarros@solidgear.es>
Mon, 28 Jul 2014 11:06:29 +0000 (13:06 +0200)
committerjabarros <jabarros@solidgear.es>
Mon, 28 Jul 2014 11:06:29 +0000 (13:06 +0200)
AndroidManifest.xml
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
src/com/owncloud/android/ui/fragment/ExtendedListFragment.java
src/com/owncloud/android/ui/fragment/LocalFileListFragment.java
src/com/owncloud/android/ui/fragment/OCFileListFragment.java

index b14ea56..5a86dcf 100644 (file)
@@ -51,7 +51,6 @@
         <activity
             android:name=".ui.activity.FileDisplayActivity"
             android:label="@string/app_name"
         <activity
             android:name=".ui.activity.FileDisplayActivity"
             android:label="@string/app_name"
-            android:configChanges="orientation|screenSize"
             >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
             >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
index 03aca99..991ea30 100644 (file)
@@ -38,7 +38,6 @@ import android.content.IntentFilter;
 import android.content.ServiceConnection;
 import android.content.SharedPreferences;
 import android.content.SyncRequest;
 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;
 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;
             }
                 // 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");
         }
         } else {
             Log.e(TAG, "OCFileListFragment is null");
         }
@@ -1654,10 +1653,5 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener
         }
         onTransferStateChanged(file, false, false);
     }
         }
         onTransferStateChanged(file, false, false);
     }
-    
-    @Override
-    public void onConfigurationChanged(Configuration newConfig) {
-        super.onConfigurationChanged(newConfig);
-    }
 
 }
 
 }
index 5cb737b..917f7a5 100644 (file)
@@ -167,11 +167,19 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic
     /**
      * Set message for empty list view
      */
     /**
      * Set message for empty list view
      */
-    public void setMessageforEmptyView(int message) {
+    public void setMessageforEmptyView(String message) {
         if (mEmptyListMessage != null) {
             mEmptyListMessage.setText(message);
         }
     }
         if (mEmptyListMessage != null) {
             mEmptyListMessage.setText(message);
         }
     }
+
+    /**
+     * Get the text of EmptyListMessage TextView
+     * 
+     * @return String
+     */
+    public String getEmptyViewText() {
+        return (mEmptyListMessage != null) ? mEmptyListMessage.getText().toString() : "";
+    }
     
 }
     
 }
index 9e21272..00aac24 100644 (file)
@@ -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
         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;
     }    
         Log_OC.i(TAG, "onCreateView() end");
         return v;
     }    
index ebe9a91..77f50cd 100644 (file)
@@ -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_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;
    
     
     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);
             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<Integer>();
             
         } else {
             mIndexes = new ArrayList<Integer>();
@@ -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.putIntegerArrayList(KEY_FIRST_POSITIONS, mFirstPositions);
         outState.putIntegerArrayList(KEY_TOPS, mTops);
         outState.putInt(KEY_HEIGHT_CELL, mHeightCell);
+        outState.putString(KEY_EMPTY_LIST_MESSAGE, getEmptyViewText());
     }
     
     /**
     }
     
     /**