mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-13 20:48:56 +01:00
Introduce incognito open-in-browser support
This commit is contained in:
@@ -178,4 +178,6 @@ object PreferenceKeys {
|
||||
const val eh_cacheSize = "eh_cache_size"
|
||||
|
||||
const val eh_preserveReadingPosition = "eh_preserve_reading_position"
|
||||
|
||||
const val eh_incogWebview = "eh_incognito_webview"
|
||||
}
|
||||
|
||||
@@ -249,4 +249,6 @@ class PreferencesHelper(val context: Context) {
|
||||
fun eh_cacheSize() = rxPrefs.getString(Keys.eh_cacheSize, "75")
|
||||
|
||||
fun eh_preserveReadingPosition() = rxPrefs.getBoolean(Keys.eh_preserveReadingPosition, false)
|
||||
|
||||
fun eh_incogWebview() = rxPrefs.getBoolean(Keys.eh_incogWebview, false)
|
||||
}
|
||||
|
||||
@@ -20,19 +20,18 @@ import android.widget.Toast
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||
import com.bumptech.glide.load.resource.bitmap.TransformationUtils.centerCrop
|
||||
import com.bumptech.glide.request.target.SimpleTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import com.jakewharton.rxbinding.support.v4.widget.refreshes
|
||||
import com.jakewharton.rxbinding.view.clicks
|
||||
import com.jakewharton.rxbinding.view.longClicks
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.R.id.*
|
||||
import eu.kanade.tachiyomi.data.database.models.Category
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
@@ -50,6 +49,7 @@ import eu.kanade.tachiyomi.util.toast
|
||||
import eu.kanade.tachiyomi.util.truncateCenter
|
||||
import exh.EH_SOURCE_ID
|
||||
import exh.EXH_SOURCE_ID
|
||||
import exh.ui.webview.WebViewActivity
|
||||
import jp.wasabeef.glide.transformations.CropSquareTransformation
|
||||
import jp.wasabeef.glide.transformations.MaskTransformation
|
||||
import kotlinx.android.synthetic.main.manga_info_controller.*
|
||||
@@ -310,11 +310,20 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||
val source = presenter.source as? HttpSource ?: return
|
||||
|
||||
try {
|
||||
val url = Uri.parse(source.mangaDetailsRequest(presenter.manga).url().toString())
|
||||
val intent = CustomTabsIntent.Builder()
|
||||
.setToolbarColor(context.getResourceColor(R.attr.colorPrimary))
|
||||
.build()
|
||||
intent.launchUrl(activity, url)
|
||||
// --> EH
|
||||
val urlString = source.mangaDetailsRequest(presenter.manga).url().toString()
|
||||
if(preferences.eh_incogWebview().getOrDefault()) {
|
||||
activity?.startActivity(Intent(activity, WebViewActivity::class.java).apply {
|
||||
putExtra(WebViewActivity.KEY_URL, urlString)
|
||||
})
|
||||
} else {
|
||||
val url = Uri.parse(urlString)
|
||||
val intent = CustomTabsIntent.Builder()
|
||||
.setToolbarColor(context.getResourceColor(R.attr.colorPrimary))
|
||||
.build()
|
||||
intent.launchUrl(activity, url)
|
||||
}
|
||||
// <-- EH
|
||||
} catch (e: Exception) {
|
||||
context.toast(e.message)
|
||||
}
|
||||
|
||||
@@ -186,6 +186,13 @@ class SettingsGeneralController : SettingsController() {
|
||||
defaultValue = false
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
key = Keys.eh_incogWebview
|
||||
title = "Incognito 'Open in browser'"
|
||||
summary = "Prevent pages viewed from the 'Open in browser' menu option from being placed into Chrome's browsing history. Some browser features will be unavailable."
|
||||
defaultValue = false
|
||||
}
|
||||
|
||||
preferenceCategory {
|
||||
title = "Application lock"
|
||||
|
||||
|
||||
@@ -3,11 +3,8 @@ package eu.kanade.tachiyomi.util
|
||||
import android.app.ActivityManager
|
||||
import android.app.Notification
|
||||
import android.app.NotificationManager
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.*
|
||||
import android.content.Context.VIBRATOR_SERVICE
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Resources
|
||||
import android.net.ConnectivityManager
|
||||
@@ -129,6 +126,14 @@ val Context.powerManager: PowerManager
|
||||
val Context.wifiManager: WifiManager
|
||||
get() = applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
|
||||
|
||||
// --> EH
|
||||
/**
|
||||
* Property to get the wifi manager from the context.
|
||||
*/
|
||||
val Context.clipboardManager: ClipboardManager
|
||||
get() = applicationContext.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
// <-- EH
|
||||
|
||||
/**
|
||||
* Function used to send a local broadcast asynchronous
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user