Merge pull request #7033 from osmandapp/nav_settings_issues
Nav settings issues
This commit is contained in:
commit
3a73b5738f
5 changed files with 27 additions and 20 deletions
|
@ -101,12 +101,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_shadow2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_bottom"/>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="app_profile_custom_nav_subtitle"></string>
|
||||
<string name="rate_dialog_descr">Please give us 30 seconds, share feedback and rate our work on Google Play.</string>
|
||||
<string name="button_rate">Rate</string>
|
||||
<string name="shared_string_privacy_policy">Privacy Policy</string>
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -37,11 +38,13 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import net.osmand.util.Algorithms;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
|
||||
public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
||||
implements OnPreferenceChangeListener, OnPreferenceClickListener {
|
||||
|
||||
private static final Log LOG = PlatformUtil.getLog(SettingsBaseActivity.class);
|
||||
public static final String INTENT_APP_MODE = "INTENT_APP_MODE";
|
||||
|
||||
protected OsmandSettings settings;
|
||||
|
@ -361,10 +364,7 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
|||
if (am != ApplicationMode.DEFAULT) {
|
||||
activeModes.add(new ProfileDataObject(
|
||||
am.toHumanString(getMyApplication()),
|
||||
am.getParent() == null
|
||||
? getString(R.string.profile_type_base_string)
|
||||
: String.format(getString(R.string.profile_type_descr_string),
|
||||
am.getParent().toHumanString(getMyApplication())),
|
||||
getAppModeDescription(am),
|
||||
am.getStringKey(),
|
||||
am.getIconRes(getMyApplication()),
|
||||
isSelected
|
||||
|
@ -406,14 +406,10 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
|||
String title = Algorithms.isEmpty(mode.getUserProfileName())
|
||||
? mode.toHumanString(SettingsBaseActivity.this)
|
||||
: mode.getUserProfileName();
|
||||
String subtitle = mode.getParent() == null
|
||||
? String.format(getString(R.string.settings_routing_mode_string), Algorithms
|
||||
.capitalizeFirstLetterAndLowercase(mode.getStringKey().replace("_", "")))
|
||||
: String.format(getString(R.string.settings_derived_routing_mode_string), Algorithms
|
||||
.capitalizeFirstLetterAndLowercase(mode.getParent().getStringKey()));
|
||||
|
||||
getModeTitleTV().setText(title);
|
||||
getModeSubTitleTV().setText(subtitle);
|
||||
getModeIconIV().setImageDrawable(getMyApplication().getUIUtilities().getIcon(mode.getSmallIconDark(),
|
||||
getModeSubTitleTV().setText(getAppModeDescription(mode));
|
||||
getModeIconIV().setImageDrawable(getMyApplication().getUIUtilities().getIcon(mode.getIconRes(this),
|
||||
getMyApplication().getSettings().isLightContent()
|
||||
? R.color.active_buttons_and_links_light
|
||||
: R.color.active_buttons_and_links_dark));
|
||||
|
@ -422,10 +418,26 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
|||
? R.color.active_buttons_and_links_light
|
||||
: R.color.active_buttons_and_links_dark));
|
||||
settings.APPLICATION_MODE.set(mode);
|
||||
previousAppMode = mode;
|
||||
isModeSelected = true;
|
||||
updateAllSettings();
|
||||
}
|
||||
|
||||
private String getAppModeDescription(ApplicationMode mode) {
|
||||
String descr;
|
||||
if (mode.getParent() == null) {
|
||||
descr = getString(R.string.profile_type_base_string);
|
||||
} else {
|
||||
descr = String.format(getString(R.string.profile_type_descr_string),
|
||||
mode.getParent().toHumanString(getMyApplication()));
|
||||
if (mode.getRoutingProfile().contains("/")) {
|
||||
descr = descr.concat(", " + mode.getRoutingProfile()
|
||||
.substring(0, mode.getRoutingProfile().indexOf("/")));
|
||||
}
|
||||
}
|
||||
return descr;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
|
|
@ -85,7 +85,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
settings = getMyApplication().getSettings();
|
||||
RouteService[] vls = RouteService.getAvailableRouters(getMyApplication());
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ public class AppProfileArrayAdapter extends ArrayAdapter<ProfileDataObject> {
|
|||
if (mode.isSelected()) {
|
||||
iconDrawable = getMyApp(context).getUIUtilities().getIcon(mode.getIconRes(),
|
||||
getMyApp(context).getSettings().isLightContent()
|
||||
? R.color.active_buttons_and_links_dark
|
||||
: R.color.active_buttons_and_links_light
|
||||
? R.color.ctx_menu_direction_color_light
|
||||
: R.color.active_buttons_and_links_dark
|
||||
);
|
||||
} else {
|
||||
iconDrawable = getMyApp(context).getUIUtilities()
|
||||
|
|
Loading…
Reference in a new issue