Search in sources :

Example 21 with BarPainter

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

the class ServerInfoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_server_info);
    final Intent intent = getIntent();
    AccountJid 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;
    }
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    toolbar.setTitle(accountItem.getConnection().getXMPPServiceDomain());
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.server_info_recycler_view);
    serverInfoAdapter = new ServerInfoAdapter();
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(serverInfoAdapter);
    progressBar = findViewById(R.id.server_info_progress_bar);
    requestServerInfo();
}
Also used : ServerInfoAdapter(com.xabber.android.ui.adapter.ServerInfoAdapter) AccountJid(com.xabber.android.data.entity.AccountJid) Intent(android.content.Intent) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 22 with BarPainter

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

the class StatusEditActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) {
        return;
    }
    actionWithItem = null;
    setContentView(R.layout.activity_status);
    Toolbar toolbar = ToolbarHelper.setUpDefaultToolbar(this, null, R.drawable.ic_clear_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    toolbar.inflateMenu(R.menu.toolbar_set_status);
    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            return onOptionsItemSelected(item);
        }
    });
    Intent intent = getIntent();
    account = StatusEditActivity.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) AccountItem(com.xabber.android.data.account.AccountItem) StatusEditorAdapter(com.xabber.android.ui.adapter.StatusEditorAdapter) MenuItem(android.view.MenuItem) Intent(android.content.Intent) StatusModeAdapter(com.xabber.android.ui.adapter.StatusModeAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) BarPainter(com.xabber.android.ui.color.BarPainter) ListView(android.widget.ListView) LayoutInflater(android.view.LayoutInflater) Toolbar(androidx.appcompat.widget.Toolbar)

Example 23 with BarPainter

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

the class ConnectionSettings 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_connection));
    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 ConnectionSettingsFragment()).commit();
    }
}
Also used : Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 24 with BarPainter

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

the class ContactListSettings 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_contacts));
    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 ContactListSettingsFragment()).commit();
    }
}
Also used : Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 25 with BarPainter

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

the class PhraseEditor method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    index = getPhraseIndex(getIntent());
    if (index == null) {
        finish();
        return;
    }
    Phrase phrase = PhraseManager.getInstance().getPhrase(index);
    if (phrase == null) {
        finish();
        return;
    }
    setPhrase(phrase);
    String title = phrase.getText();
    if ("".equals(title))
        title = Application.getInstance().getString(R.string.phrase_empty);
    Toolbar toolbar = ToolbarHelper.setUpDefaultToolbar(this, title);
    toolbar.inflateMenu(R.menu.toolbar_delete);
    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) Phrase(com.xabber.android.data.message.phrase.Phrase) Toolbar(androidx.appcompat.widget.Toolbar) 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