Search in sources :

Example 6 with BarPainter

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

the class OccupantList method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) {
        return;
    }
    account = getAccount(getIntent());
    room = Jid.getBareAddress(getUser(getIntent()));
    if (account == null || room == null || !MUCManager.getInstance().hasRoom(account, room)) {
        Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
        finish();
        return;
    }
    setContentView(R.layout.list);
    final 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) {
            NavUtils.navigateUpFromSameTask(OccupantList.this);
        }
    });
    toolbar.setTitle(room);
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    listAdapter = new OccupantListAdapter(this, account, room);
    setListAdapter(listAdapter);
    getListView().setOnItemClickListener(this);
}
Also used : OccupantListAdapter(com.xabber.android.ui.adapter.OccupantListAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) Toolbar(android.support.v7.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 7 with BarPainter

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

the class BasePhrasePreferences method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_with_toolbar_and_container);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.setDefaultColor();
    if (savedInstanceState == null) {
        getFragmentManager().beginTransaction().add(R.id.fragment_container, new PhraseEditorFragment()).commit();
    }
}
Also used : Toolbar(android.support.v7.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 8 with BarPainter

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

the class ChatContactSettings method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    account = getAccount(getIntent());
    user = getUser(getIntent());
    accountItem = AccountManager.getInstance().getAccount(account);
    if (accountItem == null || user == null) {
        Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
        finish();
        return;
    }
    setContentView(R.layout.activity_with_toolbar_and_container);
    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(ChatContactSettings.this);
        }
    });
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    if (savedInstanceState == null) {
        getFragmentManager().beginTransaction().add(R.id.fragment_container, new ChatContactSettingsFragment()).commit();
    }
}
Also used : View(android.view.View) Toolbar(android.support.v7.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 9 with BarPainter

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

the class XabberAccountInfoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // handle call from
    Bundle extras = getIntent().getExtras();
    if (extras != null)
        callFrom = extras.getString(CALL_FROM);
    setContentView(R.layout.activity_xabber_account_info);
    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.inflateMenu(R.menu.toolbar_xabber_account_info);
    toolbar.setOnMenuItemClickListener(this);
    barPainter = new BarPainter(this, toolbar);
}
Also used : Bundle(android.os.Bundle) View(android.view.View) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 10 with BarPainter

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

the class AccountActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Intent intent = getIntent();
    account = getAccount(intent);
    if (account == null) {
        LogManager.i(LOG_TAG, "Account is null, finishing!");
        finish();
        return;
    }
    accountItem = AccountManager.getInstance().getAccount(account);
    if (accountItem == null) {
        Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
        finish();
        return;
    }
    if (ACTION_CONNECTION_SETTINGS.equals(intent.getAction())) {
        isConnectionSettingsAction = true;
        startAccountSettingsActivity();
        setIntent(null);
    }
    setContentView(R.layout.activity_account);
    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) {
            NavUtils.navigateUpFromSameTask(AccountActivity.this);
        }
    });
    toolbar.setTitle(R.string.contact_account);
    toolbar.inflateMenu(R.menu.toolbar_account);
    MenuItem item = toolbar.getMenu().findItem(R.id.action_account_switch);
    switchCompat = (SwitchCompat) item.getActionView().findViewById(R.id.account_switch_view);
    switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            AccountManager.getInstance().setEnabled(accountItem.getAccount(), isChecked);
        }
    });
    barPainter = new BarPainter(this, toolbar);
    UserJid fakeAccountUser;
    try {
        fakeAccountUser = UserJid.from(account.getFullJid().asBareJid());
    } catch (UserJid.UserJidCreateException e) {
        throw new IllegalStateException();
    }
    bestContact = RosterManager.getInstance().getBestContact(account, fakeAccountUser);
    contactTitleView = findViewById(R.id.contact_title_expanded);
    statusIcon = findViewById(R.id.ivStatus);
    statusText = (TextView) findViewById(R.id.status_text);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.account_options_recycler_view);
    accountOptionsAdapter = new AccountOptionsAdapter(AccountOption.getValues(), this, accountItem);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(accountOptionsAdapter);
    recyclerView.setNestedScrollingEnabled(false);
    Fragment fragmentById = getFragmentManager().findFragmentById(R.id.account_fragment_container);
    if (fragmentById == null) {
        getSupportFragmentManager().beginTransaction().add(R.id.account_fragment_container, ContactVcardViewerFragment.newInstance(account)).commit();
    }
}
Also used : UserJid(com.xabber.android.data.entity.UserJid) Intent(android.content.Intent) MenuItem(android.view.MenuItem) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) ContactVcardViewerFragment(com.xabber.android.ui.fragment.ContactVcardViewerFragment) Fragment(android.app.Fragment) BarPainter(com.xabber.android.ui.color.BarPainter) AccountOptionsAdapter(com.xabber.android.ui.adapter.accountoptions.AccountOptionsAdapter) RecyclerView(androidx.recyclerview.widget.RecyclerView) CompoundButton(android.widget.CompoundButton) Toolbar(androidx.appcompat.widget.Toolbar)

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