Added flag for action bar back button. Added back button for actionmode

This commit is contained in:
Denis 2015-01-29 14:47:48 +02:00
parent bed99dc1ea
commit 1aee28df26
7 changed files with 16 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -78,6 +78,8 @@
<item name="actionModeBackground">@color/actionbar_light_color</item> <item name="actionModeBackground">@color/actionbar_light_color</item>
<item name="actionBarStyle">@style/Widget.Styled.ActionBarLight</item> <item name="actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item> <item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
<item name="android:actionModeCloseDrawable">@drawable/action_mode_back</item>
<item name="actionModeCloseDrawable">@drawable/action_mode_back</item>
</style> </style>
<style name="OsmandDarkTheme" parent="Theme.AppCompat"> <style name="OsmandDarkTheme" parent="Theme.AppCompat">
@ -94,6 +96,8 @@
<item name="actionModeBackground">@color/actionbar_dark_color</item> <item name="actionModeBackground">@color/actionbar_dark_color</item>
<item name="actionBarStyle">@style/Widget.Styled.ActionBarDark</item> <item name="actionBarStyle">@style/Widget.Styled.ActionBarDark</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarDark</item> <item name="android:actionBarStyle">@style/Widget.Styled.ActionBarDark</item>
<item name="android:actionModeCloseDrawable">@drawable/action_mode_back</item>
<item name="actionModeCloseDrawable">@drawable/action_mode_back</item>
</style> </style>
<style name="OsmandLightDarkActionBarTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="OsmandLightDarkActionBarTheme" parent="Theme.AppCompat.Light.DarkActionBar">

View file

@ -144,6 +144,7 @@ public class MainMenuActivity extends BaseDownloadActivity implements OsmAndLoca
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
getMyApplication().applyTheme(this); getMyApplication().applyTheme(this);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
haveHomeButton = false;
if (getIntent() != null) { if (getIntent() != null) {
Intent intent = getIntent(); Intent intent = getIntent();
if (intent.getExtras() != null && intent.getExtras().containsKey(APP_EXIT_KEY)) { if (intent.getExtras() != null && intent.getExtras().containsKey(APP_EXIT_KEY)) {

View file

@ -13,6 +13,8 @@ import net.osmand.plus.R;
*/ */
public class OsmandActionBarActivity extends ActionBarActivity { public class OsmandActionBarActivity extends ActionBarActivity {
protected boolean haveHomeButton = true;
//should be called after set content view //should be called after set content view
protected void setupHomeButton(){ protected void setupHomeButton(){
Drawable back = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha); Drawable back = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
@ -25,18 +27,24 @@ public class OsmandActionBarActivity extends ActionBarActivity {
@Override @Override
public void setContentView(int layoutResID) { public void setContentView(int layoutResID) {
super.setContentView(layoutResID); super.setContentView(layoutResID);
if (haveHomeButton) {
setupHomeButton(); setupHomeButton();
} }
}
@Override @Override
public void setContentView(View view) { public void setContentView(View view) {
super.setContentView(view); super.setContentView(view);
if (haveHomeButton) {
setupHomeButton(); setupHomeButton();
} }
}
@Override @Override
public void setContentView(View view, ViewGroup.LayoutParams params) { public void setContentView(View view, ViewGroup.LayoutParams params) {
super.setContentView(view, params); super.setContentView(view, params);
if (haveHomeButton) {
setupHomeButton(); setupHomeButton();
} }
} }
}