Merge branch 'develop2' into imageGrid2
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / fragment / ExtendedListFragment.java
index b48456f..def08c5 100644 (file)
@@ -39,14 +39,14 @@ import com.owncloud.android.ui.ExtendedListView;
 import com.owncloud.android.ui.activity.OnEnforceableRefreshListener;
 
 /**
- *  TODO extending SherlockListFragment instead of SherlockFragment 
+ * TODO extending SherlockListFragment instead of SherlockFragment
  */
 public class ExtendedListFragment extends SherlockFragment 
 implements OnItemClickListener, OnEnforceableRefreshListener {
-    
+
     private static final String TAG = ExtendedListFragment.class.getSimpleName();
 
-    private static final String KEY_SAVED_LIST_POSITION = "SAVED_LIST_POSITION"; 
+    private static final String KEY_SAVED_LIST_POSITION = "SAVED_LIST_POSITION";
     private static final String KEY_INDEXES = "INDEXES";
     private static final String KEY_FIRST_POSITIONS= "FIRST_POSITIONS";
     private static final String KEY_TOPS = "TOPS";
@@ -54,7 +54,7 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
     private static final String KEY_EMPTY_LIST_MESSAGE = "EMPTY_LIST_MESSAGE";
 
     protected ExtendedListView mList;
-    
+
     private SwipeRefreshLayout mRefreshLayout;
     private SwipeRefreshLayout mRefreshEmptyLayout;
     private TextView mEmptyListMessage;
@@ -77,6 +77,12 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
     public GridView getGridView() {
         return imageView;
     }
+    public void setFooterView(View footer) {
+        mList.addFooterView(footer, null, false);
+        mList.invalidate();
+    }
+
+
     
     protected void switchImageView(){
        imageView.setNumColumns(GridView.AUTO_FIT);
@@ -92,7 +98,7 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         Log_OC.e(TAG, "onCreateView");
-        
+
         View v = inflater.inflate(R.layout.list_fragment, null);
         
         imageView = (ExtendedListView)(v.findViewById(R.id.list_root));
@@ -102,7 +108,7 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
             int referencePosition = savedInstanceState.getInt(KEY_SAVED_LIST_POSITION);
             setReferencePosition(referencePosition);
         }
-        
+
         // Pull down refresh
         mRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_files);
         mRefreshEmptyLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_files_emptyView);
@@ -113,7 +119,6 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
         return v;
     }
 
-    
     /**
      * {@inheritDoc}
      */
@@ -149,14 +154,16 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
         savedInstanceState.putString(KEY_EMPTY_LIST_MESSAGE, getEmptyViewText());
     }
 
-    
     /**
-     * Calculates the position of the item that will be used as a reference to reposition the visible items 
-     * in the list when the device is turned to other position. 
+     * Calculates the position of the item that will be used as a reference to
+     * reposition the visible items in the list when the device is turned to
+     * other position.
      * 
-     * THe current policy is take as a reference the visible item in the center of the screen.  
+     * THe current policy is take as a reference the visible item in the center
+     * of the screen.
      * 
-     * @return      The position in the list of the visible item in the center of the screen.
+     * @return The position in the list of the visible item in the center of the
+     *         screen.
      */
     protected int getReferencePosition() {
         if (imageView != null) {
@@ -166,12 +173,11 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
         }
     }
 
-    
     /**
      * Sets the visible part of the list from the reference position.
      * 
-     * @param   position    Reference position previously 
-     * returned by {@link LocalFileListFragment#getReferencePosition()}
+     * @param position Reference position previously returned by
+     *            {@link LocalFileListFragment#getReferencePosition()}
      */
     protected void setReferencePosition(int position) {
         if (imageView != null) {
@@ -227,7 +233,7 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
     
     @Override
     public void onItemClick (AdapterView<?> parent, View view, int position, long id) {
-        // to be @overriden  
+        // to be @overriden
     }
 
     @Override
@@ -240,7 +246,6 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
             mOnRefreshListener.onRefresh();
         }
     }
-    
     public void setOnRefreshListener(OnEnforceableRefreshListener listener) {
         mOnRefreshListener = listener;
     }