Removed duplicating method.
This commit is contained in:
parent
a42d54d43e
commit
af98243576
13 changed files with 33 additions and 69 deletions
|
@ -1,9 +1,6 @@
|
||||||
package net.osmand.plus;
|
package net.osmand.plus;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.PorterDuff;
|
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.LayerDrawable;
|
import android.graphics.drawable.LayerDrawable;
|
||||||
import android.support.annotation.ColorInt;
|
import android.support.annotation.ColorInt;
|
||||||
|
@ -24,19 +21,6 @@ public class IconsCache {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable scaleImage(Drawable image, float scaleFactor) {
|
|
||||||
if ((image == null) || !(image instanceof BitmapDrawable)) {
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
Bitmap b = ((BitmapDrawable)image).getBitmap();
|
|
||||||
|
|
||||||
int sizeX = Math.round(image.getIntrinsicWidth() * scaleFactor);
|
|
||||||
int sizeY = Math.round(image.getIntrinsicHeight() * scaleFactor);
|
|
||||||
|
|
||||||
Bitmap bitmapResized = Bitmap.createScaledBitmap(b, sizeX, sizeY, false);
|
|
||||||
return new BitmapDrawable(app.getResources(), bitmapResized);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Drawable getDrawable(@DrawableRes int resId, @ColorRes int clrId) {
|
private Drawable getDrawable(@DrawableRes int resId, @ColorRes int clrId) {
|
||||||
long hash = ((long)resId << 31l) + clrId;
|
long hash = ((long)resId << 31l) + clrId;
|
||||||
Drawable d = drawable.get(hash);
|
Drawable d = drawable.get(hash);
|
||||||
|
@ -44,10 +28,8 @@ public class IconsCache {
|
||||||
d = ContextCompat.getDrawable(app, resId);
|
d = ContextCompat.getDrawable(app, resId);
|
||||||
d = DrawableCompat.wrap(d);
|
d = DrawableCompat.wrap(d);
|
||||||
d.mutate();
|
d.mutate();
|
||||||
// d.clearColorFilter();
|
|
||||||
if (clrId != 0) {
|
if (clrId != 0) {
|
||||||
DrawableCompat.setTint(d, ContextCompat.getColor(app, clrId));
|
DrawableCompat.setTint(d, ContextCompat.getColor(app, clrId));
|
||||||
// d.setColorFilter(ContextCompat.getColor(app, clrId), PorterDuff.Mode.SRC_IN);
|
|
||||||
}
|
}
|
||||||
drawable.put(hash, d);
|
drawable.put(hash, d);
|
||||||
}
|
}
|
||||||
|
@ -63,9 +45,6 @@ public class IconsCache {
|
||||||
d.mutate();
|
d.mutate();
|
||||||
DrawableCompat.setTint(d, color);
|
DrawableCompat.setTint(d, color);
|
||||||
|
|
||||||
// d = app.getResources().getDrawable(resId).mutate();
|
|
||||||
// d.clearColorFilter();
|
|
||||||
// d.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
|
||||||
drawable.put(hash, d);
|
drawable.put(hash, d);
|
||||||
}
|
}
|
||||||
return d;
|
return d;
|
||||||
|
@ -79,7 +58,6 @@ public class IconsCache {
|
||||||
return getDrawable(id, colorId);
|
return getDrawable(id, colorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Drawable getIcon(@DrawableRes int backgroundId, @DrawableRes int id, @ColorRes int colorId) {
|
public Drawable getIcon(@DrawableRes int backgroundId, @DrawableRes int id, @ColorRes int colorId) {
|
||||||
Drawable b = getDrawable(backgroundId, 0);
|
Drawable b = getDrawable(backgroundId, 0);
|
||||||
Drawable f = getDrawable(id, colorId);
|
Drawable f = getDrawable(id, colorId);
|
||||||
|
@ -93,10 +71,6 @@ public class IconsCache {
|
||||||
return getDrawable(id, app.getSettings().isLightContent() ? R.color.icon_color : 0);
|
return getDrawable(id, app.getSettings().isLightContent() ? R.color.icon_color : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getContentIcon(@DrawableRes int id, boolean isLightContent) {
|
|
||||||
return getDrawable(id, isLightContent ? R.color.icon_color : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Drawable getIcon(@DrawableRes int id) {
|
public Drawable getIcon(@DrawableRes int id) {
|
||||||
return getDrawable(id, 0);
|
return getDrawable(id, 0);
|
||||||
}
|
}
|
||||||
|
@ -105,15 +79,6 @@ public class IconsCache {
|
||||||
return getDrawable(id, light ? R.color.icon_color : 0);
|
return getDrawable(id, light ? R.color.icon_color : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getContentIconCompat(@DrawableRes int id) {
|
|
||||||
Drawable drawable = ContextCompat.getDrawable(app, id);
|
|
||||||
@ColorInt int color = ContextCompat.getColor(app, getDefaultColorRes(app));
|
|
||||||
drawable = DrawableCompat.wrap(drawable);
|
|
||||||
drawable.mutate();
|
|
||||||
DrawableCompat.setTint(drawable, color);
|
|
||||||
return drawable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void paintMenuItem(MenuItem menuItem) {
|
public void paintMenuItem(MenuItem menuItem) {
|
||||||
Drawable drawable = menuItem.getIcon();
|
Drawable drawable = menuItem.getIcon();
|
||||||
drawable = DrawableCompat.wrap(drawable);
|
drawable = DrawableCompat.wrap(drawable);
|
||||||
|
|
|
@ -371,7 +371,7 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
View view = uiContext.getLayoutInflater().inflate(R.layout.select_voice_first, null);
|
View view = uiContext.getLayoutInflater().inflate(R.layout.select_voice_first, null);
|
||||||
|
|
||||||
((ImageView) view.findViewById(R.id.icon))
|
((ImageView) view.findViewById(R.id.icon))
|
||||||
.setImageDrawable(getIconsCache().getContentIcon(R.drawable.ic_action_volume_up, getSettings().isLightContent()));
|
.setImageDrawable(getIconsCache().getIcon(R.drawable.ic_action_volume_up, getSettings().isLightContent()));
|
||||||
|
|
||||||
view.findViewById(R.id.spinner).setOnClickListener(new View.OnClickListener() {
|
view.findViewById(R.id.spinner).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -392,7 +392,7 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
});
|
});
|
||||||
|
|
||||||
((ImageView) view.findViewById(R.id.dropDownIcon))
|
((ImageView) view.findViewById(R.id.dropDownIcon))
|
||||||
.setImageDrawable(getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down, getSettings().isLightContent()));
|
.setImageDrawable(getIconsCache().getIcon(R.drawable.ic_action_arrow_drop_down, getSettings().isLightContent()));
|
||||||
|
|
||||||
builder.setCancelable(true);
|
builder.setCancelable(true);
|
||||||
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class AppModeDialog {
|
||||||
} else {
|
} else {
|
||||||
if (useMapTheme) {
|
if (useMapTheme) {
|
||||||
boolean nightMode = ctx.getDaynightHelper().isNightModeForMapControls();
|
boolean nightMode = ctx.getDaynightHelper().isNightModeForMapControls();
|
||||||
iv.setImageDrawable(ctx.getIconsCache().getContentIcon(mode.getSmallIconDark(), !nightMode));
|
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), !nightMode));
|
||||||
AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||||
} else {
|
} else {
|
||||||
iv.setImageDrawable(ctx.getIconsCache().getContentIcon(mode.getSmallIconDark()));
|
iv.setImageDrawable(ctx.getIconsCache().getContentIcon(mode.getSmallIconDark()));
|
||||||
|
|
|
@ -368,7 +368,7 @@ public class NotesFragment extends OsmAndListFragment {
|
||||||
DashAudioVideoNotesFragment.getNoteView(recording, row, getMyApplication());
|
DashAudioVideoNotesFragment.getNoteView(recording, row, getMyApplication());
|
||||||
}
|
}
|
||||||
// ((ImageView) row.findViewById(R.id.play)).setImageDrawable(getMyApplication().getIconsCache()
|
// ((ImageView) row.findViewById(R.id.play)).setImageDrawable(getMyApplication().getIconsCache()
|
||||||
// .getContentIcon(R.drawable.ic_play_dark));
|
// .getIcon(R.drawable.ic_play_dark));
|
||||||
row.findViewById(R.id.play).setVisibility(View.GONE);
|
row.findViewById(R.id.play).setVisibility(View.GONE);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -161,8 +161,8 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
||||||
final boolean optionsVisible = (SHOW_ALL && getMyApplication().getTargetPointsHelper().getIntermediatePoints().size() > 0);
|
final boolean optionsVisible = (SHOW_ALL && getMyApplication().getTargetPointsHelper().getIntermediatePoints().size() > 0);
|
||||||
|
|
||||||
options.setImageDrawable(getMyApplication().getIconsCache().
|
options.setImageDrawable(getMyApplication().getIconsCache().
|
||||||
getContentIcon(optionsVisible? R.drawable.ic_overflow_menu_white :
|
getContentIcon(optionsVisible ? R.drawable.ic_overflow_menu_white :
|
||||||
R.drawable.ic_action_remove_dark));
|
R.drawable.ic_action_remove_dark));
|
||||||
options.setOnClickListener(new View.OnClickListener() {
|
options.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -222,7 +222,7 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
||||||
MenuItem item;
|
MenuItem item;
|
||||||
// item = optionsMenu.getMenu().add(
|
// item = optionsMenu.getMenu().add(
|
||||||
// R.string.shared_string_add_to_favorites).setIcon(getMyApplication().getIconsCache().
|
// R.string.shared_string_add_to_favorites).setIcon(getMyApplication().getIconsCache().
|
||||||
// getContentIcon(R.drawable.ic_action_fav_dark));
|
// getIcon(R.drawable.ic_action_fav_dark));
|
||||||
// item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
// item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
// @Override
|
// @Override
|
||||||
// public boolean onMenuItemClick(MenuItem item) {
|
// public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
|
|
@ -334,7 +334,7 @@ public class MapMarkerDialogHelper {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
final ImageButton btn = (ImageButton) v.findViewById(R.id.image_button);
|
final ImageButton btn = (ImageButton) v.findViewById(R.id.image_button);
|
||||||
btn.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_overflow_menu_white, !nightMode));
|
btn.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_overflow_menu_white, !nightMode));
|
||||||
btn.setVisibility(View.VISIBLE);
|
btn.setVisibility(View.VISIBLE);
|
||||||
btn.setOnClickListener(new View.OnClickListener() {
|
btn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -423,7 +423,7 @@ public class MapMarkerDialogHelper {
|
||||||
more.setVisibility(View.GONE);
|
more.setVisibility(View.GONE);
|
||||||
if (!marker.history && !sorted) {
|
if (!marker.history && !sorted) {
|
||||||
move.setVisibility(View.VISIBLE);
|
move.setVisibility(View.VISIBLE);
|
||||||
((ImageView) move).setImageDrawable(app.getIconsCache().getContentIcon(
|
((ImageView) move).setImageDrawable(app.getIconsCache().getIcon(
|
||||||
R.drawable.ic_action_reorder, !nightMode));
|
R.drawable.ic_action_reorder, !nightMode));
|
||||||
move.setTag(new DynamicListView.DragIcon() {
|
move.setTag(new DynamicListView.DragIcon() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -513,7 +513,7 @@ public class MapMarkerDialogHelper {
|
||||||
.getColor(useCenter ? R.color.color_distance : R.color.color_myloc_distance));
|
.getColor(useCenter ? R.color.color_distance : R.color.color_myloc_distance));
|
||||||
} else {
|
} else {
|
||||||
waypointIcon.setImageDrawable(app.getIconsCache()
|
waypointIcon.setImageDrawable(app.getIconsCache()
|
||||||
.getContentIcon(R.drawable.ic_action_flag_dark, !nightMode));
|
.getIcon(R.drawable.ic_action_flag_dark, !nightMode));
|
||||||
AndroidUtils.setTextSecondaryColor(ctx, text, nightMode);
|
AndroidUtils.setTextSecondaryColor(ctx, text, nightMode);
|
||||||
AndroidUtils.setTextSecondaryColor(ctx, textDist, nightMode);
|
AndroidUtils.setTextSecondaryColor(ctx, textDist, nightMode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,7 +418,7 @@ public class WaypointDialogHelper {
|
||||||
remove.setVisibility(View.GONE);
|
remove.setVisibility(View.GONE);
|
||||||
move.setVisibility(View.GONE);
|
move.setVisibility(View.GONE);
|
||||||
more.setVisibility(View.VISIBLE);
|
more.setVisibility(View.VISIBLE);
|
||||||
((ImageButton) more).setImageDrawable(app.getIconsCache().getContentIcon(
|
((ImageButton) more).setImageDrawable(app.getIconsCache().getIcon(
|
||||||
R.drawable.map_overflow_menu_white, !nightMode));
|
R.drawable.map_overflow_menu_white, !nightMode));
|
||||||
more.setOnClickListener(new View.OnClickListener() {
|
more.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -481,7 +481,7 @@ public class WaypointDialogHelper {
|
||||||
remove.setVisibility(View.GONE);
|
remove.setVisibility(View.GONE);
|
||||||
move.setVisibility(View.VISIBLE);
|
move.setVisibility(View.VISIBLE);
|
||||||
more.setVisibility(View.GONE);
|
more.setVisibility(View.GONE);
|
||||||
((ImageView) move).setImageDrawable(app.getIconsCache().getContentIcon(
|
((ImageView) move).setImageDrawable(app.getIconsCache().getIcon(
|
||||||
R.drawable.ic_action_reorder, !nightMode));
|
R.drawable.ic_action_reorder, !nightMode));
|
||||||
move.setTag(new DragIcon() {
|
move.setTag(new DragIcon() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -544,7 +544,7 @@ public class WaypointDialogHelper {
|
||||||
remove.setVisibility(View.VISIBLE);
|
remove.setVisibility(View.VISIBLE);
|
||||||
move.setVisibility(View.GONE);
|
move.setVisibility(View.GONE);
|
||||||
more.setVisibility(View.GONE);
|
more.setVisibility(View.GONE);
|
||||||
((ImageButton) remove).setImageDrawable(app.getIconsCache().getContentIcon(
|
((ImageButton) remove).setImageDrawable(app.getIconsCache().getIcon(
|
||||||
R.drawable.ic_action_remove_dark, !nightMode));
|
R.drawable.ic_action_remove_dark, !nightMode));
|
||||||
remove.setOnClickListener(new View.OnClickListener() {
|
remove.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class DestinationReachedMenuFragment extends Fragment {
|
||||||
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
||||||
|
|
||||||
ImageButton closeImageButton = (ImageButton) view.findViewById(R.id.closeImageButton);
|
ImageButton closeImageButton = (ImageButton) view.findViewById(R.id.closeImageButton);
|
||||||
closeImageButton.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_remove_dark, menu.isLight()));
|
closeImageButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark, menu.isLight()));
|
||||||
closeImageButton.setOnClickListener(new View.OnClickListener() {
|
closeImageButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -60,7 +60,7 @@ public class DestinationReachedMenuFragment extends Fragment {
|
||||||
|
|
||||||
Button removeDestButton = (Button) view.findViewById(R.id.removeDestButton);
|
Button removeDestButton = (Button) view.findViewById(R.id.removeDestButton);
|
||||||
removeDestButton.setCompoundDrawablesWithIntrinsicBounds(
|
removeDestButton.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
iconsCache.getContentIcon(R.drawable.ic_action_done, menu.isLight()), null, null, null);
|
iconsCache.getIcon(R.drawable.ic_action_done, menu.isLight()), null, null, null);
|
||||||
AndroidUtils.setTextPrimaryColor(view.getContext(), removeDestButton, !menu.isLight());
|
AndroidUtils.setTextPrimaryColor(view.getContext(), removeDestButton, !menu.isLight());
|
||||||
removeDestButton.setOnClickListener(new View.OnClickListener() {
|
removeDestButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -80,7 +80,7 @@ public class DestinationReachedMenuFragment extends Fragment {
|
||||||
|
|
||||||
Button recalcDestButton = (Button) view.findViewById(R.id.recalcDestButton);
|
Button recalcDestButton = (Button) view.findViewById(R.id.recalcDestButton);
|
||||||
recalcDestButton.setCompoundDrawablesWithIntrinsicBounds(
|
recalcDestButton.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
iconsCache.getContentIcon(R.drawable.ic_action_gdirections_dark, menu.isLight()), null, null, null);
|
iconsCache.getIcon(R.drawable.ic_action_gdirections_dark, menu.isLight()), null, null, null);
|
||||||
AndroidUtils.setTextPrimaryColor(view.getContext(), recalcDestButton, !menu.isLight());
|
AndroidUtils.setTextPrimaryColor(view.getContext(), recalcDestButton, !menu.isLight());
|
||||||
recalcDestButton.setOnClickListener(new View.OnClickListener() {
|
recalcDestButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,7 +102,7 @@ public class DestinationReachedMenuFragment extends Fragment {
|
||||||
|
|
||||||
Button findParkingButton = (Button) view.findViewById(R.id.findParkingButton);
|
Button findParkingButton = (Button) view.findViewById(R.id.findParkingButton);
|
||||||
findParkingButton.setCompoundDrawablesWithIntrinsicBounds(
|
findParkingButton.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
iconsCache.getContentIcon(R.drawable.ic_action_parking_dark, menu.isLight()), null, null, null);
|
iconsCache.getIcon(R.drawable.ic_action_parking_dark, menu.isLight()), null, null, null);
|
||||||
AndroidUtils.setTextPrimaryColor(view.getContext(), findParkingButton, !menu.isLight());
|
AndroidUtils.setTextPrimaryColor(view.getContext(), findParkingButton, !menu.isLight());
|
||||||
findParkingButton.setOnClickListener(new View.OnClickListener() {
|
findParkingButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,7 +33,6 @@ import net.osmand.plus.MapMarkersHelper;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
|
@ -217,7 +216,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
main.findViewById(R.id.InfoDuration).setVisibility(View.GONE);
|
main.findViewById(R.id.InfoDuration).setVisibility(View.GONE);
|
||||||
textView.setText(R.string.route_is_too_long);
|
textView.setText(R.string.route_is_too_long);
|
||||||
textView.setVisibility(View.VISIBLE);
|
textView.setVisibility(View.VISIBLE);
|
||||||
iconView.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_warning, isLight()));
|
iconView.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_warning, isLight()));
|
||||||
} else {
|
} else {
|
||||||
main.findViewById(R.id.dividerToDropDown).setVisibility(View.GONE);
|
main.findViewById(R.id.dividerToDropDown).setVisibility(View.GONE);
|
||||||
main.findViewById(R.id.RouteInfoControls).setVisibility(View.GONE);
|
main.findViewById(R.id.RouteInfoControls).setVisibility(View.GONE);
|
||||||
|
@ -328,7 +327,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
updateToIcon(parentView);
|
updateToIcon(parentView);
|
||||||
|
|
||||||
ImageView toDropDownIcon = (ImageView) parentView.findViewById(R.id.toDropDownIcon);
|
ImageView toDropDownIcon = (ImageView) parentView.findViewById(R.id.toDropDownIcon);
|
||||||
toDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down, isLight()));
|
toDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_arrow_drop_down, isLight()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateToIcon(View parentView) {
|
private void updateToIcon(View parentView) {
|
||||||
|
@ -400,7 +399,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
updateFromIcon(parentView);
|
updateFromIcon(parentView);
|
||||||
|
|
||||||
ImageView fromDropDownIcon = (ImageView) parentView.findViewById(R.id.fromDropDownIcon);
|
ImageView fromDropDownIcon = (ImageView) parentView.findViewById(R.id.fromDropDownIcon);
|
||||||
fromDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down, isLight()));
|
fromDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_arrow_drop_down, isLight()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
@ -525,7 +524,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
mainView.findViewById(R.id.RouteInfoControls).setVisibility(View.VISIBLE);
|
mainView.findViewById(R.id.RouteInfoControls).setVisibility(View.VISIBLE);
|
||||||
final OsmandApplication ctx = mapActivity.getMyApplication();
|
final OsmandApplication ctx = mapActivity.getMyApplication();
|
||||||
ImageView prev = (ImageView) mainView.findViewById(R.id.Prev);
|
ImageView prev = (ImageView) mainView.findViewById(R.id.Prev);
|
||||||
prev.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_prev, isLight()));
|
prev.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_prev, isLight()));
|
||||||
if (directionInfo >= 0) {
|
if (directionInfo >= 0) {
|
||||||
prev.setVisibility(View.VISIBLE);
|
prev.setVisibility(View.VISIBLE);
|
||||||
prev.setOnClickListener(new View.OnClickListener() {
|
prev.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -554,7 +553,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
ImageView next = (ImageView) mainView.findViewById(R.id.Next);
|
ImageView next = (ImageView) mainView.findViewById(R.id.Next);
|
||||||
next.setVisibility(View.VISIBLE);
|
next.setVisibility(View.VISIBLE);
|
||||||
next.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_next, isLight()));
|
next.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_next, isLight()));
|
||||||
next.setOnClickListener(new View.OnClickListener() {
|
next.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -592,9 +591,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
infoDurationView.setVisibility(View.GONE);
|
infoDurationView.setVisibility(View.GONE);
|
||||||
textView.setVisibility(View.VISIBLE);
|
textView.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
infoIcon.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_action_polygom_dark, isLight()));
|
infoIcon.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_action_polygom_dark, isLight()));
|
||||||
infoIcon.setVisibility(View.VISIBLE);
|
infoIcon.setVisibility(View.VISIBLE);
|
||||||
durationIcon.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_action_time, isLight()));
|
durationIcon.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_action_time, isLight()));
|
||||||
durationIcon.setVisibility(View.VISIBLE);
|
durationIcon.setVisibility(View.VISIBLE);
|
||||||
infoDistanceView.setVisibility(View.VISIBLE);
|
infoDistanceView.setVisibility(View.VISIBLE);
|
||||||
infoDurationView.setVisibility(View.VISIBLE);
|
infoDurationView.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -331,7 +331,7 @@ public class RoutePreferencesMenu {
|
||||||
v.findViewById(R.id.description_text).setVisibility(View.GONE);
|
v.findViewById(R.id.description_text).setVisibility(View.GONE);
|
||||||
v.findViewById(R.id.select_button).setVisibility(View.GONE);
|
v.findViewById(R.id.select_button).setVisibility(View.GONE);
|
||||||
((ImageView) v.findViewById(R.id.icon))
|
((ImageView) v.findViewById(R.id.icon))
|
||||||
.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_volume_up, !nightMode));
|
.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_volume_up, !nightMode));
|
||||||
final CompoundButton btn = (CompoundButton) v.findViewById(R.id.toggle_item);
|
final CompoundButton btn = (CompoundButton) v.findViewById(R.id.toggle_item);
|
||||||
btn.setVisibility(View.VISIBLE);
|
btn.setVisibility(View.VISIBLE);
|
||||||
btn.setChecked(!routingHelper.getVoiceRouter().isMute());
|
btn.setChecked(!routingHelper.getVoiceRouter().isMute());
|
||||||
|
@ -351,7 +351,7 @@ public class RoutePreferencesMenu {
|
||||||
View v = mapActivity.getLayoutInflater().inflate(R.layout.switch_select_list_item, null);
|
View v = mapActivity.getLayoutInflater().inflate(R.layout.switch_select_list_item, null);
|
||||||
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||||
((ImageView) v.findViewById(R.id.icon))
|
((ImageView) v.findViewById(R.id.icon))
|
||||||
.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_road_works_dark, !nightMode));
|
.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_road_works_dark, !nightMode));
|
||||||
v.findViewById(R.id.toggle_item).setVisibility(View.GONE);
|
v.findViewById(R.id.toggle_item).setVisibility(View.GONE);
|
||||||
final TextView btn = (TextView) v.findViewById(R.id.select_button);
|
final TextView btn = (TextView) v.findViewById(R.id.select_button);
|
||||||
btn.setTextColor(btn.getLinkTextColors());
|
btn.setTextColor(btn.getLinkTextColors());
|
||||||
|
@ -437,7 +437,7 @@ public class RoutePreferencesMenu {
|
||||||
final TextView gpxSpinner = (TextView) v.findViewById(R.id.GPXRouteSpinner);
|
final TextView gpxSpinner = (TextView) v.findViewById(R.id.GPXRouteSpinner);
|
||||||
AndroidUtils.setTextPrimaryColor(mapActivity, gpxSpinner, nightMode);
|
AndroidUtils.setTextPrimaryColor(mapActivity, gpxSpinner, nightMode);
|
||||||
((ImageView) v.findViewById(R.id.dropDownIcon))
|
((ImageView) v.findViewById(R.id.dropDownIcon))
|
||||||
.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down, !nightMode));
|
.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_drop_down, !nightMode));
|
||||||
updateSpinnerItems(gpxSpinner);
|
updateSpinnerItems(gpxSpinner);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -445,7 +445,7 @@ public class RoutePreferencesMenu {
|
||||||
View v = mapActivity.getLayoutInflater().inflate(R.layout.layers_list_activity_item, null);
|
View v = mapActivity.getLayoutInflater().inflate(R.layout.layers_list_activity_item, null);
|
||||||
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||||
final ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
final ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||||
icon.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_settings, !nightMode));
|
icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.map_action_settings, !nightMode));
|
||||||
icon.setVisibility(View.VISIBLE);
|
icon.setVisibility(View.VISIBLE);
|
||||||
TextView titleView = (TextView) v.findViewById(R.id.title);
|
TextView titleView = (TextView) v.findViewById(R.id.title);
|
||||||
titleView.setText(R.string.routing_settings_2);
|
titleView.setText(R.string.routing_settings_2);
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class ShareMenuFragment extends Fragment implements OnItemClickListener {
|
||||||
final ShareItem item = getItem(position);
|
final ShareItem item = getItem(position);
|
||||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||||
icon.setImageDrawable(menu.getMapActivity().getMyApplication()
|
icon.setImageDrawable(menu.getMapActivity().getMyApplication()
|
||||||
.getIconsCache().getContentIcon(item.getIconResourceId(), menu.isLight()));
|
.getIconsCache().getIcon(item.getIconResourceId(), menu.isLight()));
|
||||||
TextView name = (TextView) v.findViewById(R.id.name);
|
TextView name = (TextView) v.findViewById(R.id.name);
|
||||||
AndroidUtils.setTextPrimaryColor(v.getContext(), name, !menu.isLight());
|
AndroidUtils.setTextPrimaryColor(v.getContext(), name, !menu.isLight());
|
||||||
name.setText(getContext().getText(item.getTitleResourceId()));
|
name.setText(getContext().getText(item.getTitleResourceId()));
|
||||||
|
|
|
@ -1210,7 +1210,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
||||||
if (model.isMainGroup()) {
|
if (model.isMainGroup()) {
|
||||||
v.setVisibility(View.GONE);
|
v.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
// (ImageView) v.setImageDrawable(getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_settings));
|
// (ImageView) v.setImageDrawable(getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_settings));
|
||||||
|
|
||||||
if ((selectedObject == model) != ((CheckBox) v).isChecked()) {
|
if ((selectedObject == model) != ((CheckBox) v).isChecked()) {
|
||||||
((CheckBox) v).setChecked(selectedObject == model);
|
((CheckBox) v).setChecked(selectedObject == model);
|
||||||
|
|
|
@ -222,7 +222,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
public void updateRouteButtons(View main, boolean routeInfo) {
|
public void updateRouteButtons(View main, boolean routeInfo) {
|
||||||
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
ImageView cancelRouteButton = (ImageView) main.findViewById(R.id.map_cancel_route_button);
|
ImageView cancelRouteButton = (ImageView) main.findViewById(R.id.map_cancel_route_button);
|
||||||
cancelRouteButton.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_cancel, !nightMode));
|
cancelRouteButton.setImageDrawable(app.getIconsCache().getIcon(R.drawable.map_action_cancel, !nightMode));
|
||||||
AndroidUtils.setBackground(mapActivity, cancelRouteButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
AndroidUtils.setBackground(mapActivity, cancelRouteButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||||
cancelRouteButton.setOnClickListener(new View.OnClickListener() {
|
cancelRouteButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -232,7 +232,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
});
|
});
|
||||||
|
|
||||||
ImageView waypointsButton = (ImageView) main.findViewById(R.id.map_waypoints_route_button);
|
ImageView waypointsButton = (ImageView) main.findViewById(R.id.map_waypoints_route_button);
|
||||||
waypointsButton.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_waypoint, !nightMode));
|
waypointsButton.setImageDrawable(app.getIconsCache().getIcon(R.drawable.map_action_waypoint, !nightMode));
|
||||||
AndroidUtils.setBackground(mapActivity, waypointsButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
AndroidUtils.setBackground(mapActivity, waypointsButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||||
waypointsButton.setOnClickListener(new View.OnClickListener() {
|
waypointsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -243,7 +243,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
ImageView options = (ImageView) main.findViewById(R.id.map_options_route_button);
|
ImageView options = (ImageView) main.findViewById(R.id.map_options_route_button);
|
||||||
options.setImageDrawable(!routeInfo ? app.getIconsCache().getIcon(R.drawable.map_action_settings,
|
options.setImageDrawable(!routeInfo ? app.getIconsCache().getIcon(R.drawable.map_action_settings,
|
||||||
R.color.osmand_orange) : app.getIconsCache().getContentIcon(R.drawable.map_action_settings, !nightMode));
|
R.color.osmand_orange) : app.getIconsCache().getIcon(R.drawable.map_action_settings, !nightMode));
|
||||||
AndroidUtils.setBackground(mapActivity, options, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
AndroidUtils.setBackground(mapActivity, options, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||||
options.setOnClickListener(new View.OnClickListener() {
|
options.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue