Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
|
ce954287ec | ||
|
5c10ad31f7 | ||
|
411e87f9e0 | ||
|
1264d9a714 | ||
|
6dc629fbc3 | ||
|
c061a16dbc | ||
|
61122b2ecf |
12 changed files with 161 additions and 75 deletions
|
@ -4,6 +4,7 @@ import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.MapObject;
|
import net.osmand.data.MapObject;
|
||||||
import net.osmand.data.QuadPoint;
|
import net.osmand.data.QuadPoint;
|
||||||
|
@ -616,6 +617,12 @@ public class MapUtils {
|
||||||
r.bottom = Math.min(r.bottom, latitude);
|
r.bottom = Math.min(r.bottom, latitude);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean areLatLonEqual(Location l1, Location l2) {
|
||||||
|
return l1 == null && l2 == null
|
||||||
|
|| (l1 != null && l2 != null && Math.abs(l1.getLatitude() - l2.getLatitude()) < 0.00001
|
||||||
|
&& Math.abs(l1.getLongitude() - l2.getLongitude()) < 0.00001);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
25
OsmAnd/AndroidManifest-freehuawei.xml
Normal file
25
OsmAnd/AndroidManifest-freehuawei.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<application>
|
||||||
|
<activity android:name="com.huawei.android.sdk.drm.DrmDialogActivity"
|
||||||
|
android:configChanges="screenSize|orientation|keyboardHidden"
|
||||||
|
android:exported="false"
|
||||||
|
android:theme="@android:style/Theme.Translucent">
|
||||||
|
<meta-data
|
||||||
|
android:name="hwc-theme"
|
||||||
|
android:value="androidhwext:style/Theme.Emui.Translucent" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="android.support.v4.content.FileProvider"
|
||||||
|
android:authorities="net.osmand.huawei.fileprovider"
|
||||||
|
tools:replace="android:authorities" />
|
||||||
|
<service
|
||||||
|
android:name="net.osmand.plus.NavigationService"
|
||||||
|
android:process="net.osmand.huawei"
|
||||||
|
tools:replace="android:process" />
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -116,6 +116,9 @@ android {
|
||||||
huawei {
|
huawei {
|
||||||
manifest.srcFile "AndroidManifest-huawei.xml"
|
manifest.srcFile "AndroidManifest-huawei.xml"
|
||||||
}
|
}
|
||||||
|
freehuawei {
|
||||||
|
manifest.srcFile "AndroidManifest-freehuawei.xml"
|
||||||
|
}
|
||||||
|
|
||||||
legacy {
|
legacy {
|
||||||
jniLibs.srcDirs = ["libc++"]
|
jniLibs.srcDirs = ["libc++"]
|
||||||
|
@ -189,6 +192,10 @@ android {
|
||||||
dimension "version"
|
dimension "version"
|
||||||
applicationId "net.osmand.plus.huawei"
|
applicationId "net.osmand.plus.huawei"
|
||||||
}
|
}
|
||||||
|
freehuawei {
|
||||||
|
dimension "version"
|
||||||
|
applicationId "net.osmand.huawei"
|
||||||
|
}
|
||||||
|
|
||||||
// CoreVersion
|
// CoreVersion
|
||||||
legacy {
|
legacy {
|
||||||
|
@ -493,4 +500,5 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
huaweiImplementation files('libs/huawei-android-drm_v2.5.2.300.jar')
|
huaweiImplementation files('libs/huawei-android-drm_v2.5.2.300.jar')
|
||||||
|
freehuaweiImplementation files('libs/huawei-android-drm_v2.5.2.300.jar')
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,9 @@ package net.osmand;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
import net.osmand.osm.io.Base64;
|
|
||||||
import net.osmand.osm.io.NetworkUtils;
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -18,7 +19,6 @@ import java.io.BufferedOutputStream;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
@ -30,6 +30,7 @@ import java.net.URLConnection;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.zip.GZIPOutputStream;
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
@ -43,29 +44,53 @@ public class AndroidNetworkUtils {
|
||||||
void onResult(String result);
|
void onResult(String result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class RequestResponse {
|
||||||
|
private Request request;
|
||||||
|
private String response;
|
||||||
|
|
||||||
|
RequestResponse(@NonNull Request request, @Nullable String response) {
|
||||||
|
this.request = request;
|
||||||
|
this.response = response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Request getRequest() {
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResponse() {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnRequestsResultListener {
|
||||||
|
void onResult(@NonNull List<RequestResponse> results);
|
||||||
|
}
|
||||||
|
|
||||||
public static void sendRequestsAsync(final OsmandApplication ctx,
|
public static void sendRequestsAsync(final OsmandApplication ctx,
|
||||||
final List<Request> requests,
|
final List<Request> requests,
|
||||||
final OnRequestResultListener listener) {
|
final OnRequestsResultListener listener) {
|
||||||
|
|
||||||
new AsyncTask<Void, Void, String>() {
|
new AsyncTask<Void, Void, List<RequestResponse>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String doInBackground(Void... params) {
|
protected List<RequestResponse> doInBackground(Void... params) {
|
||||||
|
List<RequestResponse> responses = new ArrayList<>();
|
||||||
for (Request request : requests) {
|
for (Request request : requests) {
|
||||||
try {
|
try {
|
||||||
return sendRequest(ctx, request.getUrl(), request.getParameters(),
|
String response = sendRequest(ctx, request.getUrl(), request.getParameters(),
|
||||||
request.getUserOperation(), request.isToastAllowed(), request.isPost());
|
request.getUserOperation(), request.isToastAllowed(), request.isPost());
|
||||||
|
responses.add(new RequestResponse(request, response));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// ignore
|
responses.add(new RequestResponse(request, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return responses;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(String response) {
|
protected void onPostExecute(@NonNull List<RequestResponse> results) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onResult(response);
|
listener.onResult(results);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class DiscountHelper {
|
||||||
public static void checkAndDisplay(final MapActivity mapActivity) {
|
public static void checkAndDisplay(final MapActivity mapActivity) {
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
OsmandSettings settings = app.getSettings();
|
OsmandSettings settings = app.getSettings();
|
||||||
if (settings.DO_NOT_SHOW_STARTUP_MESSAGES.get() || !settings.INAPPS_READ.get()) {
|
if (settings.DO_NOT_SHOW_STARTUP_MESSAGES.get() || !settings.INAPPS_READ.get() || Version.isHuawei(app)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mBannerVisible) {
|
if (mBannerVisible) {
|
||||||
|
|
|
@ -648,7 +648,7 @@ public class WaypointHelper {
|
||||||
i.getLatitude(), i.getLongitude()) < DISTANCE_IGNORE_DOUBLE_SPEEDCAMS) {
|
i.getLatitude(), i.getLongitude()) < DISTANCE_IGNORE_DOUBLE_SPEEDCAMS) {
|
||||||
// ignore double speed cams
|
// ignore double speed cams
|
||||||
} else {
|
} else {
|
||||||
lw.setAnnounce(app.getSettings().SPEAK_SPEED_CAMERA.get());
|
lw.setAnnounce(app.getSettings().SPEAK_SPEED_CAMERA.getModeValue(mode));
|
||||||
array.add(lw);
|
array.add(lw);
|
||||||
prevSpeedCam = i;
|
prevSpeedCam = i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ import com.android.billingclient.api.SkuDetailsResponseListener;
|
||||||
|
|
||||||
import net.osmand.AndroidNetworkUtils;
|
import net.osmand.AndroidNetworkUtils;
|
||||||
import net.osmand.AndroidNetworkUtils.OnRequestResultListener;
|
import net.osmand.AndroidNetworkUtils.OnRequestResultListener;
|
||||||
|
import net.osmand.AndroidNetworkUtils.OnRequestsResultListener;
|
||||||
|
import net.osmand.AndroidNetworkUtils.RequestResponse;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
@ -950,68 +952,91 @@ public class InAppPurchaseHelper {
|
||||||
Map<String, String> parameters = new HashMap<>();
|
Map<String, String> parameters = new HashMap<>();
|
||||||
parameters.put("userid", userId);
|
parameters.put("userid", userId);
|
||||||
parameters.put("sku", purchase.getSku());
|
parameters.put("sku", purchase.getSku());
|
||||||
|
parameters.put("orderId", purchase.getOrderId());
|
||||||
parameters.put("purchaseToken", purchase.getPurchaseToken());
|
parameters.put("purchaseToken", purchase.getPurchaseToken());
|
||||||
parameters.put("email", email);
|
parameters.put("email", email);
|
||||||
parameters.put("token", token);
|
parameters.put("token", token);
|
||||||
addUserInfo(parameters);
|
addUserInfo(parameters);
|
||||||
requests.add(new AndroidNetworkUtils.Request(url, parameters, userOperation, true, true));
|
requests.add(new AndroidNetworkUtils.Request(url, parameters, userOperation, true, true));
|
||||||
}
|
}
|
||||||
AndroidNetworkUtils.sendRequestsAsync(ctx, requests, new OnRequestResultListener() {
|
AndroidNetworkUtils.sendRequestsAsync(ctx, requests, new OnRequestsResultListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onResult(String result) {
|
public void onResult(@NonNull List<RequestResponse> results) {
|
||||||
if (result != null) {
|
for (RequestResponse rr : results) {
|
||||||
try {
|
String sku = rr.getRequest().getParameters().get("sku");
|
||||||
JSONObject obj = new JSONObject(result);
|
Purchase purchase = getPurchase(sku);
|
||||||
if (!obj.has("error")) {
|
if (purchase != null) {
|
||||||
String tokensSentStr = ctx.getSettings().BILLING_PURCHASE_TOKENS_SENT.get();
|
updateSentTokens(purchase);
|
||||||
Set<String> tokensSent = new HashSet<>(Arrays.asList(tokensSentStr.split(";")));
|
String result = rr.getResponse();
|
||||||
for (Purchase purchase : purchases) {
|
if (result != null) {
|
||||||
tokensSent.add(purchase.getSku());
|
try {
|
||||||
}
|
JSONObject obj = new JSONObject(result);
|
||||||
ctx.getSettings().BILLING_PURCHASE_TOKENS_SENT.set(TextUtils.join(";", tokensSent));
|
if (!obj.has("error")) {
|
||||||
|
processPurchasedJson(obj);
|
||||||
if (obj.has("visibleName") && !Algorithms.isEmpty(obj.getString("visibleName"))) {
|
} else {
|
||||||
ctx.getSettings().BILLING_USER_NAME.set(obj.getString("visibleName"));
|
complain("SendToken Error: "
|
||||||
ctx.getSettings().BILLING_HIDE_USER_NAME.set(false);
|
+ obj.getString("error")
|
||||||
} else {
|
+ " (userId=" + userId + " token=" + token + " response=" + result + " google=" + purchase.toString() + ")");
|
||||||
ctx.getSettings().BILLING_HIDE_USER_NAME.set(true);
|
|
||||||
}
|
|
||||||
if (obj.has("preferredCountry")) {
|
|
||||||
String prefferedCountry = obj.getString("preferredCountry");
|
|
||||||
if (!ctx.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.get().equals(prefferedCountry)) {
|
|
||||||
ctx.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.set(prefferedCountry);
|
|
||||||
CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment();
|
|
||||||
countrySelectionFragment.initCountries(ctx);
|
|
||||||
CountryItem countryItem = null;
|
|
||||||
if (Algorithms.isEmpty(prefferedCountry)) {
|
|
||||||
countryItem = countrySelectionFragment.getCountryItems().get(0);
|
|
||||||
} else if (!prefferedCountry.equals(OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER)) {
|
|
||||||
countryItem = countrySelectionFragment.getCountryItem(prefferedCountry);
|
|
||||||
}
|
|
||||||
if (countryItem != null) {
|
|
||||||
ctx.getSettings().BILLING_USER_COUNTRY.set(countryItem.getLocalName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
logError("SendToken", e);
|
||||||
|
complain("SendToken Error: "
|
||||||
|
+ (e.getMessage() != null ? e.getMessage() : "JSONException")
|
||||||
|
+ " (userId=" + userId + " token=" + token + " response=" + result + " google=" + purchase.toString() + ")");
|
||||||
}
|
}
|
||||||
if (obj.has("email")) {
|
|
||||||
ctx.getSettings().BILLING_USER_EMAIL.set(obj.getString("email"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
complain("SendToken Error: "
|
|
||||||
+ obj.getString("error")
|
|
||||||
+ " (userId=" + userId + " token=" + token + " response=" + result + ")");
|
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
|
||||||
logError("SendToken", e);
|
|
||||||
complain("SendToken Error: "
|
|
||||||
+ (e.getMessage() != null ? e.getMessage() : "JSONException")
|
|
||||||
+ " (userId=" + userId + " token=" + token + " response=" + result + ")");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onResult("OK");
|
listener.onResult("OK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateSentTokens(@NonNull Purchase purchase) {
|
||||||
|
String tokensSentStr = ctx.getSettings().BILLING_PURCHASE_TOKENS_SENT.get();
|
||||||
|
Set<String> tokensSent = new HashSet<>(Arrays.asList(tokensSentStr.split(";")));
|
||||||
|
tokensSent.add(purchase.getSku());
|
||||||
|
ctx.getSettings().BILLING_PURCHASE_TOKENS_SENT.set(TextUtils.join(";", tokensSent));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processPurchasedJson(JSONObject obj) throws JSONException {
|
||||||
|
if (obj.has("visibleName") && !Algorithms.isEmpty(obj.getString("visibleName"))) {
|
||||||
|
ctx.getSettings().BILLING_USER_NAME.set(obj.getString("visibleName"));
|
||||||
|
ctx.getSettings().BILLING_HIDE_USER_NAME.set(false);
|
||||||
|
} else {
|
||||||
|
ctx.getSettings().BILLING_HIDE_USER_NAME.set(true);
|
||||||
|
}
|
||||||
|
if (obj.has("preferredCountry")) {
|
||||||
|
String prefferedCountry = obj.getString("preferredCountry");
|
||||||
|
if (!ctx.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.get().equals(prefferedCountry)) {
|
||||||
|
ctx.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.set(prefferedCountry);
|
||||||
|
CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment();
|
||||||
|
countrySelectionFragment.initCountries(ctx);
|
||||||
|
CountryItem countryItem = null;
|
||||||
|
if (Algorithms.isEmpty(prefferedCountry)) {
|
||||||
|
countryItem = countrySelectionFragment.getCountryItems().get(0);
|
||||||
|
} else if (!prefferedCountry.equals(OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER)) {
|
||||||
|
countryItem = countrySelectionFragment.getCountryItem(prefferedCountry);
|
||||||
|
}
|
||||||
|
if (countryItem != null) {
|
||||||
|
ctx.getSettings().BILLING_USER_COUNTRY.set(countryItem.getLocalName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (obj.has("email")) {
|
||||||
|
ctx.getSettings().BILLING_USER_EMAIL.set(obj.getString("email"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private Purchase getPurchase(String sku) {
|
||||||
|
for (Purchase purchase : purchases) {
|
||||||
|
if (purchase.getSku().equals(sku)) {
|
||||||
|
return purchase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logError("SendToken Error", e);
|
logError("SendToken Error", e);
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
||||||
private boolean locationUpdateStarted;
|
private boolean locationUpdateStarted;
|
||||||
private boolean compassUpdateAllowed = true;
|
private boolean compassUpdateAllowed = true;
|
||||||
private PointType pointType;
|
private PointType pointType;
|
||||||
|
private Location location;
|
||||||
private float lastHeading;
|
private float lastHeading;
|
||||||
|
|
||||||
private FavoritesListener favoritesListener;
|
private FavoritesListener favoritesListener;
|
||||||
|
@ -213,7 +214,10 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLocation(Location location) {
|
public void updateLocation(Location location) {
|
||||||
updateLocationUi();
|
if (!MapUtils.areLatLonEqual(this.location, location)) {
|
||||||
|
this.location = location;
|
||||||
|
updateLocationUi();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1413,11 +1413,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLocation(Location location) {
|
public void updateLocation(Location location) {
|
||||||
boolean newLocation = this.location == null && location != null;
|
if (!MapUtils.areLatLonEqual(this.location, location)) {
|
||||||
boolean locationChanged = this.location != null && location != null
|
|
||||||
&& this.location.getLatitude() != location.getLatitude()
|
|
||||||
&& this.location.getLongitude() != location.getLongitude();
|
|
||||||
if (newLocation || locationChanged) {
|
|
||||||
this.location = location;
|
this.location = location;
|
||||||
updateLocationUi();
|
updateLocationUi();
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,11 +160,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLocation(Location location) {
|
public void updateLocation(Location location) {
|
||||||
boolean newLocation = this.location == null && location != null;
|
if (!MapUtils.areLatLonEqual(this.location, location)) {
|
||||||
boolean locationChanged = this.location != null && location != null
|
|
||||||
&& this.location.getLatitude() != location.getLatitude()
|
|
||||||
&& this.location.getLongitude() != location.getLongitude();
|
|
||||||
if (newLocation || locationChanged) {
|
|
||||||
this.location = location;
|
this.location = location;
|
||||||
updateLocationUi();
|
updateLocationUi();
|
||||||
}
|
}
|
||||||
|
|
|
@ -441,11 +441,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLocation(Location location) {
|
public void updateLocation(Location location) {
|
||||||
boolean newLocation = this.location == null && location != null;
|
if (!MapUtils.areLatLonEqual(this.location, location)) {
|
||||||
boolean locationChanged = this.location != null && location != null
|
|
||||||
&& this.location.getLatitude() != location.getLatitude()
|
|
||||||
&& this.location.getLongitude() != location.getLongitude();
|
|
||||||
if (newLocation || locationChanged) {
|
|
||||||
this.location = location;
|
this.location = location;
|
||||||
updateLocationUi();
|
updateLocationUi();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.graphics.Matrix;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
|
import android.os.Build;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.data.QuadRect;
|
import net.osmand.data.QuadRect;
|
||||||
|
@ -40,6 +41,7 @@ public class MapTileLayer extends BaseMapLayer {
|
||||||
protected ResourceManager resourceManager;
|
protected ResourceManager resourceManager;
|
||||||
protected OsmandSettings settings;
|
protected OsmandSettings settings;
|
||||||
private boolean visible = true;
|
private boolean visible = true;
|
||||||
|
private boolean useSampling;
|
||||||
|
|
||||||
|
|
||||||
public MapTileLayer(boolean mainMap) {
|
public MapTileLayer(boolean mainMap) {
|
||||||
|
@ -57,6 +59,8 @@ public class MapTileLayer extends BaseMapLayer {
|
||||||
settings = view.getSettings();
|
settings = view.getSettings();
|
||||||
resourceManager = view.getApplication().getResourceManager();
|
resourceManager = view.getApplication().getResourceManager();
|
||||||
|
|
||||||
|
useSampling = Build.VERSION.SDK_INT < 28;
|
||||||
|
|
||||||
paintBitmap = new Paint();
|
paintBitmap = new Paint();
|
||||||
paintBitmap.setFilterBitmap(true);
|
paintBitmap.setFilterBitmap(true);
|
||||||
paintBitmap.setAlpha(getAlpha());
|
paintBitmap.setAlpha(getAlpha());
|
||||||
|
@ -207,7 +211,7 @@ public class MapTileLayer extends BaseMapLayer {
|
||||||
int xZoom = (tileX % div) * tileSize / div;
|
int xZoom = (tileX % div) * tileSize / div;
|
||||||
int yZoom = (tileY % div) * tileSize / div;
|
int yZoom = (tileY % div) * tileSize / div;
|
||||||
// nice scale
|
// nice scale
|
||||||
boolean useSampling = kzoom > 3;
|
boolean useSampling = this.useSampling && kzoom > 3;
|
||||||
bitmapToZoom.set(Math.max(xZoom, 0), Math.max(yZoom, 0),
|
bitmapToZoom.set(Math.max(xZoom, 0), Math.max(yZoom, 0),
|
||||||
Math.min(xZoom + tileSize / div, tileSize),
|
Math.min(xZoom + tileSize / div, tileSize),
|
||||||
Math.min(yZoom + tileSize / div, tileSize));
|
Math.min(yZoom + tileSize / div, tileSize));
|
||||||
|
|
Loading…
Reference in a new issue