diff --git a/UIViews/src/main/res/layout/fragment_all.xml b/UIViews/src/main/res/layout/fragment_all.xml index fab001f87..d5df2ddef 100644 --- a/UIViews/src/main/res/layout/fragment_all.xml +++ b/UIViews/src/main/res/layout/fragment_all.xml @@ -22,6 +22,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" + tools:listitem="@layout/listitem_opensource" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" tools:itemCount="10" /> @@ -48,7 +49,7 @@ > = Single.create { emitter -> @@ -35,13 +39,16 @@ abstract class WcoStream(allPath: String) : ShowApi( .select("div.menulaststyle") .select("li") .select("a") - .alsoPrint() + //.alsoPrint() .map { ItemModel( title = it.text(), description = "", imageUrl = it.select("div.img").select("img").attr("abs:src"), - url = it.attr("abs:href"),//Jsoup.connect(it.attr("abs:href")).get().select("div.ildate").select("a").attr("abs:href"), + url = if (RECENT_TYPE) + it.attr("abs:href") + else + Jsoup.connect(it.attr("abs:href")).get().select("div.ildate").select("a").attr("abs:href"), source = this ) } @@ -197,7 +204,7 @@ abstract class WcoStream(allPath: String) : ShowApi( }*/ } .also { println("-".repeat(50)) } - //.also { println(it) } + //.also { println(it) } /* Storage( diff --git a/animeworld/src/main/java/com/programmersbox/animeworld/MainActivity.kt b/animeworld/src/main/java/com/programmersbox/animeworld/MainActivity.kt index f275ce0fd..6e0c95b99 100644 --- a/animeworld/src/main/java/com/programmersbox/animeworld/MainActivity.kt +++ b/animeworld/src/main/java/com/programmersbox/animeworld/MainActivity.kt @@ -8,19 +8,19 @@ import android.widget.Toast import androidx.core.content.ContextCompat import androidx.mediarouter.app.MediaRouteDialogFactory import androidx.preference.Preference +import androidx.preference.SwitchPreference import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.google.android.gms.cast.framework.CastContext import com.obsez.android.lib.filechooser.ChooserDialog import com.programmersbox.anime_sources.Sources -import com.programmersbox.anime_sources.anime.Movies -import com.programmersbox.anime_sources.anime.Torrents -import com.programmersbox.anime_sources.anime.Yts +import com.programmersbox.anime_sources.anime.* import com.programmersbox.animeworld.cast.CastHelper import com.programmersbox.animeworld.cast.ExpandedControlsActivity import com.programmersbox.animeworld.ytsdatabase.Torrent import com.programmersbox.gsonutils.fromJson import com.programmersbox.helpfulutils.requestPermissions +import com.programmersbox.helpfulutils.sharedPrefNotNullDelegate import com.programmersbox.models.ApiService import com.programmersbox.models.ChapterModel import com.programmersbox.models.sourcePublish @@ -43,6 +43,8 @@ class MainActivity : BaseMainActivity() { val cast: CastHelper = CastHelper() } + private var Context.wcoRecent by sharedPrefNotNullDelegate(true) + override fun onCreate() { activity = this @@ -51,6 +53,8 @@ class MainActivity : BaseMainActivity() { Notifications.setup(this) + WcoStream.RECENT_TYPE = wcoRecent + when (intent.data) { Uri.parse(VIEW_DOWNLOADS) -> openDownloads() Uri.parse(VIEW_VIDEOS) -> openVideos() @@ -233,6 +237,28 @@ class MainActivity : BaseMainActivity() { } preferenceScreen.generalSettings { + + it.addPreference( + SwitchPreference(it.context).apply { + title = "Wcostream Recent Type" + summary = + "Due to some possible with this source, multiple calls need to be made which we need to be careful of. If you turn this off, just be wary that Wcostream could stop you from getting data." + key = "wco_recent" + isChecked = wcoRecent + setOnPreferenceChangeListener { _, newValue -> + WcoStream.RECENT_TYPE = newValue as Boolean + wcoRecent = newValue as Boolean + true + } + icon = ContextCompat.getDrawable(it.context, R.drawable.ic_baseline_article_24) + sourcePublish.subscribe { + isVisible = it == Sources.WCO_CARTOON || it == Sources.WCO_DUBBED || + it == Sources.WCO_MOVIES || it == Sources.WCO_SUBBED || it == Sources.WCO_OVA + } + .addTo(disposable) + } + ) + it.addPreference( Preference(it.context).apply { title = getString(R.string.folder_location) diff --git a/animeworld/src/main/res/drawable/ic_baseline_article_24.xml b/animeworld/src/main/res/drawable/ic_baseline_article_24.xml new file mode 100644 index 000000000..26ca48583 --- /dev/null +++ b/animeworld/src/main/res/drawable/ic_baseline_article_24.xml @@ -0,0 +1,11 @@ + + + diff --git a/novelworld/build.gradle b/novelworld/build.gradle index 725463aa4..27e6afc53 100644 --- a/novelworld/build.gradle +++ b/novelworld/build.gradle @@ -48,6 +48,7 @@ dependencies { implementation material implementation constraintlayout implementation recyclerview + implementation 'androidx.preference:preference-ktx:1.1.1' implementation 'com.google.firebase:firebase-crashlytics:18.0.0' implementation 'com.google.firebase:firebase-analytics:19.0.0' testImplementation 'junit:junit:4.+'