Commit 708f2871 authored by Alexander Ivanov's avatar Alexander Ivanov

Replace base list activity with fragment activity.

parent 7c187aba
......@@ -28,7 +28,6 @@ import com.xabber.android.data.account.AccountManager;
import com.xabber.android.data.account.OnAccountChangedListener;
import com.xabber.android.ui.adapter.AccountListAdapter;
import com.xabber.android.ui.adapter.BaseListEditorAdapter;
import com.xabber.android.ui.adapter.UpdatableAdapter;
import com.xabber.android.ui.helper.BaseListEditor;
import com.xabber.androiddev.R;
......@@ -119,7 +118,7 @@ public class AccountList extends BaseListEditor<String> implements
@Override
public void onAccountsChanged(Collection<String> accounts) {
((UpdatableAdapter) getListAdapter()).onChange();
adapter.onChange();
}
@Override
......
......@@ -40,7 +40,6 @@ import com.xabber.android.data.account.StatusMode;
import com.xabber.android.data.intent.AccountIntentBuilder;
import com.xabber.android.ui.adapter.StatusEditorAdapter;
import com.xabber.android.ui.adapter.StatusModeAdapter;
import com.xabber.android.ui.adapter.UpdatableAdapter;
import com.xabber.android.ui.helper.ManagedListActivity;
import com.xabber.androiddev.R;
......@@ -61,6 +60,7 @@ public class StatusEditor extends ManagedListActivity implements
private EditText statusTextView;
private SavedStatus actionWithItem;
private StatusEditorAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -87,7 +87,8 @@ public class StatusEditor extends ManagedListActivity implements
listView.addHeaderView(header, null, false);
listView.setOnItemClickListener(this);
registerForContextMenu(listView);
setListAdapter(new StatusEditorAdapter(this));
adapter = new StatusEditorAdapter(this);
setListAdapter(adapter);
statusTextView = (EditText) header.findViewById(R.id.status_text);
statusModeView = (Spinner) header.findViewById(R.id.status_mode);
......@@ -146,7 +147,7 @@ public class StatusEditor extends ManagedListActivity implements
@Override
protected void onResume() {
super.onResume();
((UpdatableAdapter) getListAdapter()).onChange();
adapter.onChange();
}
@Override
......@@ -164,7 +165,7 @@ public class StatusEditor extends ManagedListActivity implements
switch (item.getItemId()) {
case OPTION_MENU_CLEAR_STATUSES_ID:
AccountManager.getInstance().clearSavedStatuses();
((UpdatableAdapter) getListAdapter()).onChange();
adapter.onChange();
return true;
}
return false;
......@@ -202,7 +203,7 @@ public class StatusEditor extends ManagedListActivity implements
return true;
case CONTEXT_MENU_REMOVE_STATUS_ID:
AccountManager.getInstance().removeSavedStatus(actionWithItem);
((UpdatableAdapter) getListAdapter()).onChange();
adapter.onChange();
return true;
}
return false;
......
......@@ -22,7 +22,6 @@ import java.util.Date;
import java.util.Map.Entry;
import java.util.TreeMap;
import android.app.ListActivity;
import android.os.Handler;
import android.view.View;
import android.view.animation.Animation;
......@@ -42,6 +41,7 @@ import com.xabber.android.data.roster.AbstractContact;
import com.xabber.android.data.roster.GroupManager;
import com.xabber.android.data.roster.RosterContact;
import com.xabber.android.data.roster.RosterManager;
import com.xabber.android.ui.helper.ManagedListActivity;
import com.xabber.androiddev.R;
/**
......@@ -114,7 +114,7 @@ public class ContactListAdapter extends
*/
private Date nextRefresh;
public ContactListAdapter(ListActivity activity) {
public ContactListAdapter(ManagedListActivity activity) {
super(activity, activity.getListView(), new ChatContactInflater(
activity), GroupManager.getInstance());
infoView = activity.findViewById(R.id.info);
......
......@@ -52,7 +52,7 @@ public abstract class BaseListEditor<T> extends ManagedListActivity implements
private T actionWith;
private BaseListEditorAdapter<T> adapter;
protected BaseListEditorAdapter<T> adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
......
......@@ -14,9 +14,11 @@
*/
package com.xabber.android.ui.helper;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.ListAdapter;
import android.widget.ListView;
import com.xabber.android.data.ActivityManager;
......@@ -28,7 +30,7 @@ import com.xabber.android.data.ActivityManager;
* @author alexander.ivanov
*
*/
public abstract class ManagedListActivity extends ListActivity {
public abstract class ManagedListActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -79,4 +81,12 @@ public abstract class ManagedListActivity extends ListActivity {
super.startActivityForResult(intent, requestCode);
}
public ListView getListView() {
return (ListView) findViewById(android.R.id.list);
}
public void setListAdapter(ListAdapter adapter) {
getListView().setAdapter(adapter);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment