mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 21:55:48 +03:00
Fixed bug. It is not possible to refresh folder when it is empty
This commit is contained in:
parent
154a3949f2
commit
5335975717
2 changed files with 44 additions and 13 deletions
|
@ -34,13 +34,33 @@
|
|||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh_files_emptyView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" >
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty_list_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="@string/empty"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
android:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
</FrameLayout>
|
||||
|
|
|
@ -46,6 +46,7 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic
|
|||
protected ExtendedListView mList;
|
||||
|
||||
private SwipeRefreshLayout mRefreshLayout;
|
||||
private SwipeRefreshLayout mRefreshEmptyLayout;
|
||||
private TextView mEmptyListMessage;
|
||||
|
||||
public void setListAdapter(ListAdapter listAdapter) {
|
||||
|
@ -67,7 +68,7 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic
|
|||
mEmptyListMessage = (TextView) v.findViewById(R.id.empty_list_view);
|
||||
mList = (ExtendedListView)(v.findViewById(R.id.list_root));
|
||||
mList.setOnItemClickListener(this);
|
||||
mList.setEmptyView(mEmptyListMessage); // looks like it's not a cool idea
|
||||
|
||||
mList.setDivider(getResources().getDrawable(R.drawable.uploader_list_separator));
|
||||
mList.setDividerHeight(1);
|
||||
|
||||
|
@ -78,11 +79,12 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic
|
|||
|
||||
// Pull down refresh
|
||||
mRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_files);
|
||||
// Colors in animations: background
|
||||
mRefreshLayout.setColorScheme(R.color.background_color, R.color.background_color,
|
||||
R.color.background_color, R.color.background_color);
|
||||
mRefreshEmptyLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_files_emptyView);
|
||||
|
||||
mRefreshLayout.setOnRefreshListener(this);
|
||||
onCreateSwipeToRefresh(mRefreshLayout);
|
||||
onCreateSwipeToRefresh(mRefreshEmptyLayout);
|
||||
|
||||
mList.setEmptyView(mRefreshEmptyLayout);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
@ -133,6 +135,7 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic
|
|||
public void onRefresh() {
|
||||
// to be @overriden
|
||||
mRefreshLayout.setRefreshing(false);
|
||||
mRefreshEmptyLayout.setRefreshing(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -182,4 +185,12 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic
|
|||
return (mEmptyListMessage != null) ? mEmptyListMessage.getText().toString() : "";
|
||||
}
|
||||
|
||||
private void onCreateSwipeToRefresh(SwipeRefreshLayout refreshLayout) {
|
||||
// Colors in animations: background
|
||||
refreshLayout.setColorScheme(R.color.background_color, R.color.background_color, R.color.background_color,
|
||||
R.color.background_color);
|
||||
|
||||
refreshLayout.setOnRefreshListener(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue