Search in sources :

Example 1 with AccountEditorFragment

use of com.xabber.android.ui.preferences.AccountEditorFragment in project xabber-android by redsolution.

the class AccountViewer method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Intent intent = getIntent();
    account = getAccount(intent);
    if (account == null) {
        finish();
        return;
    }
    accountItem = AccountManager.getInstance().getAccount(account);
    if (accountItem == null) {
        Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
        finish();
        return;
    }
    if (intent != null) {
        showAccountInfo = intent.getBooleanExtra(INTENT_SHOW_ACCOUNT_INFO, true);
    }
    if (!accountItem.getFactualStatusMode().isOnline()) {
        showAccountInfo = false;
    }
    setContentView(R.layout.account_viewer);
    toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.inflateMenu(ACCOUNT_VIEWER_MENU);
    toolbar.setOnMenuItemClickListener(this);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NavUtils.navigateUpFromSameTask(AccountViewer.this);
        }
    });
    barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    bestContact = RosterManager.getInstance().getBestContact(account, Jid.getBareAddress(account));
    contactTitleView = findViewById(R.id.contact_title_expanded);
    contactTitleView.setBackgroundColor(barPainter.getAccountPainter().getAccountMainColor(account));
    statusIcon = findViewById(R.id.status_icon);
    statusText = (TextView) findViewById(R.id.status_text);
    preferencesFragmentContainer = findViewById(R.id.fragment_container);
    vCardFragmentContainer = findViewById(R.id.scrollable_container);
    if (savedInstanceState == null) {
        getFragmentManager().beginTransaction().add(R.id.scrollable_container, ContactVcardViewerFragment.newInstance(account, Jid.getBareAddress(account))).add(R.id.fragment_container, new AccountEditorFragment()).commit();
    } else {
        showAccountInfo = savedInstanceState.getBoolean(SAVE_SHOW_ACCOUNT_INFO);
    }
    if (showAccountInfo) {
        showAccountInfo();
    } else {
        showAccountSettings();
    }
}
Also used : AccountEditorFragment(com.xabber.android.ui.preferences.AccountEditorFragment) Intent(android.content.Intent) View(android.view.View) TextView(android.widget.TextView) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 2 with AccountEditorFragment

use of com.xabber.android.ui.preferences.AccountEditorFragment in project xabber-android by redsolution.

the class AccountSettingsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_account_settings);
    account = getAccount(getIntent());
    accountItem = AccountManager.getInstance().getAccount(this.account);
    if (accountItem == null) {
        LogManager.e(LOG_TAG, "Account item is null " + account);
        finish();
        return;
    }
    toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setTitle(R.string.account_connection_settings);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    toolbar.inflateMenu(R.menu.toolbar_account_connection_settings);
    toolbar.setOnMenuItemClickListener(this);
    barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    if (savedInstanceState == null) {
        getFragmentManager().beginTransaction().add(R.id.account_settings_fragment, new AccountEditorFragment()).commit();
    }
}
Also used : AccountEditorFragment(com.xabber.android.ui.preferences.AccountEditorFragment) View(android.view.View) BarPainter(com.xabber.android.ui.color.BarPainter)

Aggregations

View (android.view.View)2 BarPainter (com.xabber.android.ui.color.BarPainter)2 AccountEditorFragment (com.xabber.android.ui.preferences.AccountEditorFragment)2 Intent (android.content.Intent)1 TextView (android.widget.TextView)1