blob: 206770eff5373219a0cd177afeaaacdc4777b6a5 [file] [log] [blame]
Alexandre Savard2b370f02012-09-06 16:06:01 -04001/*
Alexandre Lisionc1024c02014-01-06 11:12:53 -05002 * Copyright (C) 2004-2014 Savoir-Faire Linux Inc.
Alexandre Savard2b370f02012-09-06 16:06:01 -04003 *
4 * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
alision5cfc35d2013-07-11 15:11:39 -04005 * Alexandre Lision <alexandre.lision@savoirfairelinux.com>
Alexandre Savard2b370f02012-09-06 16:06:01 -04006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * Additional permission under GNU GPL version 3 section 7:
22 *
23 * If you modify this program, or any covered work, by linking or
24 * combining it with the OpenSSL project's OpenSSL library (or a
25 * modified version of that library), containing parts covered by the
26 * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
27 * grants you additional permission to convey the resulting work.
28 * Corresponding Source for a non-source form of such a combination
29 * shall include the source code for the parts of OpenSSL used as well
30 * as that of the covered work.
31 */
32
Alexandre Lision064e1e02013-10-01 16:18:42 -040033package org.sflphone.fragments;
alisionf76de3b2013-04-16 15:35:22 -040034
Alexandre Lisionef2aa9e2013-10-25 16:22:52 -040035import android.animation.Animator;
36import android.animation.AnimatorListenerAdapter;
Alexandre Savard9a93f062012-09-11 10:42:43 -040037import android.app.Activity;
Alexandre Lision5f144b82014-02-11 09:59:36 -050038import android.content.Context;
39import android.content.Intent;
alisionf76de3b2013-04-16 15:35:22 -040040import android.os.Bundle;
41import android.os.RemoteException;
Alexandre Lision5f144b82014-02-11 09:59:36 -050042import android.support.v4.app.LoaderManager;
43import android.support.v4.content.AsyncTaskLoader;
44import android.support.v4.content.Loader;
Alexandre Savard2b370f02012-09-06 16:06:01 -040045import android.util.Log;
Alexandre Lision5f144b82014-02-11 09:59:36 -050046import android.view.*;
Alexandre Lision059da9d2013-10-22 11:17:25 -040047import android.view.View.OnClickListener;
Alexandre Lision5f144b82014-02-11 09:59:36 -050048import android.widget.*;
Alexandre Lision3ccccf02013-10-07 14:10:46 -040049import android.widget.AdapterView.OnItemClickListener;
Alexandre Lision5f144b82014-02-11 09:59:36 -050050import org.sflphone.R;
51import org.sflphone.client.AccountEditionActivity;
52import org.sflphone.client.AccountWizard;
53import org.sflphone.loaders.AccountsLoader;
54import org.sflphone.loaders.LoaderConstants;
55import org.sflphone.model.Account;
56import org.sflphone.service.ISipService;
57import org.sflphone.views.dragsortlv.DragSortListView;
Alexandre Savard2b370f02012-09-06 16:06:01 -040058
Alexandre Lision5f144b82014-02-11 09:59:36 -050059import java.io.File;
60import java.util.ArrayList;
61
62public class AccountsManagementFragment extends AccountWrapperFragment implements LoaderManager.LoaderCallbacks<Bundle> {
Alexandre Savard2b370f02012-09-06 16:06:01 -040063 static final String TAG = "AccountManagementFragment";
Alexandre Savarda6c0d992012-09-28 09:24:13 -040064 static final String DEFAULT_ACCOUNT_ID = "IP2IP";
Alexandre Savard53d2ddd2012-09-30 22:04:40 -040065 static final int ACCOUNT_CREATE_REQUEST = 1;
Alexandre Lision420b2572014-01-10 11:37:18 -050066 public static final int ACCOUNT_EDIT_REQUEST = 2;
Alexandre Lision230d66e2013-10-22 12:32:12 -040067 AccountsAdapter mAccountsAdapter;
68 AccountsAdapter mIP2IPAdapter;
Alexandre Lisionef2aa9e2013-10-25 16:22:52 -040069
70 DragSortListView mDnDListView;
71 private View mLoadingView;
72 private int mShortAnimationDuration;
73
Alexandre Lision4cf78702013-10-16 13:43:23 -040074 private DragSortListView.DropListener onDrop = new DragSortListView.DropListener() {
75 @Override
76 public void drop(int from, int to) {
77 if (from != to) {
Alexandre Lision230d66e2013-10-22 12:32:12 -040078 Account item = mAccountsAdapter.getItem(from);
79 mAccountsAdapter.remove(item);
80 mAccountsAdapter.insert(item, to);
Alexandre Lision4cf78702013-10-16 13:43:23 -040081 try {
Alexandre Lision230d66e2013-10-22 12:32:12 -040082 mCallbacks.getService().setAccountOrder(mAccountsAdapter.generateAccountOrder());
Alexandre Lision4cf78702013-10-16 13:43:23 -040083 } catch (RemoteException e) {
84 e.printStackTrace();
85 }
86 }
87 }
88
Alexandre Lision4cf78702013-10-16 13:43:23 -040089 };
90
Alexandre Lision3ccccf02013-10-07 14:10:46 -040091 private Callbacks mCallbacks = sDummyCallbacks;
Alexandre Lision059da9d2013-10-22 11:17:25 -040092 private Account ip2ip;
Alexandre Lision3ccccf02013-10-07 14:10:46 -040093 private static Callbacks sDummyCallbacks = new Callbacks() {
94
95 @Override
96 public ISipService getService() {
97 return null;
98 }
99 };
100
101 public interface Callbacks {
102
103 public ISipService getService();
104
105 }
Alexandre Savardae992932012-10-17 10:26:12 -0400106
Emeric Vigier1f1ced32012-11-02 16:56:32 -0400107 @Override
108 public void onAttach(Activity activity) {
109 super.onAttach(activity);
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400110 if (!(activity instanceof Callbacks)) {
111 throw new IllegalStateException("Activity must implement fragment's callbacks.");
112 }
113
114 mCallbacks = (Callbacks) activity;
Emeric Vigier1f1ced32012-11-02 16:56:32 -0400115 }
Alexandre Savard12dc3ac2012-09-27 11:17:39 -0400116
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400117 @Override
118 public void onDetach() {
119 super.onDetach();
120 mCallbacks = sDummyCallbacks;
alisiond9e29442013-04-17 16:10:18 -0400121 }
Alexandre Savard2b370f02012-09-06 16:06:01 -0400122
123 @Override
alisiond9e29442013-04-17 16:10:18 -0400124 public void onCreate(Bundle savedInstanceState) {
Alexandre Savard2b370f02012-09-06 16:06:01 -0400125 super.onCreate(savedInstanceState);
126
Alexandre Savard9a93f062012-09-11 10:42:43 -0400127 Log.i(TAG, "Create Account Management Fragment");
Alexandre Lision230d66e2013-10-22 12:32:12 -0400128 mAccountsAdapter = new AccountsAdapter(getActivity(), new ArrayList<Account>());
Alexandre Lisionef2aa9e2013-10-25 16:22:52 -0400129 mIP2IPAdapter = new AccountsAdapter(getActivity(), new ArrayList<Account>());
Alexandre Lisiona764c682013-09-09 10:02:07 -0400130 this.setHasOptionsMenu(true);
Alexandre Lisiond16bad92013-10-09 17:16:20 -0400131
Alexandre Lisionb97c9512014-01-07 17:14:03 -0500132 mShortAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);
Alexandre Lision4d20c812013-12-12 17:44:50 -0500133 Log.i(TAG, "anim time: " + mShortAnimationDuration);
Alexandre Lisionef2aa9e2013-10-25 16:22:52 -0400134
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400135 }
Alexandre Lisiona764c682013-09-09 10:02:07 -0400136
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400137 @Override
138 public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
Alexandre Lision4cf78702013-10-16 13:43:23 -0400139 View inflatedView = inflater.inflate(R.layout.frag_accounts_list, parent, false);
Alexandre Lision5f144b82014-02-11 09:59:36 -0500140 ((ListView)inflatedView.findViewById(R.id.accounts_list)).setAdapter(mAccountsAdapter);
Alexandre Lision4cf78702013-10-16 13:43:23 -0400141
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400142 return inflatedView;
143 }
144
145 @Override
146 public void onViewCreated(View view, Bundle savedInstanceState) {
147 super.onViewCreated(view, savedInstanceState);
Alexandre Lision4cf78702013-10-16 13:43:23 -0400148
Alexandre Lision5f144b82014-02-11 09:59:36 -0500149 mDnDListView = (DragSortListView) getView().findViewById(R.id.accounts_list);
Alexandre Lisionef2aa9e2013-10-25 16:22:52 -0400150
151 mDnDListView.setDropListener(onDrop);
152 mDnDListView.setOnItemClickListener(new OnItemClickListener() {
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400153
154 @Override
155 public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) {
Alexandre Lision230d66e2013-10-22 12:32:12 -0400156 launchAccountEditActivity(mAccountsAdapter.getItem(pos));
Emeric Vigier0038a612012-11-06 18:51:19 -0500157 }
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400158 });
Alexandre Lision230d66e2013-10-22 12:32:12 -0400159
160 ((ListView) getView().findViewById(R.id.ip2ip)).setAdapter(mIP2IPAdapter);
161 ((ListView) getView().findViewById(R.id.ip2ip)).setOnItemClickListener(new OnItemClickListener() {
162
Alexandre Lision059da9d2013-10-22 11:17:25 -0400163 @Override
Alexandre Lision230d66e2013-10-22 12:32:12 -0400164 public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Alexandre Lision059da9d2013-10-22 11:17:25 -0400165 launchAccountEditActivity(ip2ip);
Alexandre Lision230d66e2013-10-22 12:32:12 -0400166
Alexandre Lision059da9d2013-10-22 11:17:25 -0400167 }
168 });
Alexandre Lision40954dc2013-10-09 15:24:03 -0400169
Alexandre Lisionef2aa9e2013-10-25 16:22:52 -0400170 mLoadingView = view.findViewById(R.id.loading_spinner);
Alexandre Savard2b370f02012-09-06 16:06:01 -0400171 }
172
Alexandre Savard8b7d4332012-09-30 20:02:11 -0400173 @Override
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400174 public void onPause() {
175 super.onPause();
Alexandre Savard8b7d4332012-09-30 20:02:11 -0400176 }
177
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400178 public void onResume() {
179 super.onResume();
Alexandre Lision5f144b82014-02-11 09:59:36 -0500180
Alexandre Lisionb97c9512014-01-07 17:14:03 -0500181 getLoaderManager().restartLoader(LoaderConstants.ACCOUNTS_LOADER, null, this);
Alexandre Lision658999c2013-12-13 14:42:45 -0500182 getActivity().getActionBar().setTitle(R.string.menu_item_accounts);
alisiona4325152013-04-19 11:10:03 -0400183 }
alision73424b62013-04-26 11:49:18 -0400184
Alexandre Lisiona764c682013-09-09 10:02:07 -0400185 @Override
186 public void onCreateOptionsMenu(Menu m, MenuInflater inf) {
187 super.onCreateOptionsMenu(m, inf);
188 inf.inflate(R.menu.account_creation, m);
189 }
190
191 @Override
192 public boolean onOptionsItemSelected(MenuItem item) {
193 super.onOptionsItemSelected(item);
194 switch (item.getItemId()) {
Alexandre Lisiona815eab2014-01-31 13:01:31 -0500195 case R.id.menuitem_create:
196 Intent intent = new Intent().setClass(getActivity(), AccountWizard.class);
197 startActivityForResult(intent, ACCOUNT_CREATE_REQUEST);
198 break;
Alexandre Lisiona764c682013-09-09 10:02:07 -0400199 }
200
201 return true;
202 }
203
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400204 private void launchAccountEditActivity(Account acc) {
Alexandre Savard68838112012-10-30 11:34:43 -0400205 Log.i(TAG, "Launch account edit activity");
Alexandre Savard833616f2012-10-30 16:02:30 -0400206
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400207 Intent intent = new Intent().setClass(getActivity(), AccountEditionActivity.class);
208 Bundle bundle = new Bundle();
Alexandre Lisiond2e9e062013-10-21 16:27:33 -0400209 bundle.putParcelable("account", acc);
Alexandre Lision059da9d2013-10-22 11:17:25 -0400210
Alexandre Savard833616f2012-10-30 16:02:30 -0400211 intent.putExtras(bundle);
212
Alexandre Savard68838112012-10-30 11:34:43 -0400213 startActivityForResult(intent, ACCOUNT_EDIT_REQUEST);
214 }
215
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400216 @Override
217 public void accountsChanged() {
218 if (getActivity() != null)
Alexandre Lisionb97c9512014-01-07 17:14:03 -0500219 getLoaderManager().restartLoader(LoaderConstants.ACCOUNTS_LOADER, null, this);
Alexandre Savard52a72522012-09-27 16:40:13 -0400220 }
221
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400222 @Override
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500223 public void accountStateChanged(String accoundID, String state, int code) {
224 mAccountsAdapter.updateAccount(accoundID, state, code);
Alexandre Savard9a93f062012-09-11 10:42:43 -0400225 }
226
Alexandre Lision420b2572014-01-10 11:37:18 -0500227 @Override
228 public void onActivityResult(int requestCode, int resultCode, Intent data) {
229 super.onActivityResult(requestCode, resultCode, data);
Alexandre Lisiona815eab2014-01-31 13:01:31 -0500230
231 getLoaderManager().restartLoader(LoaderConstants.ACCOUNTS_LOADER, null, this);
232
Alexandre Lision420b2572014-01-10 11:37:18 -0500233 }
234
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400235 /**
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400236 * Adapter for accounts List
Alexandre Lisiona815eab2014-01-31 13:01:31 -0500237 *
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400238 * @author lisional
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400239 */
240 public class AccountsAdapter extends BaseAdapter {
Alexandre Savard52a72522012-09-27 16:40:13 -0400241
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400242 // private static final String TAG = AccountSelectionAdapter.class.getSimpleName();
Alexandre Savard70982012012-09-27 17:15:50 -0400243
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400244 ArrayList<Account> accounts;
245 Context mContext;
Alexandre Savard70982012012-09-27 17:15:50 -0400246
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400247 public AccountsAdapter(Context cont, ArrayList<Account> newList) {
248 super();
249 accounts = newList;
250 mContext = cont;
Alexandre Savarde990d052012-10-18 14:43:09 -0400251 }
alisiond9e29442013-04-17 16:10:18 -0400252
Alexandre Lision4cf78702013-10-16 13:43:23 -0400253 public void insert(Account item, int to) {
254 accounts.add(to, item);
255 notifyDataSetChanged();
256 }
257
258 public void remove(Account item) {
259 accounts.remove(item);
260 notifyDataSetChanged();
261 }
Alexandre Lisiond2e9e062013-10-21 16:27:33 -0400262
Alexandre Lision4cf78702013-10-16 13:43:23 -0400263 @Override
Alexandre Lisiond2e9e062013-10-21 16:27:33 -0400264 public boolean hasStableIds() {
Alexandre Lision4cf78702013-10-16 13:43:23 -0400265 return true;
266 }
267
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400268 @Override
269 public int getCount() {
270 return accounts.size();
271 }
Alexandre Savard70982012012-09-27 17:15:50 -0400272
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400273 @Override
274 public Account getItem(int pos) {
275 return accounts.get(pos);
276 }
Alexandre Savard68838112012-10-30 11:34:43 -0400277
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400278 @Override
279 public long getItemId(int pos) {
280 return 0;
281 }
Alexandre Savard68838112012-10-30 11:34:43 -0400282
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400283 @Override
284 public View getView(final int pos, View convertView, ViewGroup parent) {
285 View rowView = convertView;
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500286 AccountView entryView;
Alexandre Savard68838112012-10-30 11:34:43 -0400287
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400288 if (rowView == null) {
289 LayoutInflater inflater = LayoutInflater.from(mContext);
290 rowView = inflater.inflate(R.layout.item_account_pref, null);
alisiond9e29442013-04-17 16:10:18 -0400291
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400292 entryView = new AccountView();
293 entryView.alias = (TextView) rowView.findViewById(R.id.account_alias);
294 entryView.host = (TextView) rowView.findViewById(R.id.account_host);
295 entryView.enabled = (CheckBox) rowView.findViewById(R.id.account_checked);
296 rowView.setTag(entryView);
297 } else {
298 entryView = (AccountView) rowView.getTag();
299 }
300
Alexandre Lision059da9d2013-10-22 11:17:25 -0400301 final Account item = accounts.get(pos);
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400302 entryView.alias.setText(accounts.get(pos).getAlias());
Alexandre Lisionef2aa9e2013-10-25 16:22:52 -0400303 if (item.isIP2IP()) {
Alexandre Lision230d66e2013-10-22 12:32:12 -0400304 entryView.host.setText(item.getRegistered_state());
305 entryView.enabled.setVisibility(View.GONE);
306 } else {
307 entryView.host.setText(item.getHost() + " - " + item.getRegistered_state());
308 entryView.enabled.setChecked(item.isEnabled());
309 entryView.enabled.setOnClickListener(new OnClickListener() {
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400310
Alexandre Lision230d66e2013-10-22 12:32:12 -0400311 @Override
312 public void onClick(View v) {
313 item.setEnabled(!item.isEnabled());
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400314
Alexandre Lision230d66e2013-10-22 12:32:12 -0400315 try {
316 mCallbacks.getService().setAccountDetails(item.getAccountID(), item.getDetails());
317 } catch (RemoteException e) {
318 e.printStackTrace();
319 }
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400320 }
Alexandre Lision230d66e2013-10-22 12:32:12 -0400321 });
322 }
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400323
324 return rowView;
325 }
326
Alexandre Lisiona815eab2014-01-31 13:01:31 -0500327 /**
328 * ******************
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400329 * ViewHolder Pattern
Alexandre Lisiona815eab2014-01-31 13:01:31 -0500330 * *******************
331 */
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400332 public class AccountView {
333 public TextView alias;
334 public TextView host;
335 public CheckBox enabled;
336 }
337
338 public void removeAll() {
339 accounts.clear();
340 notifyDataSetChanged();
341
342 }
343
344 public void addAll(ArrayList<Account> results) {
345 accounts.addAll(results);
346 notifyDataSetChanged();
347 }
348
349 /**
350 * Modify state of specific account
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400351 */
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500352 public void updateAccount(String accoundID, String state, int code) {
353 Log.i(TAG, "updateAccount:" + state);
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400354 for (Account a : accounts) {
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500355 if (a.getAccountID().contentEquals(accoundID)) {
356 a.setRegistered_state(state);
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400357 notifyDataSetChanged();
358 return;
359 }
360 }
361
362 }
Alexandre Lisiond2e9e062013-10-21 16:27:33 -0400363
Alexandre Lision4cf78702013-10-16 13:43:23 -0400364 private String generateAccountOrder() {
365 String result = DEFAULT_ACCOUNT_ID + File.separator;
366 for (Account a : accounts) {
367 result += a.getAccountID() + File.separator;
368 }
369 return result;
370 }
Alexandre Lision3ccccf02013-10-07 14:10:46 -0400371
Alexandre Savard68838112012-10-30 11:34:43 -0400372 }
Alexandre Lisionef2aa9e2013-10-25 16:22:52 -0400373
374 private void crossfade() {
375
376 // Set the content view to 0% opacity but visible, so that it is visible
377 // (but fully transparent) during the animation.
378 mDnDListView.setAlpha(0f);
379 mDnDListView.setVisibility(View.VISIBLE);
380
381 // Animate the content view to 100% opacity, and clear any animation
382 // listener set on the view.
383 mDnDListView.animate().alpha(1f).setDuration(mShortAnimationDuration).setListener(null);
384
385 // Animate the loading view to 0% opacity. After the animation ends,
386 // set its visibility to GONE as an optimization step (it won't
387 // participate in layout passes, etc.)
388 mLoadingView.animate().alpha(0f).setDuration(mShortAnimationDuration).setListener(new AnimatorListenerAdapter() {
389 @Override
390 public void onAnimationEnd(Animator animation) {
391 mLoadingView.setVisibility(View.GONE);
392 }
393 });
394 }
Alexandre Lisiona8b78722013-12-13 10:18:33 -0500395
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500396
Alexandre Lisiona8b78722013-12-13 10:18:33 -0500397 @Override
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500398 public AsyncTaskLoader<Bundle> onCreateLoader(int arg0, Bundle arg1) {
399 AccountsLoader l = new AccountsLoader(getActivity(), mCallbacks.getService());
400 l.forceLoad();
401 return l;
402 }
403
404 @Override
Alexandre Lisionbe54c342014-01-21 17:10:33 -0500405 public void onLoadFinished(Loader<Bundle> bundleLoader, Bundle results) {
Alexandre Lisiona8b78722013-12-13 10:18:33 -0500406 mAccountsAdapter.removeAll();
407 ArrayList<Account> tmp = results.getParcelableArrayList(AccountsLoader.ACCOUNTS);
408 ip2ip = results.getParcelable(AccountsLoader.ACCOUNT_IP2IP);
409 mAccountsAdapter.addAll(tmp);
410 mIP2IPAdapter.removeAll();
411 mIP2IPAdapter.insert(ip2ip, 0);
412 if (mAccountsAdapter.isEmpty()) {
413 mDnDListView.setEmptyView(getView().findViewById(R.id.empty_account_list));
414 }
415 crossfade();
416 }
417
418 @Override
Alexandre Lisionbe54c342014-01-21 17:10:33 -0500419 public void onLoaderReset(Loader<Bundle> bundleLoader) {
Alexandre Lision658999c2013-12-13 14:42:45 -0500420
Alexandre Lisiona8b78722013-12-13 10:18:33 -0500421 }
Alexandre Lisionbe54c342014-01-21 17:10:33 -0500422
Alexandre Savard2b370f02012-09-06 16:06:01 -0400423}