From: masensio Date: Fri, 30 May 2014 06:35:19 +0000 (+0200) Subject: Merge branch 'develop' into pull_down_refresh X-Git-Tag: oc-android-1.7.0_signed~292^2~6 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/aa9c09372de4a7358d14977dfb3582d2e0cea364?hp=42f4659609a91241c8a0e7cda870f1ebcbc5f0a4 Merge branch 'develop' into pull_down_refresh --- diff --git a/res/layout/list_fragment.xml b/res/layout/list_fragment.xml index 00e6b41f..c5dbef12 100644 --- a/res/layout/list_fragment.xml +++ b/res/layout/list_fragment.xml @@ -23,13 +23,19 @@ android:layout_weight="1" android:orientation="vertical" > - - + android:layout_height="match_parent" > + + + + + #1D2D44 #1D2D44 + #00ddff + #1D2D44 + #FFFFFF + #00ddff + #000000 diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 04d28134..537ed74a 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -927,6 +927,13 @@ FileFragment.ContainerActivity, OnNavigationListener, OnSslUntrustedCertListener removeStickyBroadcast(intent); Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress); setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/); + + if (mSyncInProgress) { + getListOfFilesFragment().showSwipeProgress(); + + } else { + getListOfFilesFragment().hideSwipeProgress(); + } } if (synchResult != null) { diff --git a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java index 409c5e61..8b54555c 100644 --- a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java +++ b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java @@ -25,6 +25,7 @@ import com.owncloud.android.utils.Log_OC; import android.os.Bundle; +import android.support.v4.widget.SwipeRefreshLayout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -36,7 +37,7 @@ import android.widget.ListView; /** * TODO extending SherlockListFragment instead of SherlockFragment */ -public class ExtendedListFragment extends SherlockFragment implements OnItemClickListener { +public class ExtendedListFragment extends SherlockFragment implements OnItemClickListener, SwipeRefreshLayout.OnRefreshListener{ private static final String TAG = ExtendedListFragment.class.getSimpleName(); @@ -44,6 +45,8 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic protected ExtendedListView mList; + private SwipeRefreshLayout mRefreshLayout; + public void setListAdapter(ListAdapter listAdapter) { mList.setAdapter(listAdapter); mList.invalidate(); @@ -58,6 +61,7 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log_OC.e(TAG, "onCreateView"); //mList = new ExtendedListView(getActivity()); + View v = inflater.inflate(R.layout.list_fragment, null); mList = (ExtendedListView)(v.findViewById(R.id.list_root)); mList.setOnItemClickListener(this); @@ -70,6 +74,14 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic setReferencePosition(referencePosition); } + // Pull down refresh + mRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_files); + mRefreshLayout.setColorScheme(R.color.refresh_color_start, + R.color.refresh_color_middle_1, + R.color.refresh_color_middle_2, + R.color.refresh_color_end); + mRefreshLayout.setOnRefreshListener(this); + return v; } @@ -115,5 +127,40 @@ public class ExtendedListFragment extends SherlockFragment implements OnItemClic // to be @overriden } + @Override + public void onRefresh() { + // to be @overriden + + } + + /** + * Enables swipe gesture + */ + public void enableSwipe() { + mRefreshLayout.setEnabled(true); + } + + /** + * Disables swipe gesture. It prevents manual gestures but keeps the option you show + * refreshing programmatically. + */ + public void disableSwipe() { + mRefreshLayout.setEnabled(false); + } + + /** + * It shows the SwipeRefreshLayout progress + */ + public void showSwipeProgress() { + mRefreshLayout.setRefreshing(true); + } + + /** + * It shows the SwipeRefreshLayout progress + */ + public void hideSwipeProgress() { + mRefreshLayout.setRefreshing(false); + } + } diff --git a/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java b/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java index 270a8d5c..bc466016 100644 --- a/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java @@ -77,6 +77,7 @@ public class LocalFileListFragment extends ExtendedListFragment { Log_OC.i(TAG, "onCreateView() start"); View v = super.onCreateView(inflater, container, savedInstanceState); getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); + disableSwipe(); // Disable pull refresh 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 a3bd3c2c..23bfe6e9 100644 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -106,6 +106,7 @@ public class OCFileListFragment extends ExtendedListFragment { public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Log_OC.e(TAG, "onActivityCreated() start"); + mAdapter = new FileListListAdapter(getSherlockActivity(), mContainerActivity); if (savedInstanceState != null) { @@ -432,5 +433,19 @@ public class OCFileListFragment extends ExtendedListFragment { mFile = directory; } } + + + @Override + public void onRefresh() { + super.onRefresh(); + + if (mFile != null) { + listDirectory(mFile); + + ((FileDisplayActivity)mContainerActivity).startSyncFolderOperation(mFile); + } + } + + } diff --git a/third_party/android-support-library/android-support-v4.jar b/third_party/android-support-library/android-support-v4.jar index 96644edb..187bdf48 100644 Binary files a/third_party/android-support-library/android-support-v4.jar and b/third_party/android-support-library/android-support-v4.jar differ