Merge pull request #5477 from osmandapp/updatelocview
Refactor update location view
This commit is contained in:
commit
c9d960387a
134 changed files with 998 additions and 1269 deletions
|
@ -13,7 +13,6 @@ import android.content.res.Configuration;
|
|||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
|
@ -27,6 +26,7 @@ import net.osmand.plus.activities.DayNightHelper;
|
|||
import net.osmand.plus.activities.LocalIndexHelper;
|
||||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask;
|
||||
import net.osmand.plus.helpers.AvoidSpecificRoads;
|
||||
|
@ -67,7 +67,6 @@ import java.util.Locale;
|
|||
import java.util.Random;
|
||||
|
||||
import btools.routingapp.BRouterServiceConnection;
|
||||
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn;
|
||||
|
@ -448,6 +447,7 @@ public class AppInitializer implements IProgress {
|
|||
app.mapMarkersDbHelper = startupInit(new MapMarkersDbHelper(app), MapMarkersDbHelper.class);
|
||||
app.mapMarkersHelper = startupInit(new MapMarkersHelper(app), MapMarkersHelper.class);
|
||||
app.searchUICore = startupInit(new QuickSearchHelper(app), QuickSearchHelper.class);
|
||||
app.mapViewTrackingUtilities = startupInit(new MapViewTrackingUtilities(app), MapViewTrackingUtilities.class);
|
||||
app.travelDbHelper = new TravelDbHelper(app);
|
||||
if (app.getSettings().SELECTED_TRAVEL_BOOK.get() != null) {
|
||||
app.travelDbHelper.initTravelBooks();
|
||||
|
|
|
@ -110,7 +110,7 @@ public class ContextMenuAdapter {
|
|||
@LayoutRes
|
||||
private int layoutId;
|
||||
private final ConfigureMapMenu.OnClickListener changeAppModeListener;
|
||||
private final IconsCache mIconsCache;
|
||||
private final UiUtilities mIconsCache;
|
||||
|
||||
public ContextMenuArrayAdapter(Activity context,
|
||||
@LayoutRes int layoutRes,
|
||||
|
@ -124,7 +124,7 @@ public class ContextMenuAdapter {
|
|||
this.lightTheme = lightTheme;
|
||||
this.layoutId = layoutRes;
|
||||
this.changeAppModeListener = changeAppModeListener;
|
||||
mIconsCache = app.getIconsCache();
|
||||
mIconsCache = app.getUIUtilities();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -169,7 +169,7 @@ public class ContextMenuAdapter {
|
|||
}
|
||||
if (layoutId == R.layout.help_to_improve_item) {
|
||||
TextView feedbackButton = (TextView) convertView.findViewById(R.id.feedbackButton);
|
||||
Drawable pollIcon = app.getIconsCache().getThemedIcon(R.drawable.ic_action_big_poll);
|
||||
Drawable pollIcon = app.getUIUtilities().getThemedIcon(R.drawable.ic_action_big_poll);
|
||||
feedbackButton.setCompoundDrawablesWithIntrinsicBounds(null, pollIcon, null, null);
|
||||
feedbackButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -181,7 +181,7 @@ public class ContextMenuAdapter {
|
|||
});
|
||||
TextView contactUsButton = (TextView) convertView.findViewById(R.id.contactUsButton);
|
||||
Drawable contactUsIcon =
|
||||
app.getIconsCache().getThemedIcon(R.drawable.ic_action_big_feedback);
|
||||
app.getUIUtilities().getThemedIcon(R.drawable.ic_action_big_feedback);
|
||||
contactUsButton.setCompoundDrawablesWithIntrinsicBounds(null, contactUsIcon, null,
|
||||
null);
|
||||
final String email = app.getString(R.string.support_email);
|
||||
|
|
|
@ -107,7 +107,7 @@ public class ContextMenuItem {
|
|||
if (skipPaintingWithoutColor || getColorRes() != INVALID_ID) {
|
||||
return getColorRes();
|
||||
} else {
|
||||
return IconsCache.getDefaultColorRes(context);
|
||||
return UiUtilities.getDefaultColorRes(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import gnu.trove.map.hash.TLongObjectHashMap;
|
||||
|
||||
public class IconsCache {
|
||||
|
||||
private TLongObjectHashMap<Drawable> drawable = new TLongObjectHashMap<>();
|
||||
private OsmandApplication app;
|
||||
|
||||
public IconsCache(OsmandApplication app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
private Drawable getDrawable(@DrawableRes int resId, @ColorRes int clrId) {
|
||||
long hash = ((long)resId << 31l) + clrId;
|
||||
Drawable d = drawable.get(hash);
|
||||
if (d == null) {
|
||||
d = ContextCompat.getDrawable(app, resId);
|
||||
d = DrawableCompat.wrap(d);
|
||||
d.mutate();
|
||||
if (clrId != 0) {
|
||||
DrawableCompat.setTint(d, ContextCompat.getColor(app, clrId));
|
||||
}
|
||||
drawable.put(hash, d);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
private Drawable getPaintedDrawable(@DrawableRes int resId, @ColorInt int color){
|
||||
long hash = ((long)resId << 31l) + color;
|
||||
Drawable d = drawable.get(hash);
|
||||
if(d == null) {
|
||||
d = ContextCompat.getDrawable(app, resId);
|
||||
d = DrawableCompat.wrap(d);
|
||||
d.mutate();
|
||||
DrawableCompat.setTint(d, color);
|
||||
|
||||
drawable.put(hash, d);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
public Drawable getPaintedIcon(@DrawableRes int id, @ColorInt int color){
|
||||
return getPaintedDrawable(id, color);
|
||||
}
|
||||
|
||||
public Drawable getIcon(@DrawableRes int id, @ColorRes int colorId) {
|
||||
return getDrawable(id, colorId);
|
||||
}
|
||||
|
||||
public Drawable getIcon(@DrawableRes int backgroundId, @DrawableRes int id, @ColorRes int colorId) {
|
||||
Drawable b = getDrawable(backgroundId, 0);
|
||||
Drawable f = getDrawable(id, colorId);
|
||||
Drawable[] layers = new Drawable[2];
|
||||
layers[0] = b;
|
||||
layers[1] = f;
|
||||
return new LayerDrawable(layers);
|
||||
}
|
||||
|
||||
public Drawable getThemedIcon(@DrawableRes int id) {
|
||||
return getDrawable(id, app.getSettings().isLightContent() ? R.color.icon_color : 0);
|
||||
}
|
||||
|
||||
public Drawable getIcon(@DrawableRes int id) {
|
||||
return getDrawable(id, 0);
|
||||
}
|
||||
|
||||
public Drawable getIcon(@DrawableRes int id, boolean light) {
|
||||
return getDrawable(id, light ? R.color.icon_color : 0);
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
public static int getDefaultColorRes(Context context) {
|
||||
final OsmandApplication app = (OsmandApplication) context.getApplicationContext();
|
||||
boolean light = app.getSettings().isLightContent();
|
||||
return light ? R.color.icon_color : R.color.color_white;
|
||||
}
|
||||
}
|
|
@ -556,14 +556,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized Float getHeading() {
|
||||
// if (heading != null && lastValSin != avgValSin && System.currentTimeMillis() - lastHeadingCalcTime > 700) {
|
||||
// avgValSin = lastValSin;
|
||||
// avgValCos = lastValCos;
|
||||
// Arrays.fill(previousCompassValuesA, avgValSin);
|
||||
// Arrays.fill(previousCompassValuesB, avgValCos);
|
||||
// updateCompassVal();
|
||||
// }
|
||||
public Float getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import net.osmand.plus.activities.MapActivity;
|
|||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.api.SQLiteAPI;
|
||||
import net.osmand.plus.api.SQLiteAPIImpl;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.dialogs.RateUsBottomSheetDialog;
|
||||
import net.osmand.plus.download.DownloadIndexesThread;
|
||||
import net.osmand.plus.helpers.AvoidSpecificRoads;
|
||||
|
@ -87,7 +88,7 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
OsmAndAppCustomization appCustomization;
|
||||
private final SQLiteAPI sqliteAPI = new SQLiteAPIImpl(this);
|
||||
private final OsmAndTaskManager taskManager = new OsmAndTaskManager(this);
|
||||
private final IconsCache iconsCache = new IconsCache(this);
|
||||
private final UiUtilities iconsCache = new UiUtilities(this);
|
||||
Handler uiHandler;
|
||||
private boolean plusVersionInApp;
|
||||
|
||||
|
@ -122,6 +123,7 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
QuickSearchHelper searchUICore;
|
||||
TravelDbHelper travelDbHelper;
|
||||
InAppPurchaseHelper inAppPurchaseHelper;
|
||||
MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||
|
||||
RoutingConfiguration.Builder defaultRoutingConfig;
|
||||
private Locale preferredLocale = null;
|
||||
|
@ -214,10 +216,11 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
public IconsCache getIconsCache() {
|
||||
public UiUtilities getUIUtilities() {
|
||||
return iconsCache;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
|
@ -420,7 +423,7 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
View view = uiContext.getLayoutInflater().inflate(R.layout.select_voice_first, null);
|
||||
|
||||
((ImageView) view.findViewById(R.id.icon))
|
||||
.setImageDrawable(getIconsCache().getIcon(R.drawable.ic_action_volume_up, getSettings().isLightContent()));
|
||||
.setImageDrawable(getUIUtilities().getIcon(R.drawable.ic_action_volume_up, getSettings().isLightContent()));
|
||||
|
||||
view.findViewById(R.id.spinner).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -441,7 +444,7 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
});
|
||||
|
||||
((ImageView) view.findViewById(R.id.dropDownIcon))
|
||||
.setImageDrawable(getIconsCache().getIcon(R.drawable.ic_action_arrow_drop_down, getSettings().isLightContent()));
|
||||
.setImageDrawable(getUIUtilities().getIcon(R.drawable.ic_action_arrow_drop_down, getSettings().isLightContent()));
|
||||
|
||||
builder.setCancelable(true);
|
||||
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
|
@ -1003,4 +1006,8 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
});
|
||||
bld.show();
|
||||
}
|
||||
|
||||
public MapViewTrackingUtilities getMapViewTrackingUtilities() {
|
||||
return mapViewTrackingUtilities;
|
||||
}
|
||||
}
|
||||
|
|
226
OsmAnd/src/net/osmand/plus/UiUtilities.java
Normal file
226
OsmAnd/src/net/osmand/plus/UiUtilities.java
Normal file
|
@ -0,0 +1,226 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import gnu.trove.map.hash.TLongObjectHashMap;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.views.DirectionDrawable;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorManager;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class UiUtilities {
|
||||
|
||||
private TLongObjectHashMap<Drawable> drawableCache = new TLongObjectHashMap<>();
|
||||
private OsmandApplication app;
|
||||
private static final int ORIENTATION_0 = 0;
|
||||
private static final int ORIENTATION_90 = 3;
|
||||
private static final int ORIENTATION_270 = 1;
|
||||
private static final int ORIENTATION_180 = 2;
|
||||
|
||||
|
||||
public UiUtilities(OsmandApplication app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
private Drawable getDrawable(@DrawableRes int resId, @ColorRes int clrId) {
|
||||
long hash = ((long) resId << 31l) + clrId;
|
||||
Drawable d = drawableCache.get(hash);
|
||||
if (d == null) {
|
||||
d = ContextCompat.getDrawable(app, resId);
|
||||
d = DrawableCompat.wrap(d);
|
||||
d.mutate();
|
||||
if (clrId != 0) {
|
||||
DrawableCompat.setTint(d, ContextCompat.getColor(app, clrId));
|
||||
}
|
||||
drawableCache.put(hash, d);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
private Drawable getPaintedDrawable(@DrawableRes int resId, @ColorInt int color) {
|
||||
long hash = ((long) resId << 31l) + color;
|
||||
Drawable d = drawableCache.get(hash);
|
||||
if (d == null) {
|
||||
d = ContextCompat.getDrawable(app, resId);
|
||||
d = DrawableCompat.wrap(d);
|
||||
d.mutate();
|
||||
DrawableCompat.setTint(d, color);
|
||||
|
||||
drawableCache.put(hash, d);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
public Drawable getPaintedIcon(@DrawableRes int id, @ColorInt int color) {
|
||||
return getPaintedDrawable(id, color);
|
||||
}
|
||||
|
||||
public Drawable getIcon(@DrawableRes int id, @ColorRes int colorId) {
|
||||
return getDrawable(id, colorId);
|
||||
}
|
||||
|
||||
public Drawable getIcon(@DrawableRes int backgroundId, @DrawableRes int id, @ColorRes int colorId) {
|
||||
Drawable b = getDrawable(backgroundId, 0);
|
||||
Drawable f = getDrawable(id, colorId);
|
||||
Drawable[] layers = new Drawable[2];
|
||||
layers[0] = b;
|
||||
layers[1] = f;
|
||||
return new LayerDrawable(layers);
|
||||
}
|
||||
|
||||
public Drawable getThemedIcon(@DrawableRes int id) {
|
||||
return getDrawable(id, app.getSettings().isLightContent() ? R.color.icon_color : 0);
|
||||
}
|
||||
|
||||
public Drawable getIcon(@DrawableRes int id) {
|
||||
return getDrawable(id, 0);
|
||||
}
|
||||
|
||||
public Drawable getIcon(@DrawableRes int id, boolean light) {
|
||||
return getDrawable(id, light ? R.color.icon_color : 0);
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
public static int getDefaultColorRes(Context context) {
|
||||
final OsmandApplication app = (OsmandApplication) context.getApplicationContext();
|
||||
boolean light = app.getSettings().isLightContent();
|
||||
return light ? R.color.icon_color : R.color.color_white;
|
||||
}
|
||||
|
||||
|
||||
public UpdateLocationViewCache getUpdateLocationViewCache(){
|
||||
UpdateLocationViewCache uvc = new UpdateLocationViewCache();
|
||||
uvc.screenOrientation = getScreenOrientation();
|
||||
return uvc;
|
||||
}
|
||||
|
||||
public static class UpdateLocationViewCache {
|
||||
int screenOrientation;
|
||||
public boolean paintTxt = true;
|
||||
public int arrowResId;
|
||||
public int arrowColor;
|
||||
public int textColor;
|
||||
public LatLon specialFrom;
|
||||
}
|
||||
|
||||
public void updateLocationView(UpdateLocationViewCache cache, ImageView arrow, TextView txt,
|
||||
double toLat, double toLon) {
|
||||
updateLocationView(cache, arrow, txt, new LatLon(toLat, toLon));
|
||||
}
|
||||
public void updateLocationView(UpdateLocationViewCache cache, ImageView arrow, TextView txt,
|
||||
LatLon toLoc) {
|
||||
float[] mes = new float[2];
|
||||
boolean stale = false;
|
||||
LatLon fromLoc = cache == null ? null : cache.specialFrom;
|
||||
boolean useCenter = fromLoc != null;
|
||||
Float h = null;
|
||||
if (fromLoc == null) {
|
||||
Location loc = app.getLocationProvider().getLastKnownLocation();
|
||||
h = app.getLocationProvider().getHeading();
|
||||
if (loc == null) {
|
||||
loc = app.getLocationProvider().getLastStaleKnownLocation();
|
||||
stale = true;
|
||||
}
|
||||
if (loc != null) {
|
||||
fromLoc = new LatLon(loc.getLatitude(), loc.getLongitude());
|
||||
} else {
|
||||
useCenter = true;
|
||||
fromLoc = app.getMapViewTrackingUtilities().getMapLocation();
|
||||
h = app.getMapViewTrackingUtilities().getMapRotate();
|
||||
if(h != null) {
|
||||
h = -h;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fromLoc != null && toLoc != null) {
|
||||
Location.distanceBetween(toLoc.getLatitude(), toLoc.getLongitude(), fromLoc.getLatitude(),
|
||||
fromLoc.getLongitude(), mes);
|
||||
}
|
||||
|
||||
if (arrow != null) {
|
||||
boolean newImage = false;
|
||||
int arrowResId = cache == null ? 0 : cache.arrowResId;
|
||||
if (arrowResId == 0) {
|
||||
arrowResId = R.drawable.ic_direction_arrow;
|
||||
}
|
||||
DirectionDrawable dd;
|
||||
if (!(arrow.getDrawable() instanceof DirectionDrawable)) {
|
||||
newImage = true;
|
||||
dd = new DirectionDrawable(app, arrow.getWidth(), arrow.getHeight());
|
||||
} else {
|
||||
dd = (DirectionDrawable) arrow.getDrawable();
|
||||
}
|
||||
int imgColorSet = cache == null ? 0 : cache.arrowColor;
|
||||
if (imgColorSet == 0) {
|
||||
imgColorSet = useCenter ? R.color.color_distance : R.color.color_myloc_distance;
|
||||
if (stale) {
|
||||
imgColorSet = R.color.icon_color;
|
||||
}
|
||||
}
|
||||
dd.setImage(arrowResId, imgColorSet);
|
||||
if (fromLoc == null || h == null || toLoc == null) {
|
||||
dd.setAngle(0);
|
||||
} else {
|
||||
float orientation = (cache == null ? 0 : -cache.screenOrientation) ;
|
||||
dd.setAngle(mes[1] - h + 180 + orientation);
|
||||
}
|
||||
if (newImage) {
|
||||
arrow.setImageDrawable(dd);
|
||||
}
|
||||
arrow.invalidate();
|
||||
}
|
||||
if (txt != null) {
|
||||
if (fromLoc != null && toLoc != null) {
|
||||
if (cache.paintTxt) {
|
||||
int textColorSet = cache.textColor;
|
||||
if (textColorSet == 0) {
|
||||
textColorSet = useCenter ? R.color.color_distance : R.color.color_myloc_distance;
|
||||
if (stale) {
|
||||
textColorSet = R.color.icon_color;
|
||||
}
|
||||
}
|
||||
txt.setTextColor(app.getResources().getColor(textColorSet));
|
||||
}
|
||||
txt.setText(OsmAndFormatter.getFormattedDistance(mes[0], app));
|
||||
} else {
|
||||
txt.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getScreenOrientation() {
|
||||
int screenOrientation = ((WindowManager) app.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation();
|
||||
switch (screenOrientation) {
|
||||
case ORIENTATION_0: // Device default (normally portrait)
|
||||
screenOrientation = 0;
|
||||
break;
|
||||
case ORIENTATION_90: // Landscape right
|
||||
screenOrientation = 90;
|
||||
break;
|
||||
case ORIENTATION_270: // Landscape left
|
||||
screenOrientation = 270;
|
||||
break;
|
||||
case ORIENTATION_180: // Upside down
|
||||
screenOrientation = 180;
|
||||
break;
|
||||
}
|
||||
//Looks like screenOrientation correction must not be applied for devices without compass?
|
||||
Sensor compass = ((SensorManager) app.getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
|
||||
if (compass == null) {
|
||||
screenOrientation = 0;
|
||||
}
|
||||
return screenOrientation;
|
||||
}
|
||||
|
||||
}
|
|
@ -44,7 +44,7 @@ public abstract class ActionBarPreferenceActivity extends AppCompatPreferenceAct
|
|||
shadowView = null;
|
||||
}
|
||||
tb.setClickable(true);
|
||||
tb.setNavigationIcon(((OsmandApplication) getApplication()).getIconsCache().getIcon(R.drawable.ic_arrow_back));
|
||||
tb.setNavigationIcon(((OsmandApplication) getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back));
|
||||
tb.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
tb.setBackgroundColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTabBackground)));
|
||||
tb.setTitleTextColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTextColor)));
|
||||
|
|
|
@ -244,7 +244,7 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme
|
|||
if (color == 0) {
|
||||
colorImageView.setImageDrawable(getContentIcon(R.drawable.ic_action_circle));
|
||||
} else {
|
||||
colorImageView.setImageDrawable(getMyApplication().getIconsCache().getPaintedIcon(R.drawable.ic_action_circle, color));
|
||||
colorImageView.setImageDrawable(getMyApplication().getUIUtilities().getPaintedIcon(R.drawable.ic_action_circle, color));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme
|
|||
TextView textView = (TextView) v.findViewById(R.id.text1);
|
||||
textView.setText(app.getString(ColorDialogs.paletteColors[position]));
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(null, null,
|
||||
app.getIconsCache().getPaintedIcon(R.drawable.ic_action_circle, color), null);
|
||||
app.getUIUtilities().getPaintedIcon(R.drawable.ic_action_circle, color), null);
|
||||
textView.setCompoundDrawablePadding(AndroidUtils.dpToPx(getContext(), 10f));
|
||||
v.findViewById(R.id.divider).setVisibility(View.GONE);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,24 @@
|
|||
*/
|
||||
package net.osmand.plus.activities;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.base.OsmAndListFragment;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
@ -20,23 +38,6 @@ import android.widget.ImageView;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.base.OsmAndListFragment;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class FavoritesListFragment extends OsmAndListFragment implements SearchActivityChild, OsmAndCompassListener {
|
||||
|
||||
public static final String SELECT_FAVORITE_POINT_INTENT_KEY = "SELECT_FAVORITE_POINT_INTENT_KEY";
|
||||
|
@ -48,7 +49,7 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
|||
private OsmandSettings settings;
|
||||
private boolean compassRegistered;
|
||||
|
||||
|
||||
float lastHeading ;
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
|
@ -67,7 +68,7 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
|||
double lat = intent.getDoubleExtra(SearchActivity.SEARCH_LAT, 0);
|
||||
double lon = intent.getDoubleExtra(SearchActivity.SEARCH_LON, 0);
|
||||
if (lat != 0 || lon != 0) {
|
||||
favouritesAdapter.location = new LatLon(lat, lon);
|
||||
favouritesAdapter.cache.specialFrom = new LatLon(lat, lon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,15 +86,10 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (favouritesAdapter.location == null && getActivity() instanceof SearchActivity) {
|
||||
favouritesAdapter.location = ((SearchActivity) getActivity()).getSearchPoint();
|
||||
if (getActivity() instanceof SearchActivity && ((SearchActivity) getActivity()).getSearchPoint() != null) {
|
||||
favouritesAdapter.cache.specialFrom = ((SearchActivity) getActivity()).getSearchPoint();
|
||||
}
|
||||
if (favouritesAdapter.location == null) {
|
||||
favouritesAdapter.location = settings.getLastKnownMapLocation();
|
||||
}
|
||||
favouritesAdapter.screenOrientation = DashLocationFragment.getScreenOrientation(getActivity());
|
||||
locationUpdate(favouritesAdapter.location);
|
||||
locationUpdate(favouritesAdapter.cache.specialFrom);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -106,13 +102,17 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
|||
app.getLocationProvider().addCompassListener(this);
|
||||
compassRegistered = true;
|
||||
}
|
||||
favouritesAdapter.searchAroundLocation = true;
|
||||
favouritesAdapter.cache.specialFrom = null;
|
||||
} else {
|
||||
favouritesAdapter.searchAroundLocation = false;
|
||||
favouritesAdapter.cache.specialFrom = ((SearchActivity) getActivity()).getSearchPoint();
|
||||
}
|
||||
}
|
||||
if (favouritesAdapter != null) {
|
||||
favouritesAdapter.updateLocation(l);
|
||||
if(l != null) {
|
||||
favouritesAdapter.sortByName();
|
||||
} else {
|
||||
favouritesAdapter.sortByDistance(l);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -156,33 +156,27 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
|||
|
||||
public static class FavouritesAdapter extends ArrayAdapter<FavouritePoint> {
|
||||
private Activity activity;
|
||||
private LatLon location;
|
||||
private OsmandApplication app;
|
||||
private boolean searchAroundLocation;
|
||||
private int screenOrientation;
|
||||
private Float heading;
|
||||
private boolean shoudShowMenuButton;
|
||||
private boolean shouldShowMenuButton;
|
||||
private UpdateLocationViewCache cache;
|
||||
|
||||
public FavouritesAdapter(Activity activity, List<FavouritePoint> list,
|
||||
boolean shoudShowMenuButton) {
|
||||
boolean shouldShowMenuButton) {
|
||||
super(activity, R.layout.favorites_list_item, list);
|
||||
this.activity = activity;
|
||||
this.app = ((OsmandApplication) activity.getApplication());
|
||||
this.shoudShowMenuButton = shoudShowMenuButton;
|
||||
this.shouldShowMenuButton = shouldShowMenuButton;
|
||||
cache = app.getUIUtilities().getUpdateLocationViewCache();
|
||||
}
|
||||
|
||||
public LatLon getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void updateLocation(LatLon l) {
|
||||
location = l;
|
||||
public void updateLocation(final LatLon l) {
|
||||
sort(new Comparator<FavouritePoint>() {
|
||||
@Override
|
||||
public int compare(FavouritePoint object1, FavouritePoint object2) {
|
||||
if (location != null) {
|
||||
double d1 = MapUtils.getDistance(location, object1.getLatitude(), object1.getLongitude());
|
||||
double d2 = MapUtils.getDistance(location, object2.getLatitude(), object2.getLongitude());
|
||||
if (l != null) {
|
||||
double d1 = MapUtils.getDistance(l, object1.getLatitude(), object1.getLongitude());
|
||||
double d2 = MapUtils.getDistance(l, object2.getLatitude(), object2.getLongitude());
|
||||
if (d1 == d2) {
|
||||
return 0;
|
||||
} else if (d1 > d2) {
|
||||
|
@ -204,7 +198,7 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
|||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View row = convertView;
|
||||
if (row == null) {
|
||||
LayoutInflater inflater = activity.getLayoutInflater(); // favourite dank
|
||||
LayoutInflater inflater = activity.getLayoutInflater();
|
||||
row = inflater.inflate(R.layout.favorites_list_item, parent, false);
|
||||
}
|
||||
|
||||
|
@ -212,14 +206,14 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
|||
TextView distanceText = (TextView) row.findViewById(R.id.distance);
|
||||
ImageView icon = (ImageView) row.findViewById(R.id.favourite_icon);
|
||||
ImageView direction = (ImageView) row.findViewById(R.id.direction);
|
||||
ImageView giImage= (ImageView)row.findViewById(R.id.group_image);
|
||||
ImageView giImage = (ImageView) row.findViewById(R.id.group_image);
|
||||
direction.setVisibility(View.VISIBLE);
|
||||
final FavouritePoint favorite = getItem(position);
|
||||
if (shoudShowMenuButton) {
|
||||
if (shouldShowMenuButton) {
|
||||
ImageButton options = (ImageButton) row.findViewById(R.id.options);
|
||||
options.setFocusable(false);
|
||||
options.setImageDrawable(((OsmandApplication) activity.getApplication())
|
||||
.getIconsCache().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
options.setImageDrawable(((OsmandApplication) activity.getApplication()).getUIUtilities()
|
||||
.getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
options.setVisibility(View.VISIBLE);
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -230,25 +224,65 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
|||
}
|
||||
if (!favorite.getCategory().isEmpty()) {
|
||||
giImage.setVisibility(View.VISIBLE);
|
||||
giImage.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_small_group));
|
||||
giImage.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_small_group));
|
||||
} else {
|
||||
giImage.setVisibility(View.GONE);
|
||||
}
|
||||
((TextView) row.findViewById(R.id.group_name)).setText(favorite.getCategory());
|
||||
|
||||
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(activity, favorite.getColor(), false));
|
||||
DashLocationFragment.updateLocationView(!searchAroundLocation, location, heading, direction, distanceText,
|
||||
favorite.getLatitude(), favorite.getLongitude(), screenOrientation, app);
|
||||
|
||||
|
||||
app.getUIUtilities().updateLocationView(cache, direction, distanceText,
|
||||
favorite.getLatitude(), favorite.getLongitude());
|
||||
name.setText(getName(favorite));
|
||||
final CheckBox ch = (CheckBox) row.findViewById(R.id.toggle_item);
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
ch.setVisibility(View.GONE);
|
||||
if (activity instanceof SearchActivity)
|
||||
ViewCompat.setAccessibilityDelegate(row, ((SearchActivity)activity).getAccessibilityAssistant());
|
||||
ViewCompat.setAccessibilityDelegate(row, ((SearchActivity) activity).getAccessibilityAssistant());
|
||||
return row;
|
||||
}
|
||||
|
||||
public void sortByName() {
|
||||
final Collator inst = Collator.getInstance();
|
||||
sort(new Comparator<FavouritePoint>() {
|
||||
@Override
|
||||
public int compare(FavouritePoint o1, FavouritePoint o2) {
|
||||
return inst.compare(o1.getName(), o2.getName());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
public void sortByDistance(final LatLon loc) {
|
||||
sort(new Comparator<FavouritePoint>() {
|
||||
@Override
|
||||
public int compare(FavouritePoint lhs, FavouritePoint rhs) {
|
||||
if (loc == null) {
|
||||
return 0;
|
||||
}
|
||||
double ld = MapUtils.getDistance(loc, lhs.getLatitude(), lhs.getLongitude());
|
||||
double rd = MapUtils.getDistance(loc, rhs.getLatitude(), rhs.getLongitude());
|
||||
return Double.compare(ld, rd);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void sortByDefault() {
|
||||
Location loc = app.getLocationProvider().getLastStaleKnownLocation();
|
||||
LatLon map = app.getMapViewTrackingUtilities().getMapLocation();
|
||||
if (loc != null) {
|
||||
sortByDistance(new LatLon(loc.getLatitude(), loc.getLongitude()));
|
||||
} else if(map != null){
|
||||
sortByDistance(map);
|
||||
} else{
|
||||
sortByName();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public OsmandApplication getMyApplication() {
|
||||
|
@ -260,9 +294,8 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
|||
// 99 in next line used to one-time initialize arrows (with reference vs. fixed-north direction) on non-compass
|
||||
// devices
|
||||
FragmentActivity activity = getActivity();
|
||||
float lastHeading = favouritesAdapter.heading != null ? favouritesAdapter.heading : 99;
|
||||
favouritesAdapter.heading = value;
|
||||
if (Math.abs(MapUtils.degreesDiff(lastHeading, favouritesAdapter.heading)) > 5) {
|
||||
if (Math.abs(MapUtils.degreesDiff(lastHeading, value)) > 5) {
|
||||
lastHeading = value;
|
||||
if (activity instanceof SearchActivity) {
|
||||
((SearchActivity)activity).getAccessibilityAssistant().lockEvents();
|
||||
favouritesAdapter.notifyDataSetChanged();
|
||||
|
@ -270,8 +303,6 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
|||
} else {
|
||||
favouritesAdapter.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
favouritesAdapter.heading = lastHeading;
|
||||
}
|
||||
if (activity instanceof SearchActivity) {
|
||||
final View selected = ((SearchActivity)activity).getAccessibilityAssistant().getFocusedView();
|
||||
|
@ -281,7 +312,7 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
|
|||
if ((position != AdapterView.INVALID_POSITION) && (position >= getListView().getHeaderViewsCount())) {
|
||||
FavouritePoint point = favouritesAdapter.getItem(position - getListView().getHeaderViewsCount());
|
||||
LatLon location = new LatLon(point.getLatitude(), point.getLongitude());
|
||||
((SearchActivity)activity).getNavigationInfo().updateTargetDirection(location, favouritesAdapter.heading.floatValue());
|
||||
((SearchActivity)activity).getNavigationInfo().updateTargetDirection(location, value);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
|
|
|
@ -105,7 +105,7 @@ public class FavoritesSearchFragment extends DialogFragment {
|
|||
}
|
||||
|
||||
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(app.getIconsCache().getThemedIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
|
@ -141,7 +141,7 @@ public class FavoritesSearchFragment extends DialogFragment {
|
|||
|
||||
progressBar = (ProgressBar) view.findViewById(R.id.searchProgressBar);
|
||||
clearButton = (ImageButton) view.findViewById(R.id.clearButton);
|
||||
clearButton.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_remove_dark));
|
||||
clearButton.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark));
|
||||
clearButton.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -149,7 +149,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
View searchView = inflater.inflate(R.layout.search_fav_list_item, null);
|
||||
searchView.setBackgroundResource(light ? R.color.bg_color_light : R.color.bg_color_dark);
|
||||
TextView title = (TextView) searchView.findViewById(R.id.title);
|
||||
title.setCompoundDrawablesWithIntrinsicBounds(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_search_dark), null, null, null);
|
||||
title.setCompoundDrawablesWithIntrinsicBounds(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_search_dark), null, null, null);
|
||||
title.setHint(R.string.shared_string_search);
|
||||
searchView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -783,7 +783,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
int disabledColor = light ? R.color.secondary_text_light : R.color.secondary_text_dark;
|
||||
row.findViewById(R.id.group_divider).setVisibility(groupPosition == 0 ? View.GONE : View.VISIBLE);
|
||||
int color = model.color == 0 || model.color == Color.BLACK ? getResources().getColor(R.color.color_favorite) : model.color;
|
||||
setCategoryIcon(app, app.getIconsCache().getPaintedIcon(
|
||||
setCategoryIcon(app, app.getUIUtilities().getPaintedIcon(
|
||||
R.drawable.ic_action_fav_dark, visible ? (color | 0xff000000) : getResources().getColor(disabledColor)),
|
||||
groupPosition, isExpanded, row, light);
|
||||
adjustIndicator(app, groupPosition, isExpanded, row, light);
|
||||
|
@ -833,7 +833,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
final View ch = row.findViewById(R.id.options);
|
||||
if (!selectionMode) {
|
||||
((ImageView) ch).setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
((ImageView) ch).setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
ch.setVisibility(View.VISIBLE);
|
||||
ch.setContentDescription(getString(R.string.shared_string_settings));
|
||||
ch.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -877,7 +877,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
if (showOptionsButton) {
|
||||
ImageView options = (ImageView) row.findViewById(R.id.options);
|
||||
options.setFocusable(false);
|
||||
options.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(
|
||||
options.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(
|
||||
R.drawable.ic_overflow_menu_white));
|
||||
options.setVisibility(View.VISIBLE);
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -252,7 +252,7 @@ public class IntermediatePointsDialog {
|
|||
} else {
|
||||
int icon = position == intermediates.size() - 1? R.drawable.ic_action_target:
|
||||
R.drawable.ic_action_intermediate;
|
||||
tv.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache().getThemedIcon(icon), null, null, null);
|
||||
tv.setCompoundDrawablesWithIntrinsicBounds(app.getUIUtilities().getThemedIcon(icon), null, null, null);
|
||||
tv.setCompoundDrawablePadding(padding);
|
||||
final CheckBox ch = ((CheckBox) v.findViewById(R.id.toggle_item));
|
||||
ch.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -160,7 +160,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
|
||||
private static final Log LOG = PlatformUtil.getLog(MapActivity.class);
|
||||
|
||||
private static MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||
private MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||
private static MapContextMenu mapContextMenu = new MapContextMenu();
|
||||
private static Intent prevActivityIntent = null;
|
||||
|
||||
|
@ -220,7 +220,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
boolean portraitMode = AndroidUiHelper.isOrientationPortrait(this);
|
||||
boolean largeDevice = AndroidUiHelper.isXLargeDevice(this);
|
||||
landscapeLayout = !portraitMode && !largeDevice;
|
||||
|
||||
mapViewTrackingUtilities = app.getMapViewTrackingUtilities();
|
||||
mapContextMenu.setMapActivity(this);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -1226,10 +1226,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
}
|
||||
|
||||
public LatLon getMapLocation() {
|
||||
if (mapView == null) {
|
||||
return settings.getLastKnownMapLocation();
|
||||
}
|
||||
return new LatLon(mapView.getLatitude(), mapView.getLongitude());
|
||||
return mapViewTrackingUtilities.getMapLocation();
|
||||
}
|
||||
|
||||
public float getMapRotate() {
|
||||
|
@ -1451,9 +1448,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
return mapViewTrackingUtilities;
|
||||
}
|
||||
|
||||
public static MapViewTrackingUtilities getSingleMapViewTrackingUtilities() {
|
||||
return mapViewTrackingUtilities;
|
||||
}
|
||||
|
||||
protected void parseLaunchIntentLocation() {
|
||||
Intent intent = getIntent();
|
||||
|
|
|
@ -327,7 +327,7 @@ public class MapActivityLayers {
|
|||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
Button neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
|
||||
Drawable drawable = app.getIconsCache().getThemedIcon(R.drawable.ic_action_singleselect);
|
||||
Drawable drawable = app.getUIUtilities().getThemedIcon(R.drawable.ic_action_singleselect);
|
||||
neutralButton.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
|
||||
neutralButton.setContentDescription(app.getString(R.string.shared_string_filters));
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ public class MapActivityLayers {
|
|||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
Button neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
|
||||
Drawable drawable = app.getIconsCache().getThemedIcon(R.drawable.ic_action_multiselect);
|
||||
Drawable drawable = app.getUIUtilities().getThemedIcon(R.drawable.ic_action_multiselect);
|
||||
neutralButton.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
|
||||
neutralButton.setContentDescription(app.getString(R.string.apply_filters));
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
}
|
||||
MenuItem menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(app.getIconsCache().getIcon(R.drawable.ic_action_marker_dark, light));
|
||||
menuItem = menuItem.setIcon(app.getUIUtilities().getIcon(R.drawable.ic_action_marker_dark, light));
|
||||
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -122,7 +122,7 @@ public class OpeningHoursView {
|
|||
}
|
||||
TextView label = (TextView)row.findViewById(R.id.label);
|
||||
ImageView icon = (ImageView)row.findViewById(R.id.remove);
|
||||
icon.setBackgroundDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_remove_dark));
|
||||
icon.setBackgroundDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark));
|
||||
if(selectedRule == position){
|
||||
label.setTypeface(null, Typeface.BOLD);
|
||||
label.setTextSize(22);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class OsmandActionBarActivity extends OsmandInAppPurchaseActivity {
|
|||
|
||||
//should be called after set content view
|
||||
protected void setupHomeButton(){
|
||||
Drawable back = ((OsmandApplication)getApplication()).getIconsCache().getIcon(R.drawable.ic_arrow_back);
|
||||
Drawable back = ((OsmandApplication)getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back);
|
||||
back.setColorFilter(ContextCompat.getColor(this, R.color.color_white), PorterDuff.Mode.MULTIPLY);
|
||||
final ActionBar supportActionBar = getSupportActionBar();
|
||||
if (supportActionBar != null) {
|
||||
|
|
|
@ -13,10 +13,10 @@ public abstract class OsmandBaseExpandableListAdapter extends BaseExpandableList
|
|||
protected void adjustIndicator(OsmandApplication app, int groupPosition, boolean isExpanded, View row, boolean light) {
|
||||
ImageView indicator = (ImageView) row.findViewById(R.id.explist_indicator);
|
||||
if (!isExpanded) {
|
||||
indicator.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_down, light));
|
||||
indicator.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_arrow_down, light));
|
||||
indicator.setContentDescription(row.getContext().getString(R.string.access_collapsed_list));
|
||||
} else {
|
||||
indicator.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_up, light));
|
||||
indicator.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_arrow_up, light));
|
||||
indicator.setContentDescription(row.getContext().getString(R.string.access_expanded_list));
|
||||
}
|
||||
indicator.setVisibility(getChildrenCount(groupPosition) > 0 ? View.VISIBLE : View.GONE);
|
||||
|
@ -25,9 +25,9 @@ public abstract class OsmandBaseExpandableListAdapter extends BaseExpandableList
|
|||
protected void setCategoryIcon(OsmandApplication app, int resId, int groupPosition, boolean isExpanded, View row, boolean light) {
|
||||
ImageView icon = (ImageView) row.findViewById(R.id.category_icon);
|
||||
if (resId == 0) {
|
||||
icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_folder_stroke, light));
|
||||
icon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_folder_stroke, light));
|
||||
} else {
|
||||
icon.setImageDrawable(app.getIconsCache().getIcon(resId, light));
|
||||
icon.setImageDrawable(app.getUIUtilities().getIcon(resId, light));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public abstract class OsmandListActivity extends
|
|||
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconDark, int menuItemType) {
|
||||
MenuItem menuItem = m.add(0, id, 0, titleRes);
|
||||
if (iconDark != 0) {
|
||||
menuItem.setIcon(getMyApplication().getIconsCache().getIcon(iconDark));
|
||||
menuItem.setIcon(getMyApplication().getUIUtilities().getIcon(iconDark));
|
||||
}
|
||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -132,7 +132,7 @@ public class PluginActivity extends OsmandActionBarActivity {
|
|||
Button getButton = (Button)findViewById(R.id.plugin_get);
|
||||
Button settingsButton = (Button)findViewById(R.id.plugin_settings);
|
||||
settingsButton.setCompoundDrawablesWithIntrinsicBounds(
|
||||
getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_settings),
|
||||
getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_settings),
|
||||
null, null, null);
|
||||
View installHeader = findViewById(R.id.plugin_install_header);
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class PluginActivity extends OsmandActionBarActivity {
|
|||
settingsButton.setVisibility(View.GONE);
|
||||
installHeader.setVisibility(View.VISIBLE);
|
||||
View worldGlobeIcon = installHeader.findViewById(R.id.ic_world_globe);
|
||||
Drawable worldGlobeDrawable = getMyApplication().getIconsCache().getThemedIcon(
|
||||
Drawable worldGlobeDrawable = getMyApplication().getUIUtilities().getThemedIcon(
|
||||
R.drawable.ic_world_globe_dark);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
worldGlobeIcon.setBackground(worldGlobeDrawable);
|
||||
|
|
|
@ -124,7 +124,7 @@ public class PluginsActivity extends OsmandListActivity {
|
|||
|
||||
|
||||
ImageView pluginOptions = (ImageView) view.findViewById(R.id.plugin_options);
|
||||
pluginOptions.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
pluginOptions.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
pluginOptions.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -1,6 +1,30 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.osm.io.NetworkUtils;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.DrivingRegion;
|
||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.dashboard.DashChooseAppDirFragment;
|
||||
import net.osmand.plus.dashboard.DashChooseAppDirFragment.ChooseAppDirFragment;
|
||||
import net.osmand.plus.dashboard.DashChooseAppDirFragment.MoveFilesToDifferentDirectory;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
|
@ -31,32 +55,6 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.osm.io.NetworkUtils;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.DrivingRegion;
|
||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.dashboard.DashChooseAppDirFragment;
|
||||
import net.osmand.plus.dashboard.DashChooseAppDirFragment.ChooseAppDirFragment;
|
||||
import net.osmand.plus.dashboard.DashChooseAppDirFragment.MoveFilesToDifferentDirectory;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class SettingsGeneralActivity extends SettingsBaseActivity implements OnRequestPermissionsResultCallback {
|
||||
|
||||
|
@ -168,7 +166,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
|
|||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (drs.get(which) == null) {
|
||||
settings.DRIVING_REGION_AUTOMATIC.set(true);
|
||||
MapViewTrackingUtilities mapViewTrackingUtilities = MapActivity.getSingleMapViewTrackingUtilities();
|
||||
MapViewTrackingUtilities mapViewTrackingUtilities = getMyApplication().getMapViewTrackingUtilities();
|
||||
if (mapViewTrackingUtilities != null) {
|
||||
mapViewTrackingUtilities.resetDrivingRegionUpdate();
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ import net.osmand.plus.GPXUtilities.TrkSegment;
|
|||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -108,7 +108,7 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
|||
view = inflater.inflate(R.layout.route_info_layout, container, false);
|
||||
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationIcon(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationContentDescription(R.string.shared_string_close);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -118,9 +118,9 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
|||
});
|
||||
|
||||
((ImageView) view.findViewById(R.id.distance_icon))
|
||||
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_route_distance));
|
||||
.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_route_distance));
|
||||
((ImageView) view.findViewById(R.id.time_icon))
|
||||
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_time_span));
|
||||
.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_time_span));
|
||||
|
||||
buildMenuButtons();
|
||||
|
||||
|
@ -337,13 +337,13 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
|||
((TextView) headerView.findViewById(R.id.ascent_text)).setText(asc);
|
||||
|
||||
((ImageView) headerView.findViewById(R.id.average_icon))
|
||||
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_altitude_average));
|
||||
.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_altitude_average));
|
||||
((ImageView) headerView.findViewById(R.id.range_icon))
|
||||
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_altitude_average));
|
||||
.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_altitude_average));
|
||||
((ImageView) headerView.findViewById(R.id.descent_icon))
|
||||
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_altitude_descent));
|
||||
.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_altitude_descent));
|
||||
((ImageView) headerView.findViewById(R.id.ascent_icon))
|
||||
.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_altitude_ascent));
|
||||
.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_altitude_ascent));
|
||||
|
||||
headerView.findViewById(R.id.details_view).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -415,7 +415,7 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
|||
}
|
||||
|
||||
private void buildMenuButtons() {
|
||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = getMyApplication().getUIUtilities();
|
||||
ImageButton printRoute = (ImageButton) view.findViewById(R.id.print_route);
|
||||
printRoute.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_gprint_dark));
|
||||
printRoute.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -76,15 +76,15 @@ public class AppModeDialog {
|
|||
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
||||
boolean nightMode = isNightMode(ctx, useMapTheme);
|
||||
if (checked) {
|
||||
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), nightMode ? R.color.route_info_checked_mode_icon_color_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), nightMode ? R.color.route_info_checked_mode_icon_color_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked)));
|
||||
tb.findViewById(R.id.selection).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (useMapTheme) {
|
||||
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.route_info_unchecked_mode_icon_color));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), R.color.route_info_unchecked_mode_icon_color));
|
||||
iv.setBackgroundResource(AndroidUtils.resolveAttribute(ctx, android.R.attr.selectableItemBackground));
|
||||
} else {
|
||||
iv.setImageDrawable(ctx.getIconsCache().getThemedIcon(mode.getSmallIconDark()));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getThemedIcon(mode.getSmallIconDark()));
|
||||
}
|
||||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_unchecked)));
|
||||
tb.findViewById(R.id.selection).setVisibility(View.INVISIBLE);
|
||||
|
@ -123,7 +123,7 @@ public class AppModeDialog {
|
|||
int metricsY = (int) ctx.getResources().getDimension(R.dimen.route_info_modes_height);
|
||||
View tb = layoutInflater.inflate(R.layout.mode_view, null);
|
||||
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
||||
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), isNightMode(ctx, useMapTheme) ? R.color.route_info_checked_mode_icon_color_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), isNightMode(ctx, useMapTheme) ? R.color.route_info_checked_mode_icon_color_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
iv.setContentDescription(mode.toHumanString(ctx));
|
||||
// tb.setCompoundDrawablesWithIntrinsicBounds(null, ctx.getIconsCache().getIcon(mode.getIconId(), R.color.app_mode_icon_color), null, null);
|
||||
LayoutParams lp = new LinearLayout.LayoutParams(metricsX, metricsY);
|
||||
|
|
|
@ -179,7 +179,7 @@ public class SearchAddressFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
OsmandApplication app = getApplication();
|
||||
Drawable icon = getApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_remove_dark);
|
||||
Drawable icon = getApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark);
|
||||
((ImageView)findViewById(R.id.ResetBuilding)).setBackgroundDrawable(icon);
|
||||
findViewById(R.id.ResetBuilding).setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,22 @@
|
|||
package net.osmand.plus.activities.search;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.base.OsmAndListFragment;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
@ -24,24 +41,6 @@ import android.widget.ListView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.TextView.BufferType;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.base.OsmAndListFragment;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class SearchHistoryFragment extends OsmAndListFragment implements SearchActivityChild, OsmAndCompassListener {
|
||||
private LatLon location;
|
||||
|
@ -51,9 +50,9 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
|
|||
public static final String SEARCH_LON = SearchActivity.SEARCH_LON;
|
||||
private HistoryAdapter historyAdapter;
|
||||
private Float heading;
|
||||
private boolean searchAroundLocation;
|
||||
private boolean compassRegistered;
|
||||
private int screenOrientation;
|
||||
private UpdateLocationViewCache updateLocationViewCache;
|
||||
private double lastHeading;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -125,19 +124,18 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
|
|||
//Hardy: onResume() code is needed so that search origin is properly reflected in tab contents when origin has been changed on one tab, then tab is changed to another one.
|
||||
location = null;
|
||||
FragmentActivity activity = getActivity();
|
||||
updateLocationViewCache = getMyApplication().getUIUtilities().getUpdateLocationViewCache();
|
||||
Intent intent = activity.getIntent();
|
||||
if (intent != null) {
|
||||
double lat = intent.getDoubleExtra(SEARCH_LAT, 0);
|
||||
double lon = intent.getDoubleExtra(SEARCH_LON, 0);
|
||||
if (lat != 0 || lon != 0) {
|
||||
historyAdapter.location = new LatLon(lat, lon);
|
||||
updateLocationViewCache.specialFrom = new LatLon(lat, lon);
|
||||
|
||||
}
|
||||
}
|
||||
if (location == null && activity instanceof SearchActivity) {
|
||||
location = ((SearchActivity) activity).getSearchPoint();
|
||||
}
|
||||
if (location == null) {
|
||||
location = ((OsmandApplication) activity.getApplication()).getSettings().getLastKnownMapLocation();
|
||||
if (activity instanceof SearchActivity && ((SearchActivity) activity).getSearchPoint() != null) {
|
||||
updateLocationViewCache.specialFrom = ((SearchActivity) activity).getSearchPoint();
|
||||
}
|
||||
historyAdapter.clear();
|
||||
for (HistoryEntry entry : helper.getHistoryEntries()) {
|
||||
|
@ -145,12 +143,11 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
|
|||
}
|
||||
locationUpdate(location);
|
||||
clearButton.setVisibility(historyAdapter.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
screenOrientation = DashLocationFragment.getScreenOrientation(getActivity());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void locationUpdate(LatLon l) {
|
||||
//location = l;
|
||||
if (getActivity() instanceof SearchActivity) {
|
||||
if (((SearchActivity) getActivity()).isSearchAroundCurrentLocation() && l != null) {
|
||||
if (!compassRegistered) {
|
||||
|
@ -159,13 +156,13 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
|
|||
app.getLocationProvider().addCompassListener(this);
|
||||
compassRegistered = true;
|
||||
}
|
||||
searchAroundLocation = true;
|
||||
updateLocationViewCache.specialFrom = null;
|
||||
} else {
|
||||
searchAroundLocation = false;
|
||||
updateLocationViewCache.specialFrom = ((SearchActivity) getActivity()).getSearchPoint();
|
||||
}
|
||||
}
|
||||
if (historyAdapter != null) {
|
||||
historyAdapter.updateLocation(l);
|
||||
historyAdapter.updateLocation();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,7 +202,7 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
|
|||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
MenuItem item = optionsMenu.getMenu().add(
|
||||
R.string.shared_string_remove).setIcon(
|
||||
getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_delete_dark));
|
||||
getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_delete_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
@ -218,11 +215,9 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
|
|||
}
|
||||
|
||||
class HistoryAdapter extends ArrayAdapter<HistoryEntry> {
|
||||
private LatLon location;
|
||||
|
||||
|
||||
public void updateLocation(LatLon l) {
|
||||
location = l;
|
||||
public void updateLocation() {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
@ -241,10 +236,11 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
|
|||
udpateHistoryItem(historyEntry, row, location, getActivity(), getMyApplication());
|
||||
TextView distanceText = (TextView) row.findViewById(R.id.distance);
|
||||
ImageView direction = (ImageView) row.findViewById(R.id.direction);
|
||||
DashLocationFragment.updateLocationView(!searchAroundLocation, location, heading, direction, distanceText,
|
||||
historyEntry.getLat(), historyEntry.getLon(), screenOrientation, getMyApplication());
|
||||
getMyApplication().getUIUtilities().updateLocationView(updateLocationViewCache,
|
||||
direction, distanceText, historyEntry.getLat(),
|
||||
historyEntry.getLon());
|
||||
ImageButton options = (ImageButton) row.findViewById(R.id.options);
|
||||
options.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
options.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
options.setVisibility(View.VISIBLE);
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -264,7 +260,7 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
|
|||
TextView nameText = (TextView) row.findViewById(R.id.name);
|
||||
TextView distanceText = (TextView) row.findViewById(R.id.distance);
|
||||
ImageView direction = (ImageView) row.findViewById(R.id.direction);
|
||||
IconsCache ic = app.getIconsCache();
|
||||
UiUtilities ic = app.getUIUtilities();
|
||||
direction.setImageDrawable(ic.getIcon(R.drawable.ic_direction_arrow, R.color.color_distance));
|
||||
String distance = "";
|
||||
if (location != null) {
|
||||
|
@ -326,12 +322,9 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
|
|||
|
||||
@Override
|
||||
public void updateCompassValue(float value) {
|
||||
// 99 in next line used to one-time initalize arrows (with reference vs. fixed-north direction) on non-compass
|
||||
// devices
|
||||
FragmentActivity activity = getActivity();
|
||||
float lastHeading = heading != null ? heading : 99;
|
||||
heading = value;
|
||||
if (heading != null && Math.abs(MapUtils.degreesDiff(lastHeading, heading)) > 5) {
|
||||
if (Math.abs(MapUtils.degreesDiff(lastHeading, value)) > 5) {
|
||||
lastHeading = value;
|
||||
if (activity instanceof SearchActivity) {
|
||||
((SearchActivity)activity).getAccessibilityAssistant().lockEvents();
|
||||
historyAdapter.notifyDataSetChanged();
|
||||
|
@ -339,8 +332,6 @@ public class SearchHistoryFragment extends OsmAndListFragment implements SearchA
|
|||
} else {
|
||||
historyAdapter.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
heading = lastHeading;
|
||||
}
|
||||
if (activity instanceof SearchActivity) {
|
||||
final View selected = ((SearchActivity)activity).getAccessibilityAssistant().getFocusedView();
|
||||
|
|
|
@ -3,6 +3,46 @@
|
|||
*/
|
||||
package net.osmand.plus.activities.search;
|
||||
|
||||
import gnu.trove.set.hash.TLongHashSet;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.ResultMatcher;
|
||||
import net.osmand.access.AccessibilityAssistant;
|
||||
import net.osmand.access.NavigationInfo;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.R.color;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import net.osmand.plus.activities.EditPOIFilterActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmandListActivity;
|
||||
import net.osmand.plus.poi.NominatimPoiFilter;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.poi.PoiUIFilter.AmenityNameFilter;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.plus.views.DirectionDrawable;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
import net.osmand.util.OpeningHoursParser;
|
||||
import net.osmand.util.OpeningHoursParser.OpeningHours;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
@ -36,47 +76,6 @@ import android.widget.ListView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.ResultMatcher;
|
||||
import net.osmand.access.AccessibilityAssistant;
|
||||
import net.osmand.access.NavigationInfo;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.R.color;
|
||||
import net.osmand.plus.activities.EditPOIFilterActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmandListActivity;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.plus.poi.NominatimPoiFilter;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.poi.PoiUIFilter.AmenityNameFilter;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.plus.views.DirectionDrawable;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
import net.osmand.util.OpeningHoursParser;
|
||||
import net.osmand.util.OpeningHoursParser.OpeningHours;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import gnu.trove.set.hash.TLongHashSet;
|
||||
|
||||
/**
|
||||
* Search poi activity
|
||||
*/
|
||||
|
@ -133,7 +132,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
});
|
||||
showFilterItem = menu.add(0, FILTER, 0, R.string.search_poi_filter);
|
||||
MenuItemCompat.setShowAsAction(showFilterItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
showFilterItem = showFilterItem.setIcon(getMyApplication().getIconsCache().getIcon(
|
||||
showFilterItem = showFilterItem.setIcon(getMyApplication().getUIUtilities().getIcon(
|
||||
R.drawable.ic_action_filter_dark));
|
||||
showFilterItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
@ -156,7 +155,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
|
||||
showOnMapItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
||||
MenuItemCompat.setShowAsAction(showOnMapItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
showOnMapItem = showOnMapItem.setIcon(getMyApplication().getIconsCache().getIcon(
|
||||
showOnMapItem = showOnMapItem.setIcon(getMyApplication().getUIUtilities().getIcon(
|
||||
R.drawable.ic_show_on_map));
|
||||
showOnMapItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
@ -264,9 +263,9 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
});
|
||||
searchFilter.setHint(R.string.filter_poi_hint);
|
||||
((ImageView) findViewById(R.id.search_icon)).setImageDrawable(
|
||||
getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_filter_dark));
|
||||
getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_filter_dark));
|
||||
((ImageView) findViewById(R.id.options)).
|
||||
setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
findViewById(R.id.options).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -346,7 +345,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
|
||||
private void showOptionsMenu(View v) {
|
||||
// Show menu with search all, name finder, name finder poi
|
||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = getMyApplication().getUIUtilities();
|
||||
final PopupMenu optionsMenu = new PopupMenu(this, v);
|
||||
|
||||
final PoiUIFilter f = this.filter;
|
||||
|
@ -380,7 +379,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
}
|
||||
|
||||
private void addFilter(PopupMenu optionsMenu, final String value) {
|
||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = getMyApplication().getUIUtilities();
|
||||
MenuItem item = optionsMenu.getMenu().add(getString(R.string.search_poi_filter) + ": " + value)
|
||||
.setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_filter_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
|
@ -557,7 +556,8 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
try {
|
||||
int position = getListView().getPositionForView(selected);
|
||||
if ((position != AdapterView.INVALID_POSITION) && (position >= getListView().getHeaderViewsCount())) {
|
||||
navigationInfo.updateTargetDirection(amenityAdapter.getItem(position - getListView().getHeaderViewsCount()).getLocation(), heading.floatValue());
|
||||
navigationInfo.updateTargetDirection(amenityAdapter.getItem(position - getListView().getHeaderViewsCount()).
|
||||
getLocation(), heading.floatValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
|
@ -717,10 +717,11 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
class AmenityAdapter extends ArrayAdapter<Amenity> {
|
||||
private AmenityFilter listFilter;
|
||||
private List<Amenity> originalAmenityList;
|
||||
private int screenOrientation;
|
||||
private UpdateLocationViewCache updateLocationViewCache;
|
||||
|
||||
AmenityAdapter(List<Amenity> list) {
|
||||
super(SearchPOIActivity.this, R.layout.searchpoi_list, list);
|
||||
updateLocationViewCache = getMyApplication().getUIUtilities().getUpdateLocationViewCache();
|
||||
originalAmenityList = new ArrayList<Amenity>(list);
|
||||
this.setNotifyOnChange(false);
|
||||
}
|
||||
|
@ -731,7 +732,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
|
||||
public void setNewModel(List<Amenity> amenityList) {
|
||||
setNotifyOnChange(false);
|
||||
screenOrientation = DashLocationFragment.getScreenOrientation(SearchPOIActivity.this);
|
||||
updateLocationViewCache = getMyApplication().getUIUtilities().getUpdateLocationViewCache();
|
||||
originalAmenityList = new ArrayList<Amenity>(amenityList);
|
||||
clear();
|
||||
for (Amenity obj : amenityList) {
|
||||
|
@ -768,7 +769,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
|
||||
timeIcon.setVisibility(View.VISIBLE);
|
||||
timeText.setVisibility(View.VISIBLE);
|
||||
timeIcon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_small_time, colorId));
|
||||
timeIcon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_small_time, colorId));
|
||||
timeText.setTextColor(app.getResources().getColor(colorId));
|
||||
String rt = rs.getCurrentRuleTime(inst);
|
||||
timeText.setText(rt == null ? "" : rt);
|
||||
|
@ -790,19 +791,12 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
direction.setImageDrawable(draw);
|
||||
}
|
||||
net.osmand.Location loc = location;
|
||||
if (loc != null) {
|
||||
mes = new float[2];
|
||||
LatLon l = amenity.getLocation();
|
||||
net.osmand.Location.distanceBetween(l.getLatitude(), l.getLongitude(), loc.getLatitude(),
|
||||
loc.getLongitude(), mes);
|
||||
if(searchNearBy) {
|
||||
updateLocationViewCache.specialFrom = null;
|
||||
} else if(loc != null) {
|
||||
updateLocationViewCache.specialFrom = new LatLon(loc.getLatitude(), loc.getLongitude());
|
||||
}
|
||||
if (loc != null) {
|
||||
float a = heading != null ? heading : 0;
|
||||
draw.setAngle(mes[1] - a + 180 + screenOrientation);
|
||||
} else {
|
||||
draw.setAngle(0);
|
||||
}
|
||||
draw.setColorId(searchNearBy ? color.color_myloc_distance : color.color_distance);
|
||||
getMyApplication().getUIUtilities().updateLocationView(updateLocationViewCache, direction, distanceText, amenity.getLocation());
|
||||
direction.setImageDrawable(draw);
|
||||
PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
|
||||
if (st != null) {
|
||||
|
@ -817,15 +811,10 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
icon.setImageDrawable(null);
|
||||
}
|
||||
|
||||
String distance = " ";
|
||||
if (mes != null) {
|
||||
distance = " " + OsmAndFormatter.getFormattedDistance((int) mes[0], getMyApplication()) + " "; //$NON-NLS-1$
|
||||
}
|
||||
String poiType = OsmAndFormatter.getPoiStringWithoutType(amenity,
|
||||
app.getSettings().MAP_PREFERRED_LOCALE.get(),
|
||||
app.getSettings().MAP_TRANSLITERATE_NAMES.get());
|
||||
label.setText(poiType);
|
||||
distanceText.setText(distance);
|
||||
ViewCompat.setAccessibilityDelegate(row, accessibilityAssistant);
|
||||
return (row);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.osmand.CollatorStringMatcher.StringMatcherMode;
|
|||
import net.osmand.data.LatLon;
|
||||
import net.osmand.osm.AbstractPoiType;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -67,7 +67,7 @@ public class SearchPoiFilterFragment extends OsmAndListFragment implements Searc
|
|||
v.findViewById(R.id.SearchFilterLayout).setVisibility(View.VISIBLE);
|
||||
((EditText) v.findViewById(R.id.searchEditText)).setHint(R.string.search_poi_category_hint);
|
||||
((ImageView) v.findViewById(R.id.search_icon)).setImageDrawable(
|
||||
getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_search_dark));
|
||||
getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_search_dark));
|
||||
|
||||
setupSearchEditText((EditText) v.findViewById(R.id.searchEditText));
|
||||
setupOptions((ImageView) v.findViewById(R.id.options));
|
||||
|
@ -76,7 +76,7 @@ public class SearchPoiFilterFragment extends OsmAndListFragment implements Searc
|
|||
}
|
||||
|
||||
private void setupOptions(ImageView options) {
|
||||
options.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
options.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -326,7 +326,7 @@ public class SearchPoiFilterFragment extends OsmAndListFragment implements Searc
|
|||
|
||||
private void showOptionsMenu(View v) {
|
||||
// Show menu with search all, name finder, name finder poi
|
||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = getMyApplication().getUIUtilities();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
|
||||
MenuItem item = optionsMenu.getMenu().add(R.string.poi_filter_custom_filter)
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.AVActionType;
|
||||
|
@ -124,7 +124,7 @@ public class AudioVideoNoteRecordingMenu {
|
|||
|
||||
public void update() {
|
||||
CurrentRecording recording = plugin.getCurrentRecording();
|
||||
IconsCache iconsCache = plugin.getMapActivity().getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = plugin.getMapActivity().getMyApplication().getUIUtilities();
|
||||
|
||||
ImageView leftButtonIcon = (ImageView) view.findViewById(R.id.leftButtonIcon);
|
||||
View leftButtonView = view.findViewById(R.id.leftButtonView);
|
||||
|
|
|
@ -94,7 +94,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
View view = inflater.inflate(R.layout.note, null, false);
|
||||
|
||||
getNoteView(recording, view, getMyApplication());
|
||||
((ImageView) view.findViewById(R.id.play)).setImageDrawable(getMyApplication().getIconsCache()
|
||||
((ImageView) view.findViewById(R.id.play)).setImageDrawable(getMyApplication().getUIUtilities()
|
||||
.getThemedIcon(R.drawable.ic_play_dark));
|
||||
view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -146,11 +146,11 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
Drawable iconDrawable;
|
||||
|
||||
if (recording.isAudio()) {
|
||||
iconDrawable = ctx.getIconsCache().getIcon(R.drawable.ic_type_audio, R.color.color_distance);
|
||||
iconDrawable = ctx.getUIUtilities().getIcon(R.drawable.ic_type_audio, R.color.color_distance);
|
||||
} else if (recording.isVideo()) {
|
||||
iconDrawable = ctx.getIconsCache().getIcon(R.drawable.ic_type_video, R.color.color_distance);
|
||||
iconDrawable = ctx.getUIUtilities().getIcon(R.drawable.ic_type_video, R.color.color_distance);
|
||||
} else {
|
||||
iconDrawable = ctx.getIconsCache().getIcon(R.drawable.ic_type_img, R.color.color_distance);
|
||||
iconDrawable = ctx.getUIUtilities().getIcon(R.drawable.ic_type_img, R.color.color_distance);
|
||||
}
|
||||
icon.setImageDrawable(iconDrawable);
|
||||
return iconDrawable;
|
||||
|
|
|
@ -212,7 +212,7 @@ public class NotesAdapter extends ArrayAdapter<Object> {
|
|||
int iconRes = recording.isAudio() ? R.drawable.ic_type_audio
|
||||
: (recording.isVideo() ? R.drawable.ic_type_video : R.drawable.ic_type_img);
|
||||
int colorRes = app.getSettings().isLightContent() ? R.color.icon_color : R.color.ctx_menu_info_text_dark;
|
||||
holder.icon.setImageDrawable(app.getIconsCache().getIcon(iconRes, colorRes));
|
||||
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(iconRes, colorRes));
|
||||
}
|
||||
|
||||
holder.bottomDivider.setVisibility(hideBottomDivider(position) ? View.GONE : View.VISIBLE);
|
||||
|
@ -230,7 +230,7 @@ public class NotesAdapter extends ArrayAdapter<Object> {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
holder.options.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
holder.options.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
holder.options.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -10,14 +10,14 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
public class BaseOsmAndDialogFragment extends DialogFragment {
|
||||
|
||||
private IconsCache iconsCache;
|
||||
private UiUtilities iconsCache;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -35,9 +35,9 @@ public class BaseOsmAndDialogFragment extends DialogFragment {
|
|||
return (AppCompatActivity) getActivity();
|
||||
}
|
||||
|
||||
protected IconsCache getIconsCache() {
|
||||
protected UiUtilities getIconsCache() {
|
||||
if (iconsCache == null) {
|
||||
iconsCache = getMyApplication().getIconsCache();
|
||||
iconsCache = getMyApplication().getUIUtilities();
|
||||
}
|
||||
return iconsCache;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import android.view.ViewTreeObserver;
|
|||
import android.view.animation.Animation;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -26,7 +26,7 @@ import net.osmand.plus.activities.OsmandActionBarActivity;
|
|||
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
|
||||
|
||||
public class BaseOsmAndFragment extends Fragment implements TransitionAnimator {
|
||||
private IconsCache iconsCache;
|
||||
private UiUtilities iconsCache;
|
||||
|
||||
private int statusBarColor = -1;
|
||||
private boolean transitionAnimationAllowed = true;
|
||||
|
@ -165,26 +165,26 @@ public class BaseOsmAndFragment extends Fragment implements TransitionAnimator {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
protected IconsCache getIconsCache() {
|
||||
protected UiUtilities getIconsCache() {
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (iconsCache == null && app != null) {
|
||||
iconsCache = app.getIconsCache();
|
||||
iconsCache = app.getUIUtilities();
|
||||
}
|
||||
return iconsCache;
|
||||
}
|
||||
|
||||
protected Drawable getPaintedContentIcon(@DrawableRes int id, @ColorInt int color) {
|
||||
IconsCache cache = getIconsCache();
|
||||
UiUtilities cache = getIconsCache();
|
||||
return cache != null ? cache.getPaintedIcon(id, color) : null;
|
||||
}
|
||||
|
||||
protected Drawable getIcon(@DrawableRes int id, @ColorRes int colorId) {
|
||||
IconsCache cache = getIconsCache();
|
||||
UiUtilities cache = getIconsCache();
|
||||
return cache != null ? cache.getIcon(id, colorId) : null;
|
||||
}
|
||||
|
||||
protected Drawable getContentIcon(@DrawableRes int id) {
|
||||
IconsCache cache = getIconsCache();
|
||||
UiUtilities cache = getIconsCache();
|
||||
return cache != null ? cache.getThemedIcon(id) : null;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public abstract class BottomSheetDialogFragment extends DialogFragment {
|
|||
protected Drawable getIcon(@DrawableRes int drawableRes, @ColorRes int color) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app != null) {
|
||||
return app.getIconsCache().getIcon(drawableRes, color);
|
||||
return app.getUIUtilities().getIcon(drawableRes, color);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public abstract class BottomSheetDialogFragment extends DialogFragment {
|
|||
protected Drawable getContentIcon(@DrawableRes int drawableRes) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app != null) {
|
||||
return app.getIconsCache().getThemedIcon(drawableRes);
|
||||
return app.getUIUtilities().getThemedIcon(drawableRes);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -440,6 +440,20 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
mapView.refreshMap();
|
||||
}
|
||||
}
|
||||
|
||||
public LatLon getMapLocation() {
|
||||
if (mapView == null) {
|
||||
return settings.getLastKnownMapLocation();
|
||||
}
|
||||
return new LatLon(mapView.getLatitude(), mapView.getLongitude());
|
||||
}
|
||||
|
||||
public Float getMapRotate() {
|
||||
if (mapView == null) {
|
||||
return null;
|
||||
}
|
||||
return mapView.getRotate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
|
||||
|
|
|
@ -49,7 +49,7 @@ public class DashErrorFragment extends DashBaseFragment {
|
|||
String msg = MessageFormat.format(getString(R.string.previous_run_crashed), OsmandApplication.EXCEPTION_PATH);
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
ImageView iv = ((ImageView) view.findViewById(R.id.error_icon));
|
||||
iv.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_crashlog));
|
||||
iv.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_crashlog));
|
||||
TextView message = ((TextView) view.findViewById(R.id.error_header));
|
||||
message.setTypeface(typeface);
|
||||
message.setText(msg);
|
||||
|
|
|
@ -105,7 +105,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
|
|||
ImageView groupImage = (ImageView)view.findViewById(R.id.group_image);
|
||||
if (point.getCategory().length() > 0) {
|
||||
((TextView) view.findViewById(R.id.group_name)).setText(point.getCategory());
|
||||
groupImage.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_small_group));
|
||||
groupImage.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_small_group));
|
||||
} else {
|
||||
groupImage.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
|
|||
name.setTypeface(Typeface.DEFAULT, point.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
|
||||
view.findViewById(R.id.navigate_to).setVisibility(View.VISIBLE);
|
||||
|
||||
((ImageView) view.findViewById(R.id.navigate_to)).setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_gdirections_dark));
|
||||
((ImageView) view.findViewById(R.id.navigate_to)).setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_gdirections_dark));
|
||||
view.findViewById(R.id.navigate_to).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
|
@ -1,24 +1,15 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorManager;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.views.DirectionDrawable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 26.01.2015.
|
||||
|
@ -26,12 +17,7 @@ import java.util.List;
|
|||
@SuppressLint("ResourceAsColor")
|
||||
public abstract class DashLocationFragment extends DashBaseFragment {
|
||||
|
||||
private static final int ORIENTATION_0 = 0;
|
||||
private static final int ORIENTATION_90 = 3;
|
||||
private static final int ORIENTATION_270 = 1;
|
||||
private static final int ORIENTATION_180 = 2;
|
||||
protected List<DashLocationView> distances = new ArrayList<DashLocationFragment.DashLocationView>();
|
||||
private int screenOrientation;
|
||||
|
||||
public static class DashLocationView {
|
||||
public ImageView arrow;
|
||||
|
@ -46,40 +32,14 @@ public abstract class DashLocationFragment extends DashBaseFragment {
|
|||
this.txt = txt;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onOpenDash() {
|
||||
//Hardy: getRotation() is the correction if device's screen orientation != the default display's standard orientation
|
||||
screenOrientation = getScreenOrientation(getActivity());
|
||||
}
|
||||
|
||||
public static int getScreenOrientation(Activity a) {
|
||||
int screenOrientation = ((WindowManager) a.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation();
|
||||
switch (screenOrientation) {
|
||||
case ORIENTATION_0: // Device default (normally portrait)
|
||||
screenOrientation = 0;
|
||||
break;
|
||||
case ORIENTATION_90: // Landscape right
|
||||
screenOrientation = 90;
|
||||
break;
|
||||
case ORIENTATION_270: // Landscape left
|
||||
screenOrientation = 270;
|
||||
break;
|
||||
case ORIENTATION_180: // Upside down
|
||||
screenOrientation = 180;
|
||||
break;
|
||||
}
|
||||
//Looks like screenOrientation correction must not be applied for devices without compass?
|
||||
Sensor compass = ((SensorManager) a.getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
|
||||
if (compass == null) {
|
||||
screenOrientation = 0;
|
||||
}
|
||||
return screenOrientation;
|
||||
}
|
||||
|
||||
public LatLon getDefaultLocation() {
|
||||
DashboardOnMap d = dashboard;
|
||||
|
@ -94,114 +54,16 @@ public abstract class DashLocationFragment extends DashBaseFragment {
|
|||
if (d == null) {
|
||||
return;
|
||||
}
|
||||
float head = d.getHeading();
|
||||
float mapRotation = d.getMapRotation();
|
||||
LatLon mw = d.getMapViewLocation();
|
||||
boolean useCenter = !d.isMapLinkedToLocation();
|
||||
float h = useCenter ? -mapRotation : head;
|
||||
UiUtilities ic = getMyApplication().getUIUtilities();
|
||||
UpdateLocationViewCache cache = ic.getUpdateLocationViewCache();
|
||||
for (DashLocationView lv : distances) {
|
||||
updateLocationView(useCenter, mw, h, lv.arrow, lv.arrowResId, lv.txt, lv.loc, screenOrientation,
|
||||
getMyApplication(), lv.paint);
|
||||
cache.arrowResId = lv.arrowResId;
|
||||
cache.paintTxt = lv.paint;
|
||||
ic.updateLocationView(cache, lv.arrow, lv.txt, lv.loc);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
|
||||
ImageView arrow, int imgColor, TextView txt, int textColor, double toLat, double toLon,
|
||||
int screenOrientation, OsmandApplication app, Context ctx) {
|
||||
updateLocationView(useCenter, fromLoc, h, arrow, 0, imgColor, txt, textColor, new LatLon(toLat, toLon), screenOrientation, app, true);
|
||||
}
|
||||
|
||||
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
|
||||
ImageView arrow, TextView txt, double toLat, double toLon,
|
||||
int screenOrientation, OsmandApplication app) {
|
||||
updateLocationView(useCenter, fromLoc, h, arrow, 0, txt, new LatLon(toLat, toLon), screenOrientation, app, true);
|
||||
}
|
||||
|
||||
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
|
||||
ImageView arrow, int arrowResId, TextView txt, LatLon toLoc,
|
||||
int screenOrientation, OsmandApplication app, boolean paint) {
|
||||
updateLocationView(useCenter, fromLoc, h, arrow, arrowResId, 0, txt, 0, toLoc, screenOrientation, app, paint);
|
||||
}
|
||||
|
||||
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
|
||||
ImageView arrow, int arrowResId, int imgColor, TextView txt, LatLon toLoc,
|
||||
int screenOrientation, OsmandApplication app, boolean paint) {
|
||||
updateLocationView(useCenter, fromLoc, h, arrow, arrowResId, imgColor, txt, 0, toLoc, screenOrientation, app, paint);
|
||||
}
|
||||
|
||||
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
|
||||
ImageView arrow, int arrowResId, int imgColor, TextView txt, int textColor, LatLon toLoc,
|
||||
int screenOrientation, OsmandApplication app, boolean paint) {
|
||||
float[] mes = new float[2];
|
||||
boolean stale = false;
|
||||
if(!useCenter) {
|
||||
Location loc = app.getLocationProvider().getLastKnownLocation();
|
||||
if(loc == null) {
|
||||
loc = app.getLocationProvider().getLastStaleKnownLocation();
|
||||
stale = true;
|
||||
}
|
||||
|
||||
if(loc != null) {
|
||||
fromLoc = new LatLon(loc.getLatitude(), loc.getLongitude());
|
||||
} else {
|
||||
fromLoc = null;
|
||||
}
|
||||
}
|
||||
if (fromLoc != null && toLoc != null) {
|
||||
Location.distanceBetween(toLoc.getLatitude(), toLoc.getLongitude(), fromLoc.getLatitude(), fromLoc.getLongitude(), mes);
|
||||
}
|
||||
|
||||
|
||||
if (arrow != null) {
|
||||
boolean newImage = false;
|
||||
if (arrowResId == 0) {
|
||||
arrowResId = R.drawable.ic_direction_arrow;
|
||||
}
|
||||
DirectionDrawable dd;
|
||||
if(!(arrow.getDrawable() instanceof DirectionDrawable)) {
|
||||
newImage = true;
|
||||
dd = new DirectionDrawable(app, arrow.getWidth(), arrow.getHeight());
|
||||
} else {
|
||||
dd = (DirectionDrawable) arrow.getDrawable();
|
||||
}
|
||||
int imgColorSet = imgColor;
|
||||
if (imgColorSet == 0) {
|
||||
imgColorSet = useCenter ? R.color.color_distance : R.color.color_myloc_distance;
|
||||
if(stale) {
|
||||
imgColorSet = R.color.icon_color;
|
||||
}
|
||||
}
|
||||
dd.setImage(arrowResId, imgColorSet);
|
||||
if (fromLoc == null || h == null || toLoc == null) {
|
||||
dd.setAngle(0);
|
||||
} else {
|
||||
dd.setAngle(mes[1] - h + 180 + screenOrientation);
|
||||
}
|
||||
if (newImage) {
|
||||
arrow.setImageDrawable(dd);
|
||||
}
|
||||
arrow.invalidate();
|
||||
}
|
||||
if (txt != null) {
|
||||
if (fromLoc != null && toLoc != null) {
|
||||
if (paint) {
|
||||
int textColorSet = textColor;
|
||||
if(textColorSet == 0) {
|
||||
textColorSet = useCenter ? R.color.color_distance : R.color.color_myloc_distance ;
|
||||
if(stale) {
|
||||
textColorSet = R.color.icon_color;
|
||||
}
|
||||
}
|
||||
txt.setTextColor(app.getResources().getColor(textColorSet));
|
||||
}
|
||||
txt.setText(OsmAndFormatter.getFormattedDistance(mes[0], app));
|
||||
} else {
|
||||
txt.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLocation(boolean centerChanged, boolean locationChanged, boolean compassChanged) {
|
||||
public void updateLocation(boolean centerChanged, boolean locationChanged, boolean compassChanged) {
|
||||
if (compassChanged && !dashboard.isMapLinkedToLocation()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -72,9 +72,9 @@ public class DashNavigationFragment extends DashBaseFragment {
|
|||
ImageView cancel = (ImageView) view.findViewById(R.id.cancel);
|
||||
ImageView play = (ImageView) view.findViewById(R.id.play);
|
||||
name.setText(routingHelper.getGeneralRouteInformation());
|
||||
icon.setImageDrawable(getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_start_navigation,
|
||||
icon.setImageDrawable(getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_start_navigation,
|
||||
R.color.color_myloc_distance));
|
||||
cancel.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_remove_dark)
|
||||
cancel.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark)
|
||||
);
|
||||
cancel.setOnClickListener(new OnClickListener() {
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class DashNavigationFragment extends DashBaseFragment {
|
|||
|
||||
private void updatePlayButton(final RoutingHelper routingHelper, final MapActivity map, final ImageView play) {
|
||||
boolean toContinueNavigation = routingHelper.isRoutePlanningMode();
|
||||
play.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(
|
||||
play.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(
|
||||
toContinueNavigation ? R.drawable.ic_play_dark : R.drawable.ic_pause)
|
||||
);
|
||||
play.setContentDescription(getString(toContinueNavigation ? R.string.continue_navigation :
|
||||
|
|
|
@ -89,7 +89,7 @@ public class DashRecentsFragment extends DashLocationFragment {
|
|||
SearchHistoryFragment.udpateHistoryItem(historyEntry, view, loc, getActivity(), getMyApplication());
|
||||
view.findViewById(R.id.divider).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.navigate_to).setVisibility(View.VISIBLE);
|
||||
((ImageView) view.findViewById(R.id.navigate_to)).setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_gdirections_dark));
|
||||
((ImageView) view.findViewById(R.id.navigate_to)).setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_gdirections_dark));
|
||||
view.findViewById(R.id.navigate_to).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
|
@ -30,7 +30,7 @@ public class DashSearchFragment extends DashBaseFragment {
|
|||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_search_fragment, container, false);
|
||||
|
||||
TextView searchFor = (TextView) view.findViewById(R.id.search_for);
|
||||
searchFor.setCompoundDrawablesWithIntrinsicBounds(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_search_dark), null, null, null);
|
||||
searchFor.setCompoundDrawablesWithIntrinsicBounds(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_search_dark), null, null, null);
|
||||
searchFor.setCompoundDrawablePadding(AndroidUtils.dpToPx(getActivity(), 16f));
|
||||
|
||||
view.findViewById(R.id.search_card).setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -150,7 +150,7 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
|||
id = R.drawable.list_destination;
|
||||
}
|
||||
|
||||
((ImageView) view.findViewById(R.id.favourite_icon)).setImageDrawable(getMyApplication().getIconsCache()
|
||||
((ImageView) view.findViewById(R.id.favourite_icon)).setImageDrawable(getMyApplication().getUIUtilities()
|
||||
.getIcon(id, 0));
|
||||
DashLocationView dv = new DashLocationView(direction, label, new LatLon(point.getLatitude(),
|
||||
point.getLongitude()));
|
||||
|
@ -161,7 +161,7 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
|||
options.setVisibility(View.VISIBLE);
|
||||
final boolean optionsVisible = (SHOW_ALL && getMyApplication().getTargetPointsHelper().getIntermediatePoints().size() > 0);
|
||||
|
||||
options.setImageDrawable(getMyApplication().getIconsCache().
|
||||
options.setImageDrawable(getMyApplication().getUIUtilities().
|
||||
getThemedIcon(optionsVisible ? R.drawable.ic_overflow_menu_white :
|
||||
R.drawable.ic_action_remove_dark));
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -176,7 +176,7 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
|||
});
|
||||
|
||||
ImageButton navigate = ((ImageButton)view.findViewById(R.id.navigate_to));
|
||||
navigate.setImageDrawable(getMyApplication().getIconsCache().
|
||||
navigate.setImageDrawable(getMyApplication().getUIUtilities().
|
||||
getThemedIcon(R.drawable.ic_action_gdirections_dark));
|
||||
navigate.setVisibility(target? View.VISIBLE : View.GONE);
|
||||
navigate.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -241,7 +241,7 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
|||
if (point.index > 0 || target) {
|
||||
final int ind = target ? allTargets.size() - 1 : point.index;
|
||||
item = optionsMenu.getMenu().add(R.string.waypoint_visit_before)
|
||||
.setIcon(getMyApplication().getIconsCache().
|
||||
.setIcon(getMyApplication().getUIUtilities().
|
||||
getThemedIcon(R.drawable.ic_action_up_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
@ -256,7 +256,7 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
|||
}
|
||||
if (!target) {
|
||||
item = optionsMenu.getMenu().add(R.string.waypoint_visit_after)
|
||||
.setIcon(getMyApplication().getIconsCache().
|
||||
.setIcon(getMyApplication().getUIUtilities().
|
||||
getThemedIcon(R.drawable.ic_action_down_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
@ -271,7 +271,7 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
|||
}
|
||||
}
|
||||
item = optionsMenu.getMenu().add(
|
||||
R.string.shared_string_remove).setIcon(getMyApplication().getIconsCache().
|
||||
R.string.shared_string_remove).setIcon(getMyApplication().getUIUtilities().
|
||||
getThemedIcon(R.drawable.ic_action_remove_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -51,7 +51,7 @@ import net.osmand.plus.ApplicationMode;
|
|||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnRowItemClick;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -443,12 +443,12 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
flat.setVisibility(View.GONE);
|
||||
ImageView settingsButton = (ImageView) dashboardView.findViewById(R.id.toolbar_settings);
|
||||
settingsButton.setVisibility(View.GONE);
|
||||
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = mapActivity.getMyApplication().getUIUtilities();
|
||||
ImageView lst = (ImageView) dashboardView.findViewById(R.id.toolbar_list);
|
||||
lst.setVisibility(View.GONE);
|
||||
ImageView back = (ImageView) dashboardView.findViewById(R.id.toolbar_back);
|
||||
back.setImageDrawable(
|
||||
getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back));
|
||||
getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back));
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,8 +41,8 @@ public class DashSimulateFragment extends DashBaseFragment {
|
|||
: R.string.animate_route);
|
||||
ImageButton actionButton = (ImageButton) getView().findViewById(R.id.stop);
|
||||
actionButton.setImageDrawable(
|
||||
!routeAnimating ? getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_play_dark)
|
||||
: getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_rec_stop));
|
||||
!routeAnimating ? getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_play_dark)
|
||||
: getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_rec_stop));
|
||||
actionButton.setContentDescription(getString(routeAnimating ? R.string.animate_route_off : R.string.animate_route));
|
||||
|
||||
}
|
||||
|
|
|
@ -387,9 +387,9 @@ public class ConfigureMapMenu {
|
|||
View v = super.getView(position, convertView, parent);
|
||||
final ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
if (checkedItems[position]) {
|
||||
icon.setImageDrawable(app.getIconsCache().getIcon(iconIds[position], R.color.osmand_orange));
|
||||
icon.setImageDrawable(app.getUIUtilities().getIcon(iconIds[position], R.color.osmand_orange));
|
||||
} else {
|
||||
icon.setImageDrawable(app.getIconsCache().getThemedIcon(iconIds[position]));
|
||||
icon.setImageDrawable(app.getUIUtilities().getThemedIcon(iconIds[position]));
|
||||
}
|
||||
v.findViewById(R.id.divider).setVisibility(View.GONE);
|
||||
v.findViewById(R.id.description).setVisibility(View.GONE);
|
||||
|
@ -402,9 +402,9 @@ public class ConfigureMapMenu {
|
|||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
checkedItems[position] = isChecked;
|
||||
if (checkedItems[position]) {
|
||||
icon.setImageDrawable(app.getIconsCache().getIcon(iconIds[position], R.color.osmand_orange));
|
||||
icon.setImageDrawable(app.getUIUtilities().getIcon(iconIds[position], R.color.osmand_orange));
|
||||
} else {
|
||||
icon.setImageDrawable(app.getIconsCache().getThemedIcon(iconIds[position]));
|
||||
icon.setImageDrawable(app.getUIUtilities().getThemedIcon(iconIds[position]));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1385,14 +1385,14 @@ public class ConfigureMapMenu {
|
|||
iconId = R.drawable.ic_action_gpx_width_thin;
|
||||
}
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(null, null,
|
||||
app.getIconsCache().getPaintedIcon(iconId, currentColor), null);
|
||||
app.getUIUtilities().getPaintedIcon(iconId, currentColor), null);
|
||||
} else {
|
||||
if (item.color == -1) {
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(null, null,
|
||||
app.getIconsCache().getThemedIcon(R.drawable.ic_action_circle), null);
|
||||
app.getUIUtilities().getThemedIcon(R.drawable.ic_action_circle), null);
|
||||
} else {
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(null, null,
|
||||
app.getIconsCache().getPaintedIcon(R.drawable.ic_action_circle, item.color), null);
|
||||
app.getUIUtilities().getPaintedIcon(R.drawable.ic_action_circle, item.color), null);
|
||||
}
|
||||
}
|
||||
textView.setCompoundDrawablePadding(AndroidUtils.dpToPx(getContext(), 10f));
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ErrorBottomSheetDialog extends BottomSheetDialogFragment {
|
|||
String msg = MessageFormat.format(getString(R.string.previous_run_crashed), OsmandApplication.EXCEPTION_PATH);
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
ImageView iv = ((ImageView) view.findViewById(R.id.error_icon));
|
||||
iv.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_crashlog));
|
||||
iv.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_crashlog));
|
||||
TextView message = ((TextView) view.findViewById(R.id.error_header));
|
||||
message.setTypeface(typeface);
|
||||
message.setText(msg);
|
||||
|
|
|
@ -19,8 +19,8 @@ import android.widget.EditText;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
|
@ -42,11 +42,10 @@ public class FavoriteDialogs {
|
|||
public static final String KEY_FAVORITE = "favorite";
|
||||
|
||||
public static Dialog createReplaceFavouriteDialog(final Activity activity, final Bundle args) {
|
||||
final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites();
|
||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||
final FavouritesDbHelper helper = app.getFavorites();
|
||||
final List<FavouritePoint> points = new ArrayList<FavouritePoint>(helper.getFavouritePoints());
|
||||
final FavouritesAdapter favouritesAdapter = new FavouritesAdapter(activity,
|
||||
((OsmandApplication) activity.getApplication()).getFavorites().getFavouritePoints(),
|
||||
false);
|
||||
final FavouritesAdapter favouritesAdapter = new FavouritesAdapter(activity, points,false);
|
||||
final Dialog[] dlgHolder = new Dialog[1];
|
||||
OnItemClickListener click = new AdapterView.OnItemClickListener() {
|
||||
|
||||
|
@ -56,9 +55,8 @@ public class FavoriteDialogs {
|
|||
}
|
||||
|
||||
};
|
||||
if (activity instanceof MapActivity) {
|
||||
favouritesAdapter.updateLocation(((MapActivity) activity).getMapLocation());
|
||||
}
|
||||
favouritesAdapter.sortByDefault();
|
||||
|
||||
if(points.size() == 0){
|
||||
Toast.makeText(activity, activity.getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
|
||||
return null;
|
||||
|
@ -210,25 +208,7 @@ public class FavoriteDialogs {
|
|||
final OnDismissListener dismissListener, final Dialog[] dialogHolder, final boolean sortByDist) {
|
||||
ListView listView = new ListView(uiContext);
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(uiContext);
|
||||
final Collator inst = Collator.getInstance();
|
||||
favouritesAdapter.sort(new Comparator<FavouritePoint>() {
|
||||
|
||||
@Override
|
||||
public int compare(FavouritePoint lhs, FavouritePoint rhs) {
|
||||
if (sortByDist) {
|
||||
if (favouritesAdapter.getLocation() == null) {
|
||||
return 0;
|
||||
}
|
||||
double ld = MapUtils.getDistance(favouritesAdapter.getLocation(), lhs.getLatitude(),
|
||||
lhs.getLongitude());
|
||||
double rd = MapUtils.getDistance(favouritesAdapter.getLocation(), rhs.getLatitude(),
|
||||
rhs.getLongitude());
|
||||
return Double.compare(ld, rd);
|
||||
}
|
||||
return inst.compare(lhs.getName(), rhs.getName());
|
||||
}
|
||||
});
|
||||
|
||||
favouritesAdapter.sortByDefault();
|
||||
listView.setAdapter(favouritesAdapter);
|
||||
listView.setOnItemClickListener(click);
|
||||
bld.setPositiveButton(sortByDist ? R.string.sort_by_name :
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.graphics.drawable.Drawable;
|
|||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivityType;
|
||||
|
@ -29,11 +29,11 @@ public class DownloadGroupViewHolder {
|
|||
Drawable iconLeft;
|
||||
if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_REC
|
||||
|| group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_TTS) {
|
||||
iconLeft = ctx.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_volume_up);
|
||||
iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
|
||||
} else if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.FONTS) {
|
||||
iconLeft = ctx.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_map_language);
|
||||
iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
|
||||
} else {
|
||||
IconsCache cache = ctx.getMyApplication().getIconsCache();
|
||||
UiUtilities cache = ctx.getMyApplication().getUIUtilities();
|
||||
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
|
||||
iconLeft = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
|
||||
} else {
|
||||
|
|
|
@ -28,7 +28,7 @@ import android.widget.TextView;
|
|||
|
||||
import net.osmand.AndroidNetworkUtils;
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -105,7 +105,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
activity.getAccessibilityAssistant().registerPage(view, DownloadActivity.DOWNLOAD_TAB_NUMBER);
|
||||
|
||||
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationIcon(getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -159,7 +159,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
if (!openAsDialog() && purchaseHelper != null && !purchaseHelper.hasInventory()) {
|
||||
restorePurchasesView = activity.getLayoutInflater().inflate(R.layout.restore_purchases_list_footer, null);
|
||||
((ImageView) restorePurchasesView.findViewById(R.id.icon)).setImageDrawable(
|
||||
getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_reset_to_default_dark));
|
||||
getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_reset_to_default_dark));
|
||||
restorePurchasesView.findViewById(R.id.button).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -181,7 +181,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
searchView = activity.getLayoutInflater().inflate(R.layout.simple_list_menu_item, null);
|
||||
searchView.setBackgroundResource(android.R.drawable.list_selector_background);
|
||||
TextView title = (TextView) searchView.findViewById(R.id.title);
|
||||
title.setCompoundDrawablesWithIntrinsicBounds(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_search_dark), null, null, null);
|
||||
title.setCompoundDrawablesWithIntrinsicBounds(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_search_dark), null, null, null);
|
||||
title.setHint(R.string.search_map_hint);
|
||||
searchView.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
@ -532,11 +532,11 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
Drawable iconLeft;
|
||||
if (group.getType() == DownloadResourceGroupType.VOICE_REC
|
||||
|| group.getType() == DownloadResourceGroupType.VOICE_TTS) {
|
||||
iconLeft = ctx.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_volume_up);
|
||||
iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
|
||||
} else if (group.getType() == DownloadResourceGroupType.FONTS) {
|
||||
iconLeft = ctx.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_map_language);
|
||||
iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
|
||||
} else {
|
||||
IconsCache cache = ctx.getMyApplication().getIconsCache();
|
||||
UiUtilities cache = ctx.getMyApplication().getUIUtilities();
|
||||
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
|
||||
iconLeft = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
|
||||
} else {
|
||||
|
|
|
@ -384,7 +384,7 @@ public class ItemViewHolder {
|
|||
final File fl = indexItem.getTargetFile(context.getMyApplication());
|
||||
if (fl.exists()) {
|
||||
item = optionsMenu.getMenu().add(R.string.shared_string_remove).setIcon(
|
||||
context.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_remove_dark));
|
||||
context.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
@ -424,7 +424,7 @@ public class ItemViewHolder {
|
|||
});
|
||||
}
|
||||
item = optionsMenu.getMenu().add(R.string.shared_string_download)
|
||||
.setIcon(context.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_import));
|
||||
.setIcon(context.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_import));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
@ -437,10 +437,10 @@ public class ItemViewHolder {
|
|||
}
|
||||
|
||||
private Drawable getContentIcon(DownloadActivity context, int resourceId) {
|
||||
return context.getMyApplication().getIconsCache().getThemedIcon(resourceId);
|
||||
return context.getMyApplication().getUIUtilities().getThemedIcon(resourceId);
|
||||
}
|
||||
|
||||
private Drawable getContentIcon(DownloadActivity context, int resourceId, int color) {
|
||||
return context.getMyApplication().getIconsCache().getPaintedIcon(resourceId, color);
|
||||
return context.getMyApplication().getUIUtilities().getPaintedIcon(resourceId, color);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.osmand.map.ITileSource;
|
|||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -1100,7 +1100,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
|
||||
public void bindLocalIndexInfo(final LocalIndexInfo child) {
|
||||
|
||||
options.setImageDrawable(ctx.getMyApplication().getIconsCache()
|
||||
options.setImageDrawable(ctx.getMyApplication().getUIUtilities()
|
||||
.getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
options.setContentDescription(ctx.getString(R.string.shared_string_more));
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -1177,14 +1177,14 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
}
|
||||
|
||||
private Drawable getContentIcon(DownloadActivity context, int resourceId, int colorId) {
|
||||
return context.getMyApplication().getIconsCache().getIcon(resourceId, colorId);
|
||||
return context.getMyApplication().getUIUtilities().getIcon(resourceId, colorId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void openPopUpMenu(View v, final LocalIndexInfo info) {
|
||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = getMyApplication().getUIUtilities();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||
final boolean restore = info.isBackupedData();
|
||||
|
|
|
@ -72,7 +72,7 @@ public class AvoidSpecificRoads {
|
|||
final RouteDataObject obj = getItem(position);
|
||||
v.findViewById(R.id.all_points).setVisibility(View.GONE);
|
||||
((ImageView) v.findViewById(R.id.waypoint_icon)).setImageDrawable(
|
||||
app.getIconsCache().getThemedIcon(R.drawable.ic_action_road_works_dark));
|
||||
app.getUIUtilities().getThemedIcon(R.drawable.ic_action_road_works_dark));
|
||||
double dist = MapUtils.getDistance(mapLocation, MapUtils.get31LatitudeY(obj.getPoint31YTile(0)),
|
||||
MapUtils.get31LongitudeX(obj.getPoint31XTile(0)));
|
||||
((TextView) v.findViewById(R.id.waypoint_dist)).setText(OsmAndFormatter.getFormattedDistance((float) dist, app));
|
||||
|
@ -80,7 +80,7 @@ public class AvoidSpecificRoads {
|
|||
((TextView) v.findViewById(R.id.waypoint_text)).setText(getText(obj));
|
||||
ImageButton remove = (ImageButton) v.findViewById(R.id.info_close);
|
||||
remove.setVisibility(View.VISIBLE);
|
||||
remove.setImageDrawable(app.getIconsCache().getThemedIcon(
|
||||
remove.setImageDrawable(app.getUIUtilities().getThemedIcon(
|
||||
R.drawable.ic_action_remove_dark));
|
||||
remove.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
|
|||
import net.osmand.plus.GPXUtilities.Speed;
|
||||
import net.osmand.plus.GPXUtilities.TrkSegment;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
|
@ -327,7 +327,7 @@ public class GpxUiHelper {
|
|||
final List<GPXInfo> list,
|
||||
final ContextMenuAdapter adapter) {
|
||||
final OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||
final IconsCache iconsCache = app.getIconsCache();
|
||||
final UiUtilities iconsCache = app.getUIUtilities();
|
||||
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
final int layout = R.layout.list_menu_item_native_singlechoice;
|
||||
|
@ -747,13 +747,13 @@ public class GpxUiHelper {
|
|||
v.findViewById(R.id.unknown_section).setVisibility(View.GONE);
|
||||
ImageView distanceI = (ImageView) v.findViewById(R.id.distance_icon);
|
||||
distanceI.setVisibility(View.VISIBLE);
|
||||
distanceI.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_small_distance));
|
||||
distanceI.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_small_distance));
|
||||
ImageView pointsI = (ImageView) v.findViewById(R.id.points_icon);
|
||||
pointsI.setVisibility(View.VISIBLE);
|
||||
pointsI.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_small_point));
|
||||
pointsI.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_small_point));
|
||||
ImageView timeI = (ImageView) v.findViewById(R.id.time_icon);
|
||||
timeI.setVisibility(View.VISIBLE);
|
||||
timeI.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_small_time));
|
||||
timeI.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_small_time));
|
||||
TextView time = (TextView) v.findViewById(R.id.time);
|
||||
TextView distance = (TextView) v.findViewById(R.id.distance);
|
||||
TextView pointsCount = (TextView) v.findViewById(R.id.points_count);
|
||||
|
@ -817,9 +817,9 @@ public class GpxUiHelper {
|
|||
}
|
||||
int color = GpxAppearanceAdapter.parseTrackColor(renderer, prefColorValue);
|
||||
if (color == -1) {
|
||||
colorImageView.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_circle));
|
||||
colorImageView.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_circle));
|
||||
} else {
|
||||
colorImageView.setImageDrawable(app.getIconsCache().getPaintedIcon(R.drawable.ic_action_circle, color));
|
||||
colorImageView.setImageDrawable(app.getUIUtilities().getPaintedIcon(R.drawable.ic_action_circle, color));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1610,7 +1610,7 @@ public class GpxUiHelper {
|
|||
}
|
||||
|
||||
public Drawable getImageDrawable(@NonNull OsmandApplication app) {
|
||||
return app.getIconsCache().getThemedIcon(imageId);
|
||||
return app.getUIUtilities().getThemedIcon(imageId);
|
||||
}
|
||||
|
||||
public static String getName(@NonNull Context ctx, @NonNull GPXDataSetType[] types) {
|
||||
|
@ -1663,7 +1663,7 @@ public class GpxUiHelper {
|
|||
}
|
||||
|
||||
public Drawable getImageDrawable(OsmandApplication app) {
|
||||
return app.getIconsCache().getThemedIcon(imageId);
|
||||
return app.getUIUtilities().getThemedIcon(imageId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public class MapMarkerDialogHelper {
|
|||
textDist.setTextColor(ctx.getResources()
|
||||
.getColor(useCenter ? R.color.color_distance : R.color.color_myloc_distance));
|
||||
} else {
|
||||
waypointIcon.setImageDrawable(app.getIconsCache()
|
||||
waypointIcon.setImageDrawable(app.getUIUtilities()
|
||||
.getIcon(R.drawable.ic_action_flag_dark, !nightMode));
|
||||
AndroidUtils.setTextSecondaryColor(ctx, text, nightMode);
|
||||
AndroidUtils.setTextSecondaryColor(ctx, textDist, nightMode);
|
||||
|
@ -124,6 +124,6 @@ public class MapMarkerDialogHelper {
|
|||
}
|
||||
|
||||
public static Drawable getMapMarkerIcon(OsmandApplication app, int colorIndex) {
|
||||
return app.getIconsCache().getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(colorIndex));
|
||||
return app.getUIUtilities().getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(colorIndex));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,11 +147,11 @@ public class WaypointDialogHelper {
|
|||
AndroidUtils.setTextSecondaryColor(activity, textDeviation, nightMode);
|
||||
if (ps.deviationDirectionRight) {
|
||||
textDeviation.setCompoundDrawablesWithIntrinsicBounds(
|
||||
app.getIconsCache().getIcon(R.drawable.ic_small_turn_right, colorId),
|
||||
app.getUIUtilities().getIcon(R.drawable.ic_small_turn_right, colorId),
|
||||
null, null, null);
|
||||
} else {
|
||||
textDeviation.setCompoundDrawablesWithIntrinsicBounds(
|
||||
app.getIconsCache().getIcon(R.drawable.ic_small_turn_left, colorId),
|
||||
app.getUIUtilities().getIcon(R.drawable.ic_small_turn_left, colorId),
|
||||
null, null, null);
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ public class WaypointDialogHelper {
|
|||
int iconResId = nightMode ? R.color.marker_circle_button_color_dark : R.color.ctx_menu_title_color_dark;
|
||||
|
||||
remove.setVisibility(View.VISIBLE);
|
||||
remove.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_remove_dark, iconResId));
|
||||
remove.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_remove_dark, iconResId));
|
||||
remove.setEnabled(canRemove);
|
||||
remove.setAlpha(canRemove ? 1 : .5f);
|
||||
if (canRemove) {
|
||||
|
@ -434,7 +434,7 @@ public class WaypointDialogHelper {
|
|||
|
||||
move.setVisibility(notFlatTargets ? View.VISIBLE : View.GONE);
|
||||
if (notFlatTargets) {
|
||||
move.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_reorder, iconResId));
|
||||
move.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_reorder, iconResId));
|
||||
move.setTag(new DragIcon() {
|
||||
@Override
|
||||
public void onClick() {
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.osmand.data.LocationPoint;
|
|||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||
|
@ -704,7 +704,7 @@ public class WaypointHelper {
|
|||
return null;
|
||||
|
||||
} else if (type == TARGETS) {
|
||||
IconsCache iconsCache = app.getIconsCache();
|
||||
UiUtilities iconsCache = app.getUIUtilities();
|
||||
if (((TargetPoint) point).start) {
|
||||
if (app.getTargetPointsHelper().getPointToStart() == null) {
|
||||
return iconsCache.getIcon(R.drawable.ic_action_location_color, 0);
|
||||
|
|
|
@ -179,7 +179,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
|||
TextView regionNameHeaderTextView = (TextView) subscriptionHeader.findViewById(R.id.regionHeaderTextView);
|
||||
TextView regionNameTextView = (TextView) subscriptionHeader.findViewById(R.id.regionTextView);
|
||||
statusTextView.setText(getString(R.string.osm_live_active));
|
||||
statusIcon.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_done));
|
||||
statusIcon.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_done));
|
||||
regionNameHeaderTextView.setText(R.string.osm_live_support_region);
|
||||
String countryName = getSettings().BILLING_USER_COUNTRY.get();
|
||||
if (Algorithms.isEmpty(countryName)) {
|
||||
|
@ -618,7 +618,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
|||
}
|
||||
|
||||
private Drawable getSecondaryColorPaintedIcon(@DrawableRes int drawable) {
|
||||
return fragment.getMyActivity().getMyApplication().getIconsCache()
|
||||
return fragment.getMyActivity().getMyApplication().getUIUtilities()
|
||||
.getPaintedIcon(drawable, secondaryColor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,9 +135,9 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
|
|||
View view = inflater.inflate(R.layout.subscription_fragment, container, false);
|
||||
ImageButton closeButton = (ImageButton) view.findViewById(R.id.closeButton);
|
||||
if (editMode) {
|
||||
closeButton.setImageDrawable(getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_mode_back));
|
||||
closeButton.setImageDrawable(getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_mode_back));
|
||||
} else {
|
||||
closeButton.setImageDrawable(getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_remove_dark));
|
||||
closeButton.setImageDrawable(getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_remove_dark));
|
||||
}
|
||||
closeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -158,7 +158,7 @@ public class AdditionalActionsBottomSheetDialogFragment extends net.osmand.plus.
|
|||
|
||||
@Override
|
||||
protected Drawable getContentIcon(@DrawableRes int id) {
|
||||
return getMyApplication().getIconsCache().getIcon(id, nightMode ? R.color.grid_menu_icon_dark : R.color.on_map_icon_color);
|
||||
return getMyApplication().getUIUtilities().getIcon(id, nightMode ? R.color.grid_menu_icon_dark : R.color.on_map_icon_color);
|
||||
}
|
||||
|
||||
private int getCancelRowBgResId() {
|
||||
|
|
|
@ -2,7 +2,7 @@ package net.osmand.plus.mapcontextmenu;
|
|||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
|
@ -71,7 +71,7 @@ public abstract class BaseMenuController {
|
|||
}
|
||||
|
||||
protected Drawable getIconOrig(int iconId) {
|
||||
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = getMapActivity().getMyApplication().getUIUtilities();
|
||||
return iconsCache.getIcon(iconId, 0);
|
||||
}
|
||||
|
||||
|
@ -80,17 +80,17 @@ public abstract class BaseMenuController {
|
|||
}
|
||||
|
||||
protected Drawable getIcon(int iconId, int colorId) {
|
||||
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = getMapActivity().getMyApplication().getUIUtilities();
|
||||
return iconsCache.getIcon(iconId, colorId);
|
||||
}
|
||||
|
||||
protected Drawable getPaintedIcon(int iconId, int color) {
|
||||
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = getMapActivity().getMyApplication().getUIUtilities();
|
||||
return iconsCache.getPaintedIcon(iconId, color);
|
||||
}
|
||||
|
||||
protected Drawable getIcon(int iconId, int colorLightId, int colorDarkId) {
|
||||
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = getMapActivity().getMyApplication().getUIUtilities();
|
||||
return iconsCache.getIcon(iconId, isLight() ? colorLightId : colorDarkId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
package net.osmand.plus.mapcontextmenu;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.CallbackWithObject;
|
||||
import net.osmand.Location;
|
||||
|
@ -56,11 +49,16 @@ import net.osmand.plus.views.OsmandMapLayer;
|
|||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class MapContextMenu extends MenuTitleController implements StateChangedListener<ApplicationMode>,
|
||||
MapMarkerChangedListener, TargetPointChangedListener {
|
||||
|
@ -84,10 +82,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
private boolean centerMarker;
|
||||
private int mapZoom;
|
||||
|
||||
private LatLon myLocation;
|
||||
private Float heading;
|
||||
private boolean inLocationUpdate = false;
|
||||
private boolean cachedMyLocation;
|
||||
private boolean appModeChanged;
|
||||
private boolean appModeListenerAdded;
|
||||
private boolean autoHide;
|
||||
|
@ -294,9 +289,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
boolean update, boolean restorePrevious) {
|
||||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
|
||||
if (myLocation == null) {
|
||||
updateMyLocation(app.getLocationProvider().getLastKnownLocation(), false);
|
||||
}
|
||||
|
||||
if (!update && isVisible()) {
|
||||
if (this.object == null || !this.object.equals(object)) {
|
||||
|
@ -423,7 +415,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
}
|
||||
|
||||
public void onFragmentResume() {
|
||||
if (active && displayDistanceDirection() && myLocation != null) {
|
||||
if (active && displayDistanceDirection()) {
|
||||
updateLocation(false, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -1249,27 +1241,12 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
return getCurrentMenuState() == MenuState.HEADER_ONLY;
|
||||
}
|
||||
|
||||
public LatLon getMyLocation() {
|
||||
return myLocation;
|
||||
}
|
||||
|
||||
public boolean isCachedMyLocation() {
|
||||
return cachedMyLocation;
|
||||
}
|
||||
|
||||
public Float getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
|
||||
private void updateMyLocation(Location location, boolean updateLocationUi) {
|
||||
if (location == null) {
|
||||
location = getMapActivity().getMyApplication().getLocationProvider().getLastStaleKnownLocation();
|
||||
cachedMyLocation = location != null;
|
||||
} else {
|
||||
cachedMyLocation = false;
|
||||
}
|
||||
if (location != null) {
|
||||
myLocation = new LatLon(location.getLatitude(), location.getLongitude());
|
||||
if (updateLocationUi) {
|
||||
updateLocation(false, true, false);
|
||||
}
|
||||
|
@ -1284,15 +1261,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
|
||||
public void updateCompassValue(float value) {
|
||||
if (active && displayDistanceDirection()) {
|
||||
// 99 in next line used to one-time initialize arrows (with reference vs. fixed-north direction)
|
||||
// on non-compass devices
|
||||
float lastHeading = heading != null ? heading : 99;
|
||||
heading = value;
|
||||
if (Math.abs(MapUtils.degreesDiff(lastHeading, heading)) > 5) {
|
||||
updateLocation(false, false, true);
|
||||
} else {
|
||||
heading = lastHeading;
|
||||
}
|
||||
updateLocation(false, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,36 @@
|
|||
package net.osmand.plus.mapcontextmenu;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.LockableScrollView;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
|
||||
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
||||
import net.osmand.plus.transport.TransportStopRoute;
|
||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.TransportStopsLayer;
|
||||
import net.osmand.plus.views.controls.HorizontalSwipeConfirm;
|
||||
import net.osmand.plus.views.controls.SingleTapConfirm;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.annotation.TargetApi;
|
||||
|
@ -35,38 +66,6 @@ import android.widget.OverScroller;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.LockableScrollView;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
|
||||
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
||||
import net.osmand.plus.transport.TransportStopRoute;
|
||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.TransportStopsLayer;
|
||||
import net.osmand.plus.views.controls.HorizontalSwipeConfirm;
|
||||
import net.osmand.plus.views.controls.SingleTapConfirm;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
|
||||
|
||||
|
||||
public class MapContextMenuFragment extends BaseOsmAndFragment implements DownloadEvents {
|
||||
public static final String TAG = "MapContextMenuFragment";
|
||||
|
@ -134,6 +133,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
private int screenOrientation;
|
||||
private boolean created;
|
||||
|
||||
private UpdateLocationViewCache updateLocationViewCache;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
@ -141,6 +142,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
processScreenHeight(container);
|
||||
|
||||
menu = getMapActivity().getContextMenu();
|
||||
updateLocationViewCache = getMyApplication().getUIUtilities().getUpdateLocationViewCache();
|
||||
|
||||
markerPaddingPx = dpToPx(MARKER_PADDING_DP);
|
||||
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
|
||||
|
@ -751,7 +753,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
}
|
||||
|
||||
private void updateImageButton(ImageButton button, int iconLightId, int iconDarkId, int bgLightId, int bgDarkId, boolean night) {
|
||||
button.setImageDrawable(getMapActivity().getMyApplication().getIconsCache().getIcon(night ? iconDarkId : iconLightId));
|
||||
button.setImageDrawable(getMapActivity().getMyApplication().getUIUtilities().getIcon(night ? iconDarkId : iconLightId));
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
button.setBackground(getMapActivity().getResources().getDrawable(night ? bgDarkId : bgLightId,
|
||||
getMapActivity().getTheme()));
|
||||
|
@ -1171,7 +1173,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
dismissMenu();
|
||||
return;
|
||||
}
|
||||
screenOrientation = DashLocationFragment.getScreenOrientation(getActivity());
|
||||
updateLocationViewCache = getMyApplication().getUIUtilities().getUpdateLocationViewCache();
|
||||
getMapActivity().getMapViewTrackingUtilities().setContextMenu(menu);
|
||||
getMapActivity().getMapViewTrackingUtilities().setMapLinkedToLocation(false);
|
||||
wasDrawerDisabled = getMapActivity().isDrawerDisabled();
|
||||
|
@ -1495,7 +1497,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
OsmandApplication app = getMyApplication();
|
||||
if (app != null && view != null) {
|
||||
View compassView = view.findViewById(R.id.compass_layout);
|
||||
if (menu.getMyLocation() != null && menu.displayDistanceDirection() && menu.getCurrentMenuState() != MenuState.FULL_SCREEN) {
|
||||
if (menu.displayDistanceDirection() && menu.getCurrentMenuState() != MenuState.FULL_SCREEN) {
|
||||
updateDistanceDirection();
|
||||
compassView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
@ -1534,10 +1536,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
if (app != null && activity != null && view != null) {
|
||||
TextView distanceText = (TextView) view.findViewById(R.id.distance);
|
||||
ImageView direction = (ImageView) view.findViewById(R.id.direction);
|
||||
float myHeading = menu.getHeading() == null ? 0f : menu.getHeading();
|
||||
int color = menu.isCachedMyLocation() ? R.color.icon_color : 0;
|
||||
DashLocationFragment.updateLocationView(false, menu.getMyLocation(), myHeading, direction, color, distanceText,
|
||||
color, menu.getLatLon().getLatitude(), menu.getLatLon().getLongitude(), screenOrientation, app, activity);
|
||||
getMyApplication().getUIUtilities().updateLocationView(updateLocationViewCache, direction, distanceText, menu.getLatLon());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ import net.osmand.data.LatLon;
|
|||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
|
@ -745,7 +745,7 @@ public class MenuBuilder {
|
|||
}
|
||||
|
||||
public Drawable getRowIcon(int iconId) {
|
||||
IconsCache iconsCache = app.getIconsCache();
|
||||
UiUtilities iconsCache = app.getUIUtilities();
|
||||
return iconsCache.getIcon(iconId, light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark);
|
||||
}
|
||||
|
||||
|
@ -782,7 +782,7 @@ public class MenuBuilder {
|
|||
}
|
||||
|
||||
public Drawable getCollapseIcon(boolean collapsed) {
|
||||
return app.getIconsCache().getIcon(collapsed ? R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up,
|
||||
return app.getUIUtilities().getIcon(collapsed ? R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up,
|
||||
light ? R.color.ctx_menu_collapse_icon_color_light : R.color.ctx_menu_collapse_icon_color_dark);
|
||||
}
|
||||
|
||||
|
@ -826,7 +826,7 @@ public class MenuBuilder {
|
|||
titleView.setTextSize(16);
|
||||
titleView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
|
||||
String desc = route.getDescription(getMapActivity().getMyApplication(), true);
|
||||
Drawable arrow = app.getIconsCache().getIcon(R.drawable.ic_arrow_right_16, light ? R.color.ctx_menu_route_icon_color_light : R.color.ctx_menu_route_icon_color_dark);
|
||||
Drawable arrow = app.getUIUtilities().getIcon(R.drawable.ic_arrow_right_16, light ? R.color.ctx_menu_route_icon_color_light : R.color.ctx_menu_route_icon_color_dark);
|
||||
arrow.setBounds(0, 0, arrow.getIntrinsicWidth(), arrow.getIntrinsicHeight());
|
||||
|
||||
titleView.setText(AndroidUtils.replaceCharsWithIcon(desc, arrow, arrowChars));
|
||||
|
|
|
@ -260,9 +260,9 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
});
|
||||
button.setAllCaps(true);
|
||||
button.setText(R.string.context_menu_read_full_article);
|
||||
Drawable normal = app.getIconsCache().getIcon(R.drawable.ic_action_read_text,
|
||||
Drawable normal = app.getUIUtilities().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,
|
||||
Drawable pressed = app.getUIUtilities().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(Build.VERSION.SDK_INT >= 21
|
||||
? AndroidUtils.createPressedStateListDrawable(normal, pressed) : normal, null, null, null);
|
||||
|
|
|
@ -93,7 +93,7 @@ public class FavouritePointMenuBuilder extends MenuBuilder {
|
|||
int disabledColor = light ? R.color.secondary_text_light : R.color.secondary_text_dark;
|
||||
color = favoriteGroup.visible ? (color | 0xff000000) : view.getResources().getColor(disabledColor);
|
||||
String name = view.getContext().getString(R.string.context_menu_points_of_group);
|
||||
buildRow(view, app.getIconsCache().getPaintedIcon(R.drawable.ic_action_folder, color), null, name, 0, null,
|
||||
buildRow(view, app.getUIUtilities().getPaintedIcon(R.drawable.ic_action_folder, color), null, name, 0, null,
|
||||
true, getCollapsableFavouritesView(view.getContext(), true, favoriteGroup, fav),
|
||||
false, 0, false, null, false);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class GpxItemMenuBuilder extends MenuBuilder {
|
|||
llIconParams.setMargins(0, 0, gpxSmallIconMargin, 0);
|
||||
llIconParams.gravity = Gravity.CENTER_VERTICAL;
|
||||
icon.setLayoutParams(llIconParams);
|
||||
icon.setImageDrawable(app.getIconsCache().getThemedIcon(iconId));
|
||||
icon.setImageDrawable(app.getUIUtilities().getThemedIcon(iconId));
|
||||
ll.addView(icon);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ public class WptPtMenuBuilder extends MenuBuilder {
|
|||
File file = new File(gpx.path);
|
||||
String gpxName = file.getName().replace(".gpx", "").replace("/", " ").replace("_", " ");
|
||||
int color = getPointColor(wpt, getFileColor(selectedGpxFile));
|
||||
buildRow(view, app.getIconsCache().getPaintedIcon(R.drawable.ic_type_waypoints_group, color), null, title, 0, gpxName,
|
||||
buildRow(view, app.getUIUtilities().getPaintedIcon(R.drawable.ic_type_waypoints_group, color), null, title, 0, gpxName,
|
||||
true, getCollapsableWaypointsView(view.getContext(), true, gpx, wpt),
|
||||
false, 0, false, null, false);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public abstract class AbstractCard {
|
|||
|
||||
final Toolbar topBar = new Toolbar(ctx);
|
||||
topBar.setClickable(true);
|
||||
Drawable back = app.getIconsCache().getIcon(R.drawable.ic_action_remove_dark);
|
||||
Drawable back = app.getUIUtilities().getIcon(R.drawable.ic_action_remove_dark);
|
||||
topBar.setNavigationIcon(back);
|
||||
topBar.setNavigationContentDescription(R.string.shared_string_close);
|
||||
topBar.setTitle(title);
|
||||
|
|
|
@ -328,7 +328,7 @@ public abstract class ImageCard extends AbstractCard {
|
|||
R.drawable.context_menu_card_light, R.drawable.context_menu_card_dark);
|
||||
|
||||
if (icon == null && topIconId != 0) {
|
||||
icon = getMyApplication().getIconsCache().getIcon(topIconId);
|
||||
icon = getMyApplication().getUIUtilities().getIcon(topIconId);
|
||||
}
|
||||
if (icon == null) {
|
||||
iconImageView.setVisibility(View.GONE);
|
||||
|
@ -373,9 +373,9 @@ public abstract class ImageCard extends AbstractCard {
|
|||
}
|
||||
if (buttonIcon == null && buttonIconId != 0) {
|
||||
if (buttonIconColor != 0) {
|
||||
buttonIcon = getMyApplication().getIconsCache().getPaintedIcon(buttonIconId, buttonIconColor);
|
||||
buttonIcon = getMyApplication().getUIUtilities().getPaintedIcon(buttonIconId, buttonIconColor);
|
||||
} else {
|
||||
buttonIcon = getMyApplication().getIconsCache().getIcon(buttonIconId);
|
||||
buttonIcon = getMyApplication().getUIUtilities().getIcon(buttonIconId);
|
||||
}
|
||||
}
|
||||
button.setCompoundDrawablesWithIntrinsicBounds(buttonIcon, null, null, null);
|
||||
|
|
|
@ -6,7 +6,7 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapillary.MapillaryPlugin;
|
||||
|
@ -25,7 +25,7 @@ public class NoImagesCard extends AbstractCard {
|
|||
@Override
|
||||
public void update() {
|
||||
if (view != null) {
|
||||
IconsCache ic = getMyApplication().getIconsCache();
|
||||
UiUtilities ic = getMyApplication().getUIUtilities();
|
||||
boolean night = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
MapActivity ctx = getMapActivity();
|
||||
AndroidUtils.setBackgroundColor(ctx, view, night, R.color.bg_color_light, R.color.bg_color_dark);
|
||||
|
|
|
@ -47,7 +47,7 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setTitle(getToolbarTitle());
|
||||
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationIcon(getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setTitleTextColor(getResources().getColor(getResIdFromAttribute(getMapActivity(), R.attr.pstsTextColor)));
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.plus.FavouritesDbHelper;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -168,7 +168,7 @@ public class SelectCategoryDialogFragment extends DialogFragment {
|
|||
|
||||
private static Drawable getIcon(final Activity activity, int iconId) {
|
||||
OsmandApplication app = (OsmandApplication)activity.getApplication();
|
||||
IconsCache iconsCache = app.getIconsCache();
|
||||
UiUtilities iconsCache = app.getUIUtilities();
|
||||
boolean light = app.getSettings().isLightContent();
|
||||
return iconsCache.getIcon(iconId,
|
||||
light ? R.color.icon_color : R.color.icon_color_light);
|
||||
|
|
|
@ -15,7 +15,7 @@ import android.widget.TextView;
|
|||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
|
@ -55,7 +55,7 @@ public class DestinationReachedMenuFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = getMapActivity().getMyApplication().getUIUtilities();
|
||||
|
||||
ImageButton closeImageButton = (ImageButton) view.findViewById(R.id.closeImageButton);
|
||||
closeImageButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark, menu.isLight()));
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
package net.osmand.plus.mapcontextmenu.other;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import android.app.Activity;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -7,35 +15,19 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FavouritesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
|
||||
private final List<FavouritePoint> favouritePoints;
|
||||
private OsmandApplication app;
|
||||
private IconsCache iconsCache;
|
||||
private View.OnClickListener listener;
|
||||
|
||||
private LatLon location;
|
||||
private Float heading;
|
||||
private boolean useCenter;
|
||||
private int screenOrientation;
|
||||
private UpdateLocationViewCache cache;
|
||||
|
||||
public FavouritesAdapter(OsmandApplication app, List<FavouritePoint> FavouritePoints) {
|
||||
this.app = app;
|
||||
iconsCache = app.getIconsCache();
|
||||
this.favouritePoints = FavouritePoints;
|
||||
cache = app.getUIUtilities().getUpdateLocationViewCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,15 +49,8 @@ public class FavouritesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
favouritesViewHolder.description.setText(favouritePoint.getCategory());
|
||||
}
|
||||
favouritesViewHolder.favouriteImage.setImageDrawable(FavoriteImageDrawable.getOrCreate(app, favouritePoint.getColor(), false));
|
||||
if (location == null) {
|
||||
return;
|
||||
}
|
||||
float dist = (float) MapUtils.getDistance(favouritePoint.getLatitude(), favouritePoint.getLongitude(), location.getLatitude(), location.getLongitude());
|
||||
favouritesViewHolder.distance.setText(OsmAndFormatter.getFormattedDistance(dist, app));
|
||||
favouritesViewHolder.arrowImage.setImageDrawable(iconsCache.getIcon(R.drawable.ic_direction_arrow));
|
||||
DashLocationFragment.updateLocationView(useCenter, location, heading, favouritesViewHolder.arrowImage,
|
||||
favouritesViewHolder.distance, favouritePoint.getLatitude(), favouritePoint.getLongitude(),
|
||||
screenOrientation, app);
|
||||
app.getUIUtilities().updateLocationView(cache, favouritesViewHolder.arrowImage, favouritesViewHolder.distance,
|
||||
favouritePoint.getLatitude(), favouritePoint.getLongitude());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,21 +67,6 @@ public class FavouritesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void setScreenOrientation(int screenOrientation) {
|
||||
this.screenOrientation = screenOrientation;
|
||||
}
|
||||
|
||||
public void setLocation(LatLon location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public void setHeading(Float heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public void setUseCenter(boolean useCenter) {
|
||||
this.useCenter = useCenter;
|
||||
}
|
||||
|
||||
class FavouritesViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
|
|
|
@ -37,9 +37,6 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
|||
private static final String IS_SORTED = "sorted";
|
||||
private static final String SORTED_BY_TYPE = "sortedByType";
|
||||
|
||||
private Location location;
|
||||
private LatLon latLon;
|
||||
private Float heading;
|
||||
private List<FavouritePoint> favouritePoints;
|
||||
private FavouritesAdapter adapter;
|
||||
private RecyclerView recyclerView;
|
||||
|
@ -49,6 +46,7 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
|||
private boolean compassUpdateAllowed = true;
|
||||
private boolean target;
|
||||
private boolean intermediate;
|
||||
private float lastHeading;
|
||||
|
||||
@Override
|
||||
public void createMenuItems(final Bundle savedInstanceState) {
|
||||
|
@ -66,16 +64,7 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
|||
recyclerView = (RecyclerView) View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
||||
R.layout.recyclerview, null);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
location = getMyApplication().getLocationProvider().getLastStaleKnownLocation();
|
||||
adapter = new FavouritesAdapter(getMyApplication(), favouritePoints);
|
||||
if (location != null) {
|
||||
latLon = new LatLon(location.getLatitude(), location.getLongitude());
|
||||
adapter.setUseCenter(false);
|
||||
} else {
|
||||
latLon = ((MapActivity) getActivity()).getMapLocation();
|
||||
adapter.setUseCenter(true);
|
||||
}
|
||||
adapter.setLocation(latLon);
|
||||
sortFavourites();
|
||||
final BottomSheetItemTitleWithDescrAndButton[] title = new BottomSheetItemTitleWithDescrAndButton[1];
|
||||
title[0] = (BottomSheetItemTitleWithDescrAndButton) new BottomSheetItemTitleWithDescrAndButton.Builder()
|
||||
|
@ -171,7 +160,6 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
adapter.setScreenOrientation(DashLocationFragment.getScreenOrientation(getActivity()));
|
||||
startLocationUpdate();
|
||||
}
|
||||
|
||||
|
@ -184,26 +172,14 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
|||
|
||||
@Override
|
||||
public void updateLocation(Location location) {
|
||||
boolean newLocation = this.location == null && location != null;
|
||||
boolean locationChanged = this.location != null && location != null
|
||||
&& this.location.getLatitude() != location.getLatitude()
|
||||
&& this.location.getLongitude() != location.getLongitude();
|
||||
if (newLocation || locationChanged) {
|
||||
this.location = location;
|
||||
updateLocationUi();
|
||||
}
|
||||
updateLocationUi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCompassValue(float value) {
|
||||
// 99 in next line used to one-time initialize arrows (with reference vs. fixed-north direction)
|
||||
// on non-compass devices
|
||||
float lastHeading = heading != null ? heading : 99;
|
||||
heading = value;
|
||||
if (Math.abs(MapUtils.degreesDiff(lastHeading, heading)) > 5) {
|
||||
if (Math.abs(MapUtils.degreesDiff(lastHeading, value)) > 5) {
|
||||
lastHeading = value;
|
||||
updateLocationUi();
|
||||
} else {
|
||||
heading = lastHeading;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,15 +192,6 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
|||
mapActivity.getMyApplication().runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (location == null) {
|
||||
location = getMyApplication().getLocationProvider().getLastStaleKnownLocation();
|
||||
}
|
||||
|
||||
boolean useCenter = location == null;
|
||||
latLon = useCenter ? mapActivity.getMapLocation() : new LatLon(location.getLatitude(), location.getLongitude());
|
||||
adapter.setUseCenter(useCenter);
|
||||
adapter.setLocation(latLon);
|
||||
adapter.setHeading(useCenter ? -mapActivity.getMapRotate() : heading != null ? heading : 99);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
@ -266,6 +233,9 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
|||
|
||||
private void sortFavourites() {
|
||||
final Collator inst = Collator.getInstance();
|
||||
Location stale = getMyApplication().getLocationProvider().getLastStaleKnownLocation();
|
||||
final LatLon latLon = stale != null ? new LatLon(stale.getLatitude(), stale.getLongitude()) :
|
||||
getMyApplication().getMapViewTrackingUtilities().getMapLocation();
|
||||
Collections.sort(favouritePoints, new Comparator<FavouritePoint>() {
|
||||
@Override
|
||||
public int compare(FavouritePoint lhs, FavouritePoint rhs) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.osmand.data.RotatedTileBox;
|
|||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.GeocodingLookupService;
|
||||
import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.MapMarkersHelper;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
|
@ -231,7 +231,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
main.findViewById(R.id.InfoDuration).setVisibility(View.GONE);
|
||||
textView.setText(R.string.route_is_too_long_v2);
|
||||
textView.setVisibility(View.VISIBLE);
|
||||
iconView.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_warning, isLight()));
|
||||
iconView.setImageDrawable(mapActivity.getMyApplication().getUIUtilities().getIcon(R.drawable.ic_warning, isLight()));
|
||||
} else {
|
||||
main.findViewById(R.id.dividerToDropDown).setVisibility(View.GONE);
|
||||
main.findViewById(R.id.RouteInfoControls).setVisibility(View.GONE);
|
||||
|
@ -294,7 +294,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
ImageView viaIcon = (ImageView) parentView.findViewById(R.id.viaIcon);
|
||||
viaIcon.setImageDrawable(getIconOrig(R.drawable.list_intermediate));
|
||||
|
||||
swapDirectionView.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_change_navigation_points,
|
||||
swapDirectionView.setImageDrawable(mapActivity.getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_change_navigation_points,
|
||||
isLight() ? R.color.route_info_control_icon_color_light : R.color.route_info_control_icon_color_dark));
|
||||
swapDirectionView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -378,7 +378,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
updateToIcon(parentView);
|
||||
|
||||
ImageView toDropDownIcon = (ImageView) parentView.findViewById(R.id.toDropDownIcon);
|
||||
toDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_arrow_drop_down, isLight()));
|
||||
toDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_arrow_drop_down, isLight()));
|
||||
}
|
||||
|
||||
private void updateToIcon(View parentView) {
|
||||
|
@ -448,7 +448,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
updateFromIcon(parentView);
|
||||
|
||||
ImageView fromDropDownIcon = (ImageView) parentView.findViewById(R.id.fromDropDownIcon);
|
||||
fromDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_arrow_drop_down, isLight()));
|
||||
fromDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_arrow_drop_down, isLight()));
|
||||
}
|
||||
|
||||
public void updateFromIcon(View parentView) {
|
||||
|
@ -520,7 +520,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
}
|
||||
|
||||
private Drawable getIconOrig(int iconId) {
|
||||
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = mapActivity.getMyApplication().getUIUtilities();
|
||||
return iconsCache.getIcon(iconId, 0);
|
||||
}
|
||||
|
||||
|
@ -550,7 +550,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
mainView.findViewById(R.id.RouteInfoControls).setVisibility(View.VISIBLE);
|
||||
final OsmandApplication ctx = mapActivity.getMyApplication();
|
||||
ImageView prev = (ImageView) mainView.findViewById(R.id.Prev);
|
||||
prev.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_prev, isLight()));
|
||||
prev.setImageDrawable(ctx.getUIUtilities().getIcon(R.drawable.ic_prev, isLight()));
|
||||
if (directionInfo >= 0) {
|
||||
prev.setVisibility(View.VISIBLE);
|
||||
prev.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -578,7 +578,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
}
|
||||
ImageView next = (ImageView) mainView.findViewById(R.id.Next);
|
||||
next.setVisibility(View.VISIBLE);
|
||||
next.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_next, isLight()));
|
||||
next.setImageDrawable(ctx.getUIUtilities().getIcon(R.drawable.ic_next, isLight()));
|
||||
next.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -614,9 +614,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
infoDurationView.setVisibility(View.GONE);
|
||||
textView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
infoIcon.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_action_route_distance, R.color.route_info_unchecked_mode_icon_color));
|
||||
infoIcon.setImageDrawable(ctx.getUIUtilities().getIcon(R.drawable.ic_action_route_distance, R.color.route_info_unchecked_mode_icon_color));
|
||||
infoIcon.setVisibility(View.VISIBLE);
|
||||
durationIcon.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_action_time_span, R.color.route_info_unchecked_mode_icon_color));
|
||||
durationIcon.setImageDrawable(ctx.getUIUtilities().getIcon(R.drawable.ic_action_time_span, R.color.route_info_unchecked_mode_icon_color));
|
||||
durationIcon.setVisibility(View.VISIBLE);
|
||||
infoDistanceView.setVisibility(View.VISIBLE);
|
||||
infoDurationView.setVisibility(View.VISIBLE);
|
||||
|
@ -997,7 +997,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
if (row.icon != null) {
|
||||
icon = row.icon;
|
||||
} else if (row.iconId > 0) {
|
||||
icon = mapActivity.getMyApplication().getIconsCache().getThemedIcon(row.iconId);
|
||||
icon = mapActivity.getMyApplication().getUIUtilities().getThemedIcon(row.iconId);
|
||||
}
|
||||
label.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
|
||||
label.setCompoundDrawablePadding(AndroidUtils.dpToPx(mapActivity, 16f));
|
||||
|
|
|
@ -11,7 +11,7 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -50,7 +50,7 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter<MapMultiSelectionMe
|
|||
}
|
||||
}
|
||||
});
|
||||
IconsCache iconsCache = menu.getMapActivity().getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = menu.getMapActivity().getMyApplication().getUIUtilities();
|
||||
final View iconLayout = convertView.findViewById(R.id.context_menu_icon_layout);
|
||||
final ImageView iconView = (ImageView) convertView.findViewById(R.id.context_menu_icon_view);
|
||||
Drawable icon = item.getRightIcon();
|
||||
|
|
|
@ -454,7 +454,7 @@ public class RoutePreferencesMenu {
|
|||
v.findViewById(R.id.description_text).setVisibility(View.GONE);
|
||||
v.findViewById(R.id.select_button).setVisibility(View.GONE);
|
||||
((ImageView) v.findViewById(R.id.icon))
|
||||
.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_volume_up, !nightMode));
|
||||
.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_volume_up, !nightMode));
|
||||
final CompoundButton btn = (CompoundButton) v.findViewById(R.id.toggle_item);
|
||||
btn.setVisibility(View.VISIBLE);
|
||||
btn.setChecked(!routingHelper.getVoiceRouter().isMute());
|
||||
|
@ -474,7 +474,7 @@ public class RoutePreferencesMenu {
|
|||
View v = mapActivity.getLayoutInflater().inflate(R.layout.switch_select_list_item, null);
|
||||
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||
((ImageView) v.findViewById(R.id.icon))
|
||||
.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_road_works_dark, !nightMode));
|
||||
.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_road_works_dark, !nightMode));
|
||||
v.findViewById(R.id.toggle_item).setVisibility(View.GONE);
|
||||
final TextView btn = (TextView) v.findViewById(R.id.select_button);
|
||||
btn.setTextColor(btn.getLinkTextColors());
|
||||
|
@ -560,7 +560,7 @@ public class RoutePreferencesMenu {
|
|||
final TextView gpxSpinner = (TextView) v.findViewById(R.id.GPXRouteSpinner);
|
||||
AndroidUtils.setTextPrimaryColor(mapActivity, gpxSpinner, nightMode);
|
||||
((ImageView) v.findViewById(R.id.dropDownIcon))
|
||||
.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_drop_down, !nightMode));
|
||||
.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_arrow_drop_down, !nightMode));
|
||||
updateSpinnerItems(gpxSpinner);
|
||||
return v;
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ public class RoutePreferencesMenu {
|
|||
View v = mapActivity.getLayoutInflater().inflate(R.layout.layers_list_activity_item, null);
|
||||
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||
final ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.map_action_settings, !nightMode));
|
||||
icon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.map_action_settings, !nightMode));
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
TextView titleView = (TextView) v.findViewById(R.id.title);
|
||||
titleView.setText(R.string.routing_settings_2);
|
||||
|
|
|
@ -27,7 +27,7 @@ import net.osmand.plus.GPXUtilities.TrkSegment;
|
|||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -450,7 +450,7 @@ public class TrackDetailsMenu {
|
|||
});
|
||||
|
||||
final OsmandApplication app = mapActivity.getMyApplication();
|
||||
final IconsCache ic = app.getIconsCache();
|
||||
final UiUtilities ic = app.getUIUtilities();
|
||||
|
||||
GpxUiHelper.setupGPXChart(app, chart, 4);
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ public class MapillaryAutoCompleteAdapter extends ArrayAdapter<String> implement
|
|||
|
||||
nameTv.setText(names.get(position));
|
||||
if (wrong) {
|
||||
Drawable icon = app.getIconsCache().getPaintedIcon(R.drawable.ic_warning, app.getResources().getColor(R.color.color_warning));
|
||||
Drawable icon = app.getUIUtilities().getPaintedIcon(R.drawable.ic_warning, app.getResources().getColor(R.color.color_warning));
|
||||
iconIv.setImageDrawable(icon);
|
||||
iconIv.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import net.osmand.data.QuadRect;
|
|||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.map.TileSourceManager;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||
|
@ -85,12 +85,12 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
|||
private double fetchedTileLon = Double.NaN;
|
||||
private List<MapillaryImage> sequenceImages = new ArrayList<>();
|
||||
private AtomicInteger downloadRequestNumber = new AtomicInteger();
|
||||
private IconsCache ic;
|
||||
private UiUtilities ic;
|
||||
|
||||
public MapillaryImageDialog(@NonNull MapActivity mapActivity, @NonNull Bundle bundle) {
|
||||
super(mapActivity, CardDialogType.MAPILLARY);
|
||||
restoreFields(bundle);
|
||||
this.ic = mapActivity.getMyApplication().getIconsCache();
|
||||
this.ic = mapActivity.getMyApplication().getUIUtilities();
|
||||
}
|
||||
|
||||
public MapillaryImageDialog(MapActivity mapActivity, String key, String sKey, String imageUrl,
|
||||
|
@ -104,7 +104,7 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
|||
this.viewerUrl = viewerUrl;
|
||||
this.latLon = latLon;
|
||||
this.ca = ca;
|
||||
this.ic = mapActivity.getMyApplication().getIconsCache();
|
||||
this.ic = mapActivity.getMyApplication().getUIUtilities();
|
||||
this.sync = sync;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
|||
@Override
|
||||
protected void createMenuItems(Menu menu) {
|
||||
MenuItem item = menu.add(R.string.open_mapillary)
|
||||
.setIcon(getMapActivity().getMyApplication().getIconsCache().getThemedIcon(
|
||||
.setIcon(getMapActivity().getMyApplication().getUIUtilities().getThemedIcon(
|
||||
R.drawable.ic_action_mapillary));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -47,7 +47,6 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
|
@ -58,6 +57,7 @@ import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
|
@ -99,6 +99,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
private boolean locationUpdateStarted;
|
||||
private boolean compassUpdateAllowed = true;
|
||||
|
||||
|
||||
public void setListener(OnMapMarkersSavedListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
@ -497,7 +498,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
adapter.setScreenOrientation(DashLocationFragment.getScreenOrientation(getActivity()));
|
||||
|
||||
startLocationUpdate();
|
||||
|
||||
final View focusedView = getDialog().getCurrentFocus();
|
||||
|
@ -1020,7 +1021,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
}
|
||||
|
||||
private Drawable getColoredIcon(@DrawableRes int resId, @ColorRes int colorResId) {
|
||||
return getMyApplication().getIconsCache().getIcon(resId, colorResId);
|
||||
return getMyApplication().getUIUtilities().getIcon(resId, colorResId);
|
||||
}
|
||||
|
||||
private MapActivity getMapActivity() {
|
||||
|
@ -1065,15 +1066,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
mapActivity.getMyApplication().runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (location == null) {
|
||||
location = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||
}
|
||||
MapViewTrackingUtilities utilities = mapActivity.getMapViewTrackingUtilities();
|
||||
boolean useCenter = !(utilities.isMapLinkedToLocation() && location != null);
|
||||
|
||||
adapter.setUseCenter(useCenter);
|
||||
adapter.setLocation(useCenter ? mapActivity.getMapLocation() : new LatLon(location.getLatitude(), location.getLongitude()));
|
||||
adapter.setHeading(useCenter ? -mapActivity.getMapRotate() : heading != null ? heading : 99);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -36,11 +36,11 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
|
|||
private Float heading;
|
||||
private boolean useCenter;
|
||||
private boolean nightMode;
|
||||
private int screenOrientation;
|
||||
private boolean target;
|
||||
private boolean intermediate;
|
||||
|
||||
private OnMarkerSelectListener onClickListener;
|
||||
private int screenOrientation;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -63,7 +63,7 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
|
|||
MapRouteInfoMenu routeInfoMenu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
||||
onClickListener = routeInfoMenu.getOnMarkerSelectListener();
|
||||
|
||||
screenOrientation = DashLocationFragment.getScreenOrientation(mapActivity);
|
||||
screenOrientation = app.getUIUtilities().getScreenOrientation();
|
||||
|
||||
MapViewTrackingUtilities trackingUtils = mapActivity.getMapViewTrackingUtilities();
|
||||
if (trackingUtils != null) {
|
||||
|
@ -84,7 +84,7 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
|
|||
|
||||
View view = inflater.inflate(R.layout.map_marker_selection_fragment, container, false);
|
||||
ImageButton closeButton = (ImageButton) view.findViewById(R.id.closeButton);
|
||||
closeButton.setImageDrawable(getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_mode_back));
|
||||
closeButton.setImageDrawable(getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_mode_back));
|
||||
closeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -147,7 +147,6 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
adapter.setScreenOrientation(DashLocationFragment.getScreenOrientation(getActivity()));
|
||||
startLocationUpdate();
|
||||
}
|
||||
|
||||
|
@ -220,12 +219,6 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
|
|||
if (location == null) {
|
||||
location = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||
}
|
||||
MapViewTrackingUtilities utilities = mapActivity.getMapViewTrackingUtilities();
|
||||
boolean useCenter = !(utilities.isMapLinkedToLocation() && location != null);
|
||||
|
||||
adapter.setUseCenter(useCenter);
|
||||
adapter.setLocation(useCenter ? mapActivity.getMapLocation() : new LatLon(location.getLatitude(), location.getLongitude()));
|
||||
adapter.setHeading(useCenter ? -mapActivity.getMapRotate() : heading != null ? heading : 99);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -147,7 +147,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
|||
View mainView = inflater.inflate(R.layout.fragment_map_markers_dialog, container);
|
||||
|
||||
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.map_markers_toolbar);
|
||||
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationIcon(getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,22 @@
|
|||
package net.osmand.plus.mapmarkers;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapmarkers.SelectionMarkersGroupBottomSheetDialogFragment.AddMarkersGroupFragmentListener;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkersGroupsAdapter;
|
||||
import net.osmand.plus.widgets.EmptyStateRecyclerView;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
|
@ -22,34 +39,11 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.plus.mapmarkers.SelectionMarkersGroupBottomSheetDialogFragment.AddMarkersGroupFragmentListener;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkersGroupsAdapter;
|
||||
import net.osmand.plus.widgets.EmptyStateRecyclerView;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassListener, OsmAndLocationListener {
|
||||
|
||||
public static final String TAG = "MapMarkersGroupsFragment";
|
||||
|
||||
private MapMarkersGroupsAdapter adapter;
|
||||
private Float heading;
|
||||
private Location location;
|
||||
private boolean locationUpdateStarted;
|
||||
private Paint backgroundPaint = new Paint();
|
||||
private Paint iconPaint = new Paint();
|
||||
|
@ -400,7 +394,6 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
adapter.setScreenOrientation(DashLocationFragment.getScreenOrientation(getActivity()));
|
||||
startLocationUpdate();
|
||||
}
|
||||
|
||||
|
@ -442,27 +435,12 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
|
|||
|
||||
@Override
|
||||
public void updateLocation(Location location) {
|
||||
boolean newLocation = this.location == null && location != null;
|
||||
boolean locationChanged = this.location != null && location != null
|
||||
&& this.location.getLatitude() != location.getLatitude()
|
||||
&& this.location.getLongitude() != location.getLongitude();
|
||||
if (newLocation || locationChanged) {
|
||||
this.location = location;
|
||||
updateLocationUi();
|
||||
}
|
||||
updateLocationUi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCompassValue(float value) {
|
||||
// 99 in next line used to one-time initialize arrows (with reference vs. fixed-north direction)
|
||||
// on non-compass devices
|
||||
float lastHeading = heading != null ? heading : 99;
|
||||
heading = value;
|
||||
if (Math.abs(MapUtils.degreesDiff(lastHeading, heading)) > 5) {
|
||||
updateLocationUi();
|
||||
} else {
|
||||
heading = lastHeading;
|
||||
}
|
||||
updateLocationUi();
|
||||
}
|
||||
|
||||
private OsmandApplication getMyApplication() {
|
||||
|
@ -481,15 +459,6 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
|
|||
mapActivity.getMyApplication().runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (location == null) {
|
||||
location = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||
}
|
||||
MapViewTrackingUtilities utilities = mapActivity.getMapViewTrackingUtilities();
|
||||
boolean useCenter = !(utilities.isMapLinkedToLocation() && location != null);
|
||||
|
||||
adapter.setUseCenter(useCenter);
|
||||
adapter.setLocation(useCenter ? mapActivity.getMapLocation() : new LatLon(location.getLatitude(), location.getLongitude()));
|
||||
adapter.setHeading(useCenter ? -mapActivity.getMapRotate() : heading != null ? heading : 99);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
package net.osmand.plus.mapmarkers.adapters;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.ColorRes;
|
||||
|
@ -10,51 +18,25 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CoordinateInputAdapter extends RecyclerView.Adapter<MapMarkerItemViewHolder> {
|
||||
|
||||
private MapActivity mapActivity;
|
||||
private IconsCache iconsCache;
|
||||
private UiUtilities iconsCache;
|
||||
private List<MapMarker> mapMarkers;
|
||||
|
||||
private boolean nightTheme;
|
||||
|
||||
private LatLon location;
|
||||
private Float heading;
|
||||
private boolean useCenter;
|
||||
private int screenOrientation;
|
||||
private UpdateLocationViewCache updateViewCache;
|
||||
|
||||
public CoordinateInputAdapter(MapActivity mapActivity, List<MapMarker> mapMarkers) {
|
||||
this.mapActivity = mapActivity;
|
||||
iconsCache = mapActivity.getMyApplication().getIconsCache();
|
||||
iconsCache = mapActivity.getMyApplication().getUIUtilities();
|
||||
updateViewCache = iconsCache.getUpdateLocationViewCache();
|
||||
this.mapMarkers = mapMarkers;
|
||||
nightTheme = !mapActivity.getMyApplication().getSettings().isLightContent();
|
||||
}
|
||||
|
||||
public void setLocation(LatLon location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public void setHeading(Float heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public void setUseCenter(boolean useCenter) {
|
||||
this.useCenter = useCenter;
|
||||
}
|
||||
|
||||
public void setScreenOrientation(int screenOrientation) {
|
||||
this.screenOrientation = screenOrientation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapMarkerItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
|
@ -98,11 +80,8 @@ public class CoordinateInputAdapter extends RecyclerView.Adapter<MapMarkerItemVi
|
|||
holder.divider.setVisibility((!singleItem && !lastItem) ? View.VISIBLE : View.GONE);
|
||||
|
||||
holder.title.setText(mapMarker.getName(mapActivity));
|
||||
|
||||
DashLocationFragment.updateLocationView(useCenter, location,
|
||||
heading, holder.iconDirection, R.drawable.ic_direction_arrow,
|
||||
holder.distance, new LatLon(mapMarker.getLatitude(), mapMarker.getLongitude()),
|
||||
screenOrientation, mapActivity.getMyApplication(), true);
|
||||
mapActivity.getMyApplication().getUIUtilities().updateLocationView(updateViewCache,
|
||||
holder.iconDirection, holder.distance, mapMarker.getLatitude(), mapMarker.getLongitude());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
|
@ -17,11 +17,11 @@ public abstract class GroupsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
|||
|
||||
private GroupsAdapterListener listener;
|
||||
protected OsmandApplication app;
|
||||
protected IconsCache iconsCache;
|
||||
protected UiUtilities iconsCache;
|
||||
|
||||
public GroupsAdapter(Context context) {
|
||||
this.app = (OsmandApplication) context.getApplicationContext();
|
||||
this.iconsCache = app.getIconsCache();
|
||||
this.iconsCache = app.getUIUtilities();
|
||||
}
|
||||
|
||||
public void setAdapterListener(GroupsAdapterListener listener) {
|
||||
|
|
|
@ -11,11 +11,12 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.MapMarkersHelper;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -35,15 +36,15 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
|||
private Snackbar snackbar;
|
||||
private boolean showDirectionEnabled;
|
||||
|
||||
private LatLon location;
|
||||
private Float heading;
|
||||
private boolean useCenter;
|
||||
private int screenOrientation;
|
||||
private boolean night;
|
||||
private UiUtilities uiUtilities;
|
||||
private UpdateLocationViewCache updateLocationViewCache;
|
||||
|
||||
public MapMarkersActiveAdapter(MapActivity mapActivity) {
|
||||
setHasStableIds(true);
|
||||
this.mapActivity = mapActivity;
|
||||
uiUtilities = mapActivity.getMyApplication().getUIUtilities();
|
||||
updateLocationViewCache = uiUtilities.getUpdateLocationViewCache();
|
||||
markers = mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers();
|
||||
night = !mapActivity.getMyApplication().getSettings().isLightContent();
|
||||
showDirectionEnabled = mapActivity.getMyApplication().getSettings().MARKERS_DISTANCE_INDICATION_ENABLED.get();
|
||||
|
@ -56,23 +57,6 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
|||
public void setAdapterListener(MapMarkersActiveAdapterListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void setLocation(LatLon location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public void setHeading(Float heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public void setUseCenter(boolean useCenter) {
|
||||
this.useCenter = useCenter;
|
||||
}
|
||||
|
||||
public void setScreenOrientation(int screenOrientation) {
|
||||
this.screenOrientation = screenOrientation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapMarkerItemViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
|
||||
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_new, viewGroup, false);
|
||||
|
@ -87,7 +71,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(final MapMarkerItemViewHolder holder, final int pos) {
|
||||
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = mapActivity.getMyApplication().getUIUtilities();
|
||||
MapMarker marker = markers.get(pos);
|
||||
|
||||
ImageView markerImageViewToUpdate;
|
||||
|
@ -193,10 +177,9 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
|||
}
|
||||
});
|
||||
|
||||
DashLocationFragment.updateLocationView(useCenter, location,
|
||||
heading, markerImageViewToUpdate, drawableResToUpdate,
|
||||
showDirectionEnabled && displayedInWidget ? markerColor : 0, holder.distance, markerLatLon,
|
||||
screenOrientation, mapActivity.getMyApplication(), true);
|
||||
updateLocationViewCache.arrowResId = drawableResToUpdate;
|
||||
updateLocationViewCache.arrowColor = showDirectionEnabled && displayedInWidget ? markerColor : 0;
|
||||
uiUtilities.updateLocationView(updateLocationViewCache, markerImageViewToUpdate, holder.distance, markerLatLon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.data.LatLon;
|
||||
|
@ -18,7 +17,7 @@ import net.osmand.plus.GPXUtilities.GPXFile;
|
|||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.MapMarkersHelper;
|
||||
import net.osmand.plus.MapMarkersHelper.GroupHeader;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
|
@ -26,6 +25,7 @@ import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
|
|||
import net.osmand.plus.MapMarkersHelper.ShowHideHistoryButton;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.plus.mapmarkers.SelectWptCategoriesBottomSheetDialogFragment;
|
||||
|
@ -60,15 +60,12 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
private OsmandApplication app;
|
||||
private List<Object> items = new ArrayList<>();
|
||||
private boolean night;
|
||||
private int screenOrientation;
|
||||
private LatLon location;
|
||||
private Float heading;
|
||||
private boolean useCenter;
|
||||
private boolean showDirectionEnabled;
|
||||
private List<MapMarker> showDirectionMarkers;
|
||||
private Snackbar snackbar;
|
||||
|
||||
private MapMarkersGroupsAdapterListener listener;
|
||||
private UpdateLocationViewCache updateLocationViewCache;
|
||||
|
||||
public void setListener(MapMarkersGroupsAdapterListener listener) {
|
||||
this.listener = listener;
|
||||
|
@ -77,6 +74,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
public MapMarkersGroupsAdapter(MapActivity mapActivity) {
|
||||
this.mapActivity = mapActivity;
|
||||
app = mapActivity.getMyApplication();
|
||||
updateLocationViewCache = app.getUIUtilities().getUpdateLocationViewCache();
|
||||
night = !mapActivity.getMyApplication().getSettings().isLightContent();
|
||||
updateShowDirectionMarkers();
|
||||
createDisplayGroups();
|
||||
|
@ -225,22 +223,6 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
return pos;
|
||||
}
|
||||
|
||||
public void setLocation(LatLon location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public void setHeading(Float heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public void setUseCenter(boolean useCenter) {
|
||||
this.useCenter = useCenter;
|
||||
}
|
||||
|
||||
public void setScreenOrientation(int screenOrientation) {
|
||||
this.screenOrientation = screenOrientation;
|
||||
}
|
||||
|
||||
public void updateDisplayedData() {
|
||||
createDisplayGroups();
|
||||
updateShowDirectionMarkers();
|
||||
|
@ -274,7 +256,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) {
|
||||
IconsCache iconsCache = app.getIconsCache();
|
||||
UiUtilities iconsCache = app.getUIUtilities();
|
||||
if (holder instanceof MapMarkerItemViewHolder) {
|
||||
final MapMarkerItemViewHolder itemViewHolder = (MapMarkerItemViewHolder) holder;
|
||||
final MapMarker marker = (MapMarker) getItem(position);
|
||||
|
@ -392,10 +374,9 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
itemViewHolder.bottomShadow.setVisibility(lastItem ? View.VISIBLE : View.GONE);
|
||||
|
||||
LatLon markerLatLon = new LatLon(marker.getLatitude(), marker.getLongitude());
|
||||
DashLocationFragment.updateLocationView(useCenter, location,
|
||||
heading, markerImageViewToUpdate, drawableResToUpdate, markerToHighlight ? color : 0,
|
||||
itemViewHolder.distance, markerLatLon,
|
||||
screenOrientation, app, true);
|
||||
updateLocationViewCache.arrowResId = drawableResToUpdate;
|
||||
updateLocationViewCache.arrowColor = markerToHighlight ? color : 0;
|
||||
app.getUIUtilities().updateLocationView(updateLocationViewCache, markerImageViewToUpdate, itemViewHolder.distance, markerLatLon);
|
||||
} else if (holder instanceof MapMarkerHeaderViewHolder) {
|
||||
final MapMarkerHeaderViewHolder headerViewHolder = (MapMarkerHeaderViewHolder) holder;
|
||||
final Object header = getItem(position);
|
||||
|
@ -575,7 +556,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
categoriesViewHolder.title.setText(getGroupWptCategoriesString(group));
|
||||
categoriesViewHolder.divider.setVisibility(View.VISIBLE);
|
||||
categoriesViewHolder.button.setCompoundDrawablesWithIntrinsicBounds(
|
||||
null, null, app.getIconsCache().getIcon(R.drawable.ic_action_filter,
|
||||
null, null, app.getUIUtilities().getIcon(R.drawable.ic_action_filter,
|
||||
night ? R.color.wikivoyage_active_dark : R.color.wikivoyage_active_light), null);
|
||||
categoriesViewHolder.button.setOnClickListener(openChooseCategoriesDialog);
|
||||
categoriesViewHolder.title.setOnClickListener(openChooseCategoriesDialog);
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -111,7 +111,7 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
IconsCache iconsCache = app.getIconsCache();
|
||||
UiUtilities iconsCache = app.getUIUtilities();
|
||||
if (holder instanceof MapMarkerItemViewHolder) {
|
||||
final MapMarkerItemViewHolder itemViewHolder = (MapMarkerItemViewHolder) holder;
|
||||
final MapMarker marker = (MapMarker) getItem(position);
|
||||
|
|
|
@ -16,7 +16,7 @@ import net.osmand.data.PointDescription;
|
|||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
|
||||
import net.osmand.plus.GeocodingLookupService.OnAddressLookupResult;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -89,7 +89,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
|
|||
public void onBindViewHolder(final MapMarkerItemViewHolder holder, int pos) {
|
||||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
boolean night = app.getDaynightHelper().isNightModeForMapControls();
|
||||
IconsCache iconsCache = app.getIconsCache();
|
||||
UiUtilities iconsCache = app.getUIUtilities();
|
||||
|
||||
boolean locationItem = showLocationItem && pos == 0;
|
||||
boolean firstMarkerItem = showLocationItem ? pos == 1 : pos == 0;
|
||||
|
|
|
@ -141,7 +141,7 @@ public class SnapToRoadBottomSheetDialogFragment extends android.support.design.
|
|||
}
|
||||
|
||||
private Drawable getContentIcon(@DrawableRes int id) {
|
||||
return getMyApplication().getIconsCache()
|
||||
return getMyApplication().getUIUtilities()
|
||||
.getIcon(id, nightMode ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -57,7 +57,7 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(final MeasureToolItemVH holder, int pos) {
|
||||
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = mapActivity.getMyApplication().getUIUtilities();
|
||||
holder.iconReorder.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reorder));
|
||||
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
|
|
|
@ -200,10 +200,10 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
final boolean isRecording = app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get();
|
||||
ImageButton stop = ((ImageButton) v.findViewById(R.id.stop));
|
||||
if (isRecording) {
|
||||
stop.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_rec_stop));
|
||||
stop.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_rec_stop));
|
||||
stop.setContentDescription(app.getString(R.string.gpx_monitoring_stop));
|
||||
} else {
|
||||
stop.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_rec_start));
|
||||
stop.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_rec_start));
|
||||
stop.setContentDescription(app.getString(R.string.gpx_monitoring_start));
|
||||
}
|
||||
stop.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -230,7 +230,7 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
} else {
|
||||
save.setVisibility(View.GONE);
|
||||
}
|
||||
save.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_gsave_dark));
|
||||
save.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_gsave_dark));
|
||||
save.setContentDescription(app.getString(R.string.save_current_track));
|
||||
|
||||
((TextView) v.findViewById(R.id.points_count)).setText(String.valueOf(sth.getPoints()));
|
||||
|
@ -239,17 +239,17 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
v.findViewById(R.id.points_icon).setVisibility(View.VISIBLE);
|
||||
ImageView distance = (ImageView) v.findViewById(R.id.distance_icon);
|
||||
distance.setVisibility(View.VISIBLE);
|
||||
distance.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_small_distance));
|
||||
distance.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_small_distance));
|
||||
ImageView pointsCount = (ImageView) v.findViewById(R.id.points_icon);
|
||||
pointsCount.setVisibility(View.VISIBLE);
|
||||
pointsCount.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_small_point));
|
||||
pointsCount.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_small_point));
|
||||
}
|
||||
|
||||
private void updateShowOnMap(final OsmandApplication app, final File f, final View pView, final ImageButton showOnMap) {
|
||||
final GpxSelectionHelper selectedGpxHelper = app.getSelectedGpxHelper();
|
||||
final SelectedGpxFile selected = selectedGpxHelper.getSelectedFileByPath(f.getAbsolutePath());
|
||||
if(selected != null) {
|
||||
showOnMap.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_show_on_map, R.color.color_distance));
|
||||
showOnMap.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_show_on_map, R.color.color_distance));
|
||||
showOnMap.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -262,7 +262,7 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
showOnMap.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_show_on_map));
|
||||
showOnMap.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_show_on_map));
|
||||
showOnMap.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -60,7 +60,7 @@ import net.osmand.plus.GpxSelectionHelper;
|
|||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
|
@ -222,7 +222,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
final boolean isRecording = app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get();
|
||||
|
||||
ImageView icon = (ImageView) currentGpxView.findViewById(R.id.icon);
|
||||
icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.monitoring_rec_big));
|
||||
icon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.monitoring_rec_big));
|
||||
icon.setVisibility(selectionMode && showOnMapMode ? View.GONE : View.VISIBLE);
|
||||
|
||||
final boolean light = app.getSettings().isLightContent();
|
||||
|
@ -234,14 +234,14 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
TextView segmentTime = (TextView) currentGpxView.findViewById(R.id.segment_time);
|
||||
segmentTime.setText(OsmAndFormatter.getFormattedDurationShort((int)(sth.getDuration() / 1000)));
|
||||
segmentTime.setVisibility(View.VISIBLE);
|
||||
stop.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache()
|
||||
stop.setCompoundDrawablesWithIntrinsicBounds(app.getUIUtilities()
|
||||
.getIcon(R.drawable.ic_action_rec_stop, light ? R.color.color_dialog_buttons_light : R.color.color_dialog_buttons_dark), null, null, null);
|
||||
stop.setText(app.getString(R.string.shared_string_control_stop));
|
||||
stop.setContentDescription(app.getString(R.string.gpx_monitoring_stop));
|
||||
} else {
|
||||
currentGpxView.findViewById(R.id.segment_time_div).setVisibility(View.GONE);
|
||||
currentGpxView.findViewById(R.id.segment_time).setVisibility(View.GONE);
|
||||
stop.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache()
|
||||
stop.setCompoundDrawablesWithIntrinsicBounds(app.getUIUtilities()
|
||||
.getIcon(R.drawable.ic_action_rec_start, light ? R.color.color_dialog_buttons_light : R.color.color_dialog_buttons_dark), null, null, null);
|
||||
stop.setText(app.getString(R.string.shared_string_record));
|
||||
stop.setContentDescription(app.getString(R.string.gpx_monitoring_start));
|
||||
|
@ -259,7 +259,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
});
|
||||
Button save = (Button) currentGpxView.findViewById(R.id.save_button);
|
||||
save.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache()
|
||||
save.setCompoundDrawablesWithIntrinsicBounds(app.getUIUtilities()
|
||||
.getIcon(R.drawable.ic_action_gsave_dark, light ? R.color.color_dialog_buttons_light : R.color.color_dialog_buttons_dark), null, null, null);
|
||||
save.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -379,9 +379,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
public void createCurrentTrackView() {
|
||||
ImageView distanceI = (ImageView) currentGpxView.findViewById(R.id.distance_icon);
|
||||
distanceI.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_small_distance));
|
||||
distanceI.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_small_distance));
|
||||
ImageView pointsI = (ImageView) currentGpxView.findViewById(R.id.points_icon);
|
||||
pointsI.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_small_point));
|
||||
pointsI.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_small_point));
|
||||
updateCurrentTrack();
|
||||
}
|
||||
|
||||
|
@ -1069,7 +1069,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
ImageButton options = (ImageButton) v.findViewById(R.id.options);
|
||||
options.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
options.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -1176,7 +1176,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
final CheckBox ch = (CheckBox) v.findViewById(R.id.toggle_item);
|
||||
ch.setVisibility(View.GONE);
|
||||
if (isSelectedGroup(groupPosition)) {
|
||||
setCategoryIcon(app, app.getIconsCache().getIcon(R.drawable.ic_map, R.color.osmand_orange), groupPosition, isExpanded, v, light);
|
||||
setCategoryIcon(app, app.getUIUtilities().getIcon(R.drawable.ic_map, R.color.osmand_orange), groupPosition, isExpanded, v, light);
|
||||
} else {
|
||||
setCategoryIcon(app, 0, groupPosition, isExpanded, v, light);
|
||||
}
|
||||
|
@ -1353,7 +1353,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
|
||||
private void openPopUpMenu(View v, final GpxInfo gpxInfo) {
|
||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||
UiUtilities iconsCache = getMyApplication().getUIUtilities();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||
|
||||
|
@ -1790,14 +1790,14 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
// ImageView icon = (ImageView) v.findViewById(!isDashItem? R.id.icon : R.id.show_on_map);
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
icon.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_polygom_dark));
|
||||
icon.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_polygom_dark));
|
||||
if (child.isCorrupted()) {
|
||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
|
||||
} else {
|
||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||
}
|
||||
if (getSelectedGpxFile(child, app) != null) {
|
||||
icon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_polygom_dark, R.color.color_distance));
|
||||
icon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_polygom_dark, R.color.color_distance));
|
||||
}
|
||||
GPXTrackAnalysis analysis = getGpxTrackAnalysis(child, app);
|
||||
boolean sectionRead = analysis == null;
|
||||
|
@ -1826,13 +1826,13 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
v.findViewById(R.id.unknown_section).setVisibility(View.GONE);
|
||||
ImageView distanceI = (ImageView) v.findViewById(R.id.distance_icon);
|
||||
distanceI.setVisibility(View.VISIBLE);
|
||||
distanceI.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_small_distance));
|
||||
distanceI.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_small_distance));
|
||||
ImageView pointsI = (ImageView) v.findViewById(R.id.points_icon);
|
||||
pointsI.setVisibility(View.VISIBLE);
|
||||
pointsI.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_small_point));
|
||||
pointsI.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_small_point));
|
||||
ImageView timeI = (ImageView) v.findViewById(R.id.time_icon);
|
||||
timeI.setVisibility(View.VISIBLE);
|
||||
timeI.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_small_time));
|
||||
timeI.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_small_time));
|
||||
TextView time = (TextView) v.findViewById(R.id.time);
|
||||
TextView distance = (TextView) v.findViewById(R.id.distance);
|
||||
TextView pointsCount = (TextView) v.findViewById(R.id.points_count);
|
||||
|
|
|
@ -181,7 +181,7 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment
|
|||
if (color == 0) {
|
||||
colorImageView.setImageDrawable(getContentIcon(R.drawable.ic_action_circle));
|
||||
} else {
|
||||
colorImageView.setImageDrawable(getMyApplication().getIconsCache().getPaintedIcon(R.drawable.ic_action_circle, color));
|
||||
colorImageView.setImageDrawable(getMyApplication().getUIUtilities().getPaintedIcon(R.drawable.ic_action_circle, color));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import net.osmand.plus.GpxSelectionHelper;
|
|||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -62,7 +62,7 @@ public class SplitSegmentDialogFragment extends DialogFragment {
|
|||
private List<Double> distanceSplit = new ArrayList<>();
|
||||
private TIntArrayList timeSplit = new TIntArrayList();
|
||||
private int selectedSplitInterval;
|
||||
private IconsCache ic;
|
||||
private UiUtilities ic;
|
||||
private int minMaxSpeedLayoutWidth;
|
||||
private Paint minMaxSpeedPaint;
|
||||
private Rect minMaxSpeedTextBounds;
|
||||
|
@ -73,7 +73,7 @@ public class SplitSegmentDialogFragment extends DialogFragment {
|
|||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
app = getMyApplication();
|
||||
ic = app.getIconsCache();
|
||||
ic = app.getUIUtilities();
|
||||
boolean isLightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
||||
int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
|
||||
setStyle(STYLE_NO_FRAME, themeId);
|
||||
|
@ -109,7 +109,7 @@ public class SplitSegmentDialogFragment extends DialogFragment {
|
|||
if (trackActivityActionBar != null) {
|
||||
titleTextView.setText(trackActivityActionBar.getTitle());
|
||||
}
|
||||
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationIcon(getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -254,7 +254,7 @@ public class SplitSegmentDialogFragment extends DialogFragment {
|
|||
int color = app.getResources().getColor(colorId);
|
||||
title.setTextColor(color);
|
||||
text.setTextColor(color);
|
||||
img.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_drop_down, colorId));
|
||||
img.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_arrow_drop_down, colorId));
|
||||
}
|
||||
|
||||
private void updateSplitIntervalView(View view) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue