Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 1 | /* |
Alexandre Lision | c1024c0 | 2014-01-06 11:12:53 -0500 | [diff] [blame] | 2 | * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 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 | 3cefec2 | 2013-11-14 17:26:35 -0500 | [diff] [blame] | 37 | import java.util.Observable; |
| 38 | import java.util.Observer; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 39 | |
| 40 | import org.sflphone.R; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 41 | import org.sflphone.account.AccountDetailBasic; |
Alexandre Lision | c48c36a | 2013-11-12 16:26:10 -0500 | [diff] [blame] | 42 | import org.sflphone.fragments.AdvancedAccountFragment; |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 43 | import org.sflphone.fragments.AudioManagementFragment; |
Alexandre Lision | 8907c1c | 2013-11-12 11:40:14 -0500 | [diff] [blame] | 44 | import org.sflphone.fragments.GeneralAccountFragment; |
Alexandre Lision | a365099 | 2013-11-13 14:19:35 -0500 | [diff] [blame] | 45 | import org.sflphone.fragments.NestedSettingsFragment; |
Alexandre Lision | c48c36a | 2013-11-12 16:26:10 -0500 | [diff] [blame] | 46 | import org.sflphone.fragments.SecurityAccountFragment; |
Alexandre Lision | d2e9e06 | 2013-10-21 16:27:33 -0400 | [diff] [blame] | 47 | import org.sflphone.model.Account; |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 48 | import org.sflphone.service.ISipService; |
| 49 | import org.sflphone.service.SipService; |
Alexandre Lision | 8907c1c | 2013-11-12 11:40:14 -0500 | [diff] [blame] | 50 | import org.sflphone.views.PagerSlidingTabStrip; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 51 | |
| 52 | import android.app.Activity; |
| 53 | import android.app.AlertDialog; |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 54 | import android.app.Fragment; |
| 55 | import android.app.FragmentManager; |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 56 | import android.content.ComponentName; |
| 57 | import android.content.Context; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 58 | import android.content.DialogInterface; |
| 59 | import android.content.Intent; |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 60 | import android.content.ServiceConnection; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 61 | import android.os.Bundle; |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 62 | import android.os.IBinder; |
| 63 | import android.os.RemoteException; |
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 | 3f1aa68 | 2013-11-18 10:49:28 -0500 | [diff] [blame] | 71 | public class AccountEditionActivity extends Activity implements GeneralAccountFragment.Callbacks, AudioManagementFragment.Callbacks, |
Alexandre Lision | a365099 | 2013-11-13 14:19:35 -0500 | [diff] [blame] | 72 | AdvancedAccountFragment.Callbacks, SecurityAccountFragment.Callbacks, NestedSettingsFragment.Callbacks { |
Alexandre Lision | 3cefec2 | 2013-11-14 17:26:35 -0500 | [diff] [blame] | 73 | private static final String TAG = AccountEditionActivity.class.getSimpleName(); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 74 | |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 75 | private boolean mBound = false; |
| 76 | private ISipService service; |
Alexandre Lision | d2e9e06 | 2013-10-21 16:27:33 -0400 | [diff] [blame] | 77 | private Account acc_selected; |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 78 | |
Alexandre Lision | 3f1aa68 | 2013-11-18 10:49:28 -0500 | [diff] [blame] | 79 | private ViewPager mViewPager; |
| 80 | |
| 81 | private NestedSettingsFragment toDisplay; |
| 82 | |
| 83 | private Observer mAccountObserver = new Observer() { |
| 84 | |
| 85 | @Override |
| 86 | public void update(Observable observable, Object data) { |
| 87 | processAccount(); |
| 88 | } |
| 89 | }; |
| 90 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 91 | PreferencesPagerAdapter mPreferencesPagerAdapter; |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 92 | private ServiceConnection mConnection = new ServiceConnection() { |
| 93 | |
| 94 | @Override |
| 95 | public void onServiceConnected(ComponentName className, IBinder binder) { |
| 96 | service = ISipService.Stub.asInterface(binder); |
| 97 | mBound = true; |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 98 | |
| 99 | ArrayList<Fragment> fragments = new ArrayList<Fragment>(); |
| 100 | if (acc_selected.isIP2IP()) { |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 101 | fragments.add(new AudioManagementFragment()); |
| 102 | } else { |
Alexandre Lision | 8907c1c | 2013-11-12 11:40:14 -0500 | [diff] [blame] | 103 | fragments.add(new GeneralAccountFragment()); |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 104 | fragments.add(new AudioManagementFragment()); |
Alexandre Lision | c48c36a | 2013-11-12 16:26:10 -0500 | [diff] [blame] | 105 | fragments.add(new AdvancedAccountFragment()); |
| 106 | fragments.add(new SecurityAccountFragment()); |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 107 | } |
| 108 | |
Alexandre Lision | 3f1aa68 | 2013-11-18 10:49:28 -0500 | [diff] [blame] | 109 | mViewPager = (ViewPager) findViewById(R.id.pager); |
| 110 | |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 111 | mPreferencesPagerAdapter = new PreferencesPagerAdapter(AccountEditionActivity.this, getFragmentManager(), fragments); |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 112 | mViewPager.setAdapter(mPreferencesPagerAdapter); |
Alexandre Lision | c48c36a | 2013-11-12 16:26:10 -0500 | [diff] [blame] | 113 | mViewPager.setOffscreenPageLimit(3); |
| 114 | |
Alexandre Lision | 8907c1c | 2013-11-12 11:40:14 -0500 | [diff] [blame] | 115 | final PagerSlidingTabStrip strip = PagerSlidingTabStrip.class.cast(findViewById(R.id.pager_sliding_strip)); |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 116 | |
Alexandre Lision | 8907c1c | 2013-11-12 11:40:14 -0500 | [diff] [blame] | 117 | strip.setViewPager(mViewPager); |
Alexandre Lision | 3cefec2 | 2013-11-14 17:26:35 -0500 | [diff] [blame] | 118 | |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | @Override |
| 122 | public void onServiceDisconnected(ComponentName arg0) { |
| 123 | |
| 124 | } |
| 125 | }; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 126 | |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 127 | @Override |
| 128 | protected void onCreate(Bundle savedInstanceState) { |
| 129 | super.onCreate(savedInstanceState); |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 130 | |
Alexandre Lision | 8907c1c | 2013-11-12 11:40:14 -0500 | [diff] [blame] | 131 | setContentView(R.layout.activity_account_settings); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 132 | |
| 133 | getActionBar().setDisplayHomeAsUpEnabled(true); |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 134 | |
Alexandre Lision | d2e9e06 | 2013-10-21 16:27:33 -0400 | [diff] [blame] | 135 | acc_selected = getIntent().getExtras().getParcelable("account"); |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 136 | |
Alexandre Lision | 3cefec2 | 2013-11-14 17:26:35 -0500 | [diff] [blame] | 137 | acc_selected.addObserver(mAccountObserver); |
| 138 | |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 139 | if (!mBound) { |
| 140 | Log.i(TAG, "onCreate: Binding service..."); |
| 141 | Intent intent = new Intent(this, SipService.class); |
| 142 | bindService(intent, mConnection, Context.BIND_AUTO_CREATE); |
| 143 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 144 | |
| 145 | } |
| 146 | |
| 147 | @Override |
| 148 | public boolean onCreateOptionsMenu(Menu menu) { |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 149 | if (acc_selected.isIP2IP()) { |
| 150 | return true; |
| 151 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 152 | MenuInflater inflater = getMenuInflater(); |
| 153 | inflater.inflate(R.menu.account_edition, menu); |
| 154 | return true; |
| 155 | } |
| 156 | |
| 157 | @Override |
| 158 | public void onBackPressed() { |
| 159 | |
Alexandre Lision | 3cefec2 | 2013-11-14 17:26:35 -0500 | [diff] [blame] | 160 | if (toDisplay != null) { |
Alexandre Lision | 8ad3959 | 2013-11-21 13:23:58 -0500 | [diff] [blame] | 161 | getFragmentManager().beginTransaction().setCustomAnimations(R.animator.slidein_up, R.animator.slideout_down).remove(toDisplay).commit(); |
Alexandre Lision | 06412a3 | 2014-02-05 17:33:04 -0500 | [diff] [blame] | 162 | ((SecurityAccountFragment) mPreferencesPagerAdapter.getItem(3)).updateSummaries(); |
Alexandre Lision | 3cefec2 | 2013-11-14 17:26:35 -0500 | [diff] [blame] | 163 | toDisplay = null; |
| 164 | return; |
| 165 | } |
| 166 | |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 167 | if (acc_selected.isIP2IP()) { |
| 168 | super.onBackPressed(); |
| 169 | return; |
| 170 | } |
| 171 | |
Alexandre Lision | 3cefec2 | 2013-11-14 17:26:35 -0500 | [diff] [blame] | 172 | super.onBackPressed(); |
| 173 | |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | @Override |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 177 | protected void onDestroy() { |
Alexandre Lision | afff1cc | 2013-11-22 11:57:33 -0500 | [diff] [blame] | 178 | super.onDestroy(); |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 179 | if (mBound) { |
| 180 | unbindService(mConnection); |
| 181 | mBound = false; |
| 182 | } |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | @Override |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 186 | public boolean onOptionsItemSelected(MenuItem item) { |
| 187 | |
| 188 | switch (item.getItemId()) { |
| 189 | case android.R.id.home: |
Alexandre Lision | 3cefec2 | 2013-11-14 17:26:35 -0500 | [diff] [blame] | 190 | if (toDisplay != null) { |
Alexandre Lision | afff1cc | 2013-11-22 11:57:33 -0500 | [diff] [blame] | 191 | getFragmentManager().beginTransaction().setCustomAnimations(R.animator.slidein_up, R.animator.slideout_down).remove(toDisplay) |
| 192 | .commit(); |
Alexandre Lision | 06412a3 | 2014-02-05 17:33:04 -0500 | [diff] [blame] | 193 | ((SecurityAccountFragment) mPreferencesPagerAdapter.getItem(3)).updateSummaries(); |
Alexandre Lision | 3cefec2 | 2013-11-14 17:26:35 -0500 | [diff] [blame] | 194 | toDisplay = null; |
| 195 | } else |
| 196 | finish(); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 197 | return true; |
| 198 | case R.id.menuitem_delete: |
| 199 | AlertDialog dialog = createDeleteDialog(); |
| 200 | dialog.show(); |
| 201 | break; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | return true; |
| 205 | } |
| 206 | |
Alexandre Lision | 6a13ac0 | 2014-02-04 15:58:20 -0500 | [diff] [blame] | 207 | @Override |
| 208 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 209 | super.onActivityResult(requestCode, resultCode, data); |
| 210 | } |
| 211 | |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 212 | private void processAccount() { |
Alexandre Lision | 3cefec2 | 2013-11-14 17:26:35 -0500 | [diff] [blame] | 213 | try { |
| 214 | service.setCredentials(acc_selected.getAccountID(), acc_selected.getCredentialsHashMapList()); |
| 215 | service.setAccountDetails(acc_selected.getAccountID(), acc_selected.getDetails()); |
| 216 | } catch (RemoteException e) { |
| 217 | e.printStackTrace(); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | } |
Alexandre Lision | c48c36a | 2013-11-12 16:26:10 -0500 | [diff] [blame] | 221 | |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 222 | private AlertDialog createDeleteDialog() { |
| 223 | Activity ownerActivity = this; |
| 224 | AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity); |
| 225 | builder.setMessage("Do you really want to delete this account").setTitle("Delete Account") |
| 226 | .setPositiveButton("Ok", new DialogInterface.OnClickListener() { |
| 227 | @Override |
| 228 | public void onClick(DialogInterface dialog, int whichButton) { |
| 229 | Bundle bundle = new Bundle(); |
Alexandre Lision | d2e9e06 | 2013-10-21 16:27:33 -0400 | [diff] [blame] | 230 | bundle.putString("AccountID", acc_selected.getAccountID()); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 231 | |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 232 | try { |
Alexandre Lision | d2e9e06 | 2013-10-21 16:27:33 -0400 | [diff] [blame] | 233 | service.removeAccount(acc_selected.getAccountID()); |
Alexandre Lision | d16bad9 | 2013-10-09 17:16:20 -0400 | [diff] [blame] | 234 | } catch (RemoteException e) { |
| 235 | e.printStackTrace(); |
| 236 | } |
| 237 | finish(); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 238 | } |
| 239 | }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { |
| 240 | @Override |
| 241 | public void onClick(DialogInterface dialog, int whichButton) { |
| 242 | /* Terminate with no action */ |
| 243 | } |
| 244 | }); |
| 245 | |
| 246 | AlertDialog alertDialog = builder.create(); |
| 247 | alertDialog.setOwnerActivity(ownerActivity); |
| 248 | |
| 249 | return alertDialog; |
| 250 | } |
| 251 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 252 | public class PreferencesPagerAdapter extends FragmentStatePagerAdapter { |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 253 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 254 | Context mContext; |
| 255 | ArrayList<Fragment> fragments; |
| 256 | |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 257 | public PreferencesPagerAdapter(Context c, FragmentManager fm, ArrayList<Fragment> items) { |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 258 | super(fm); |
| 259 | mContext = c; |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 260 | fragments = new ArrayList<Fragment>(items); |
| 261 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 262 | } |
| 263 | |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 264 | @Override |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 265 | public int getCount() { |
| 266 | return fragments.size(); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 267 | } |
| 268 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 269 | @Override |
| 270 | public Fragment getItem(int position) { |
| 271 | return fragments.get(position); |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 272 | } |
| 273 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 274 | @Override |
| 275 | public CharSequence getPageTitle(int position) { |
| 276 | switch (position) { |
| 277 | case 0: |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 278 | if (acc_selected.isIP2IP()) { |
Alexandre Lision | c9c30b7 | 2013-11-18 16:27:26 -0500 | [diff] [blame] | 279 | return getString(R.string.account_preferences_audio_tab).toUpperCase(Locale.getDefault()); |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 280 | } else { |
Alexandre Lision | c9c30b7 | 2013-11-18 16:27:26 -0500 | [diff] [blame] | 281 | return getString(R.string.account_preferences_basic_tab).toUpperCase(Locale.getDefault()); |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 282 | } |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 283 | case 1: |
Alexandre Lision | c9c30b7 | 2013-11-18 16:27:26 -0500 | [diff] [blame] | 284 | return getString(R.string.account_preferences_audio_tab).toUpperCase(Locale.getDefault()); |
Alexandre Lision | c48c36a | 2013-11-12 16:26:10 -0500 | [diff] [blame] | 285 | case 2: |
Alexandre Lision | c9c30b7 | 2013-11-18 16:27:26 -0500 | [diff] [blame] | 286 | return getString(R.string.account_preferences_advanced_tab).toUpperCase(Locale.getDefault()); |
Alexandre Lision | c48c36a | 2013-11-12 16:26:10 -0500 | [diff] [blame] | 287 | case 3: |
Alexandre Lision | c9c30b7 | 2013-11-18 16:27:26 -0500 | [diff] [blame] | 288 | return getString(R.string.account_preferences_security_tab).toUpperCase(Locale.getDefault()); |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 289 | default: |
| 290 | Log.e(TAG, "getPreferencePageTitle: unknown tab position " + position); |
| 291 | break; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 292 | } |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 293 | return null; |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 294 | } |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 295 | } |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 296 | |
Alexandre Lision | afd40e4 | 2013-10-15 13:48:37 -0400 | [diff] [blame] | 297 | @Override |
Alexandre Lision | 933ef0a | 2013-10-15 17:28:40 -0400 | [diff] [blame] | 298 | public ISipService getService() { |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 299 | return service; |
Alexandre Lision | 933ef0a | 2013-10-15 17:28:40 -0400 | [diff] [blame] | 300 | } |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 301 | |
Alexandre Lision | 933ef0a | 2013-10-15 17:28:40 -0400 | [diff] [blame] | 302 | @Override |
Alexandre Lision | 059da9d | 2013-10-22 11:17:25 -0400 | [diff] [blame] | 303 | public Account getAccount() { |
| 304 | return acc_selected; |
| 305 | } |
| 306 | |
Alexandre Lision | 3b7148e | 2013-11-13 17:23:06 -0500 | [diff] [blame] | 307 | @Override |
| 308 | public void displayCredentialsScreen() { |
Alexandre Lision | 3cefec2 | 2013-11-14 17:26:35 -0500 | [diff] [blame] | 309 | toDisplay = new NestedSettingsFragment(); |
Alexandre Lision | 3b7148e | 2013-11-13 17:23:06 -0500 | [diff] [blame] | 310 | Bundle b = new Bundle(); |
| 311 | b.putInt("MODE", 0); |
| 312 | toDisplay.setArguments(b); |
Alexandre Lision | 8ad3959 | 2013-11-21 13:23:58 -0500 | [diff] [blame] | 313 | getFragmentManager().beginTransaction().setCustomAnimations(R.animator.slidein_up, R.animator.slideout_down) |
| 314 | .replace(R.id.hidden_container, toDisplay).commit(); |
Alexandre Lision | 3b7148e | 2013-11-13 17:23:06 -0500 | [diff] [blame] | 315 | } |
| 316 | |
Alexandre Lision | c9c30b7 | 2013-11-18 16:27:26 -0500 | [diff] [blame] | 317 | @Override |
| 318 | public void displaySRTPScreen() { |
| 319 | toDisplay = new NestedSettingsFragment(); |
| 320 | Bundle b = new Bundle(); |
| 321 | b.putInt("MODE", 1); |
| 322 | toDisplay.setArguments(b); |
Alexandre Lision | 8ad3959 | 2013-11-21 13:23:58 -0500 | [diff] [blame] | 323 | getFragmentManager().beginTransaction().setCustomAnimations(R.animator.slidein_up, R.animator.slideout_down) |
| 324 | .replace(R.id.hidden_container, toDisplay).commit(); |
Alexandre Lision | c9c30b7 | 2013-11-18 16:27:26 -0500 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | @Override |
| 328 | public void displayTLSScreen() { |
| 329 | toDisplay = new NestedSettingsFragment(); |
| 330 | Bundle b = new Bundle(); |
| 331 | b.putInt("MODE", 2); |
| 332 | toDisplay.setArguments(b); |
Alexandre Lision | 8ad3959 | 2013-11-21 13:23:58 -0500 | [diff] [blame] | 333 | getFragmentManager().beginTransaction().setCustomAnimations(R.animator.slidein_up, R.animator.slideout_down) |
| 334 | .replace(R.id.hidden_container, toDisplay).commit(); |
Alexandre Lision | c9c30b7 | 2013-11-18 16:27:26 -0500 | [diff] [blame] | 335 | } |
| 336 | |
Alexandre Lision | 227b59c | 2013-10-03 17:37:57 -0400 | [diff] [blame] | 337 | } |