Temporary workaround for #83.

This commit is contained in:
Amine 2017-10-23 15:09:23 +02:00
parent e1476c5840
commit 0812259470
3 changed files with 24 additions and 16 deletions

View File

@ -4,6 +4,8 @@
- Fixed logs not working.
- Temporary workaround handling opening invalid urls. Waiting to solve #83.
**1.5.3.05**
- Fixed an issue on older versions of Android.

View File

@ -8,6 +8,7 @@ import android.graphics.BitmapFactory
import android.net.Uri
import android.support.customtabs.CustomTabsIntent
import android.util.Patterns
import android.widget.Toast
import apps.amine.bou.readerforselfoss.R
import apps.amine.bou.readerforselfoss.ReaderActivity
import apps.amine.bou.readerforselfoss.utils.customtabs.CustomTabActivityHelper
@ -54,7 +55,10 @@ fun Context.openItemUrl(linkDecoded: String,
articleViewer: Boolean,
app: Activity) {
if (!internalBrowser || !linkDecoded.isUrlValid()) {
if (!linkDecoded.isUrlValid()) {
Toast.makeText(this, this.getString(R.string.cant_open_invalid_url), Toast.LENGTH_LONG).show()
} else {
if (!internalBrowser) {
openInBrowser(linkDecoded, app)
} else {
if (articleViewer) {
@ -81,6 +85,7 @@ fun Context.openItemUrl(linkDecoded: String,
}
}
}
}
}
private fun openInBrowser(linkDecoded: String, app: Activity) {

View File

@ -155,4 +155,5 @@
<string name="login_everything_off">No api call will be logged</string>
<string name="pref_general_infinite_loading_title">(BETA) Load more articles on scroll</string>
<string name="translation">Translation</string>
<string name="cant_open_invalid_url">The item url is invalid. I\'m looking into solving this issue so the app won\'t crash.</string>
</resources>