nav settings screen fixes
This commit is contained in:
parent
905a6eda60
commit
a2a46b1838
4 changed files with 21 additions and 8 deletions
|
@ -11,6 +11,7 @@
|
||||||
Thx - Hardy
|
Thx - Hardy
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
<string name="app_profile_custom_nav_subtitle"></string>
|
||||||
<string name="profile_name_hint">Profile Name</string>
|
<string name="profile_name_hint">Profile Name</string>
|
||||||
<string name="nav_type_hint">Navigation Type</string>
|
<string name="nav_type_hint">Navigation Type</string>
|
||||||
<string name="app_mode_taxi">Taxi</string>
|
<string name="app_mode_taxi">Taxi</string>
|
||||||
|
|
|
@ -20,6 +20,7 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
@ -37,11 +38,13 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
|
||||||
public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
||||||
implements OnPreferenceChangeListener, OnPreferenceClickListener {
|
implements OnPreferenceChangeListener, OnPreferenceClickListener {
|
||||||
|
|
||||||
|
private static final Log LOG = PlatformUtil.getLog(SettingsBaseActivity.class);
|
||||||
public static final String INTENT_APP_MODE = "INTENT_APP_MODE";
|
public static final String INTENT_APP_MODE = "INTENT_APP_MODE";
|
||||||
|
|
||||||
protected OsmandSettings settings;
|
protected OsmandSettings settings;
|
||||||
|
@ -359,12 +362,20 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
||||||
isSelected = true;
|
isSelected = true;
|
||||||
}
|
}
|
||||||
if (am != ApplicationMode.DEFAULT) {
|
if (am != ApplicationMode.DEFAULT) {
|
||||||
|
String descr;
|
||||||
|
if (am.getParent() == null) {
|
||||||
|
descr = getString(R.string.profile_type_base_string);
|
||||||
|
} else {
|
||||||
|
descr = String.format(getString(R.string.profile_type_descr_string),
|
||||||
|
am.getParent().toHumanString(getMyApplication()));
|
||||||
|
if (am.getRoutingProfile().contains("/")) {
|
||||||
|
descr = descr.concat(", " + am.getRoutingProfile()
|
||||||
|
.substring(0, am.getRoutingProfile().indexOf("/")));
|
||||||
|
}
|
||||||
|
}
|
||||||
activeModes.add(new ProfileDataObject(
|
activeModes.add(new ProfileDataObject(
|
||||||
am.toHumanString(getMyApplication()),
|
am.toHumanString(getMyApplication()),
|
||||||
am.getParent() == null
|
descr,
|
||||||
? getString(R.string.profile_type_base_string)
|
|
||||||
: String.format(getString(R.string.profile_type_descr_string),
|
|
||||||
am.getParent().toHumanString(getMyApplication())),
|
|
||||||
am.getStringKey(),
|
am.getStringKey(),
|
||||||
am.getIconRes(getMyApplication()),
|
am.getIconRes(getMyApplication()),
|
||||||
isSelected
|
isSelected
|
||||||
|
@ -413,7 +424,7 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
||||||
.capitalizeFirstLetterAndLowercase(mode.getParent().getStringKey()));
|
.capitalizeFirstLetterAndLowercase(mode.getParent().getStringKey()));
|
||||||
getModeTitleTV().setText(title);
|
getModeTitleTV().setText(title);
|
||||||
getModeSubTitleTV().setText(subtitle);
|
getModeSubTitleTV().setText(subtitle);
|
||||||
getModeIconIV().setImageDrawable(getMyApplication().getUIUtilities().getIcon(mode.getSmallIconDark(),
|
getModeIconIV().setImageDrawable(getMyApplication().getUIUtilities().getIcon(mode.getIconRes(this),
|
||||||
getMyApplication().getSettings().isLightContent()
|
getMyApplication().getSettings().isLightContent()
|
||||||
? R.color.active_buttons_and_links_light
|
? R.color.active_buttons_and_links_light
|
||||||
: R.color.active_buttons_and_links_dark));
|
: R.color.active_buttons_and_links_dark));
|
||||||
|
@ -422,6 +433,7 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
||||||
? R.color.active_buttons_and_links_light
|
? R.color.active_buttons_and_links_light
|
||||||
: R.color.active_buttons_and_links_dark));
|
: R.color.active_buttons_and_links_dark));
|
||||||
settings.APPLICATION_MODE.set(mode);
|
settings.APPLICATION_MODE.set(mode);
|
||||||
|
previousAppMode = mode;
|
||||||
isModeSelected = true;
|
isModeSelected = true;
|
||||||
updateAllSettings();
|
updateAllSettings();
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
||||||
settings = getMyApplication().getSettings();
|
settings = getMyApplication().getSettings();
|
||||||
RouteService[] vls = RouteService.getAvailableRouters(getMyApplication());
|
RouteService[] vls = RouteService.getAvailableRouters(getMyApplication());
|
||||||
String[] entries = new String[vls.length];
|
String[] entries = new String[vls.length];
|
||||||
for(int i=0; i<entries.length; i++){
|
for (int i = 0; i < entries.length; i++) {
|
||||||
entries[i] = vls[i].getName();
|
entries[i] = vls[i].getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,8 @@ public class AppProfileArrayAdapter extends ArrayAdapter<ProfileDataObject> {
|
||||||
if (mode.isSelected()) {
|
if (mode.isSelected()) {
|
||||||
iconDrawable = getMyApp(context).getUIUtilities().getIcon(mode.getIconRes(),
|
iconDrawable = getMyApp(context).getUIUtilities().getIcon(mode.getIconRes(),
|
||||||
getMyApp(context).getSettings().isLightContent()
|
getMyApp(context).getSettings().isLightContent()
|
||||||
? R.color.active_buttons_and_links_dark
|
? R.color.ctx_menu_direction_color_light
|
||||||
: R.color.active_buttons_and_links_light
|
: R.color.active_buttons_and_links_dark
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
iconDrawable = getMyApp(context).getUIUtilities()
|
iconDrawable = getMyApp(context).getUIUtilities()
|
||||||
|
|
Loading…
Reference in a new issue