Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-01-13 13:08:11 +01:00
commit f012cc4a5d
13 changed files with 46 additions and 37 deletions

View file

@ -26,6 +26,7 @@
android:dividerHeight="0dp"/>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="shared_string_without_name">Without name</string>
<string name="what_is_here">What\'s here:</string>
<string name="parked_at">parked at</string>
<string name="pick_up_till">Pick up until</string>

View file

@ -140,7 +140,8 @@ public class AdditionalActionsBottomSheetDialogFragment extends net.osmand.plus.
if (!portrait) {
final Window window = getDialog().getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.width = getActivity().getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width);
params.width = getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width)
+ AndroidUtils.dpToPx(getContext(), 16); // 8 dp is shadow width on each side
window.setAttributes(params);
}
}

View file

@ -583,6 +583,16 @@ public abstract class MenuController extends BaseMenuController {
return null;
}
public void clearIcon(boolean left) {
if (left) {
leftIcon = null;
leftIconId = 0;
} else {
rightIcon = null;
rightIconId = 0;
}
}
public void updateStateListDrawableIcon(@DrawableRes int resId, boolean left) {
if (left) {
leftIcon = enabled ? getStateListDrawable(resId) : null;

View file

@ -234,8 +234,11 @@ public class AmenityMenuBuilder extends MenuBuilder {
});
button.setAllCaps(true);
button.setText(R.string.context_menu_read_full_article);
Drawable compoundDrawable = app.getIconsCache().getIcon(R.drawable.ic_action_read_text, light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
button.setCompoundDrawablesWithIntrinsicBounds(compoundDrawable, null, null, null);
Drawable normal = app.getIconsCache().getIcon(R.drawable.ic_action_read_text,
light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
Drawable pressed = app.getIconsCache().getIcon(R.drawable.ic_action_read_text,
light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p);
button.setCompoundDrawablesWithIntrinsicBounds(AndroidUtils.createStateListDrawable(normal, pressed), null, null, null);
button.setCompoundDrawablePadding(dpToPx(8f));
llText.addView(button);
}

View file

@ -73,7 +73,7 @@ public class AmenityMenuController extends MenuController {
}
};
leftTitleButtonController.caption = getMapActivity().getString(R.string.context_menu_read_article);
leftTitleButtonController.leftIcon = getIcon(R.drawable.ic_action_read_text, isLight() ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
leftTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_read_text, true);
}
openingHoursInfo = processOpeningHours(amenity);

View file

@ -115,7 +115,7 @@ public class MapDataMenuController extends MenuController {
}
};
leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_download);
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
leftDownloadButtonController.updateStateListDrawableIcon(R.drawable.ic_action_import, true);
rightDownloadButtonController = new TitleButtonController() {
@Override
@ -142,7 +142,7 @@ public class MapDataMenuController extends MenuController {
}
};
rightDownloadButtonController.caption = getMapActivity().getString(R.string.download_select_map_types);
rightDownloadButtonController.leftIconId = R.drawable.ic_plugin_srtm;
rightDownloadButtonController.updateStateListDrawableIcon(R.drawable.ic_plugin_srtm, true);
bottomTitleButtonController = new TitleButtonController() {
@Override
@ -159,7 +159,7 @@ public class MapDataMenuController extends MenuController {
}
};
bottomTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
bottomTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
bottomTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_delete_dark, true);
titleProgressController = new TitleProgressController() {
@Override
@ -367,7 +367,7 @@ public class MapDataMenuController extends MenuController {
}
leftDownloadButtonController.visible = true;
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
leftDownloadButtonController.updateStateListDrawableIcon(R.drawable.ic_action_import, true);
if (backuped) {
leftDownloadButtonController.caption = getMapActivity().getString(R.string.local_index_mi_restore);
} else if (indexItem != null) {
@ -375,7 +375,7 @@ public class MapDataMenuController extends MenuController {
|| indexItem.getType() == DownloadActivityType.HILLSHADE_FILE)
&& srtmDisabled) {
leftDownloadButtonController.caption = getMapActivity().getString(R.string.get_plugin);
leftDownloadButtonController.leftIconId = 0;
leftDownloadButtonController.clearIcon(true);
} else if (indexItem.isOutdated()) {
leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_update);
} else if (!downloaded) {

View file

@ -199,7 +199,7 @@ class MapillaryVectorLayer extends MapTileLayer implements MapillaryLayer, ICont
}
String userKey = settings.MAPILLARY_FILTER_USER_KEY.get();
HashMap<String, Object> userData = (HashMap<String, Object>) data;
long capturedAt = (long) userData.get("captured_at");
long capturedAt = ((Number) userData.get("captured_at")).longValue();
long from = settings.MAPILLARY_FILTER_FROM_DATE.get();
long to = settings.MAPILLARY_FILTER_TO_DATE.get();

View file

@ -1,7 +1,6 @@
package net.osmand.plus.osmedit;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.support.v7.app.AlertDialog;
import net.osmand.data.PointDescription;
@ -43,7 +42,7 @@ public class EditPOIMenuController extends MenuController {
}
};
leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_upload);
leftTitleButtonController.leftIconId = R.drawable.ic_action_export;
leftTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_export, true);
rightTitleButtonController = new TitleButtonController() {
@Override
@ -73,7 +72,7 @@ public class EditPOIMenuController extends MenuController {
}
};
rightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
rightTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_delete_dark, true);
category = getCategory();
@ -196,12 +195,6 @@ public class EditPOIMenuController extends MenuController {
}
private String getCategory() {
String category = "";
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
} else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
category = getMapActivity().getString(R.string.osn_bug_name);
}
return category;
return OsmEditingPlugin.getCategory(osmPoint, getMapActivity());
}
}

View file

@ -39,7 +39,7 @@ public class OsmBugMenuController extends MenuController {
} else {
leftTitleButtonController.caption = getMapActivity().getString(R.string.poi_dialog_reopen);
}
leftTitleButtonController.leftIconId = R.drawable.ic_action_note_dark;
leftTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_note_dark, true);
rightTitleButtonController = new TitleButtonController() {
@Override
@ -50,7 +50,7 @@ public class OsmBugMenuController extends MenuController {
}
};
rightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_close);
rightTitleButtonController.leftIconId = R.drawable.ic_action_remove_dark;
rightTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_remove_dark, true);
updateData();
}

View file

@ -445,6 +445,19 @@ public class OsmEditingPlugin extends OsmandPlugin {
}
}
public static String getCategory(OsmPoint osmPoint, Context context) {
String category = "";
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
if (Algorithms.isEmpty(category)) {
category = context.getString(R.string.shared_string_without_name);
}
} else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
category = context.getString(R.string.osn_bug_name);
}
return category;
}
public static String getPrefix(OsmPoint osmPoint) {
return (osmPoint.getGroup() == OsmPoint.Group.POI ? "POI" : "Bug") + " id: " + osmPoint.getId() + " ";
}

View file

@ -301,11 +301,7 @@ public class OsmEditsAdapter extends ArrayAdapter<Object> {
}
private String getCategory(OsmPoint point) {
String category = "";
if (point.getGroup() == OsmPoint.Group.POI) {
category = ((OpenstreetmapPoint) point).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
}
return category;
return OsmEditingPlugin.getCategory(point, getContext());
}
private String getDescription(OsmPoint point) {
@ -322,20 +318,12 @@ public class OsmEditsAdapter extends ArrayAdapter<Object> {
String category = getCategory(point);
String comment = "";
if (point.getGroup() == OsmPoint.Group.BUG) {
comment = getContext().getString(R.string.osn_bug_name);
}
String prefix = OsmEditingPlugin.getPrefix(point);
String description = "";
if (!Algorithms.isEmpty(action)) {
description += action + "";
}
if (!Algorithms.isEmpty(comment)) {
description += comment + "";
}
if (!Algorithms.isEmpty(category)) {
description += category + "";
}

View file

@ -1,7 +1,6 @@
package net.osmand.plus.parkingpoint;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandPlugin;
@ -32,7 +31,7 @@ public class ParkingPositionMenuController extends MenuController {
}
};
leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
leftTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_delete_dark, true);
}
private void buildParkingDescription(MapActivity mapActivity) {