Fix small issues
This commit is contained in:
parent
1c7c644e06
commit
37cd9f0bb3
4 changed files with 62 additions and 32 deletions
|
@ -3,10 +3,12 @@
|
|||
android:insetLeft="15dp"
|
||||
android:insetRight="15dp" >
|
||||
|
||||
<shape
|
||||
android:shape="line"
|
||||
android:height="1px"
|
||||
android:color="#FF404040">
|
||||
</shape>
|
||||
<stroke
|
||||
android:dashGap="1dp"
|
||||
android:dashWidth="1.5dp"
|
||||
android:width="1dp"
|
||||
android:color="#404040" />
|
||||
|
||||
<size android:height="3dp" />
|
||||
|
||||
</inset>
|
|
@ -77,6 +77,7 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
@ -776,8 +777,13 @@ public class MapActivityActions implements DialogProvider {
|
|||
public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
|
||||
OnContextMenuClick click = cm.getClickAdapter(which);
|
||||
if (click != null) {
|
||||
if (click.onContextMenuClick(listAdapter, cm.getElementId(which), which, false)) {
|
||||
mDrawerLayout.closeDrawer(mDrawerList);
|
||||
CompoundButton btn = (CompoundButton) view.findViewById(R.id.check_item);
|
||||
if (btn != null && btn.getVisibility() == View.VISIBLE) {
|
||||
btn.setChecked(!btn.isChecked());
|
||||
} else {
|
||||
if (click.onContextMenuClick(listAdapter, cm.getElementId(which), which, false)) {
|
||||
mDrawerLayout.closeDrawer(mDrawerList);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mDrawerLayout.closeDrawer(mDrawerList);
|
||||
|
@ -900,17 +906,13 @@ public class MapActivityActions implements DialogProvider {
|
|||
optionsMenuHelper.item(R.string.target_points).icons(R.drawable.ic_action_flage_dark, R.drawable.ic_action_flage_light)
|
||||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
|
||||
|
||||
final List<WaypointHelper.LocationPointWrapper> deletedPoints = new ArrayList<WaypointHelper.LocationPointWrapper>();
|
||||
ContextMenuAdapter cm = waypointDialogHelper.setListAdapter(app.getMapActivity(), mDrawerList, deletedPoints);
|
||||
|
||||
return false;
|
||||
} else {
|
||||
openIntermediatePointsDialog();
|
||||
return true;
|
||||
}
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos,
|
||||
boolean isChecked) {
|
||||
final List<WaypointHelper.LocationPointWrapper> deletedPoints = new ArrayList<WaypointHelper.LocationPointWrapper>();
|
||||
ContextMenuAdapter cm = waypointDialogHelper.setListAdapter(app.getMapActivity(),
|
||||
mDrawerList, deletedPoints);
|
||||
prepareOptionsMenu(cm);
|
||||
return false;
|
||||
}
|
||||
}).reg();
|
||||
}
|
||||
|
|
|
@ -125,10 +125,10 @@ public class ConfigureMapMenu {
|
|||
|
||||
private void createRenderingAttributeItems(final ContextMenuAdapter adapter, final MapActivity activity) {
|
||||
adapter.item(R.string.map_widget_map_rendering).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
|
||||
String descr = activity.getMyApplication().getRendererRegistry().getCurrentSelectedRenderer().getName();
|
||||
String descr = getRenderDescr(activity);
|
||||
adapter.item(R.string.map_widget_renderer).listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(activity);
|
||||
bld.setTitle(R.string.renderers);
|
||||
final OsmandApplication app = activity.getMyApplication();
|
||||
|
@ -157,6 +157,8 @@ public class ConfigureMapMenu {
|
|||
} else {
|
||||
AccessibleToast.makeText(app, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
adapter.setItemDescription(pos, getRenderDescr(activity));
|
||||
ad.notifyDataSetInvalidated();
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
|
@ -166,9 +168,9 @@ public class ConfigureMapMenu {
|
|||
}
|
||||
}).description(descr).layout(R.layout.drawer_list_doubleitem).reg();
|
||||
|
||||
adapter.item(R.string.map_widget_day_night).description(activity.getMyApplication().getSettings().DAYNIGHT_MODE.get().toHumanString(activity)).listen(new OnContextMenuClick() {
|
||||
adapter.item(R.string.map_widget_day_night).description(getDayNightDescr(activity)).listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||
final OsmandMapTileView view = activity.getMapView();
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext());
|
||||
bld.setTitle(R.string.daynight);
|
||||
|
@ -183,6 +185,8 @@ public class ConfigureMapMenu {
|
|||
view.getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.values()[which]);
|
||||
refreshMapComplete(activity);
|
||||
dialog.dismiss();
|
||||
adapter.setItemDescription(pos, getDayNightDescr(activity));
|
||||
ad.notifyDataSetInvalidated();
|
||||
}
|
||||
});
|
||||
bld.show();
|
||||
|
@ -190,10 +194,9 @@ public class ConfigureMapMenu {
|
|||
}
|
||||
}).layout(R.layout.drawer_list_doubleitem).reg();
|
||||
|
||||
int scale = (int)(activity.getMyApplication().getSettings().TEXT_SCALE.get() * 100);
|
||||
adapter.item(R.string.text_size).listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||
final OsmandMapTileView view = activity.getMapView();
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
|
||||
// test old descr as title
|
||||
|
@ -212,21 +215,36 @@ public class ConfigureMapMenu {
|
|||
public void onClick(DialogInterface dialog, int which) {
|
||||
view.getSettings().TEXT_SCALE.set(txtValues[which]);
|
||||
refreshMapComplete(activity);
|
||||
adapter.setItemDescription(pos, getScale(activity));
|
||||
ad.notifyDataSetInvalidated();
|
||||
}
|
||||
});
|
||||
b.show();
|
||||
return false;
|
||||
}
|
||||
}).description(scale + " %").layout(R.layout.drawer_list_doubleitem).reg();
|
||||
}).description(getScale(activity)).layout(R.layout.drawer_list_doubleitem).reg();
|
||||
|
||||
RenderingRulesStorage renderer = activity.getMyApplication().getRendererRegistry().getCurrentSelectedRenderer();
|
||||
if (renderer != null) {
|
||||
createCustomRenderingProperties(renderer, adapter, activity);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getRenderDescr(final MapActivity activity) {
|
||||
return activity.getMyApplication().getRendererRegistry().getCurrentSelectedRenderer().getName();
|
||||
}
|
||||
|
||||
protected String getDayNightDescr(final MapActivity activity) {
|
||||
return activity.getMyApplication().getSettings().DAYNIGHT_MODE.get().toHumanString(activity);
|
||||
}
|
||||
|
||||
protected String getScale(final MapActivity activity) {
|
||||
int scale = (int)(activity.getMyApplication().getSettings().TEXT_SCALE.get() * 100);
|
||||
return scale + " %";
|
||||
}
|
||||
|
||||
|
||||
private void createCustomRenderingProperties(RenderingRulesStorage renderer, ContextMenuAdapter adapter , final MapActivity activity){
|
||||
private void createCustomRenderingProperties(RenderingRulesStorage renderer, final ContextMenuAdapter adapter , final MapActivity activity){
|
||||
final OsmandMapTileView view = activity.getMapView();
|
||||
adapter.item(R.string.map_widget_vector_attributes).setCategory(true).layout(R.layout.drawer_list_sub_header).reg();
|
||||
final OsmandApplication app = view.getApplication();
|
||||
|
@ -256,7 +274,7 @@ public class ConfigureMapMenu {
|
|||
adapter.item(propertyName).listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
|
||||
// test old descr as title
|
||||
b.setTitle(propertyDescr);
|
||||
|
@ -276,7 +294,9 @@ public class ConfigureMapMenu {
|
|||
pref.set(p.getPossibleValues()[which]);
|
||||
app.getResourceManager().getRenderer().clearCache();
|
||||
view.refreshMap(true);
|
||||
adapter.setItemDescription(pos, SettingsActivity.getStringPropertyValue(activity, pref.get()));
|
||||
dialog.dismiss();
|
||||
ad.notifyDataSetInvalidated();
|
||||
}
|
||||
});
|
||||
b.show();
|
||||
|
|
|
@ -343,28 +343,34 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
return cm;
|
||||
}
|
||||
|
||||
private void addControls(ContextMenuAdapter adapter, Set<MapWidgetRegInfo> top, final ApplicationMode mode) {
|
||||
private void addControls(final ContextMenuAdapter adapter, Set<MapWidgetRegInfo> top, final ApplicationMode mode) {
|
||||
for(final MapWidgetRegInfo r : top){
|
||||
// String s = mi.visibleCollapsed(mode)? " - " : " ";
|
||||
// tv.setText(s +map.getString(mi.messageId) +s);
|
||||
adapter.item(r.messageId).selected(r.visibleCollapsed(mode) || r.visible(mode) ? 1 : 0)
|
||||
.icons(r.drawableDark, r.drawableLight).listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> a, int itemId, int pos, boolean isChecked) {
|
||||
final boolean selecteable = r.selecteable();
|
||||
boolean check = r.visibleCollapsed(mode) || r.visible(mode);
|
||||
if (check || selecteable) {
|
||||
mapInfoControls.changeVisibility(r);
|
||||
}
|
||||
recreateControls();
|
||||
adapter.notifyDataSetInvalidated();
|
||||
adapter.setItemName(pos, getText(mode, r));
|
||||
adapter.setSelection(pos, r.visibleCollapsed(mode) || r.visible(mode) ? 1 : 0);
|
||||
a.notifyDataSetInvalidated();
|
||||
return false;
|
||||
}
|
||||
}).reg();
|
||||
adapter.setItemName(adapter.length() - 1, getText(mode, r));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected String getText(final ApplicationMode mode, final MapWidgetRegInfo r) {
|
||||
return (r.visibleCollapsed(mode)? " - " : " ") + map.getString(r.messageId);
|
||||
}
|
||||
|
||||
private int themeId = -1;
|
||||
public void updateColorShadowsOfText(DrawSettings drawSettings) {
|
||||
boolean transparent = view.getSettings().TRANSPARENT_MAP_THEME.get();
|
||||
|
|
Loading…
Reference in a new issue