diff options
author | Allan Wang <me@allanwang.ca> | 2017-11-26 16:49:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-26 16:49:09 -0500 |
commit | 41d27aeb517eb8f9a870a7ae0292761e6c0dd92d (patch) | |
tree | 621a74a897160fa81d67f3051ec151610079ea8b | |
parent | 6d682201115a70009f8789eee6da24a775d1d89d (diff) | |
download | frost-41d27aeb517eb8f9a870a7ae0292761e6c0dd92d.tar.gz frost-41d27aeb517eb8f9a870a7ae0292761e6c0dd92d.tar.bz2 frost-41d27aeb517eb8f9a870a7ae0292761e6c0dd92d.zip |
Misc (#513)
* Split content call from adding call
* Comment out reactive network code
* Remove autoplay settings, fixes #500
10 files changed, 43 insertions, 71 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") } } 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 @@ <string name="newsfeed_sort_desc">Bestimmt die Reihenfolge in welcher die Posts angezeigt werden</string> <string name="aggressive_recents">Aggressive Neuigkeiten</string> <string name="aggressive_recents_desc">Zusätzliche alte Posts aus Facebook\'s originalem \"Neuigkeiten\"-Feed herausfiltern. Deaktivieren Sie dies, falls Ihr News-Feed leer ist.</string> - <string name="autoplay_settings">Video Autoplay Einstellungen</string> - <string name="autoplay_settings_desc">Aktiviert/deaktiviert automatisches Video abspielen im mobilen Netz für die ganze Zeit. Diese Einstellung ist unabhängig von Ihren normalen Facebook Einstellungen.</string> <string name="composer">Status Erstellung</string> <string name="composer_desc">Zeige Status Erstellung im Feed</string> <string name="pro_features">Pro Funktionen</string> 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 @@ <string name="newsfeed_sort_desc">Define el orden en que aparecen las publicaciones</string> <string name="aggressive_recents">Modo \"Más Recientes\" agresivo</string> <string name="aggressive_recents_desc">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.</string> - <string name="autoplay_settings">Configuración de reproducción automática de vídeos</string> - <string name="autoplay_settings_desc">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.</string> - <string name="composer">Escritor de Estado</string> + <string name="composer">Escritor de Estado</string> <string name="composer_desc">Mostrar escritor de estado en el feed</string> <string name="pro_features">Características Pro</string> <string name="suggested_friends">Sugerencias de Amigos</string> 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 @@ <string name="newsfeed_sort_desc">Définit l’ordre dans lequel les messages sont affichés</string> <string name="aggressive_recents">Récents agressifs</string> <string name="aggressive_recents_desc">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.</string> - <string name="autoplay_settings">Paramètres de lecture automatique des vidéos</string> - <string name="autoplay_settings_desc">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.</string> <string name="composer">Compositeur de statut</string> <string name="composer_desc">Montrer le compositeur de status dans le fil de nouvelles</string> <string name="pro_features">Fonctionnalités Pro</string> 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 @@ <string name="newsfeed_sort_desc">Definisce l\'ordine in cui sono mostrati i post</string> <string name="aggressive_recents">Recenti Aggressivi</string> <string name="aggressive_recents_desc">Filtra ulteriori post vecchi dalla sezione originale più recenti di Facebook. Disabilita se il tuo feed è vuoto.</string> - <string name="autoplay_settings">Impostazioni Video Autoplay</string> - <string name="autoplay_settings_desc">Abilita/disabilita l\'autoplay dei video per un periodo o sempre.\nQueste impostazioni sono indipendenti da quelle per desktop.</string> - <string name="composer">Compositore di Stato</string> + <string name="composer">Compositore di Stato</string> <string name="composer_desc">Mostra la casella per comporre uno stato nelle Notizie</string> <string name="pro_features">Funzionalità Pro</string> <string name="suggested_friends">Amici Suggeriti</string> 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 @@ <string name="newsfeed_sort_desc">게시물이 보여지는 순서를 지정합니다.</string> <string name="aggressive_recents">적극적인 최신글</string> <string name="aggressive_recents_desc">페이스북의 원 최신 글 피드에서 조금 오래된 글을 제외합니다. 피드가 비었다면 비활성화 하세요.</string> - <string name="autoplay_settings">동영상 자동재생 설정</string> - <string name="autoplay_settings_desc">데이터 환경이나 항상 동영상 자동 재생을 끄거나 켤지 설정합니다.\n이 설정은 데스크톱의 설정과는 무관합니다.</string> - <string name="composer">상태 도우미</string> + <string name="composer">상태 도우미</string> <string name="composer_desc">상태 도우미를 피드에 표시할지 결정합니다.</string> <string name="pro_features">Pro 기능</string> <string name="suggested_friends">추천 친구</string> 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 @@ <string name="newsfeed_sort_desc">Quy định thứ tự sắp xếp cái bài đăng</string> <string name="aggressive_recents">Tin gần đây chọn lọc</string> <string name="aggressive_recents_desc">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.</string> - <string name="autoplay_settings">Cài đặt video tự động</string> - <string name="autoplay_settings_desc">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.</string> - <string name="composer">Soạn trạng thái</string> + <string name="composer">Soạn trạng thái</string> <string name="composer_desc">Hiện mục soạn trạng thái trên bảng tin</string> <string name="pro_features">Tính năng Pro</string> <string name="suggested_friends">Gợi ý bạn</string> 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 @@ <string name="newsfeed_sort_desc">Defines the order in which the posts are shown</string> <string name="aggressive_recents">Aggressive Recents</string> <string name="aggressive_recents_desc">Filter out additional old posts from Facebook\'s original most recents feed. Disable this if your feed is empty.</string> - <string name="autoplay_settings">Video Autoplay Settings</string> - <string name="autoplay_settings_desc">Enable/disable video autoplays on data or at all times.\nThese settings are independent of your settings for desktop.</string> <string name="composer">Status Composer</string> <string name="composer_desc">Show status composer in the feed</string> |