Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. |
| 3 | * |
| 4 | * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> |
| 5 | * Alexandre Savard <alexandre.savard@savoirfairelinux.com> |
| 6 | * |
| 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 | |
| 33 | package org.sflphone.client; |
| 34 | |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 35 | import java.util.ArrayList; |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 36 | import java.util.Locale; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 37 | |
| 38 | import org.sflphone.R; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 39 | import org.sflphone.account.AccountDetailBasic; |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 40 | import org.sflphone.fragments.AudioManagementFragment; |
| 41 | import org.sflphone.fragments.EditionFragment; |
Alexandre Lision | d2e9e06 | 2013-10-21 16:27:33 -0400 | [diff] [blame] | 42 | import org.sflphone.model.Account; |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 43 | import org.sflphone.service.ISipService; |
| 44 | import org.sflphone.service.SipService; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 45 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 46 | import android.app.ActionBar; |
| 47 | import android.app.ActionBar.Tab; |
| 48 | import android.app.ActionBar.TabListener; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 49 | import android.app.Activity; |
| 50 | import android.app.AlertDialog; |
| 51 | import android.app.Dialog; |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 52 | import android.app.Fragment; |
| 53 | import android.app.FragmentManager; |
| 54 | import android.app.FragmentTransaction; |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 55 | import android.content.ComponentName; |
| 56 | import android.content.Context; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 57 | import android.content.DialogInterface; |
| 58 | import android.content.Intent; |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 59 | import android.content.ServiceConnection; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 60 | import android.os.Bundle; |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 61 | import android.os.IBinder; |
| 62 | import android.os.RemoteException; |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 63 | import android.preference.EditTextPreference; |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 64 | import android.support.v13.app.FragmentStatePagerAdapter; |
| 65 | import android.support.v4.view.ViewPager; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 66 | import android.util.Log; |
| 67 | import android.view.Menu; |
| 68 | import android.view.MenuInflater; |
| 69 | import android.view.MenuItem; |
| 70 | |
Alexandre Lision | 933ef0a | 2013-10-15 17:28:40 -0400 | [diff] [blame] | 71 | public class AccountEditionActivity extends Activity implements TabListener, EditionFragment.Callbacks, AudioManagementFragment.Callbacks { |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 72 | private static final String TAG = "AccoutPreferenceActivity"; |
| 73 | |
| 74 | public static final String KEY_MODE = "mode"; |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 75 | private boolean mBound = false; |
| 76 | private ISipService service; |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 77 | |
Alexandre Lision | d2e9e06 | 2013-10-21 16:27:33 -0400 | [diff] [blame] | 78 | private Account acc_selected; |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 79 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 80 | PreferencesPagerAdapter mPreferencesPagerAdapter; |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 81 | private ServiceConnection mConnection = new ServiceConnection() { |
| 82 | |
| 83 | @Override |
| 84 | public void onServiceConnected(ComponentName className, IBinder binder) { |
| 85 | service = ISipService.Stub.asInterface(binder); |
| 86 | mBound = true; |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 87 | |
| 88 | ArrayList<Fragment> fragments = new ArrayList<Fragment>(); |
| 89 | if (acc_selected.isIP2IP()) { |
| 90 | |
| 91 | fragments.add(new AudioManagementFragment()); |
| 92 | } else { |
| 93 | fragments.add(new EditionFragment()); |
| 94 | fragments.add(new AudioManagementFragment()); |
| 95 | } |
| 96 | |
| 97 | mPreferencesPagerAdapter = new PreferencesPagerAdapter(AccountEditionActivity.this, getFragmentManager(), fragments); |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 98 | mViewPager.setAdapter(mPreferencesPagerAdapter); |
| 99 | getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); |
| 100 | for (int i = 0; i < mPreferencesPagerAdapter.getCount(); i++) { |
| 101 | getActionBar().addTab( |
| 102 | getActionBar().newTab().setText(mPreferencesPagerAdapter.getPageTitle(i)).setTabListener(AccountEditionActivity.this)); |
| 103 | |
| 104 | } |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | @Override |
| 108 | public void onServiceDisconnected(ComponentName arg0) { |
| 109 | |
| 110 | } |
| 111 | }; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 112 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 113 | private ViewPager mViewPager; |
| 114 | |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 115 | // private ArrayList<String> requiredFields = null; |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 116 | // EditionFragment mEditionFragment; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 117 | |
| 118 | @Override |
| 119 | protected void onCreate(Bundle savedInstanceState) { |
| 120 | super.onCreate(savedInstanceState); |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 121 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 122 | setContentView(R.layout.activity_wizard); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 123 | |
| 124 | getActionBar().setDisplayHomeAsUpEnabled(true); |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 125 | mViewPager = (ViewPager) findViewById(R.id.pager); |
| 126 | mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { |
| 127 | @Override |
| 128 | public void onPageSelected(int position) { |
| 129 | getActionBar().setSelectedNavigationItem(position); |
| 130 | } |
| 131 | }); |
| 132 | |
Alexandre Lision | d2e9e06 | 2013-10-21 16:27:33 -0400 | [diff] [blame] | 133 | acc_selected = getIntent().getExtras().getParcelable("account"); |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 134 | |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 135 | if (!mBound) { |
| 136 | Log.i(TAG, "onCreate: Binding service..."); |
| 137 | Intent intent = new Intent(this, SipService.class); |
| 138 | bindService(intent, mConnection, Context.BIND_AUTO_CREATE); |
| 139 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 140 | |
| 141 | } |
| 142 | |
| 143 | @Override |
| 144 | public boolean onCreateOptionsMenu(Menu menu) { |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 145 | if (acc_selected.isIP2IP()) { |
| 146 | return true; |
| 147 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 148 | MenuInflater inflater = getMenuInflater(); |
| 149 | inflater.inflate(R.menu.account_edition, menu); |
| 150 | return true; |
| 151 | } |
| 152 | |
| 153 | @Override |
| 154 | public void onBackPressed() { |
| 155 | |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 156 | if (acc_selected.isIP2IP()) { |
| 157 | super.onBackPressed(); |
| 158 | return; |
| 159 | } |
| 160 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 161 | if (mPreferencesPagerAdapter.getItem(0) != null && ((EditionFragment) mPreferencesPagerAdapter.getItem(0)).isDifferent()) { |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 162 | AlertDialog dialog = createCancelDialog(); |
| 163 | dialog.show(); |
| 164 | } else { |
| 165 | super.onBackPressed(); |
| 166 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | @Override |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 170 | protected void onDestroy() { |
| 171 | |
| 172 | if (mBound) { |
| 173 | unbindService(mConnection); |
| 174 | mBound = false; |
| 175 | } |
| 176 | |
| 177 | // stopService(new Intent(this, SipService.class)); |
| 178 | // serviceIsOn = false; |
| 179 | super.onDestroy(); |
| 180 | } |
| 181 | |
| 182 | @Override |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 183 | public boolean onOptionsItemSelected(MenuItem item) { |
| 184 | |
| 185 | switch (item.getItemId()) { |
| 186 | case android.R.id.home: |
| 187 | finish(); |
| 188 | return true; |
| 189 | case R.id.menuitem_delete: |
| 190 | AlertDialog dialog = createDeleteDialog(); |
| 191 | dialog.show(); |
| 192 | break; |
| 193 | case R.id.menuitem_edit: |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 194 | processAccount(); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 195 | break; |
| 196 | |
| 197 | } |
| 198 | |
| 199 | return true; |
| 200 | } |
| 201 | |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 202 | private void processAccount() { |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 203 | AlertDialog dialog; |
| 204 | ArrayList<String> missingValue = new ArrayList<String>(); |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 205 | if (validateAccountCreation(missingValue)) { |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 206 | try { |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 207 | service.setAccountDetails(acc_selected.getAccountID(), acc_selected.getDetails()); |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 208 | } catch (RemoteException e) { |
| 209 | e.printStackTrace(); |
| 210 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 211 | finish(); |
| 212 | } else { |
| 213 | dialog = createCouldNotValidateDialog(missingValue); |
| 214 | dialog.show(); |
| 215 | } |
| 216 | |
| 217 | } |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 218 | |
| 219 | public boolean validateAccountCreation(ArrayList<String> missingValue) { |
| 220 | boolean valid = true; |
| 221 | ArrayList<String> requiredFields = new ArrayList<String>(); |
| 222 | requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_ALIAS); |
| 223 | requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_HOSTNAME); |
| 224 | requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_USERNAME); |
| 225 | requiredFields.add(AccountDetailBasic.CONFIG_ACCOUNT_PASSWORD); |
| 226 | for (String s : requiredFields) { |
| 227 | |
| 228 | if (acc_selected.getBasicDetails().getDetailString(s).isEmpty()) { |
| 229 | valid = false; |
| 230 | missingValue.add(s); |
| 231 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 232 | } |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 233 | |
| 234 | return valid; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 235 | } |
| 236 | |
| 237 | /****************************************** |
| 238 | * |
| 239 | * AlertDialogs |
| 240 | * |
| 241 | ******************************************/ |
| 242 | |
| 243 | private AlertDialog createCouldNotValidateDialog(ArrayList<String> missingValue) { |
| 244 | String message = "The following parameters are missing:"; |
| 245 | |
| 246 | for (String s : missingValue) |
| 247 | message += "\n - " + s; |
| 248 | |
| 249 | Activity ownerActivity = this; |
| 250 | AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity); |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 251 | builder.setMessage(message).setTitle("Missing Parameters").setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 252 | @Override |
| 253 | public void onClick(DialogInterface dialog, int whichButton) { |
| 254 | /* Nothing to be done */ |
| 255 | } |
| 256 | }); |
| 257 | |
| 258 | AlertDialog alertDialog = builder.create(); |
| 259 | return alertDialog; |
| 260 | } |
| 261 | |
| 262 | private AlertDialog createCancelDialog() { |
| 263 | Activity ownerActivity = this; |
| 264 | AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity); |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 265 | builder.setMessage("Modifications will be lost").setTitle("Account Edition") |
| 266 | .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { |
| 267 | @Override |
| 268 | public void onClick(DialogInterface dialog, int whichButton) { |
| 269 | Activity activity = ((Dialog) dialog).getOwnerActivity(); |
| 270 | activity.finish(); |
| 271 | } |
| 272 | }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { |
| 273 | @Override |
| 274 | public void onClick(DialogInterface dialog, int whichButton) { |
| 275 | /* Terminate with no action */ |
| 276 | } |
| 277 | }); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 278 | |
| 279 | AlertDialog alertDialog = builder.create(); |
| 280 | alertDialog.setOwnerActivity(ownerActivity); |
| 281 | |
| 282 | return alertDialog; |
| 283 | } |
| 284 | |
| 285 | private AlertDialog createDeleteDialog() { |
| 286 | Activity ownerActivity = this; |
| 287 | AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity); |
| 288 | builder.setMessage("Do you really want to delete this account").setTitle("Delete Account") |
| 289 | .setPositiveButton("Ok", new DialogInterface.OnClickListener() { |
| 290 | @Override |
| 291 | public void onClick(DialogInterface dialog, int whichButton) { |
| 292 | Bundle bundle = new Bundle(); |
Alexandre Lision | d2e9e06 | 2013-10-21 16:27:33 -0400 | [diff] [blame] | 293 | bundle.putString("AccountID", acc_selected.getAccountID()); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 294 | |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 295 | try { |
Alexandre Lision | d2e9e06 | 2013-10-21 16:27:33 -0400 | [diff] [blame] | 296 | service.removeAccount(acc_selected.getAccountID()); |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 297 | } catch (RemoteException e) { |
| 298 | e.printStackTrace(); |
| 299 | } |
| 300 | finish(); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 301 | } |
| 302 | }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { |
| 303 | @Override |
| 304 | public void onClick(DialogInterface dialog, int whichButton) { |
| 305 | /* Terminate with no action */ |
| 306 | } |
| 307 | }); |
| 308 | |
| 309 | AlertDialog alertDialog = builder.create(); |
| 310 | alertDialog.setOwnerActivity(ownerActivity); |
| 311 | |
| 312 | return alertDialog; |
| 313 | } |
| 314 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 315 | public class PreferencesPagerAdapter extends FragmentStatePagerAdapter { |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 316 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 317 | Context mContext; |
| 318 | ArrayList<Fragment> fragments; |
| 319 | |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 320 | public PreferencesPagerAdapter(Context c, FragmentManager fm, ArrayList<Fragment> items) { |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 321 | super(fm); |
| 322 | mContext = c; |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 323 | fragments = new ArrayList<Fragment>(items); |
| 324 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 325 | } |
| 326 | |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 327 | @Override |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 328 | public int getCount() { |
| 329 | return fragments.size(); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 330 | } |
| 331 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 332 | @Override |
| 333 | public Fragment getItem(int position) { |
| 334 | return fragments.get(position); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 335 | } |
| 336 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 337 | @Override |
| 338 | public CharSequence getPageTitle(int position) { |
| 339 | switch (position) { |
| 340 | case 0: |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 341 | if (acc_selected.isIP2IP()) { |
| 342 | return getString(R.string.account_preferences_audio).toUpperCase(Locale.getDefault()); |
| 343 | } else { |
| 344 | return getString(R.string.account_preferences_basic).toUpperCase(Locale.getDefault()); |
| 345 | } |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 346 | case 1: |
| 347 | return getString(R.string.account_preferences_audio).toUpperCase(Locale.getDefault()); |
| 348 | default: |
| 349 | Log.e(TAG, "getPreferencePageTitle: unknown tab position " + position); |
| 350 | break; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 351 | } |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 352 | return null; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 353 | } |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 354 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 355 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 356 | @Override |
| 357 | public void onTabReselected(Tab arg0, FragmentTransaction arg1) { |
| 358 | // TODO Stub de la méthode généré automatiquement |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 359 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 360 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 361 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 362 | @Override |
| 363 | public void onTabSelected(Tab tab, FragmentTransaction ft) { |
| 364 | mViewPager.setCurrentItem(tab.getPosition()); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 365 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 366 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 367 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 368 | @Override |
| 369 | public void onTabUnselected(Tab tab, FragmentTransaction ft) { |
| 370 | // TODO Stub de la méthode généré automatiquement |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 371 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 372 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 373 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 374 | @Override |
Alexandre Lision | 933ef0a | 2013-10-15 17:28:40 -0400 | [diff] [blame] | 375 | public ISipService getService() { |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 376 | return service; |
Alexandre Lision | 933ef0a | 2013-10-15 17:28:40 -0400 | [diff] [blame] | 377 | } |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 378 | |
Alexandre Lision | 933ef0a | 2013-10-15 17:28:40 -0400 | [diff] [blame] | 379 | @Override |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 380 | public String getAccountID() { |
Alexandre Lision | d2e9e06 | 2013-10-21 16:27:33 -0400 | [diff] [blame] | 381 | return acc_selected.getAccountID(); |
Alexandre Lision | 933ef0a | 2013-10-15 17:28:40 -0400 | [diff] [blame] | 382 | } |
| 383 | |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 384 | @Override |
| 385 | public Account getAccount() { |
| 386 | return acc_selected; |
| 387 | } |
| 388 | |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 389 | } |