conversations-classic/src/main/java/eu/siacs/conversations/ui/ActionBarActivity.java

29 lines
867 B
Java
Raw Normal View History

2018-03-11 18:09:35 +00:00
package eu.siacs.conversations.ui;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
2018-10-19 00:30:33 +00:00
import android.view.MenuItem;
2018-03-11 18:09:35 +00:00
public abstract class ActionBarActivity extends AppCompatActivity {
public static void configureActionBar(ActionBar actionBar) {
configureActionBar(actionBar, true);
}
public static void configureActionBar(ActionBar actionBar, boolean upNavigation) {
2018-03-11 18:09:35 +00:00
if (actionBar != null) {
actionBar.setHomeButtonEnabled(upNavigation);
actionBar.setDisplayHomeAsUpEnabled(upNavigation);
2018-03-11 18:09:35 +00:00
}
}
2018-10-19 00:30:33 +00:00
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
}
return super.onOptionsItemSelected(item);
}
2018-03-11 18:09:35 +00:00
}