Reduce text scale for car rendering + move text scale setting to other on screen widget settings

This commit is contained in:
Victor Shcherb 2014-09-29 01:13:49 +03:00
parent 13153bec28
commit 6ee4bd2790
3 changed files with 31 additions and 14 deletions

View file

@ -42,7 +42,6 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
return true; return true;
} }
}); });
addTextScale(grp);
addSpeechRateSetting(grp); addSpeechRateSetting(grp);
grp.addPreference(accessibilityModePreference); grp.addPreference(accessibilityModePreference);
@ -86,18 +85,6 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
} }
protected void addTextScale(PreferenceGroup grp) {
Float[] txtValues = new Float[] {0.75f, 1f, 1.25f, 1.5f, 2f, 3f} ;
String[] txtNames = new String[txtValues.length];
for(int i = 0; i < txtNames.length; i++) {
txtNames[i] = (int)(txtValues[i] * 100) + " %";
}
grp.addPreference(createListPreference(settings.TEXT_SCALE, txtNames, txtValues, R.string.text_size, R.string.text_size_descr));
}
protected void addSpeechRateSetting(PreferenceGroup grp) { protected void addSpeechRateSetting(PreferenceGroup grp) {
Float[] sprValues = new Float[] {0.5f, 0.75f, 1f, 1.25f, 1.5f, 2f} ; Float[] sprValues = new Float[] {0.5f, 0.75f, 1f, 1.25f, 1.5f, 2f} ;
String[] sprNames = new String[sprValues.length]; String[] sprNames = new String[sprValues.length];

View file

@ -702,7 +702,7 @@ public class OsmandSettings {
public final CommonPreference<Float> TEXT_SCALE = new FloatPreference("text_scale", 1f).makeProfile().cache(); public final CommonPreference<Float> TEXT_SCALE = new FloatPreference("text_scale", 1f).makeProfile().cache();
{ {
TEXT_SCALE.setModeDefaultValue(ApplicationMode.CAR, 1.5f); TEXT_SCALE.setModeDefaultValue(ApplicationMode.CAR, 1.25f);
} }
public final CommonPreference<Float> MAP_ZOOM_SCALE_BY_DENSITY = new FloatPreference("map_zoom_scale_wo_density", 0f).makeProfile().cache(); public final CommonPreference<Float> MAP_ZOOM_SCALE_BY_DENSITY = new FloatPreference("map_zoom_scale_wo_density", 0f).makeProfile().cache();

View file

@ -18,6 +18,7 @@ import net.osmand.render.RenderingRulesStorage;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.preference.PreferenceGroup;
import android.widget.Toast; import android.widget.Toast;
public class AppearanceWidgetsFactory { public class AppearanceWidgetsFactory {
@ -53,6 +54,35 @@ public class AppearanceWidgetsFactory {
view.refreshMap(); view.refreshMap();
} }
}); });
MapWidgetRegistry.MapWidgetRegInfo w = mapInfoControls.registerAppearanceWidget(R.drawable.widget_no_icon,
R.string.text_size, "text_size", view.getSettings().TEXT_SCALE);
w.setStateChangeListener(new Runnable() {
@Override
public void run() {
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
//test old descr as title
b.setTitle(R.string.text_size);
final Float[] txtValues = new Float[] {0.75f, 1f, 1.25f, 1.5f, 2f, 3f} ;
int selected = -1;
final String[] txtNames = new String[txtValues.length];
for (int i = 0; i < txtNames.length; i++) {
txtNames[i] = (int) (txtValues[i] * 100) + " %";
if (view.getSettings().TEXT_SCALE.get() == txtValues[i]) {
selected = i;
}
}
b.setSingleChoiceItems(txtNames, selected, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
view.getSettings().TEXT_SCALE.set(txtValues[which]);
view.getApplication().getResourceManager().getRenderer().clearCache();
view.refreshMap(true);
dialog.dismiss();
}
});
b.show();
}
});
final MapWidgetRegistry.MapWidgetRegInfo showDestinationArrow = mapInfoControls.registerAppearanceWidget(R.drawable.widget_show_destination_arrow, R.string.map_widget_show_destination_arrow, final MapWidgetRegistry.MapWidgetRegInfo showDestinationArrow = mapInfoControls.registerAppearanceWidget(R.drawable.widget_show_destination_arrow, R.string.map_widget_show_destination_arrow,
"show_destination_arrow", view.getSettings().SHOW_DESTINATION_ARROW); "show_destination_arrow", view.getSettings().SHOW_DESTINATION_ARROW);