Search in sources :

Example 6 with ContactTitleActionBarInflater

use of com.xabber.android.ui.helper.ContactTitleActionBarInflater in project xabber-android by redsolution.

the class QuestionActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) {
        return;
    }
    Intent intent = getIntent();
    account = QuestionActivity.getAccount(intent);
    user = QuestionActivity.getUser(intent);
    if (AccountManager.getInstance().getAccount(account) == null || user == null) {
        Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
        finish();
        return;
    }
    if (intent.getBooleanExtra(EXTRA_FIELD_CANCEL, false)) {
        try {
            OTRManager.getInstance().abortSmp(account, user);
        } catch (NetworkException e) {
            Application.getInstance().onError(e);
        }
        finish();
        return;
    }
    showQuestion = intent.getBooleanExtra(EXTRA_FIELD_SHOW_QUESTION, true);
    answerRequest = intent.getBooleanExtra(EXTRA_FIELD_ANSWER_REQUEST, false);
    if (showQuestion) {
        setContentView(R.layout.activity_question);
        questionView = (EditText) findViewById(R.id.question);
        questionView.setEnabled(!answerRequest);
        if (answerRequest) {
            questionView.setText(intent.getStringExtra(Intent.EXTRA_TEXT));
        } else {
            findViewById(R.id.cancel).setVisibility(View.GONE);
        }
    } else {
        setContentView(R.layout.secret_viewer);
    }
    findViewById(R.id.cancel).setOnClickListener(this);
    findViewById(R.id.send).setOnClickListener(this);
    contactTitleActionBarInflater = new ContactTitleActionBarInflater(this);
    contactTitleActionBarInflater.setUpActionBarView();
}
Also used : ContactTitleActionBarInflater(com.xabber.android.ui.helper.ContactTitleActionBarInflater) Intent(android.content.Intent) NetworkException(com.xabber.android.data.NetworkException)

Aggregations

Intent (android.content.Intent)6 ContactTitleActionBarInflater (com.xabber.android.ui.helper.ContactTitleActionBarInflater)6 Toolbar (android.support.v7.widget.Toolbar)3 IntentIntegrator (com.google.zxing.integration.android.IntentIntegrator)2 NetworkException (com.xabber.android.data.NetworkException)2