Rename left icon to right icon

This commit is contained in:
PavelRatushny 2017-12-27 17:07:38 +02:00
parent 16c733d726
commit e01319cd82
26 changed files with 41 additions and 42 deletions

View file

@ -86,7 +86,7 @@ public class AudioVideoNoteMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
if (mRecording.isPhoto()) { if (mRecording.isPhoto()) {
return getIcon(R.drawable.ic_action_photo_dark, R.color.audio_video_icon_color); return getIcon(R.drawable.ic_action_photo_dark, R.color.audio_video_icon_color);
} else if (mRecording.isAudio()) { } else if (mRecording.isAudio()) {

View file

@ -851,8 +851,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
if (app != null && view != null) { if (app != null && view != null) {
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view); final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
Drawable icon = menu.getLeftIcon(); Drawable icon = menu.getRightIcon();
int iconId = menu.getLeftIconId(); int iconId = menu.getRightIconId();
if (icon != null) { if (icon != null) {
iconView.setImageDrawable(icon); iconView.setImageDrawable(icon);
iconView.setVisibility(View.VISIBLE); iconView.setVisibility(View.VISIBLE);

View file

@ -386,11 +386,11 @@ public abstract class MenuController extends BaseMenuController {
return false; return false;
} }
public int getLeftIconId() { public int getRightIconId() {
return 0; return 0;
} }
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return null; return null;
} }

View file

@ -11,8 +11,8 @@ import net.osmand.util.Algorithms;
public abstract class MenuTitleController { public abstract class MenuTitleController {
protected int leftIconId; protected int rightIconId;
protected Drawable leftIcon; protected Drawable rightIcon;
protected String nameStr = ""; protected String nameStr = "";
protected String typeStr = ""; protected String typeStr = "";
protected String commonTypeStr = ""; protected String commonTypeStr = "";
@ -65,12 +65,12 @@ public abstract class MenuTitleController {
return !addressNotFoundStr.equals(title) && !searchAddressStr.equals(title); return !addressNotFoundStr.equals(title) && !searchAddressStr.equals(title);
} }
public int getLeftIconId() { public int getRightIconId() {
return leftIconId; return rightIconId;
} }
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return leftIcon; return rightIcon;
} }
public Drawable getTypeIcon() { public Drawable getTypeIcon() {
@ -125,13 +125,13 @@ public abstract class MenuTitleController {
protected void acquireIcons() { protected void acquireIcons() {
MenuController menuController = getMenuController(); MenuController menuController = getMenuController();
leftIconId = 0; rightIconId = 0;
leftIcon = null; rightIcon = null;
secondLineTypeIcon = null; secondLineTypeIcon = null;
if (menuController != null) { if (menuController != null) {
leftIconId = menuController.getLeftIconId(); rightIconId = menuController.getRightIconId();
leftIcon = menuController.getLeftIcon(); rightIcon = menuController.getRightIcon();
secondLineTypeIcon = menuController.getSecondLineTypeIcon(); secondLineTypeIcon = menuController.getSecondLineTypeIcon();
} }
} }

View file

@ -49,7 +49,7 @@ public class AMapPointMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return getIcon(R.drawable.ic_action_get_my_location); return getIcon(R.drawable.ic_action_get_my_location);
} }

View file

@ -21,7 +21,6 @@ import net.osmand.plus.transport.TransportStopRoute;
import net.osmand.plus.render.RenderingIcons; import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.resources.TransportIndexRepository; import net.osmand.plus.resources.TransportIndexRepository;
import net.osmand.plus.transport.TransportStopType; import net.osmand.plus.transport.TransportStopType;
import net.osmand.plus.views.POIMapLayer;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import net.osmand.util.OpeningHoursParser; import net.osmand.util.OpeningHoursParser;
@ -109,11 +108,11 @@ public class AmenityMenuController extends MenuController {
} }
@Override @Override
public int getLeftIconId() { public int getRightIconId() {
return getLeftIconId(amenity); return getRightIconId(amenity);
} }
private static int getLeftIconId(Amenity amenity) { private static int getRightIconId(Amenity amenity) {
String id = null; String id = null;
PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType()); PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
if (st != null) { if (st != null) {
@ -221,7 +220,7 @@ public class AmenityMenuController extends MenuController {
public static void addPlainMenuItems(Amenity amenity, String typeStr, MenuBuilder builder) { public static void addPlainMenuItems(Amenity amenity, String typeStr, MenuBuilder builder) {
if (!Algorithms.isEmpty(typeStr)) { if (!Algorithms.isEmpty(typeStr)) {
int resId = getLeftIconId(amenity); int resId = getRightIconId(amenity);
if (resId == 0) { if (resId == 0) {
PoiCategory pc = amenity.getType(); PoiCategory pc = amenity.getType();
resId = RenderingIcons.getBigIconResourceId(pc.getIconKeyName()); resId = RenderingIcons.getBigIconResourceId(pc.getIconKeyName());

View file

@ -102,7 +102,7 @@ public class FavouritePointMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), fav.getColor(), false); return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), fav.getColor(), false);
} }

View file

@ -45,7 +45,7 @@ public class GpxItemMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return getIcon(R.drawable.ic_action_polygom_dark, R.color.osmand_orange); return getIcon(R.drawable.ic_action_polygom_dark, R.color.osmand_orange);
} }
} }

View file

@ -52,7 +52,7 @@ public class HistoryMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return getIcon(SearchHistoryFragment.getItemIcon(entry.getName())); return getIcon(SearchHistoryFragment.getItemIcon(entry.getName()));
} }

View file

@ -53,7 +53,7 @@ public class ImpassibleRoadsMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return ContextCompat.getDrawable(getMapActivity(), R.drawable.map_pin_avoid_road); return ContextCompat.getDrawable(getMapActivity(), R.drawable.map_pin_avoid_road);
} }
} }

View file

@ -231,7 +231,7 @@ public class MapDataMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
int iconResId; int iconResId;
if (getDownloadActivityType() != null) { if (getDownloadActivityType() != null) {
iconResId = getDownloadActivityType().getIconResource(); iconResId = getDownloadActivityType().getIconResource();

View file

@ -89,7 +89,7 @@ public class MapMarkerMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return MapMarkerDialogHelper.getMapMarkerIcon(getMapActivity().getMyApplication(), mapMarker.colorIndex); return MapMarkerDialogHelper.getMapMarkerIcon(getMapActivity().getMyApplication(), mapMarker.colorIndex);
} }

View file

@ -42,7 +42,7 @@ public class MyLocationMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
ApplicationMode appMode = getMapActivity().getMyApplication().getSettings().getApplicationMode(); ApplicationMode appMode = getMapActivity().getMyApplication().getSettings().getApplicationMode();
return getMapActivity().getResources().getDrawable(appMode.getResourceLocationDay()); return getMapActivity().getResources().getDrawable(appMode.getResourceLocationDay());
} }

View file

@ -46,7 +46,7 @@ public class PointDescriptionMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return getIcon(SearchHistoryFragment.getItemIcon(getPointDescription())); return getIcon(SearchHistoryFragment.getItemIcon(getPointDescription()));
} }

View file

