1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 12:02:33 +01:00
* Split content call from adding call

* Comment out reactive network code

* Remove autoplay settings, fixes #500
This commit is contained in:
Allan Wang 2017-11-26 16:49:09 -05:00 committed by GitHub
parent 6d68220111
commit 41d27aeb51
10 changed files with 43 additions and 71 deletions

View File

@ -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() {

View File

@ -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)

View File

@ -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")
}
}

View File

@ -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>

View File

@ -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>

View File

@ -5,8 +5,6 @@
<string name="newsfeed_sort_desc">Définit lordre 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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>