anotherim/src/main/java/eu/siacs/conversations/ui/ActionBarActivity.java

36 lines
1 KiB
Java
Raw Normal View History

2018-03-11 18:09:35 +00:00
package eu.siacs.conversations.ui;
2021-01-23 08:25:34 +00:00
import android.view.MenuItem;
import android.view.View;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
2021-01-23 08:25:34 +00:00
import androidx.appcompat.widget.Toolbar;
2018-10-19 00:30:33 +00:00
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
2021-01-23 08:25:34 +00:00
public void setSupportActionBar(View toolbar) {
super.setSupportActionBar((Toolbar) toolbar);
}
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
}