@ -49,7 +49,7 @@ public class RenderedObjectMenuController extends MenuController {
} }
@Override @Override
public int getLeftIconId() { public int getRightIconId() {
if (renderedObject.getIconRes() != null && RenderingIcons.containsBigIcon(renderedObject.getIconRes())) { if (renderedObject.getIconRes() != null && RenderingIcons.containsBigIcon(renderedObject.getIconRes())) {
return RenderingIcons.getBigIconResourceId(renderedObject.getIconRes()); return RenderingIcons.getBigIconResourceId(renderedObject.getIconRes());
} else { } else {

View file

@ -79,7 +79,7 @@ public class TargetPointMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
if (targetPoint.start) { if (targetPoint.start) {
return getIconOrig(R.drawable.list_startpoint); return getIconOrig(R.drawable.list_startpoint);
} else if (!targetPoint.intermediate) { } else if (!targetPoint.intermediate) {

View file

@ -61,7 +61,7 @@ public class TransportRouteController extends MenuController {
} }
@Override @Override
public int getLeftIconId() { public int getRightIconId() {
return this.transportRoute.type == null ? return this.transportRoute.type == null ?
R.drawable.mx_public_transport : R.drawable.mx_public_transport :
this.transportRoute.type.getTopResourceId(); this.transportRoute.type.getTopResourceId();

View file

@ -58,7 +58,7 @@ public class TransportStopController extends MenuController {
} }
@Override @Override
public int getLeftIconId() { public int getRightIconId() {
if (topType == null) { if (topType == null) {
return R.drawable.mx_public_transport; return R.drawable.mx_public_transport;
} else { } else {

View file

@ -76,7 +76,7 @@ public class WptPtMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(), return FavoriteImageDrawable.getOrCreate(getMapActivity().getMyApplication(),
wpt.getColor(ContextCompat.getColor(getMapActivity(), R.color.gpx_color_point)), false); wpt.getColor(ContextCompat.getColor(getMapActivity(), R.color.gpx_color_point)), false);
} }

View file

@ -49,8 +49,8 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter<MapMultiSelectionMe
IconsCache iconsCache = menu.getMapActivity().getMyApplication().getIconsCache(); IconsCache iconsCache = menu.getMapActivity().getMyApplication().getIconsCache();
final View iconLayout = convertView.findViewById(R.id.context_menu_icon_layout); final View iconLayout = convertView.findViewById(R.id.context_menu_icon_layout);
final ImageView iconView = (ImageView) convertView.findViewById(R.id.context_menu_icon_view); final ImageView iconView = (ImageView) convertView.findViewById(R.id.context_menu_icon_view);
Drawable icon = item.getLeftIcon(); Drawable icon = item.getRightIcon();
int iconId = item.getLeftIconId(); int iconId = item.getRightIconId();
if (icon != null) { if (icon != null) {
iconView.setImageDrawable(icon); iconView.setImageDrawable(icon);
iconLayout.setVisibility(View.VISIBLE); iconLayout.setVisibility(View.VISIBLE);

View file

@ -56,7 +56,7 @@ public class MapillaryMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return getIcon(R.drawable.ic_action_mapillary, R.color.mapillary_color); return getIcon(R.drawable.ic_action_mapillary, R.color.mapillary_color);
} }

View file

@ -148,7 +148,7 @@ public class EditPOIMenuController extends MenuController {
} }
@Override @Override
public int getLeftIconId() { public int getRightIconId() {
if (osmPoint.getGroup() == OsmPoint.Group.POI) { if (osmPoint.getGroup() == OsmPoint.Group.POI) {
OpenstreetmapPoint osmP = (OpenstreetmapPoint) osmPoint; OpenstreetmapPoint osmP = (OpenstreetmapPoint) osmPoint;
int iconResId = 0; int iconResId = 0;

View file

@ -73,7 +73,7 @@ public class OsmBugMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
if (bug.isOpened()) { if (bug.isOpened()) {
return getIcon(R.drawable.ic_action_gabout_dark, R.color.osm_bug_unresolved_icon_color); return getIcon(R.drawable.ic_action_gabout_dark, R.color.osm_bug_unresolved_icon_color);
} else { } else {

View file

@ -96,7 +96,7 @@ public class OsMoMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
if (isLight()) { if (isLight()) {
return getIconOrig(R.drawable.widget_osmo_connected_location_day); return getIconOrig(R.drawable.widget_osmo_connected_location_day);
} else { } else {

View file

@ -89,7 +89,7 @@ public class ParkingPositionMenuController extends MenuController {
} }
@Override @Override
public Drawable getLeftIcon() { public Drawable getRightIcon() {
return getIcon(R.drawable.ic_action_parking_dark, R.color.map_widget_blue); return getIcon(R.drawable.ic_action_parking_dark, R.color.map_widget_blue);
} }

View file

@ -504,7 +504,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
view.setLatLon(lat, lon); view.setLatLon(lat, lon);
mInChangeMarkerPositionMode = true; mInChangeMarkerPositionMode = true;
mMoveMarkerBottomSheetHelper.show(menu.getLeftIcon()); mMoveMarkerBottomSheetHelper.show(menu.getRightIcon());
mark(View.INVISIBLE, R.id.map_ruler_layout, mark(View.INVISIBLE, R.id.map_ruler_layout,
R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info);