From 41d27aeb517eb8f9a870a7ae0292761e6c0dd92d Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 26 Nov 2017 16:49:09 -0500 Subject: Misc (#513) * Split content call from adding call * Comment out reactive network code * Remove autoplay settings, fixes #500 --- .../pitchedapps/frost/activities/BaseActivity.kt | 84 ++++++++++------------ .../kotlin/com/pitchedapps/frost/settings/Feed.kt | 5 -- .../com/pitchedapps/frost/utils/AdBlocker.kt | 3 +- app/src/main/res/values-de/strings_pref_feed.xml | 2 - app/src/main/res/values-es/strings_pref_feed.xml | 4 +- app/src/main/res/values-fr/strings_pref_feed.xml | 2 - app/src/main/res/values-it/strings_pref_feed.xml | 4 +- app/src/main/res/values-ko/strings_pref_feed.xml | 4 +- app/src/main/res/values-vi/strings_pref_feed.xml | 4 +- app/src/main/res/values/strings_pref_feed.xml | 2 - 10 files changed, 43 insertions(+), 71 deletions(-) (limited to 'app/src/main') 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") } } diff --git a/app/src/main/res/values-de/strings_pref_feed.xml b/app/src/main/res/values-de/strings_pref_feed.xml index eec84559..cd39e930 100644 --- a/app/src/main/res/values-de/strings_pref_feed.xml +++ b/app/src/main/res/values-de/strings_pref_feed.xml @@ -5,8 +5,6 @@ Bestimmt die Reihenfolge in welcher die Posts angezeigt werden Aggressive Neuigkeiten Zusätzliche alte Posts aus Facebook\'s originalem \"Neuigkeiten\"-Feed herausfiltern. Deaktivieren Sie dies, falls Ihr News-Feed leer ist. - Video Autoplay Einstellungen - Aktiviert/deaktiviert automatisches Video abspielen im mobilen Netz für die ganze Zeit. Diese Einstellung ist unabhängig von Ihren normalen Facebook Einstellungen. Status Erstellung Zeige Status Erstellung im Feed Pro Funktionen diff --git a/app/src/main/res/values-es/strings_pref_feed.xml b/app/src/main/res/values-es/strings_pref_feed.xml index 99f8fce6..9d81a88b 100644 --- a/app/src/main/res/values-es/strings_pref_feed.xml +++ b/app/src/main/res/values-es/strings_pref_feed.xml @@ -5,9 +5,7 @@ Define el orden en que aparecen las publicaciones Modo \"Más Recientes\" agresivo Filtra de manera adicional las publicaciones más antiguas de Facebook de las noticias recientes. Deshabilita esta opción si el feed se encuentra vacio. - Configuración de reproducción automática de vídeos - Activa o desactiva la reproducción automática de vídeos mientras usas datos móviles.\nEstos ajustes son independientes de tus ajustes para escritorio. - Escritor de Estado + Escritor de Estado Mostrar escritor de estado en el feed Características Pro Sugerencias de Amigos diff --git a/app/src/main/res/values-fr/strings_pref_feed.xml b/app/src/main/res/values-fr/strings_pref_feed.xml index 0439a10d..70a83a89 100644 --- a/app/src/main/res/values-fr/strings_pref_feed.xml +++ b/app/src/main/res/values-fr/strings_pref_feed.xml @@ -5,8 +5,6 @@ Définit l’ordre dans lequel les messages sont affichés Récents agressifs Filtrer les vieilles publications additionnelles du fil de nouvelles les plus récentes de Facebook. Désactivez cette option si votre fil de nouvelles est vide. - Paramètres de lecture automatique des vidéos - Activer/désactiver la lecture automatique de vidéo sur données mobiles ou à tout temps. \nCes paramètres sont indépendants des paramètres de votre ordinateur de bureau. Compositeur de statut Montrer le compositeur de status dans le fil de nouvelles Fonctionnalités Pro diff --git a/app/src/main/res/values-it/strings_pref_feed.xml b/app/src/main/res/values-it/strings_pref_feed.xml index 0a7c992e..7e814f28 100644 --- a/app/src/main/res/values-it/strings_pref_feed.xml +++ b/app/src/main/res/values-it/strings_pref_feed.xml @@ -5,9 +5,7 @@ Definisce l\'ordine in cui sono mostrati i post Recenti Aggressivi Filtra ulteriori post vecchi dalla sezione originale più recenti di Facebook. Disabilita se il tuo feed è vuoto. - Impostazioni Video Autoplay - Abilita/disabilita l\'autoplay dei video per un periodo o sempre.\nQueste impostazioni sono indipendenti da quelle per desktop. - Compositore di Stato + Compositore di Stato Mostra la casella per comporre uno stato nelle Notizie Funzionalità Pro Amici Suggeriti diff --git a/app/src/main/res/values-ko/strings_pref_feed.xml b/app/src/main/res/values-ko/strings_pref_feed.xml index 31bc548a..80512b58 100644 --- a/app/src/main/res/values-ko/strings_pref_feed.xml +++ b/app/src/main/res/values-ko/strings_pref_feed.xml @@ -5,9 +5,7 @@ 게시물이 보여지는 순서를 지정합니다. 적극적인 최신글 페이스북의 원 최신 글 피드에서 조금 오래된 글을 제외합니다. 피드가 비었다면 비활성화 하세요. - 동영상 자동재생 설정 - 데이터 환경이나 항상 동영상 자동 재생을 끄거나 켤지 설정합니다.\n이 설정은 데스크톱의 설정과는 무관합니다. - 상태 도우미 + 상태 도우미 상태 도우미를 피드에 표시할지 결정합니다. Pro 기능 추천 친구 diff --git a/app/src/main/res/values-vi/strings_pref_feed.xml b/app/src/main/res/values-vi/strings_pref_feed.xml index be0c4ab0..db5c18f7 100644 --- a/app/src/main/res/values-vi/strings_pref_feed.xml +++ b/app/src/main/res/values-vi/strings_pref_feed.xml @@ -5,9 +5,7 @@ Quy định thứ tự sắp xếp cái bài đăng Tin gần đây chọn lọc Lọc bớt những bài đăng cũ trên bảng tin gần đây của Facebook. Tắt nếu bạn thấy bảng tin trống. - Cài đặt video tự động - Bật/Tắt tính năng tự chạy video khi dùng mạng di động.\nTính năng này không liên quan đến cài đặt của bạn trên máy tính. - Soạn trạng thái + Soạn trạng thái Hiện mục soạn trạng thái trên bảng tin Tính năng Pro Gợi ý bạn diff --git a/app/src/main/res/values/strings_pref_feed.xml b/app/src/main/res/values/strings_pref_feed.xml index cc11f850..f858ee39 100644 --- a/app/src/main/res/values/strings_pref_feed.xml +++ b/app/src/main/res/values/strings_pref_feed.xml @@ -5,8 +5,6 @@ Defines the order in which the posts are shown Aggressive Recents Filter out additional old posts from Facebook\'s original most recents feed. Disable this if your feed is empty. - Video Autoplay Settings - Enable/disable video autoplays on data or at all times.\nThese settings are independent of your settings for desktop. Status Composer Show status composer in the feed -- cgit v1.2.3