-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 91bf8bf
Showing
59 changed files
with
1,255 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
.idea | ||
.DS_Store | ||
build | ||
/captures | ||
.externalNativeBuild | ||
app/build |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 27 | ||
defaultConfig { | ||
applicationId 'ir.map.sdkdemo_map' | ||
minSdkVersion 17 | ||
targetSdkVersion 27 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
implementation 'com.android.support:appcompat-v7:27.1.1' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.2' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
|
||
implementation 'ir.map.sdk:sdk_common:2.0.0' | ||
implementation 'ir.map.sdk:sdk_map:2.0.1' | ||
|
||
implementation 'com.google.android.gms:play-services-maps:15.0.1' | ||
implementation 'com.squareup.okhttp3:okhttp:3.9.1' | ||
implementation 'com.google.code.gson:gson:2.8.2' | ||
implementation 'io.reactivex:rxandroid:1.2.1' | ||
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' | ||
implementation 'com.google.maps.android:android-maps-utils:0.5' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/ir/map/sdkdemo_map/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package ir.map.sdkdemo_map; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("ir.map.sdkdemo_v2", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="ir.map.sdkdemo_map"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
|
||
<application | ||
android:name=".AppController" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
|
||
<meta-data | ||
android:name="com.google.android.maps.v2.API_KEY" | ||
android:value="AIzaSyAvvR6vDDafdq7F8SbHjKMiLrvRYUtFrMI" /> | ||
|
||
<activity android:name=".MainActivity"> | ||
|
||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
|
||
</activity> | ||
|
||
<activity android:name=".BasicMapActivity" /> | ||
|
||
<activity android:name=".CurrentLocationActivity" /> | ||
|
||
<activity android:name=".ZoomLocationActivity" /> | ||
|
||
<activity android:name=".AddMarkerActivity" /> | ||
|
||
<activity android:name=".AddPolylineActivity" /> | ||
|
||
<activity android:name=".AddPolygonActivity" /> | ||
|
||
</application> | ||
|
||
</manifest> |
41 changes: 41 additions & 0 deletions
41
app/src/main/java/ir/map/sdkdemo_map/AddMarkerActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package ir.map.sdkdemo_map; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
import ir.map.sdk_common.MaptexLatLng; | ||
import ir.map.sdk_map.wrapper.MaptexBitmapDescriptorFactory; | ||
import ir.map.sdk_map.wrapper.MaptexMap; | ||
import ir.map.sdk_map.wrapper.MaptexMarker; | ||
import ir.map.sdk_map.wrapper.MaptexMarkerOptions; | ||
import ir.map.sdk_map.wrapper.OnMaptexReadyCallback; | ||
import ir.map.sdk_map.wrapper.SupportMaptexFragment; | ||
|
||
public class AddMarkerActivity extends AppCompatActivity { | ||
|
||
|
||
private static final MaptexLatLng TEHRAN = new MaptexLatLng(35.6970118, 51.2097353); | ||
private MaptexMap maptexMap; | ||
private MaptexMarker mTehran; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_add_marker); | ||
|
||
((SupportMaptexFragment) getSupportFragmentManager().findFragmentById(R.id.myMapView)) | ||
.getMaptexAsync(new OnMaptexReadyCallback() { | ||
@Override | ||
public void onMaptexReady(MaptexMap map) { | ||
maptexMap = map; | ||
// Check if we were successful in obtaining the map. | ||
if (maptexMap != null) { | ||
// Uses a custom icon. | ||
mTehran = maptexMap.addMarker(new MaptexMarkerOptions() | ||
.position(TEHRAN).title("Tehran").snippet("Population: 8,627,300") | ||
.icon(MaptexBitmapDescriptorFactory.fromResource(R.drawable.ic_marker))); | ||
} | ||
} | ||
}); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
app/src/main/java/ir/map/sdkdemo_map/AddPolygonActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package ir.map.sdkdemo_map; | ||
|
||
import android.graphics.Color; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import ir.map.sdk_common.MaptexLatLng; | ||
import ir.map.sdk_map.wrapper.MaptexMap; | ||
import ir.map.sdk_map.wrapper.MaptexPolygonOptions; | ||
import ir.map.sdk_map.wrapper.OnMaptexReadyCallback; | ||
import ir.map.sdk_map.wrapper.SupportMaptexFragment; | ||
|
||
public class AddPolygonActivity extends AppCompatActivity { | ||
|
||
private static final MaptexLatLng ARAK = new MaptexLatLng(34.0954, 49.7013); | ||
private static final MaptexLatLng SHIRAZ = new MaptexLatLng(29.591, 52.5837); | ||
private static final MaptexLatLng MASHHAD = new MaptexLatLng(36.2605, 59.6168); | ||
private static final MaptexLatLng RASHT = new MaptexLatLng(37.2682, 49.5891); | ||
private List polygonPointList = new ArrayList<>(); | ||
private MaptexMap maptexMap; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_add_polygon); | ||
|
||
((SupportMaptexFragment) getSupportFragmentManager().findFragmentById(R.id.myMapView)) | ||
.getMaptexAsync(new OnMaptexReadyCallback() { | ||
@Override | ||
public void onMaptexReady(MaptexMap map) { | ||
maptexMap = map; | ||
// Check if we were successful in obtaining the map. | ||
if (maptexMap != null) { | ||
|
||
polygonPointList.add(ARAK); | ||
polygonPointList.add(SHIRAZ); | ||
polygonPointList.add(MASHHAD); | ||
polygonPointList.add(RASHT); | ||
|
||
maptexMap.addPolygon(new MaptexPolygonOptions() | ||
.addAll(polygonPointList) | ||
.fillColor(Color.TRANSPARENT) | ||
.strokeColor(Color.BLUE) | ||
.strokeWidth(5)); | ||
|
||
} | ||
} | ||
}); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
app/src/main/java/ir/map/sdkdemo_map/AddPolylineActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package ir.map.sdkdemo_map; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
import ir.map.sdk_common.MaptexLatLng; | ||
import ir.map.sdk_map.wrapper.MaptexMap; | ||
import ir.map.sdk_map.wrapper.MaptexPolylineOptions; | ||
import ir.map.sdk_map.wrapper.OnMaptexReadyCallback; | ||
import ir.map.sdk_map.wrapper.SupportMaptexFragment; | ||
|
||
public class AddPolylineActivity extends AppCompatActivity { | ||
|
||
private static final MaptexLatLng ARAK = new MaptexLatLng(34.0954, 49.7013); | ||
private static final MaptexLatLng SHIRAZ = new MaptexLatLng(29.591, 52.5837); | ||
private static final MaptexLatLng RASHT = new MaptexLatLng(37.2682, 49.5891); | ||
private MaptexMap maptexMap; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_add_polyline); | ||
|
||
((SupportMaptexFragment) getSupportFragmentManager().findFragmentById(R.id.myMapView)) | ||
.getMaptexAsync(new OnMaptexReadyCallback() { | ||
@Override | ||
public void onMaptexReady(MaptexMap map) { | ||
maptexMap = map; | ||
// Check if we were successful in obtaining the map. | ||
if (maptexMap != null) { | ||
// Uses a custom icon. | ||
maptexMap.addPolyline((new MaptexPolylineOptions()) | ||
.add(ARAK, SHIRAZ, RASHT)); | ||
} | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ir.map.sdkdemo_map; | ||
|
||
import android.app.Application; | ||
|
||
import ir.map.sdk_map.MapSDK; | ||
|
||
public class AppController extends Application { | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
MapSDK.init(this); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/ir/map/sdkdemo_map/BasicMapActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package ir.map.sdkdemo_map; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
public class BasicMapActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_basic_map); | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
app/src/main/java/ir/map/sdkdemo_map/CurrentLocationActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package ir.map.sdkdemo_map; | ||
|
||
import android.Manifest; | ||
import android.content.pm.PackageManager; | ||
import android.os.Bundle; | ||
import android.support.v4.app.ActivityCompat; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.widget.Toast; | ||
|
||
import ir.map.sdk_map.wrapper.MaptexMap; | ||
import ir.map.sdk_map.wrapper.OnMaptexReadyCallback; | ||
import ir.map.sdk_map.wrapper.SupportMaptexFragment; | ||
|
||
public class CurrentLocationActivity extends AppCompatActivity { | ||
|
||
public static final int MY_PERMISSIONS_REQUEST_LOCATION = 99; | ||
private MaptexMap maptexMap; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_current_location); | ||
|
||
((SupportMaptexFragment) getSupportFragmentManager().findFragmentById(R.id.myMapView)) | ||
.getMaptexAsync(new OnMaptexReadyCallback() { | ||
@Override | ||
public void onMaptexReady(MaptexMap map) { | ||
maptexMap = map; | ||
// Check if we were successful in obtaining the map. | ||
if (maptexMap != null) { | ||
if (ActivityCompat.checkSelfPermission(CurrentLocationActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED | ||
&& ActivityCompat.checkSelfPermission(CurrentLocationActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { | ||
Toast.makeText(CurrentLocationActivity.this, "Add Permission Access", Toast.LENGTH_LONG).show(); | ||
ActivityCompat.requestPermissions(CurrentLocationActivity.this, | ||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, | ||
MY_PERMISSIONS_REQUEST_LOCATION); | ||
return; | ||
} | ||
maptexMap.setMyLocationEnabled(true); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void onRequestPermissionsResult(int requestCode, | ||
String permissions[], int[] grantResults) { | ||
switch (requestCode) { | ||
case MY_PERMISSIONS_REQUEST_LOCATION: { | ||
// If request is cancelled, the result arrays are empty. | ||
if (grantResults.length > 0 | ||
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) { | ||
|
||
// permission was granted, yay! Do the | ||
// location-related task you need to do. | ||
if (ActivityCompat.checkSelfPermission(CurrentLocationActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED | ||
&& ActivityCompat.checkSelfPermission(CurrentLocationActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { | ||
|
||
maptexMap.setMyLocationEnabled(true); | ||
} | ||
|
||
} else { | ||
|
||
// permission denied, boo! Disable the | ||
// functionality that depends on this permission. | ||
|
||
} | ||
return; | ||
} | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.