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

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

View file

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

View file

@ -151,8 +151,14 @@ class AnimeExtensionAdapter(private val clickListener: OnAnimeInstallClickListen
} }
} }
val extensionIconImageView: ImageView = binding.extensionIconImageView val extensionIconImageView: ImageView = binding.extensionIconImageView
fun bind(extension: AnimeExtension.Available) { fun bind(extension: AnimeExtension.Available) {
val nsfw = if (extension.isNsfw) {
"(18+)"
} else {
""
}
binding.extensionNameTextView.text = extension.name 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 val extensionIconImageView: ImageView = binding.extensionIconImageView
fun bind(extension: MangaExtension.Available) { fun bind(extension: MangaExtension.Available) {
val nsfw = if (extension.isNsfw) {
"(18+)"
} else {
""
}
binding.extensionNameTextView.text = extension.name binding.extensionNameTextView.text = extension.name
binding.extensionVersionTextView.text = "${extension.versionName} $nsfw"
} }
} }
} }

View file

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

View file

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