1
0
mirror of https://github.com/nerzhul/ownCloud-SMS-App.git synced 2025-06-13 02:46:41 +00:00

Add basic refresh layout to phone list, need handling

This commit is contained in:
Loic Blot 2015-08-09 23:34:10 +02:00
parent fd7abccb42
commit d0bd844c48
2 changed files with 36 additions and 14 deletions

View File

@ -6,6 +6,9 @@ import android.accounts.Account;
import android.accounts.AccountManager; import android.accounts.AccountManager;
import android.app.ListActivity; import android.app.ListActivity;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout;
import fr.nrz.androidlib.adapters.AndroidAccountAdapter; import fr.nrz.androidlib.adapters.AndroidAccountAdapter;
import fr.unix_experience.owncloud_sms.R; import fr.unix_experience.owncloud_sms.R;
import fr.unix_experience.owncloud_sms.adapters.ContactListAdapter; import fr.unix_experience.owncloud_sms.adapters.ContactListAdapter;
@ -15,6 +18,7 @@ public class ContactListActivity extends ListActivity implements ASyncContactLoa
static AccountManager _accountMgr; static AccountManager _accountMgr;
ContactListAdapter adapter; ContactListAdapter adapter;
SwipeRefreshLayout _layout;
@Override @Override
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {
@ -34,6 +38,14 @@ public class ContactListActivity extends ListActivity implements ASyncContactLoa
// Init view // Init view
ArrayList<String> objects = new ArrayList<String>(); ArrayList<String> objects = new ArrayList<String>();
setContentView(R.layout.restore_activity_contactlist); setContentView(R.layout.restore_activity_contactlist);
_layout = (SwipeRefreshLayout) findViewById(R.id.contactlist_swipe_container);
//_layout.setOnRefreshListener(this);
_layout.setColorScheme(android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
adapter = new ContactListAdapter(getBaseContext(), adapter = new ContactListAdapter(getBaseContext(),
android.R.layout.simple_list_item_1, android.R.layout.simple_list_item_1,
objects, objects,
@ -50,8 +62,11 @@ public class ContactListActivity extends ListActivity implements ASyncContactLoa
} }
} }
// This function fetch contacts from the ownCloud instance and generate the list activity /*@Override public void onRefresh() {
private void loadContacts(final Account account) { new Handler().postDelayed(new Runnable() {
@Override public void run() {
} _layout.setRefreshing(false);
}
}, 5000);
}*/
} }

View File

@ -24,16 +24,23 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
--> -->
<LinearLayout
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:id="@+id/contactlist_swipe_container"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" > android:layout_height="match_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView <ListView
android:id="@android:id/list" android:id="@android:id/list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:drawSelectorOnTop="false" /> android:drawSelectorOnTop="false" />
</LinearLayout> </LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>