From 9b4df7e36ffbc007827bd05dda6a14504eee39a9 Mon Sep 17 00:00:00 2001
From: zkwip
Date: Tue, 9 Jun 2015 12:44:59 +0200
Subject: Intents

open RRS Feeds with RRSin
---
 app/src/main/AndroidManifest.xml                   | 31 ++++++++++++++++++++++
 .../main/java/org/rssin/android/FeedsActivity.java | 11 ++++++++
 app/src/main/res/values/strings.xml                |  2 ++
 3 files changed, 44 insertions(+)

(limited to 'app/src')

diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 65dc82a..c0a9eed 100755
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -43,6 +43,37 @@
             <meta-data
                 android:name="android.support.PARENT_ACTIVITY"
                 android:value="org.rssin.android.HomeScreenActivity" />
+            <intent-filter android:label="@string/app_name">
+                <action android:name="android.intent.action.VIEW"/>
+                <category android:name="android.intent.category.DEFAULT"/>
+                <category android:name="android.intent.category.BROWSABLE"/>
+                <data android:scheme="http"/>
+                <data android:host="*"/>
+                <data android:pathPattern=".*\\.xml"/>
+                <data android:pathPattern=".*\\.rss"/>
+            </intent-filter>
+
+            <intent-filter android:label="@string/app_name">
+                <action android:name="android.intent.action.VIEW"/>
+                <category android:name="android.intent.category.DEFAULT"/>
+                <category android:name="android.intent.category.BROWSABLE"/>
+                <data android:scheme="http"/>
+                <data android:host="feeds.feedburner.com"/>
+                <data android:host="feedproxy.google.com"/>
+                <data android:host="feeds2.feedburner.com"/>
+                <data android:host="feedsproxy.google.com"/>
+            </intent-filter>
+
+            <intent-filter android:label="@string/app_name">
+                <action android:name="android.intent.action.VIEW"/>
+                <category android:name="android.intent.category.DEFAULT"/>
+                <category android:name="android.intent.category.BROWSABLE"/>
+                <data android:scheme="http"/>
+                <data android:mimeType="text/xml"/>
+                <data android:mimeType="application/rss+xml"/>
+                <data android:mimeType="application/atom+xml"/>
+                <data android:mimeType="application/xml"/>
+            </intent-filter>
         </activity>
         <activity
             android:name="org.rssin.android.ArticleActivity"
diff --git a/app/src/main/java/org/rssin/android/FeedsActivity.java b/app/src/main/java/org/rssin/android/FeedsActivity.java
index bc234d4..4a69af9 100755
--- a/app/src/main/java/org/rssin/android/FeedsActivity.java
+++ b/app/src/main/java/org/rssin/android/FeedsActivity.java
@@ -4,6 +4,7 @@ import android.app.Activity;
 import android.app.AlertDialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.Intent;
 import android.content.pm.ActivityInfo;
 import android.support.v7.app.ActionBarActivity;
 import android.os.Bundle;
@@ -35,12 +36,21 @@ public class FeedsActivity extends ActionBarActivity {
     private FeedsList feedsList;
     private ListView feedsView;
     private FeedAdapter feedAdapter;
+    private String startUri = "";
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.fragment_feeds);
 
+        Intent intent = getIntent();
+        String ac = intent.getAction();
+        if (ac.equals(Intent.ACTION_VIEW)) {
+            //open with
+            startUri = intent.getData().toString();
+            openAddDialog();
+        }
+
         feedsView = (ListView) findViewById(R.id.feeds_list);
 
         try {
@@ -100,6 +110,7 @@ public class FeedsActivity extends ActionBarActivity {
 
         final EditText input = new EditText(this);
         input.setFocusable(true);
+        input.setText(startUri);
         input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
         input.setMaxLines(1);
         input.requestFocus();
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 83cda21..550bc2a 100755
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,6 +1,8 @@
 <resources>
     <string name="app_name">RSSin</string>
 
+    <string name="action_import_feed">Open in RRSin</string>
+
     <string name="action_settings">Settings</string>
     <string name="action_filters">Filters</string>
     <string name="action_feeds">Feeds</string>
-- 
cgit v1.2.3