Action bar icon as up
This commit is contained in:
parent
9154f9b508
commit
2396de20a4
@ -94,13 +94,16 @@ public class ActivityUi extends BaseUi {
|
||||
onCreate((Activity) activity);
|
||||
final ActionBar actionBar = activity.getSupportActionBar();
|
||||
actionBar.setDisplayUseLogoEnabled(false);
|
||||
actionBar.setDisplayHomeAsUpEnabled(false);
|
||||
final boolean homeAsUp = !(activity instanceof CalculatorActivity);
|
||||
actionBar.setDisplayHomeAsUpEnabled(homeAsUp);
|
||||
actionBar.setHomeButtonEnabled(false);
|
||||
actionBar.setDisplayShowHomeEnabled(true);
|
||||
|
||||
toggleTitle(activity, true);
|
||||
|
||||
if (!homeAsUp) {
|
||||
actionBar.setIcon(R.drawable.ab_icon);
|
||||
}
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package org.solovyev.android.calculator;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@ -70,4 +71,14 @@ public class BaseActivity extends ActionBarActivity {
|
||||
super.onDestroy();
|
||||
ui.onDestroy(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user