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;
|
|
|
|
|
2021-01-18 17:26:46 +00:00
|
|
|
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) {
|
2018-10-23 19:25:38 +00:00
|
|
|
configureActionBar(actionBar, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void configureActionBar(ActionBar actionBar, boolean upNavigation) {
|
2018-03-11 18:09:35 +00:00
|
|
|
if (actionBar != null) {
|
2018-10-23 19:25:38 +00:00
|
|
|
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
|
|
|
}
|