Show current highlighter in as ActionBar subtitle

This commit is contained in:
fkloft 2013-09-24 14:38:29 +02:00
parent 3172fc4e69
commit 2765200d0b
2 changed files with 16 additions and 1 deletions

View File

@ -177,7 +177,7 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (mLoading) return;
if (parent.equals(mSpinnerHighlighter)) {
String name = mHighlighters.getItem(position);
mIitc.getWebView().loadUrl("javascript: window.changePortalHighlights('" + name + "')");
@ -201,6 +201,8 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
mBaseLayers.clear();
mOverlayLayers.clear();
mIitc.getNavigationHelper().setHighlighter(null);
mLoading = true;
}
@ -210,6 +212,8 @@ public class IITC_MapSettings implements OnItemSelectedListener, OnItemClickList
int position = mHighlighters.getPosition(mActiveHighlighter);
if (position >= 0 && position < mHighlighters.getCount())
mSpinnerHighlighter.setSelection(position);
mIitc.getNavigationHelper().setHighlighter(name);
}
public void setLayers(String base_layer, String overlay_layer) {

View File

@ -111,6 +111,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
private boolean mIsLoading;
private boolean mHideInFullscreen = false;
private Pane mPane = Pane.MAP;
private String mHighlighter = null;
public IITC_NavigationHelper(IITC_Mobile activity, ActionBar bar) {
super(activity, (DrawerLayout) activity.findViewById(R.id.drawer_layout),
@ -217,6 +218,11 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
mActionBar.setTitle(getPaneTitle(mPane));
}
if (!isDrawerOpened() && (mDesktopMode || mPane == Pane.MAP))
mActionBar.setSubtitle(mHighlighter);
else
mActionBar.setSubtitle(null);
if (mFullscreen && mHideInFullscreen)
mActionBar.hide();
else
@ -317,6 +323,11 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
updateActionBar();
}
public void setHighlighter(String name) {
mHighlighter = name;
updateActionBar();
}
public void setLoadingState(boolean isLoading) {
mIsLoading = isLoading;
updateActionBar();