Skip to content
Browse files

special activity as SGF intent catcher - should finaly closes #53

  • Loading branch information...
1 parent 393373c commit d45038bd5ecf84fae636b6bd9a61f52f0bc15dde @ligi committed Apr 21, 2012
View
75 AndroidManifest.xml
@@ -76,45 +76,46 @@
<activity android:name=".ui.sgf_listing.SGFSDCardListActivity"></activity>
<activity android:name=".ui.links.LinksActivity"></activity>
<activity android:name=".ui.tsumego.TsumegoActivity"></activity>
- <activity android:name=".ui.SGFLoadActivity">
- <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:scheme="http" android:host="*" android:pathPattern=".*\\.sgf"/>
- </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:scheme="https" android:host="*" android:pathPattern=".*\\.sgf"/>
- </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:scheme="file" android:host="*" android:pathPattern=".*\\.sgf"/>
+ <activity android:name=".ui.SGFLoadActivity"/>
+ <activity android:name=".ui.SGFLoadFromExternalActivity">
+ <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:scheme="http" android:host="*" android:pathPattern=".*\\.sgf"/>
+ </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:scheme="https" android:host="*" android:pathPattern=".*\\.sgf"/>
+ </intent-filter>
- </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:scheme="content" android:host="*" android:pathPattern=".*\\.sgf"/>
+ <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:scheme="file" android:host="*" android:pathPattern=".*\\.sgf"/>
+
+ </intent-filter>
- </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:mimeType="application/x-go-sgf" />
- </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:scheme="content" android:host="*" android:pathPattern=".*\\.sgf"/>
+
+ </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:mimeType="application/x-go-sgf" />
+ </intent-filter>
</activity>
<activity android:name=".ui.recording.GameRecordActivity"></activity>
<activity android:name=".ui.review.GameReviewActivity"></activity>
View
4 src/org/ligi/gobandroid_hd/ui/SGFLoadActivity.java
@@ -175,9 +175,7 @@ public void run() {
game=SGFHelper.sgf2game(sgf, null,SGFHelper.BREAKON_NOTHING,transform);
}
- if (!src.startsWith("file://")) // educated guess on what the user wants ;-9 - file:// means we come from intern gobandroid
- getApp().getInteractionScope().setMode(InteractionScope.MODE_REVIEW);
- } catch (Exception e) {
+ } catch (Exception e) {
Log.w("exception in load", e);
handler.post(new Runnable() {
View
51 src/org/ligi/gobandroid_hd/ui/SGFLoadFromExternalActivity.java
@@ -0,0 +1,51 @@
+/**
+ * gobandroid
+ * by Marcus -Ligi- Bueschleb
+ * http://ligi.de
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ **/
+
+package org.ligi.gobandroid_hd.ui;
+import org.ligi.gobandroid_hd.InteractionScope;
+import org.ligi.gobandroid_hd.ui.application.GobandroidFragmentActivity;
+import android.content.Intent;
+import android.os.Bundle;
+
+/**
+ * Activity to load a SGF with a ProgressDialog showing the Progress
+ *
+ * @author <a href="http://ligi.de">Marcus -Ligi- Bueschleb</a>
+ *
+ * License: This software is licensed with GPLv3
+ *
+ **/
+
+public class SGFLoadFromExternalActivity
+ extends GobandroidFragmentActivity
+{
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // thats the main reason why we build this fwd activity
+ getApp().getInteractionScope().setMode(InteractionScope.MODE_REVIEW);
+
+ // take the original intent and change the class - the rest stays
+ Intent fwd_intent=getIntent();
+ fwd_intent.setClass(this, SGFLoadActivity.class);
+ startActivity(fwd_intent);
+ }
+
+}

0 comments on commit d45038b

Please sign in to comment.
Something went wrong with that request. Please try again.