Browse Source

Merge branch 'master' of git.fakecake.org:tt-rss-android

Andrew Dolgov 11 months ago
parent
commit
350564c5c0

+ 2 - 2
org.fox.ttrss/src/main/AndroidManifest.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="org.fox.ttrss"
-    android:versionCode="497"
-    android:versionName="1.263">
+    android:versionCode="499"
+    android:versionName="1.265">
 
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+ 36 - 21
org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java

@@ -7,6 +7,7 @@ import android.app.Dialog;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
+import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
 import android.preference.PreferenceManager;
@@ -464,27 +465,41 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
 	
 	public void onArticleSelected(Article article, boolean open) {
 		if (open) {
-			HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
-
-			Intent intent = new Intent(MasterActivity.this, DetailActivity.class);
-			intent.putExtra("feed", hf.getFeed());
-			//intent.putExtra("article", article);
-			intent.putExtra("searchQuery", hf.getSearchQuery());
-            //intent.putExtra("articles", (Parcelable)hf.getAllArticles());
-            Application.getInstance().tmpArticleList = hf.getAllArticles();
-			Application.getInstance().tmpArticle = article;
-
-            /* if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-                startActivityForResult(intent, HEADLINES_REQUEST, ActivityOptions.makeSceneTransitionAnimation(this).toBundle());
-            } else {
-                startActivityForResult(intent, HEADLINES_REQUEST);
-            } */
-
-            // mysterious crashes somewhere in gl layer (?) on some feeds if we use activitycompat transitions here on LP so welp
-            startActivityForResult(intent, HEADLINES_REQUEST);
-			overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
-
-
+			boolean alwaysOpenUri = m_prefs.getBoolean("always_open_uri", false);
+			if (alwaysOpenUri) {
+				if (article.unread) {
+					article.unread = false;
+					saveArticleUnread(article);
+				}
+
+				HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
+				if (hf != null) {
+					hf.setActiveArticle(article);
+				}
+
+				openUri(Uri.parse(article.link));
+			}
+			else {
+				HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
+
+				Intent intent = new Intent(MasterActivity.this, DetailActivity.class);
+				intent.putExtra("feed", hf.getFeed());
+				//intent.putExtra("article", article);
+				intent.putExtra("searchQuery", hf.getSearchQuery());
+				//intent.putExtra("articles", (Parcelable)hf.getAllArticles());
+				Application.getInstance().tmpArticleList = hf.getAllArticles();
+				Application.getInstance().tmpArticle = article;
+
+				/* if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+					startActivityForResult(intent, HEADLINES_REQUEST, ActivityOptions.makeSceneTransitionAnimation(this).toBundle());
+				} else {
+					startActivityForResult(intent, HEADLINES_REQUEST);
+				} */
+
+				// mysterious crashes somewhere in gl layer (?) on some feeds if we use activitycompat transitions here on LP so welp
+				startActivityForResult(intent, HEADLINES_REQUEST);
+				overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
+			}
 		} else {
 			invalidateOptionsMenu();
 

+ 2 - 0
org.fox.ttrss/src/main/res/values/strings.xml

@@ -239,6 +239,8 @@
     <string name="headlines_row_top_changed">New articles found, reload feed to continue.</string>
     <string name="prefs_custom_tabs_summary">Open external links with browser custom tabs (faster, used if available)</string>
     <string name="prefs_use_custom_tabs">Use quick preview</string>
+    <string name="prefs_always_open_uri">Always open in browser</string>
+    <string name="prefs_always_open_uri_summary">Open articles directly in your web browser, instead of going to the detail view</string>
     <string name="ask_me_every_time">Ask me every time</string>
     <!-- <string name="open_link">Open link</string> -->
     <string name="quick_preview">Quick preview</string>

+ 5 - 0
org.fox.ttrss/src/main/res/xml/preferences.xml

@@ -148,6 +148,11 @@
             android:defaultValue="true"
             android:key="custom_tabs_ask_always"
             android:title="@string/ask_me_every_time" />
+        <org.fox.ttrss.util.LessBrokenSwitchPreference
+            android:defaultValue="false"
+            android:key="always_open_uri"
+            android:summary="@string/prefs_always_open_uri_summary"
+            android:title="@string/prefs_always_open_uri" />
     </PreferenceCategory>
     <PreferenceCategory android:title="@string/offline_mode" >
         <ListPreference