use of com.voipgrid.vialer.util.PhoneAccountHelper in project vialer-android by VoIPGRID.
the class SetupActivity method onFinish.
@Override
public void onFinish(Fragment fragment) {
if (mActivityToReturnToName.equals(AccountActivity.class.getSimpleName())) {
PhoneAccountHelper phoneAccountHelper = new PhoneAccountHelper(this);
phoneAccountHelper.savePhoneAccountAndRegister((PhoneAccount) mJsonStorage.get(PhoneAccount.class));
Intent intent = new Intent(this, AccountActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
} else {
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
}
finish();
}
use of com.voipgrid.vialer.util.PhoneAccountHelper in project vialer-android by VoIPGRID.
the class AccountActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_account);
mJsonStorage = new JsonStorage(this);
mPhoneAccountHelper = new PhoneAccountHelper(this);
mPreferences = new Preferences(this);
/* set the Toolbar to use as ActionBar */
setSupportActionBar((Toolbar) findViewById(R.id.action_bar));
/* enabled home as up for the Toolbar */
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
/* enabled home button for the Toolbar */
getSupportActionBar().setHomeButtonEnabled(true);
mRemoteLogIdEditText = (EditText) findViewById(R.id.remote_logging_id_edit_text);
mRemoteLogIdEditText.setVisibility(View.GONE);
mSipIdEditText = ((EditText) findViewById(R.id.account_sip_id_edit_text));
mVoipSwitch = (CompoundButton) findViewById(R.id.account_sip_switch);
mVoipSwitch.setOnCheckedChangeListener(this);
initConnectionSpinner();
initRemoteLoggingSwitch();
initUse3GSwitch();
}
use of com.voipgrid.vialer.util.PhoneAccountHelper in project vialer-android by VoIPGRID.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle startBundle = getIntent().getExtras();
if (startBundle != null) {
boolean onBoot = startBundle.getBoolean("OnBoot");
if (onBoot) {
finish();
return;
}
}
JsonStorage jsonStorage = new JsonStorage(this);
ConnectivityHelper connectivityHelper = ConnectivityHelper.get(this);
Boolean hasSystemUser = jsonStorage.has(SystemUser.class);
SystemUser systemUser = (SystemUser) jsonStorage.get(SystemUser.class);
// on boarding part where the mobile number needs to be configured.
if (!hasSystemUser) {
// Start on boarding flow.
startActivity(new Intent(this, SetupActivity.class));
finish();
return;
} else if (UpdateHelper.requiresUpdate(this)) {
Intent intent = new Intent(this, UpdateActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
return;
} else if (systemUser.getMobileNumber() == null) {
Intent intent = new Intent(this, SetupActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("fragment", R.id.fragment_account);
bundle.putString("activity", AccountFragment.class.getSimpleName());
intent.putExtras(bundle);
startActivity(intent);
finish();
return;
} else if (connectivityHelper.hasNetworkConnection()) {
// Update SystemUser and PhoneAccount on background thread.
new PhoneAccountHelper(this).executeUpdatePhoneAccountTask();
}
if (SyncUtils.requiresFullContactSync(this)) {
SyncUtils.requestContactSync(this);
} else {
startContactObserverService();
}
SyncUtils.setPeriodicSync(this);
setContentView(R.layout.activity_main);
// Set the Toolbar to use as ActionBar.
setActionBar(R.id.action_bar);
setNavigationDrawer(R.id.drawer_layout);
// Set tabs.
setupTabs();
FloatingActionButton openDialerFab = findViewById(R.id.floating_action_button);
openDialerFab.setOnClickListener(this);
requestCounter = 0;
mReachabilityReceiver = new ReachabilityReceiver(this);
}
Aggregations