Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorburivuh <burivuh@maps.me>2017-05-16 20:16:33 +0300
committerGitHub <noreply@github.com>2017-05-16 20:16:33 +0300
commit9862d31cc6d1d0bced503daebf3689b404b14e20 (patch)
tree67fc3039802ff729afb110c6df1b9e1923facffc
parenteb9738af4ded0c1406ca2d4d29c841c32952a911 (diff)
parent09810af600656f6c60b3d4175814bf4b8568c58e (diff)
Merge pull request #6064 from goblinr/MAPSME-4488-lead-url-intent-filterbeta-809
[android] Added intent processor for lead url
-rw-r--r--android/AndroidManifest.xml15
-rw-r--r--android/src/com/mapswithme/maps/DownloadResourcesActivity.java30
2 files changed, 45 insertions, 0 deletions
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index e9ebc34f0b..285256642a 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -135,6 +135,21 @@
android:scheme="http"/>
</intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW"/>
+
+ <category android:name="android.intent.category.DEFAULT"/>
+ <category android:name="android.intent.category.BROWSABLE"/>
+
+ <data
+ android:host="lead.maps.me"
+ android:scheme="http"/>
+
+ <data
+ android:host="lead.maps.me"
+ android:scheme="https"/>
+ </intent-filter>
+
<!-- API CALL -->
<intent-filter>
<action android:name="com.mapswithme.maps.api.request"/>
diff --git a/android/src/com/mapswithme/maps/DownloadResourcesActivity.java b/android/src/com/mapswithme/maps/DownloadResourcesActivity.java
index 4dbbeb93dd..ea23a23e34 100644
--- a/android/src/com/mapswithme/maps/DownloadResourcesActivity.java
+++ b/android/src/com/mapswithme/maps/DownloadResourcesActivity.java
@@ -98,6 +98,7 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
new Ge0IntentProcessor(),
new MapsWithMeIntentProcessor(),
new GoogleMapsIntentProcessor(),
+ new LeadUrlIntentProcessor(),
new OpenCountryTaskProcessor(),
new KmzKmlProcessor()
};
@@ -612,6 +613,35 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
}
}
+ private class LeadUrlIntentProcessor implements IntentProcessor
+ {
+ @Override
+ public boolean isSupported(Intent intent)
+ {
+ final Uri data = intent.getData();
+
+ if (data == null)
+ return false;
+
+ String scheme = intent.getScheme();
+ String host = data.getHost();
+ if (TextUtils.isEmpty(scheme) || TextUtils.isEmpty(host))
+ return false;
+
+ return (scheme.equals("https") || scheme.equals("http")) && "lead.maps.me".equals(host);
+ }
+
+ @Override
+ public boolean process(Intent intent)
+ {
+ final String url = intent.getData().toString();
+ LOGGER.i(TAG, "URL = " + url);
+ mMapTaskToForward = new OpenUrlTask(url);
+ org.alohalytics.Statistics.logEvent("LeadUrlIntentProcessor::process", url);
+ return true;
+ }
+ }
+
private class OpenCountryTaskProcessor implements IntentProcessor
{
@Override