Merge pull request #280 from RepoDevil/semi-auto
Automatically search through sources
This commit is contained in:
commit
89e18b0e2f
7 changed files with 78 additions and 5 deletions
|
@ -159,8 +159,7 @@ class AnimeWatchAdapter(
|
||||||
}
|
}
|
||||||
subscribeButton(false)
|
subscribeButton(false)
|
||||||
fragment.loadEpisodes(media.selected!!.sourceIndex, true)
|
fragment.loadEpisodes(media.selected!!.sourceIndex, true)
|
||||||
} ?: run {
|
} ?: run { }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//settings
|
//settings
|
||||||
|
@ -430,6 +429,22 @@ class AnimeWatchAdapter(
|
||||||
val sourceFound = media.anime.episodes!!.isNotEmpty()
|
val sourceFound = media.anime.episodes!!.isNotEmpty()
|
||||||
binding.animeSourceNotFound.isGone = sourceFound
|
binding.animeSourceNotFound.isGone = sourceFound
|
||||||
binding.faqbutton.isGone = sourceFound
|
binding.faqbutton.isGone = sourceFound
|
||||||
|
if (!sourceFound && PrefManager.getVal(PrefName.SearchSources)) {
|
||||||
|
if (binding.animeSource.adapter.count > media.selected!!.sourceIndex + 1) {
|
||||||
|
val nextIndex = media.selected!!.sourceIndex + 1
|
||||||
|
binding.animeSource.setText(binding.animeSource.adapter
|
||||||
|
.getItem(nextIndex).toString(), false)
|
||||||
|
fragment.onSourceChange(nextIndex).apply {
|
||||||
|
binding.animeSourceTitle.text = showUserText
|
||||||
|
showUserTextListener = { MainScope().launch { binding.animeSourceTitle.text = it } }
|
||||||
|
binding.animeSourceDubbed.isChecked = selectDub
|
||||||
|
binding.animeSourceDubbedCont.isVisible = isDubAvailableSeparately()
|
||||||
|
setLanguageList(0, nextIndex)
|
||||||
|
}
|
||||||
|
subscribeButton(false)
|
||||||
|
fragment.loadEpisodes(nextIndex, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
binding.animeSourceContinue.visibility = View.GONE
|
binding.animeSourceContinue.visibility = View.GONE
|
||||||
binding.animeSourceNotFound.visibility = View.GONE
|
binding.animeSourceNotFound.visibility = View.GONE
|
||||||
|
|
|
@ -481,6 +481,22 @@ class MangaReadAdapter(
|
||||||
val sourceFound = media.manga.chapters!!.isNotEmpty()
|
val sourceFound = media.manga.chapters!!.isNotEmpty()
|
||||||
binding.animeSourceNotFound.isGone = sourceFound
|
binding.animeSourceNotFound.isGone = sourceFound
|
||||||
binding.faqbutton.isGone = sourceFound
|
binding.faqbutton.isGone = sourceFound
|
||||||
|
if (!sourceFound && PrefManager.getVal(PrefName.SearchSources)) {
|
||||||
|
if (binding.animeSource.adapter.count > media.selected!!.sourceIndex + 1) {
|
||||||
|
val nextIndex = media.selected!!.sourceIndex + 1
|
||||||
|
binding.animeSource.setText(binding.animeSource.adapter
|
||||||
|
.getItem(nextIndex).toString(), false)
|
||||||
|
fragment.onSourceChange(nextIndex).apply {
|
||||||
|
binding.animeSourceTitle.text = showUserText
|
||||||
|
showUserTextListener = { MainScope().launch { binding.animeSourceTitle.text = it } }
|
||||||
|
setLanguageList(0, nextIndex)
|
||||||
|
}
|
||||||
|
subscribeButton(false)
|
||||||
|
// invalidate if it's the last source
|
||||||
|
val invalidate = nextIndex == mangaReadSources.names.size - 1
|
||||||
|
fragment.loadChapters(nextIndex, invalidate)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
binding.animeSourceContinue.visibility = View.GONE
|
binding.animeSourceContinue.visibility = View.GONE
|
||||||
binding.animeSourceNotFound.visibility = View.GONE
|
binding.animeSourceNotFound.visibility = View.GONE
|
||||||
|
|
|
@ -710,6 +710,11 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
||||||
PrefManager.setVal(PrefName.ContinueMedia, isChecked)
|
PrefManager.setVal(PrefName.ContinueMedia, isChecked)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settingsSearchSources.isChecked = PrefManager.getVal(PrefName.SearchSources)
|
||||||
|
settingsSearchSources.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
PrefManager.setVal(PrefName.SearchSources, isChecked)
|
||||||
|
}
|
||||||
|
|
||||||
settingsRecentlyListOnly.isChecked = PrefManager.getVal(PrefName.RecentlyListOnly)
|
settingsRecentlyListOnly.isChecked = PrefManager.getVal(PrefName.RecentlyListOnly)
|
||||||
settingsRecentlyListOnly.setOnCheckedChangeListener { _, isChecked ->
|
settingsRecentlyListOnly.setOnCheckedChangeListener { _, isChecked ->
|
||||||
PrefManager.setVal(PrefName.RecentlyListOnly, isChecked)
|
PrefManager.setVal(PrefName.RecentlyListOnly, isChecked)
|
||||||
|
|
|
@ -15,6 +15,7 @@ enum class PrefName(val data: Pref) { //TODO: Split this into multiple files
|
||||||
NSFWExtension(Pref(Location.General, Boolean::class, true)),
|
NSFWExtension(Pref(Location.General, Boolean::class, true)),
|
||||||
SdDl(Pref(Location.General, Boolean::class, false)),
|
SdDl(Pref(Location.General, Boolean::class, false)),
|
||||||
ContinueMedia(Pref(Location.General, Boolean::class, true)),
|
ContinueMedia(Pref(Location.General, Boolean::class, true)),
|
||||||
|
SearchSources(Pref(Location.General, Boolean::class, true)),
|
||||||
RecentlyListOnly(Pref(Location.General, Boolean::class, false)),
|
RecentlyListOnly(Pref(Location.General, Boolean::class, false)),
|
||||||
SettingsPreferDub(Pref(Location.General, Boolean::class, false)),
|
SettingsPreferDub(Pref(Location.General, Boolean::class, false)),
|
||||||
SubscriptionCheckingNotifications(Pref(Location.General, Boolean::class, true)),
|
SubscriptionCheckingNotifications(Pref(Location.General, Boolean::class, true)),
|
||||||
|
|
17
app/src/main/res/drawable/ic_round_search_sources_24.xml
Normal file
17
app/src/main/res/drawable/ic_round_search_sources_24.xml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<vector
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="#000000"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:width="24dp">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M11.5,3.5m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"/>
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M12.13,7.12c-0.17,-0.35 -0.44,-0.65 -0.8,-0.85C10.72,5.91 9.99,5.93 9.4,6.24l0,-0.01L4,9.3V14h2v-3.54l1.5,-0.85C7.18,10.71 7,11.85 7,13v5.33L4.4,21.8L6,23l3,-4l0.22,-3.54L11,18v5h2v-6.5l-1.97,-2.81c-0.04,-0.52 -0.14,-1.76 0.45,-3.4c0.75,1.14 1.88,1.98 3.2,2.41L20.63,23l0.87,-0.5L16.02,13H17v-2c-0.49,0 -2.88,0.17 -4.08,-2.21"/>
|
||||||
|
|
||||||
|
</vector>
|
|
@ -255,7 +255,25 @@
|
||||||
android:elegantTextHeight="true"
|
android:elegantTextHeight="true"
|
||||||
android:fontFamily="@font/poppins_bold"
|
android:fontFamily="@font/poppins_bold"
|
||||||
android:minHeight="64dp"
|
android:minHeight="64dp"
|
||||||
android:text="@string/always_continue_shows"
|
android:text="@string/always_continue_content"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textColor="?attr/colorOnBackground"
|
||||||
|
app:cornerRadius="0dp"
|
||||||
|
app:drawableTint="?attr/colorPrimary"
|
||||||
|
app:showText="false"
|
||||||
|
app:thumbTint="@color/button_switch_track" />
|
||||||
|
|
||||||
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
|
android:id="@+id/settingsSearchSources"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:checked="true"
|
||||||
|
android:drawableStart="@drawable/ic_round_search_sources_24"
|
||||||
|
android:drawablePadding="16dp"
|
||||||
|
android:elegantTextHeight="true"
|
||||||
|
android:fontFamily="@font/poppins_bold"
|
||||||
|
android:minHeight="64dp"
|
||||||
|
android:text="@string/search_source_list"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:textColor="?attr/colorOnBackground"
|
android:textColor="?attr/colorOnBackground"
|
||||||
app:cornerRadius="0dp"
|
app:cornerRadius="0dp"
|
||||||
|
|
|
@ -174,7 +174,7 @@
|
||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
<string name="extensions">Extensions</string>
|
<string name="extensions">Extensions</string>
|
||||||
<string name="player_settings">Player Settings</string>
|
<string name="player_settings">Player Settings</string>
|
||||||
<string name="recentlyListOnly">Only show My Shows in Recently Updated</string>
|
<string name="recentlyListOnly">Only show my content in \"Recently Updated\"</string>
|
||||||
<string name="download_manager_select">Download Manager</string>
|
<string name="download_manager_select">Download Manager</string>
|
||||||
<string name="downloadInSd">Download in SD card</string>
|
<string name="downloadInSd">Download in SD card</string>
|
||||||
<string name="noSdFound">No SD card was Found.</string>
|
<string name="noSdFound">No SD card was Found.</string>
|
||||||
|
@ -369,7 +369,8 @@
|
||||||
<string name="planned_anime">Planned Anime</string>
|
<string name="planned_anime">Planned Anime</string>
|
||||||
<string name="planned_manga">Planned Manga</string>
|
<string name="planned_manga">Planned Manga</string>
|
||||||
<string name="image_long_clicking">Open image by Long Clicking</string>
|
<string name="image_long_clicking">Open image by Long Clicking</string>
|
||||||
<string name="always_continue_shows">Always continue Shows</string>
|
<string name="always_continue_content">Always continue previous items</string>
|
||||||
|
<string name="search_source_list">Search next available source</string>
|
||||||
<string name="timestamp_proxy_desc">Useful if you are getting Handshake Fails</string>
|
<string name="timestamp_proxy_desc">Useful if you are getting Handshake Fails</string>
|
||||||
<string name="timestamp_proxy">Use Proxy for Timestamps</string>
|
<string name="timestamp_proxy">Use Proxy for Timestamps</string>
|
||||||
<string name="check_app_updates">Always check for App Updates</string>
|
<string name="check_app_updates">Always check for App Updates</string>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue