UI improvements

- add file size to plugin entries.
- move flag, version and +18 around
- make icon size compatible with stuff other than google favicons
This commit is contained in:
C10udburst 2022-08-19 10:59:11 +02:00
parent 79470a78cc
commit 318230dd09
5 changed files with 65 additions and 43 deletions

View file

@ -57,7 +57,8 @@ data class PluginData(
null,
null,
null,
null
null,
File(this.filePath).length()
)
}
}

View file

@ -60,6 +60,8 @@ data class SitePlugin(
@JsonProperty("tvTypes") val tvTypes: List<String>?,
@JsonProperty("language") val language: String?,
@JsonProperty("iconUrl") val iconUrl: String?,
// Automatically generated by the gradle plugin
@JsonProperty("fileSize") val fileSize: Long?,
)

View file

@ -1,8 +1,7 @@
package com.lagradost.cloudstream3.ui.settings.extensions
import android.content.res.Resources
import android.text.format.Formatter.formatShortFileSize
import android.util.Log
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -95,7 +94,7 @@ class PluginAdapter(
}
val iconSize by lazy {
findClosestBase2(24.toPx, 16, 512)
findClosestBase2(32.toPx, 16, 512)
}
}
@ -156,9 +155,9 @@ class PluginAdapter(
if (itemView.entry_icon?.setImage(//itemView.entry_icon?.height ?:
metadata.iconUrl?.replace(
"&sz=24",
"&sz=$iconSize"
), // lazy fix for better resolution
"%size%",
"$iconSize"
),
null,
errorImageDrawable = R.drawable.ic_baseline_extension_24
) != true
@ -176,6 +175,14 @@ class PluginAdapter(
itemView.lang_icon?.isVisible = false
}
if (metadata.fileSize != null) {
itemView.ext_filesize?.isVisible = true
itemView.ext_filesize?.text = formatShortFileSize(itemView.context, metadata.fileSize)
} else {
itemView.ext_filesize?.isVisible = false
}
itemView.main_text?.text = metadata.name
itemView.sub_text?.isGone = metadata.description.isNullOrBlank()
itemView.sub_text?.text = metadata.description.html()

View file

@ -5,45 +5,45 @@
android:id="@+id/repository_item_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:nextFocusRight="@id/action_button"
android:background="?attr/selectableItemBackground"
android:padding="20dp">
android:nextFocusRight="@id/action_button"
android:orientation="horizontal"
android:padding="12dp">
<ImageView
android:id="@+id/entry_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="start|center_vertical"
android:layout_marginEnd="20dp"
android:layout_marginEnd="16dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_github_logo" />
<LinearLayout
android:layout_gravity="center_vertical"
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/main_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
tools:text="Test repository" />
<LinearLayout
android:layout_gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/main_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
tools:text="Test repository" />
<TextView
android:id="@+id/lang_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="🇷🇼"
android:visibility="gone"
tools:visibility="visible" />
@ -53,9 +53,28 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:text="v1"
android:textColor="@color/colorPrimaryGrey"
android:visibility="gone"
tools:visibility="visible" />
<TextView
android:id="@+id/nsfw_marker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="@string/is_adult"
android:textColor="@color/adultColor"
android:visibility="gone"
tools:visibility="visible" />
<TextView
android:id="@+id/ext_filesize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:text="100MB"
android:visibility="gone"
tools:visibility="visible" />
@ -70,39 +89,30 @@
tools:text="https://github.com/..." />
</LinearLayout>
<TextView
android:id="@+id/nsfw_marker"
style="@style/SearchBox"
android:layout_gravity="center"
android:gravity="end"
android:text="@string/is_adult"
android:visibility="gone"
tools:visibility="visible" />
<ImageView
android:background="?attr/selectableItemBackgroundBorderless"
android:id="@+id/action_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_settings"
android:visibility="gone"
app:srcCompat="@drawable/ic_baseline_tune_24"
tools:visibility="visible"
android:contentDescription="@string/title_settings" />
tools:visibility="visible" />
<ImageView
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="10dp"
android:nextFocusLeft="@id/repository_item_root"
android:clickable="true"
android:id="@+id/action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginStart="10dp"
tools:src="@drawable/ic_baseline_add_24"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:contentDescription="@string/download"
android:focusable="true"
android:contentDescription="@string/download" />
android:nextFocusLeft="@id/repository_item_root"
android:padding="12dp"
tools:src="@drawable/ic_baseline_add_24" />
</LinearLayout>

View file

@ -31,6 +31,8 @@
<color name="typeColor">#3BF585</color>
<color name="typeColorBg">?attr/colorPrimaryDark</color>
<color name="adultColor">#F54A3B</color> <!-- same as sub color -->
<color name="video_ripple">#80FFFFFF</color>
<color name="video_button_ripple">#32FFFFFF</color>