conversations-classic/src/main/java/eu/siacs/conversations/ui/ActionBarActivity.java
2018-10-31 13:33:55 +01:00

29 lines
867 B
Java

package eu.siacs.conversations.ui;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
public abstract class ActionBarActivity extends AppCompatActivity {
public static void configureActionBar(ActionBar actionBar) {
configureActionBar(actionBar, true);
}
public static void configureActionBar(ActionBar actionBar, boolean upNavigation) {
if (actionBar != null) {
actionBar.setHomeButtonEnabled(upNavigation);
actionBar.setDisplayHomeAsUpEnabled(upNavigation);
}
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
}
return super.onOptionsItemSelected(item);
}
}