Skip to content

Commit

Permalink
Merge branch 'release/v4.1.0' into 'master'
Browse files Browse the repository at this point in the history
Release v4.1.0

See merge request mobile/android/android!1725
  • Loading branch information
javiergm1983 committed Apr 12, 2021
2 parents e80db0b + 1a43b76 commit 564278b
Show file tree
Hide file tree
Showing 1,543 changed files with 18,555 additions and 21,889 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
.idea/assetWizardSettings.xml
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml

# User-specific stuff:
.idea/workspace.xml
Expand All @@ -31,7 +32,6 @@
.idea/encodings.xml
.idea/misc.xml
.idea/vcs.xml
.idea/compiler.xml
.gradle

#Captures
Expand Down
12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

22 changes: 17 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ android {
debuggable true
// minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ext.enableCrashlytics = false
}
release {
// minifyEnabled false
Expand Down Expand Up @@ -110,6 +111,15 @@ android {
productFlavors {
gms {
dimension "service"
apply plugin: 'com.google.firebase.crashlytics'
firebaseCrashlytics {
// Enable processing and uploading of native symbols to Crashlytics servers.
// This flag must be enabled to see properly-symbolicated native
// stack traces in the Crashlytics dashboard.
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir 'src/main/obj/local'
}

}
hms {
dimension "service"
Expand Down Expand Up @@ -143,7 +153,7 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-core-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-process:$lifecycleVersion"

implementation "androidx.navigation:navigation-runtime-ktx:$navigationVersion"
Expand All @@ -166,7 +176,7 @@ dependencies {
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.github.nirhart:parallaxscroll:1.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.vdurmont:emoji-java:4.0.0'
implementation 'com.google.android.exoplayer:exoplayer-core:2.11.8'
Expand All @@ -181,7 +191,7 @@ dependencies {
implementation 'androidx.emoji:emoji:1.1.0'
implementation 'androidx.emoji:emoji-appcompat:1.1.0'
implementation 'androidx.emoji:emoji-bundled:1.1.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'io.supercharge:shimmerlayout:2.1.0'
implementation 'net.opacapp:multiline-collapsingtoolbar:27.1.1'
implementation 'com.github.tony19:named-regexp:0.2.5'
Expand Down Expand Up @@ -223,7 +233,9 @@ dependencies {
gmsImplementation 'com.google.android.gms:play-services-maps:17.0.0'
gmsImplementation 'com.google.maps.android:android-maps-utils:0.5'
gmsImplementation "com.google.android.gms:play-services-ads:$playServicesAdsVersion"

gmsImplementation platform("com.google.firebase:firebase-bom:$firebaseBom")
gmsImplementation 'com.google.firebase:firebase-crashlytics-ndk'
gmsImplementation 'com.google.firebase:firebase-analytics-ktx'
//HMS
hmsImplementation 'com.huawei.hms:push:4.0.2.300'
hmsImplementation 'com.huawei.hms:location:4.0.2.300'
Expand All @@ -236,4 +248,4 @@ if (taskRequests.contains("Hms")) {
apply plugin: 'com.huawei.agconnect'
} else if (taskRequests.contains("Gms")) {
apply plugin: 'com.google.gms.google-services'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package mega.privacy.android.app.service

/** The url for rating the app, open Google play */
const val RATE_APP_URL = "market://details?id=mega.privacy.android.app"
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package mega.privacy.android.app.service.map;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.location.Address;
import android.location.Location;
import android.os.Looper;
import android.view.View;

import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
Expand Down Expand Up @@ -36,17 +41,22 @@
import mega.privacy.android.app.middlelayer.map.AbstractMapHandler;
import mega.privacy.android.app.middlelayer.map.MegaLatLng;

import static mega.privacy.android.app.lollipop.megachat.MapsActivity.REQUEST_INTERVAL;
import static mega.privacy.android.app.lollipop.megachat.MapsActivity.getAddresses;
import static mega.privacy.android.app.utils.LogUtil.logDebug;
import static mega.privacy.android.app.utils.LogUtil.logError;
import static mega.privacy.android.app.utils.LogUtil.*;

@SuppressLint("MissingPermission")
public class MapHandlerImpl extends AbstractMapHandler implements OnMapReadyCallback, OnMyLocationClickListener, OnMyLocationButtonClickListener, OnCameraMoveStartedListener, OnCameraIdleListener, OnMarkerClickListener, OnInfoWindowClickListener {

private GoogleMap mMap;

private MapView mapView;

private FusedLocationProviderClient fusedLocationProviderClient;
private final FusedLocationProviderClient fusedLocationProviderClient;
private final LocationRequest locationRequest;
private final LocationCallback locationCallback;

private Location lastLocation;

private Marker fullScreenMarker;

Expand All @@ -58,7 +68,30 @@ public MapHandlerImpl(MapsActivity activity, Bitmap fullscreenIconMarker) {
if (mapFragment != null) {
mapFragment.getMapAsync(this);
}

fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(activity);
locationRequest = LocationRequest.create();
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
locationRequest.setInterval(REQUEST_INTERVAL);

locationCallback = new LocationCallback() {
@Override
public void onLocationResult(LocationResult locationResult) {
if (locationResult == null || locationResult.getLastLocation() == null) {
logWarning("locationResult is null");
return;
}

lastLocation = locationResult.getLastLocation();
onGetLastLocation(lastLocation.getLatitude(), lastLocation.getLongitude());

if (!activity.isFullScreenEnabled()) {
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude()),
DEFAULT_ZOOM));
}
}
};
}

/**
Expand All @@ -74,6 +107,7 @@ private LatLngBounds getLatLngBounds(int radius, LatLng latLng) {
double distanceFromCenterToCorner = radius * Math.sqrt(2);
LatLng southwestCorner = SphericalUtil.computeOffset(latLng, distanceFromCenterToCorner, 225.0);
LatLng northeastCorner = SphericalUtil.computeOffset(latLng, distanceFromCenterToCorner, 45.0);

return new LatLngBounds(southwestCorner, northeastCorner);
}

Expand Down Expand Up @@ -103,6 +137,7 @@ public boolean onMarkerClick(Marker marker) {
setAddress(fullScreenAddress);
return true;
}

return false;
}

Expand Down Expand Up @@ -139,13 +174,16 @@ public void onMyLocationClick(Location location) {
@Override
public void onMapReady(GoogleMap googleMap) {
logDebug("onMapReady");

mMap = googleMap;
enableLocationUpdates();

if (!isGPSEnabled()) {
askForGPS();
} else {
initMap();
}

setCurrentLocationVisibility();
}

Expand Down Expand Up @@ -201,8 +239,10 @@ public void createSnapshot(double latitude, double longitude, int mapWidth) {
@Override
public void initMap() {
if (mMap == null) {
logWarning("mMap is null");
return;
}

dismissProgress();
mMap.setMyLocationEnabled(getInitResult());

Expand All @@ -218,24 +258,29 @@ public void initMap() {
setFullScreen();
}

@Override
public void disableCurrentLocationUpdates() {
fusedLocationProviderClient.removeLocationUpdates(locationCallback);
}

@Override
public void enableCurrentLocationUpdates() {
fusedLocationProviderClient.requestLocationUpdates(locationRequest, locationCallback,
Looper.getMainLooper());
}

@Override
public void setMyLocation(boolean animateCamera) {
if (mMap == null) {
if (mMap == null || lastLocation == null) {
logWarning("mMap or lastLocation is null");
return;
}

fusedLocationProviderClient.getLastLocation().addOnFailureListener(e -> {
logError("getLastLocation() onFailure: " + e.getMessage());
showError();
}).addOnSuccessListener(location -> {
if (location != null) {
logDebug("getLastLocation() onSuccess");
onGetLastLocation(location.getLatitude(), location.getLongitude());
if (animateCamera) {
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), DEFAULT_ZOOM));
}
}
});
if (animateCamera) {
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude()),
DEFAULT_ZOOM));
}
}

@Override
Expand All @@ -246,6 +291,7 @@ public void removeMarker() {
logError(e.getMessage(), e);
e.printStackTrace();
}

fullScreenMarker = null;
}

Expand All @@ -256,6 +302,7 @@ public void removeMarker() {
@Override
public void getMarkerInfo() {
if (mMap == null) {
logWarning("mMap is null");
return;
}

Expand All @@ -268,25 +315,31 @@ public void getMarkerInfo() {
if (addresses != null && addresses.size() > 0) {
String address = addresses.get(0).getAddressLine(0);
fullScreenAddress = new MapAddress(new MegaLatLng(latLng.latitude, latLng.longitude), null, address);

if (fullScreenMarker == null) {
fullScreenMarker = mMap.addMarker(new MarkerOptions().position(latLng).title(title).snippet(address).icon(BitmapDescriptorFactory.fromBitmap(fullscreenIconMarker)));
} else {
fullScreenMarker.setPosition(latLng);
fullScreenMarker.setSnippet(address);
}

showIconShadow();

if (!fullScreenMarker.isVisible()) {
showMarker();
}

fullScreenMarker.showInfoWindow();
} else {
fullScreenAddress = new MapAddress(new MegaLatLng(latLng.latitude, latLng.longitude), null, null);

if (fullScreenMarker == null) {
fullScreenMarker = mMap.addMarker(new MarkerOptions().position(latLng).title(title).snippet("").icon(BitmapDescriptorFactory.fromBitmap(fullscreenIconMarker)));
} else {
fullScreenMarker.setPosition(latLng);
fullScreenMarker.setSnippet("");
}

showIconShadow();
setAnimatingMarker(0);
}
Expand All @@ -304,6 +357,7 @@ public boolean hideMarker() {
fullScreenMarker.setVisible(false);
return true;
}

return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package mega.privacy.android.app.service

/** The url for rating the app, open App gallery */
const val RATE_APP_URL = "appmarket://details?id=mega.privacy.android.app.huawei"
Loading

0 comments on commit 564278b

Please sign in to comment.