aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt84
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt5
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/AdBlocker.kt3
3 files changed, 39 insertions, 53 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt
index d1cdf1fa..97afd480 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt
@@ -4,18 +4,8 @@ import android.content.res.Configuration
import android.os.Bundle
import ca.allanwang.kau.internal.KauBaseActivity
import ca.allanwang.kau.searchview.SearchViewHolder
-import ca.allanwang.kau.utils.finishSlideOut
-import com.github.pwittchen.reactivenetwork.library.rx2.Connectivity
-import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
-import com.pitchedapps.frost.R
import com.pitchedapps.frost.contracts.VideoViewHolder
-import com.pitchedapps.frost.utils.L
-import com.pitchedapps.frost.utils.Prefs
-import com.pitchedapps.frost.utils.materialDialogThemed
import com.pitchedapps.frost.utils.setFrostTheme
-import io.reactivex.android.schedulers.AndroidSchedulers
-import io.reactivex.disposables.Disposable
-import io.reactivex.schedulers.Schedulers
/**
* Created by Allan Wang on 2017-06-12.
@@ -38,43 +28,43 @@ abstract class BaseActivity : KauBaseActivity() {
super.onCreate(savedInstanceState)
if (this !is WebOverlayActivityBase) setFrostTheme()
}
-
- private var networkDisposable: Disposable? = null
- private var networkConsumer: ((Connectivity) -> Unit)? = null
-
- fun setNetworkObserver(consumer: (connectivity: Connectivity) -> Unit) {
- this.networkConsumer = consumer
- }
-
- private fun observeNetworkConnectivity() {
- val consumer = networkConsumer ?: return
- networkDisposable = ReactiveNetwork.observeNetworkConnectivity(applicationContext)
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe { connectivity: Connectivity ->
- connectivity.apply {
- L.d("Network connectivity changed: isAvailable: $isAvailable isRoaming: $isRoaming")
- consumer(connectivity)
- }
- }
- }
-
- private fun disposeNetworkConnectivity() {
- if (networkDisposable?.isDisposed == false)
- networkDisposable?.dispose()
- networkDisposable = null
- }
-
- override fun onResume() {
- super.onResume()
-// disposeNetworkConnectivity()
-// observeNetworkConnectivity()
- }
-
- override fun onPause() {
- super.onPause()
-// disposeNetworkConnectivity()
- }
+//
+// private var networkDisposable: Disposable? = null
+// private var networkConsumer: ((Connectivity) -> Unit)? = null
+//
+// fun setNetworkObserver(consumer: (connectivity: Connectivity) -> Unit) {
+// this.networkConsumer = consumer
+// }
+//
+// private fun observeNetworkConnectivity() {
+// val consumer = networkConsumer ?: return
+// networkDisposable = ReactiveNetwork.observeNetworkConnectivity(applicationContext)
+// .subscribeOn(Schedulers.io())
+// .observeOn(AndroidSchedulers.mainThread())
+// .subscribe { connectivity: Connectivity ->
+// connectivity.apply {
+// L.d("Network connectivity changed: isAvailable: $isAvailable isRoaming: $isRoaming")
+// consumer(connectivity)
+// }
+// }
+// }
+//
+// private fun disposeNetworkConnectivity() {
+// if (networkDisposable?.isDisposed == false)
+// networkDisposable?.dispose()
+// networkDisposable = null
+// }
+//
+// override fun onResume() {
+// super.onResume()
+//// disposeNetworkConnectivity()
+//// observeNetworkConnectivity()
+// }
+//
+// override fun onPause() {
+// super.onPause()
+//// disposeNetworkConnectivity()
+// }
override fun onStop() {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
index 3c7b385d..e3a0872a 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
@@ -41,11 +41,6 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
descRes = R.string.aggressive_recents_desc
}
- plainText(R.string.autoplay_settings) {
- descRes = R.string.autoplay_settings_desc
- onClick = { _, _, _ -> launchWebOverlay("https://touch.facebook.com/settings/videos"); true }
- }
-
checkbox(R.string.composer, { Prefs.showComposer }, {
Prefs.showComposer = it
setFrostResult(MainActivity.REQUEST_REFRESH)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/AdBlocker.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/AdBlocker.kt
index 6f137519..be71a913 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/AdBlocker.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/AdBlocker.kt
@@ -23,7 +23,8 @@ open class AdBlocker(val assetPath: String) {
fun init(context: Context) {
doAsync {
- data.addAll(context.assets.open(assetPath).bufferedReader().use { it.readLines().filter { !it.startsWith("#") } })
+ val content = context.assets.open(assetPath).bufferedReader().use { it.readLines().filter { !it.startsWith("#") } }
+ data.addAll(content)
L.i("Initialized adblock for $assetPath with ${data.size} hosts")
}
}