Better extension page(maybe) (#45)

* Fixed Mono icon not loading/Extension page customization

* Better extension page(maybe)
This commit is contained in:
aayush262 2023-11-15 07:11:07 +05:30 committed by GitHub
parent 2fc351f57a
commit 5543d29317
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 88 additions and 32 deletions

View file

@ -210,7 +210,14 @@ class InstalledAnimeExtensionsFragment : Fragment() {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val extension = getItem(position) // Use getItem() from ListAdapter
val nsfw = if (extension.isNsfw) {
"(18+)"
} else {
""
}
holder.extensionNameTextView.text = extension.name
holder.extensionVersionTextView.text = "${extension.versionName} $nsfw"
if (!skipIcons) {
holder.extensionIconImageView.setImageDrawable(extension.icon)
}
@ -235,6 +242,7 @@ class InstalledAnimeExtensionsFragment : Fragment() {
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val extensionNameTextView: TextView = view.findViewById(R.id.extensionNameTextView)
val extensionVersionTextView: TextView = view.findViewById(R.id.extensionVersionTextView)
val settingsImageView: ImageView = view.findViewById(R.id.settingsImageView)
val extensionIconImageView: ImageView = view.findViewById(R.id.extensionIconImageView)
val closeTextView: TextView = view.findViewById(R.id.closeTextView)

View file

@ -204,7 +204,13 @@ class InstalledMangaExtensionsFragment : Fragment() {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val extension = getItem(position) // Use getItem() from ListAdapter
val nsfw = if (extension.isNsfw) {
"(18+)"
} else {
""
}
holder.extensionNameTextView.text = extension.name
holder.extensionVersionTextView.text = "${extension.versionName} $nsfw"
if (!skipIcons) {
holder.extensionIconImageView.setImageDrawable(extension.icon)
}
@ -229,6 +235,7 @@ class InstalledMangaExtensionsFragment : Fragment() {
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val extensionNameTextView: TextView = view.findViewById(R.id.extensionNameTextView)
val extensionVersionTextView: TextView = view.findViewById(R.id.extensionVersionTextView)
val settingsImageView: ImageView = view.findViewById(R.id.settingsImageView)
val extensionIconImageView: ImageView = view.findViewById(R.id.extensionIconImageView)
val closeTextView: TextView = view.findViewById(R.id.closeTextView)

View file

@ -152,7 +152,13 @@ class AnimeExtensionAdapter(private val clickListener: OnAnimeInstallClickListen
}
val extensionIconImageView: ImageView = binding.extensionIconImageView
fun bind(extension: AnimeExtension.Available) {
val nsfw = if (extension.isNsfw) {
"(18+)"
} else {
""
}
binding.extensionNameTextView.text = extension.name
binding.extensionVersionTextView.text = "${extension.versionName} $nsfw"
}
}
}

View file

@ -154,7 +154,13 @@ class MangaExtensionAdapter(private val clickListener: OnMangaInstallClickListen
}
val extensionIconImageView: ImageView = binding.extensionIconImageView
fun bind(extension: MangaExtension.Available) {
val nsfw = if (extension.isNsfw) {
"(18+)"
} else {
""
}
binding.extensionNameTextView.text = extension.name
binding.extensionVersionTextView.text = "${extension.versionName} $nsfw"
}
}
}

View file

@ -4,24 +4,49 @@
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:paddingTop="16dp"
android:paddingBottom="16dp">
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:id="@+id/extensionIconImageView"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"/>
android:layout_marginEnd="3dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/extensionNameTextView"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Extension Name"
android:textSize="15sp"
android:fontFamily="@font/poppins_semi_bold"/>
<TextView
android:id="@+id/extensionVersionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="1"
android:textSize="11sp" />
</LinearLayout>
<TextView
android:id="@+id/closeTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:textSize="18sp"
android:text="Extension Name" />
android:layout_marginEnd="16dp"
android:textStyle="bold"
android:text="Uninstall"
android:textColor="?attr/colorPrimary"
android:textSize="14sp"/>
<ImageView
android:id="@+id/settingsImageView"
@ -31,16 +56,6 @@
app:tint="?attr/colorOnBackground"
android:layout_gravity="center_vertical"
android:layout_weight="0"
android:layout_marginEnd="16dp"
android:contentDescription="Settings"/>
<TextView
android:id="@+id/closeTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textStyle="bold"
android:text="Uninstall"
android:textColor="?attr/colorPrimary"
android:textSize="14sp"/>
</LinearLayout>

View file

@ -3,24 +3,38 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="16dp"
android:paddingBottom="16dp">
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:id="@+id/extensionIconImageView"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"/>
android:layout_marginEnd="3dp"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/extensionNameTextView"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAlignment="textStart"
android:textSize="18sp"
android:text="Extension Name" />
android:text="Extension Name"
android:textSize="15sp"
android:fontFamily="@font/poppins_semi_bold"/>
<TextView
android:id="@+id/extensionVersionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="1"
android:textSize="11sp" />
</LinearLayout>
<TextView
android:id="@+id/closeTextView"