Skip to content

Commit

Permalink
Merge pull request #74 from rebelonion/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
rebelonion authored Dec 6, 2023
2 parents d687911 + 97a4cba commit 8797af0
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 98 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {
minSdk 23
targetSdk 34
versionCode ((System.currentTimeMillis() / 60000).toInteger())
versionName "1.0.0-beta03i-2"
versionName "2.0.0"
signingConfig signingConfigs.debug
}

Expand Down
32 changes: 5 additions & 27 deletions app/src/main/java/ani/dantotsu/media/manga/MangaChapterAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class MangaChapterAdapter(
// Find the position of the chapter and notify only that item
val position = arr.indexOfFirst { it.number == chapterNumber }
if (position != -1) {
arr[position].progress = ""
notifyItemChanged(position)
}
}
Expand All @@ -102,6 +103,7 @@ class MangaChapterAdapter(
// Find the position of the chapter and notify only that item
val position = arr.indexOfFirst { it.number == chapterNumber }
if (position != -1) {
arr[position].progress = ""
notifyItemChanged(position)
}
}
Expand All @@ -116,30 +118,6 @@ class MangaChapterAdapter(
}
}

fun downloadNextNChapters(n: Int) {
//find last viewed chapter
var lastViewedChapter = arr.indexOfFirst { MangaNameAdapter.findChapterNumber(it.number)?.toInt() == media.userProgress }
if (lastViewedChapter == -1) {
lastViewedChapter = 0
}
//download next n chapters
for (i in 1..n) {
if (lastViewedChapter + i < arr.size) {
val chapterNumber = arr[lastViewedChapter + i].number
if (activeDownloads.contains(chapterNumber)) {
//do nothing
continue
} else if (downloadedChapters.contains(chapterNumber)) {
//do nothing
continue
} else {
fragment.onMangaChapterDownloadClick(chapterNumber)
startDownload(chapterNumber)
}
}
}
}

fun downloadNChaptersFrom(position: Int, n: Int) {
//download next n chapters
for (i in 0..<n) {
Expand Down Expand Up @@ -179,10 +157,10 @@ class MangaChapterAdapter(
} else if (downloadedChapters.contains(chapterNumber)) {
// Show checkmark
binding.itemDownload.setImageResource(R.drawable.ic_circle_check)
binding.itemDownload.setColorFilter(typedValue2.data)
//binding.itemDownload.setColorFilter(typedValue2.data) //TODO: colors go to wrong places
binding.itemDownload.postDelayed({
binding.itemDownload.setImageResource(R.drawable.ic_circle_cancel)
binding.itemDownload.setColorFilter(typedValue2.data)
binding.itemDownload.setImageResource(R.drawable.ic_round_delete_24)
//binding.itemDownload.setColorFilter(typedValue2.data)
}, 1000)
} else {
// Show download icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class MangaReadAdapter(
hiddenScanlators.add(checkBox.text.toString())
}
}
media.selected!!.scanlators = hiddenScanlators
fragment.onScanlatorChange(hiddenScanlators)
scanlatorSelectionListener?.onScanlatorsSelected()
}
.setNegativeButton("Cancel", null)
Expand Down
22 changes: 21 additions & 1 deletion app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,21 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
}

fun multiDownload(n: Int) {
chapterAdapter.downloadNextNChapters(n)
//get last viewed chapter
val selected = media.userProgress
val chapters = media.manga?.chapters?.values?.toList()
//filter by selected language
val progressChapterIndex = chapters?.indexOfFirst { MangaNameAdapter.findChapterNumber(it.number)?.toInt() == selected }?:0
val chaptersToDownload = chapters?.subList(
progressChapterIndex + 1,
progressChapterIndex + n + 1
)
if (chaptersToDownload != null) {
for (chapter in chaptersToDownload) {
onMangaChapterDownloadClick(chapter.title!!)
}
}

}

private fun updateChapters() {
Expand Down Expand Up @@ -275,6 +289,12 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
media.selected = selected
}

fun onScanlatorChange(list: List<String>) {
val selected = model.loadSelected(media)
selected.scanlators = list
model.saveSelected(media.id, selected, requireActivity())
media.selected = selected
}

fun loadChapters(i: Int, invalidate: Boolean) {
lifecycleScope.launch(Dispatchers.IO) { model.loadMangaChapters(media, i, invalidate) }
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/ani/dantotsu/others/AppUpdater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.decodeFromJsonElement
import rx.android.BuildConfig
import java.io.File
import java.text.SimpleDateFormat
import java.util.*
Expand Down
22 changes: 22 additions & 0 deletions app/src/main/java/ani/dantotsu/others/LanguageMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,28 @@ class LanguageMapper {
else -> ""
}
}

enum class Language(val code: String) {
ALL("all"),
ARABIC("ar"),
GERMAN("de"),
ENGLISH("en"),
SPANISH("es"),
FRENCH("fr"),
INDONESIAN("id"),
ITALIAN("it"),
JAPANESE("ja"),
KOREAN("ko"),
POLISH("pl"),
PORTUGUESE_BRAZIL("pt-BR"),
RUSSIAN("ru"),
THAI("th"),
TURKISH("tr"),
UKRAINIAN("uk"),
VIETNAMESE("vi"),
CHINESE("zh"),
CHINESE_SIMPLIFIED("zh-Hans")
}
}
}

19 changes: 10 additions & 9 deletions app/src/main/java/ani/dantotsu/settings/ExtensionsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import ani.dantotsu.others.LangSet
import ani.dantotsu.themes.ThemeManager
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import eu.kanade.tachiyomi.extension.anime.model.AnimeExtension

