Search in sources :

Example 26 with BarPainter

use of com.xabber.android.ui.color.BarPainter in project xabber-android by redsolution.

the class PrivacySettings method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing())
        return;
    setContentView(R.layout.activity_with_toolbar_and_container);
    String title = PreferenceSummaryHelperActivity.getPreferenceTitle(getString(R.string.preference_privacy));
    Toolbar toolbar = ToolbarHelper.setUpDefaultToolbar(this, title);
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.setDefaultColor();
    if (savedInstanceState == null) {
        getFragmentManager().beginTransaction().add(R.id.fragment_container, new PrivacySettingsFragment()).commit();
    }
}
Also used : Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 27 with BarPainter

use of com.xabber.android.ui.color.BarPainter in project xabber-android by redsolution.

the class CustomNotifySettings method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_with_toolbar_and_container);
    account = EntityIntentBuilder.getAccount(getIntent());
    user = EntityIntentBuilder.getUser(getIntent());
    group = getIntent().getStringExtra(GROUP_KEY);
    phraseID = getIntent().getLongExtra(PHRASE_ID_KEY, -1);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setTitle(getTitle());
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NavUtils.navigateUpFromSameTask(CustomNotifySettings.this);
        }
    });
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    if (savedInstanceState == null) {
        Key key = Key.createKey(account, user, group, phraseID);
        if (key == null)
            finish();
        getFragmentManager().beginTransaction().add(R.id.fragment_container, CustomNotifSettingsFragment.createInstance(this, key)).commit();
    }
}
Also used : View(android.view.View) Key(com.xabber.android.data.notification.custom_notification.Key) Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 28 with BarPainter

use of com.xabber.android.ui.color.BarPainter in project xabber-android by redsolution.

the class PhraseAdder method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Toolbar toolbar = ToolbarHelper.setUpDefaultToolbar(this, getString(R.string.phrase_add), R.drawable.ic_clear_white_24dp);
    toolbar.inflateMenu(R.menu.toolbar_save);
    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            return onOptionsItemSelected(item);
        }
    });
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.setDefaultColor();
}
Also used : MenuItem(android.view.MenuItem) Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 29 with BarPainter

use of com.xabber.android.ui.color.BarPainter in project xabber-android by redsolution.

the class StatusEditor method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) {
        return;
    }
    actionWithItem = null;
    setContentView(R.layout.status_editor);
    Toolbar toolbar = (Toolbar) findViewById(R.id.top_toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_clear_white_24dp);
    setTitle(null);
    setSupportActionBar(toolbar);
    Intent intent = getIntent();
    account = StatusEditor.getAccount(intent);
    BarPainter barPainter = new BarPainter(this, toolbar);
    if (account != null) {
        barPainter.updateWithAccountName(account);
    } else {
        barPainter.setDefaultColor();
    }
    ListView listView = getListView();
    listView.setOnItemClickListener(this);
    registerForContextMenu(listView);
    adapter = new StatusEditorAdapter(this);
    View footerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.status_history_footer, null, false);
    footerView.findViewById(R.id.clear_status_history_button).setOnClickListener(this);
    listView.addFooterView(footerView);
    setListAdapter(adapter);
    statusTextView = (EditText) findViewById(R.id.status_text);
    statusModeView = (Spinner) findViewById(R.id.status_icon);
    statusModeView.setAdapter(new StatusModeAdapter(this));
    savedStatusesTextView = findViewById(R.id.saved_statuses_textview);
    StatusMode statusMode;
    String statusText;
    if (savedInstanceState == null) {
        if (account == null) {
            statusMode = SettingsManager.statusMode();
            statusText = SettingsManager.statusText();
        } else {
            AccountItem accountItem = AccountManager.getInstance().getAccount(account);
            if (accountItem == null) {
                Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
                finish();
                return;
            }
            statusMode = accountItem.getFactualStatusMode();
            statusText = accountItem.getStatusText();
        }
    } else {
        statusMode = StatusMode.valueOf(savedInstanceState.getString(SAVED_MODE));
        statusText = savedInstanceState.getString(SAVED_TEXT);
    }
    showStatus(statusMode, statusText);
}
Also used : StatusMode(com.xabber.android.data.account.StatusMode) ListView(android.widget.ListView) AccountItem(com.xabber.android.data.account.AccountItem) LayoutInflater(android.view.LayoutInflater) StatusEditorAdapter(com.xabber.android.ui.adapter.StatusEditorAdapter) Intent(android.content.Intent) StatusModeAdapter(com.xabber.android.ui.adapter.StatusModeAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Toolbar(android.support.v7.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 30 with BarPainter

use of com.xabber.android.ui.color.BarPainter in project xabber-android by redsolution.

the class AccountInfoEditor method onCreate.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_with_toolbar_and_container);
    Intent intent = getIntent();
    String account = getAccount(intent);
    String vCard = intent.getStringExtra(ARG_VCARD);
    if (AccountManager.getInstance().getAccount(account) == null) {
        Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
        setResult(RESULT_CANCELED);
        finish();
    }
    toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_clear_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    toolbar.setTitle(R.string.edit_account_user_info);
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    toolbar.inflateMenu(SAVE_MENU);
    toolbar.setOnMenuItemClickListener(this);
    boolean isSaveButtonEnabled = false;
    if (savedInstanceState == null) {
        getFragmentManager().beginTransaction().add(R.id.fragment_container, AccountInfoEditorFragment.newInstance(account, vCard)).commit();
    } else {
        isSaveButtonEnabled = savedInstanceState.getBoolean(ARGUMENT_SAVE_BUTTON_ENABLED);
    }
    toolbar.getMenu().findItem(R.id.action_save).setEnabled(isSaveButtonEnabled);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}
Also used : Intent(android.content.Intent) View(android.view.View) BarPainter(com.xabber.android.ui.color.BarPainter)

Aggregations

BarPainter (com.xabber.android.ui.color.BarPainter)48 View (android.view.View)26 Toolbar (androidx.appcompat.widget.Toolbar)26 Intent (android.content.Intent)15 Toolbar (android.support.v7.widget.Toolbar)8 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)8 TextView (android.widget.TextView)7 RecyclerView (androidx.recyclerview.widget.RecyclerView)7 AccountJid (com.xabber.android.data.entity.AccountJid)7 MenuItem (android.view.MenuItem)5 AdapterView (android.widget.AdapterView)4 Bundle (android.os.Bundle)2 LayoutInflater (android.view.LayoutInflater)2 ListView (android.widget.ListView)2 AccountItem (com.xabber.android.data.account.AccountItem)2 StatusMode (com.xabber.android.data.account.StatusMode)2 UserJid (com.xabber.android.data.entity.UserJid)2 OccupantListAdapter (com.xabber.android.ui.adapter.OccupantListAdapter)2 ServerInfoAdapter (com.xabber.android.ui.adapter.ServerInfoAdapter)2 StatusEditorAdapter (com.xabber.android.ui.adapter.StatusEditorAdapter)2