ConferenceSelectActivity.java 1.72 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
package com.xabber.android.ui;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.xabber.android.R;
import com.xabber.android.data.intent.EntityIntentBuilder;
import com.xabber.android.ui.helper.BarPainter;
import com.xabber.android.ui.helper.ManagedActivity;

15
public class ConferenceSelectActivity extends ManagedActivity implements ConferenceSelectFragment.Listener {
16 17 18 19

    private BarPainter barPainter;

    public static Intent createIntent(Context context) {
20
        return new EntityIntentBuilder(context, ConferenceSelectActivity.class).build();
21 22 23 24 25 26 27 28 29 30 31 32 33
    }

    @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);
        toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
34
                NavUtils.navigateUpFromSameTask(ConferenceSelectActivity.this);
35 36 37 38 39 40 41
            }
        });
        toolbar.setTitle(getString(R.string.muc_choose_conference));

        barPainter = new BarPainter(this, toolbar);
        barPainter.setDefaultColor();

42
        if (savedInstanceState == null) {
43
            getFragmentManager().beginTransaction().add(R.id.fragment_container, new ConferenceSelectFragment()).commit();
44
        }
45 46 47 48 49 50 51
    }

    @Override
    public void onAccountSelected(String account) {
        barPainter.updateWithAccountName(account);
    }
}