Skip to content

Commit

Permalink
- added WcoStream.kt fully. DID give an option to allow for full info…
Browse files Browse the repository at this point in the history
… or just to view the info. Still need to put the strings in the right place.
  • Loading branch information
jakepurple13 committed May 14, 2021
1 parent 8823954 commit a0d752e
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 8 deletions.
3 changes: 2 additions & 1 deletion UIViews/src/main/res/layout/fragment_all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />

Expand All @@ -48,7 +49,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorOnPrimary"
android:background="?colorSurface"
app:layout_collapseMode="pin">

<com.google.android.material.textfield.TextInputLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum class Sources(private val api: ApiService) : ApiService by api {
ANIMETOON(AnimeToonApi),

//DUBBED_ANIME_BIZ(DubbedAnimeBiz),
//WCO_DUBBED(WcoDubbed), WCO_SUBBED(WcoSubbed), WCO_CARTOON(WcoCartoon), WCO_MOVIES(WcoMovies), WCO_OVA(WcoOva),
WCO_DUBBED(WcoDubbed), WCO_SUBBED(WcoSubbed), WCO_CARTOON(WcoCartoon), WCO_MOVIES(WcoMovies), WCO_OVA(WcoOva),
DUBBED_ANIME(AnimeToonDubbed),
ANIMETOON_MOVIES(AnimeToonMovies);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ abstract class WcoStream(allPath: String) : ShowApi(
recentPath = "last-50-recent-release"
) {

companion object {
var RECENT_TYPE = true
}

override val canScroll: Boolean get() = false

override fun getRecent(doc: Document): Single<List<ItemModel>> = Single.create { emitter ->
Expand All @@ -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
)
}
Expand Down Expand Up @@ -197,7 +204,7 @@ abstract class WcoStream(allPath: String) : ShowApi(
}*/
}
.also { println("-".repeat(50)) }
//.also { println(it) }
//.also { println(it) }

/*
Storage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -43,6 +43,8 @@ class MainActivity : BaseMainActivity() {
val cast: CastHelper = CastHelper()
}

private var Context.wcoRecent by sharedPrefNotNullDelegate(true)

override fun onCreate() {

activity = this
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions animeworld/src/main/res/drawable/ic_baseline_article_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM14,17L7,17v-2h7v2zM17,13L7,13v-2h10v2zM17,9L7,9L7,7h10v2z" />
</vector>
1 change: 1 addition & 0 deletions novelworld/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.+'
Expand Down

0 comments on commit a0d752e

Please sign in to comment.