Skip to content

Commit

Permalink
[TF][FEATURE] replace Google Maps with OSMDroid
Browse files Browse the repository at this point in the history
  • Loading branch information
thermatk committed Sep 1, 2018
1 parent 2bdbff2 commit a290358
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 186 deletions.
1 change: 1 addition & 0 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies {
implementation 'com.android.support:exifinterface:28.0.0-rc01'
implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation 'org.osmdroid:osmdroid-android:6.0.2'
}

//return an api key from a properties file.
Expand Down
7 changes: 6 additions & 1 deletion TMessagesProj/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@
-dontwarn com.googlecode.mp4parser.**
# Use -keep to explicitly keep any other classes shrinking would remove
-dontoptimize
-dontobfuscate
-dontobfuscate

# https://github.com/osmdroid/osmdroid/issues/633
-dontwarn org.osmdroid.tileprovider.modules.NetworkAvailabliltyCheck
# Osmdroid
-dontwarn org.osmdroid.**
Original file line number Diff line number Diff line change
Expand Up @@ -294,30 +294,7 @@ public static void removeAdjustResize(Activity activity, int classGuid) {
}

public static boolean isGoogleMapsInstalled(final BaseFragment fragment) {
try {
ApplicationLoader.applicationContext.getPackageManager().getApplicationInfo("com.google.android.apps.maps", 0);
return true;
} catch (PackageManager.NameNotFoundException e) {
if (fragment.getParentActivity() == null) {
return false;
}
AlertDialog.Builder builder = new AlertDialog.Builder(fragment.getParentActivity());
builder.setMessage("Install Google Maps?");
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.google.android.apps.maps"));
fragment.getParentActivity().startActivityForResult(intent, 500);
} catch (Exception e) {
FileLog.e(e);
}
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
fragment.showDialog(builder.create());
return false;
}
return true;
}

public static boolean isInternalUri(Uri uri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import android.view.Gravity;
import android.widget.FrameLayout;

import com.google.android.gms.maps.model.LatLng;
import org.osmdroid.util.GeoPoint;

import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ContactsController;
Expand Down Expand Up @@ -215,9 +215,9 @@ public void setDialog(LocationActivity.LiveLocation info, Location userLocation)
}
}

LatLng position = info.marker.getPosition();
location.setLatitude(position.latitude);
location.setLongitude(position.longitude);
GeoPoint position = info.marker.getPosition();
location.setLatitude(position.getLatitude());
location.setLongitude(position.getLongitude());

String time = LocaleController.formatLocationUpdateDate(info.object.edit_date != 0 ? info.object.edit_date : info.object.date);
if (userLocation != null) {
Expand Down
Loading

0 comments on commit a290358

Please sign in to comment.