package epson.print;

import android.view.MenuItem;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

/**
 * 基类
 */
public abstract class ActivityIACommon extends AppCompatActivity {
    protected void setActionBar(int i, boolean z) {
        setActionBar(getResources().getString(i), z);
    }

    protected void setActionBar(String str, boolean z) {
        setTitle(str);
        setSupportActionBar((Toolbar) findViewById(R.id.navigation_bar));
        if (z) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() != 16908332) {
            return super.onOptionsItemSelected(menuItem);
        }
        onBackPressed();
        return true;
    }
}
