Search in sources :

Example 1 with PhoneAccountHelper

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();
}
Also used : AccountActivity(com.voipgrid.vialer.AccountActivity) PhoneAccountHelper(com.voipgrid.vialer.util.PhoneAccountHelper) Intent(android.content.Intent)

Example 2 with PhoneAccountHelper

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();
}
Also used : EditText(android.widget.EditText) PhoneAccountHelper(com.voipgrid.vialer.util.PhoneAccountHelper) JsonStorage(com.voipgrid.vialer.util.JsonStorage)

Example 3 with PhoneAccountHelper

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);
}
Also used : ConnectivityHelper(com.voipgrid.vialer.util.ConnectivityHelper) Bundle(android.os.Bundle) UpdateActivity(com.voipgrid.vialer.util.UpdateActivity) Intent(android.content.Intent) ReachabilityReceiver(com.voipgrid.vialer.reachability.ReachabilityReceiver) SetupActivity(com.voipgrid.vialer.onboarding.SetupActivity) PhoneAccountHelper(com.voipgrid.vialer.util.PhoneAccountHelper) SystemUser(com.voipgrid.vialer.api.models.SystemUser) FloatingActionButton(android.support.design.widget.FloatingActionButton) JsonStorage(com.voipgrid.vialer.util.JsonStorage) AccountFragment(com.voipgrid.vialer.onboarding.AccountFragment)

Aggregations

PhoneAccountHelper (com.voipgrid.vialer.util.PhoneAccountHelper)3 Intent (android.content.Intent)2 JsonStorage (com.voipgrid.vialer.util.JsonStorage)2 Bundle (android.os.Bundle)1 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 EditText (android.widget.EditText)1 AccountActivity (com.voipgrid.vialer.AccountActivity)1 SystemUser (com.voipgrid.vialer.api.models.SystemUser)1 AccountFragment (com.voipgrid.vialer.onboarding.AccountFragment)1 SetupActivity (com.voipgrid.vialer.onboarding.SetupActivity)1 ReachabilityReceiver (com.voipgrid.vialer.reachability.ReachabilityReceiver)1 ConnectivityHelper (com.voipgrid.vialer.util.ConnectivityHelper)1 UpdateActivity (com.voipgrid.vialer.util.UpdateActivity)1