class ExtensionsActivity : AppCompatActivity() {
private val restartMainActivity = object : OnBackPressedCallback(false) {
Expand Down Expand Up @@ -120,15 +119,17 @@ class ExtensionsActivity : AppCompatActivity() {


initActivity(this)

fun bind(extension: AnimeExtension.Available) {
binding.languageselect.setOnClickListener {
val popup = PopupMenu(this, it)

popup.inflate(R.menu.launguage_selector_menu)
popup.show()
/* TODO
binding.languageselect.setOnClickListener {
val popup = PopupMenu(this, it)
popup.inflate(R.menu.launguage_selector_menu)
popup.setOnMenuItemClickListener { menuItem ->
true
}
}
popup.setOnDismissListener {
}
popup.show()
}*/
binding.settingsContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
bottomMargin = navBarHeight
Expand Down
15 changes: 4 additions & 11 deletions app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class SettingsActivity : AppCompatActivity() {
passedColor = color
linearLayout.setBackgroundColor(color)
})
alertDialog.show()
alertDialog.window?.setDimAmount(0.8f)
}

Expand Down Expand Up @@ -338,16 +339,6 @@ class SettingsActivity : AppCompatActivity() {
binding.settingsRecentlyListOnly.setOnCheckedChangeListener { _, isChecked ->
saveData("recently_list_only", isChecked)
}

val dns = listOf("None", "Google", "Cloudflare", "AdGuard")
binding.settingsDns.setText(dns[loadData("settings_dns") ?: 0], false)
binding.settingsDns.setAdapter(ArrayAdapter(this, R.layout.item_dropdown, dns))
binding.settingsDns.setOnItemClickListener { _, _, i, _ ->
saveData("settings_dns", i)
initializeNetwork(this)
binding.settingsDns.clearFocus()
}

binding.settingsPreferDub.isChecked = loadData("settings_prefer_dub") ?: false
binding.settingsPreferDub.setOnCheckedChangeListener { _, isChecked ->
saveData("settings_prefer_dub", isChecked)
Expand Down Expand Up @@ -546,7 +537,9 @@ class SettingsActivity : AppCompatActivity() {
cursedCounter++
(binding.settingsLogo.drawable as Animatable).start()
if (cursedCounter % 7 == 0) {
snackString("youwu have been cuwsed :pwayge:")
Toast.makeText(this, "youwu have been cuwsed :pwayge:", Toast.LENGTH_LONG).show()
val url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
openLinkInBrowser(url)
getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit().putBoolean(
"use_cursed_lang",
getSharedPreferences(
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageButton

<ImageButton
android:id="@+id/languageselect"
android:layout_width="48dp"
android:layout_height="48dp"
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/res/layout/activity_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
android:id="@+id/listTitle"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginStart="16dp"
android:fontFamily="@font/poppins_bold"
android:gravity="center"
android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"
Expand All @@ -48,7 +47,6 @@
android:id="@+id/random"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/random_selection"
app:tint="?attr/colorOnBackground"
Expand All @@ -58,7 +56,7 @@
android:id="@+id/listSort"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginEnd="16dp"
android:layout_marginEnd="8dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/sort_by"
app:tint="?attr/colorOnBackground"
Expand Down
38 changes: 1 addition & 37 deletions app/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -706,41 +706,6 @@
android:layout_marginBottom="8dp"
android:background="?android:attr/listDivider" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.58"
android:fontFamily="@font/poppins_bold"
android:text="@string/extension_specific_dns" />

<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:hintAnimationEnabled="true"
app:startIconDrawable="@drawable/ic_round_dns_24">

<AutoCompleteTextView
android:id="@+id/settingsExtensionDns"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/poppins_bold"
android:freezesText="false"
android:inputType="none"
android:padding="8dp"
android:text="@string/none"
android:textAllCaps="true"
android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"
tools:ignore="LabelFor,TextContrastCheck,DuplicateSpeakableTextCheck" />
</com.google.android.material.textfield.TextInputLayout>


</ani.dantotsu.others.Xpandable>

<ani.dantotsu.others.Xpandable
Expand Down Expand Up @@ -888,7 +853,7 @@
app:startIconDrawable="@drawable/ic_round_dns_24">

<AutoCompleteTextView
android:id="@+id/settingsDns"
android:id="@+id/settingsExtensionDns"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
Expand All @@ -903,7 +868,6 @@
tools:ignore="LabelFor,TextContrastCheck,DuplicateSpeakableTextCheck" />
</com.google.android.material.textfield.TextInputLayout>


<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
25 changes: 20 additions & 5 deletions stable.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
# 1.0.0
# 2.0.0

- **New Features:**
- Novel Support
- Offline support for manga and novels
- Filter anime/manga by language
- Filter manga by scanlator
- Many new theme options
- Saikou theme
- Random anime/manga selector from lists
- Incognito mode (sus)
- Various UI uplifts
- Many small features (see beta changelogs)
- New easter egg :3

- **Bugfixes:**
- Fixed extension page hiding icons on first install
- Discord RPC fix
- Many source fixes
- Various bug/crash fixes
- Fixes for monochrome theme
- General theme tweaks
- Ability to disable hold-to-fast-forward in videos (caused issues for some users)
- Many small bug fixes (see beta changelogs)

- **New Features:**
- added oled variant to all themes
- **Like what you see?**
- Consider supporting me on [Github](https://github.com/sponsors/rebelonion) or [Buy Me a Coffee](https://www.buymeacoffee.com/rebelonion)!

0 comments on commit 8797af0

Please sign in to comment.