diff --git a/app/src/main/java/org/libre/agosto/p2play/ManagerSingleton.kt b/app/src/main/java/org/libre/agosto/p2play/ManagerSingleton.kt index 65b9e60..5c9ef84 100644 --- a/app/src/main/java/org/libre/agosto/p2play/ManagerSingleton.kt +++ b/app/src/main/java/org/libre/agosto/p2play/ManagerSingleton.kt @@ -9,6 +9,7 @@ object ManagerSingleton { var url: String?= null var user: UserModel = UserModel() var token: TokenModel = TokenModel() + var nfsw: Boolean = false // var keys: fun Toast(text: String?) { diff --git a/app/src/main/java/org/libre/agosto/p2play/SplashActivity.kt b/app/src/main/java/org/libre/agosto/p2play/SplashActivity.kt index fc5845c..9291f83 100644 --- a/app/src/main/java/org/libre/agosto/p2play/SplashActivity.kt +++ b/app/src/main/java/org/libre/agosto/p2play/SplashActivity.kt @@ -24,8 +24,9 @@ class SplashActivity : AppCompatActivity() { settings = PreferenceManager.getDefaultSharedPreferences(this) - editor = settings.edit() + ManagerSingleton.context = this + ManagerSingleton.nfsw = settings.getBoolean("show_nfsw", false) val host = settings.getString("hostP2play","") val lastHost = settings.getString("last_host","") diff --git a/app/src/main/java/org/libre/agosto/p2play/ajax/Videos.kt b/app/src/main/java/org/libre/agosto/p2play/ajax/Videos.kt index bd3f5b1..486e1d8 100644 --- a/app/src/main/java/org/libre/agosto/p2play/ajax/Videos.kt +++ b/app/src/main/java/org/libre/agosto/p2play/ajax/Videos.kt @@ -3,6 +3,7 @@ package org.libre.agosto.p2play.ajax import android.util.JsonReader import android.util.JsonToken import android.util.Log +import org.libre.agosto.p2play.ManagerSingleton import org.libre.agosto.p2play.models.VideoModel import java.io.InputStreamReader @@ -92,7 +93,8 @@ class Videos: Client() { } private fun getVideos(start:Int, count:Int, sort:String = "-publishedAt", filter:String = ""):ArrayList{ - var params = "start=$start&count=$count&sort=$sort" + val nfsw = ManagerSingleton.nfsw + var params = "start=$start&count=$count&sort=$sort&nsfw=$nfsw" if(filter != "") params+="&filter=$filter" var con=this._newCon("videos?$params","GET")