Bug fixes , download page redesign , new theme(Emerald) (#95)

* Restart option when choosing custom theme
Typo fix
Extension page bug fix

* Downloaded manga page redesign(lol)

* quick fix

* New theme(Emerald)
Fine-tuned colors.xml

* Toggle for list view and compact view in downloaded manga and novels (much more)
This commit is contained in:
aayush262 2023-12-26 09:19:34 +05:30 committed by GitHub
parent 5339593e17
commit eb75d299d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 762 additions and 449 deletions

View file

@ -1,11 +1,13 @@
package ani.dantotsu.download.manga
import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.cardview.widget.CardView
import ani.dantotsu.R
@ -32,10 +34,18 @@ class OfflineMangaAdapter(
return position.toLong()
}
@SuppressLint("SetTextI18n")
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
val style = context.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).getInt("offline_view", 0)
var view = convertView
if (view == null) {
view = inflater.inflate(R.layout.item_media_compact, parent, false)
if (view == null && style == 0 ) {
view = inflater.inflate(R.layout.item_media_large, parent, false) // large view
}
else if (view == null && style == 1){
view = inflater.inflate(R.layout.item_media_compact, parent, false) // compact view
}
val item = getItem(position) as OfflineMangaModel
@ -44,11 +54,31 @@ class OfflineMangaAdapter(
val itemScore = view.findViewById<TextView>(R.id.itemCompactScore)
val itemScoreBG = view.findViewById<View>(R.id.itemCompactScoreBG)
val ongoing = view.findViewById<CardView>(R.id.itemCompactOngoing)
val totalchapter = view.findViewById<TextView>(R.id.itemCompactTotal)
val type = view.findViewById<TextView>(R.id.itemCompactRelation)
val typeView = view.findViewById<LinearLayout>(R.id.itemCompactType)
if (style == 0){
val bannerView = view.findViewById<ImageView>(R.id.itemCompactBanner) // for large view
val chapters = view.findViewById<TextView>(R.id.itemTotal)
chapters.text = " Chapters"
bannerView.setImageURI(item.banner)
totalchapter.text = item.totalchapter
}
else if (style == 1){
val readchapter = view.findViewById<TextView>(R.id.itemCompactUserProgress) // for compact view
readchapter.text = item.readchapter
totalchapter.text = " | "+item.totalchapter
}
// Bind item data to the views
// For example:
type.text = item.type
typeView.visibility = View.VISIBLE
imageView.setImageURI(item.image)
titleTextView.text = item.title
itemScore.text = item.score
if (item.isOngoing) {
ongoing.visibility = View.VISIBLE
} else {