mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 22:35:22 +01:00
Move untrusted/obsolete/unofficial extension text
This commit is contained in:
parent
f9baff0e90
commit
150ea29a70
@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.extension.model.InstallStep
|
|||||||
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||||
import eu.kanade.tachiyomi.ui.base.holder.SlicedHolder
|
import eu.kanade.tachiyomi.ui.base.holder.SlicedHolder
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
|
||||||
import io.github.mthli.slice.Slice
|
import io.github.mthli.slice.Slice
|
||||||
import kotlinx.android.synthetic.main.extension_card_item.card
|
import kotlinx.android.synthetic.main.extension_card_item.card
|
||||||
import kotlinx.android.synthetic.main.extension_card_item.ext_button
|
import kotlinx.android.synthetic.main.extension_card_item.ext_button
|
||||||
@ -16,6 +15,7 @@ import kotlinx.android.synthetic.main.extension_card_item.ext_title
|
|||||||
import kotlinx.android.synthetic.main.extension_card_item.image
|
import kotlinx.android.synthetic.main.extension_card_item.image
|
||||||
import kotlinx.android.synthetic.main.extension_card_item.lang
|
import kotlinx.android.synthetic.main.extension_card_item.lang
|
||||||
import kotlinx.android.synthetic.main.extension_card_item.version
|
import kotlinx.android.synthetic.main.extension_card_item.version
|
||||||
|
import kotlinx.android.synthetic.main.extension_card_item.warning
|
||||||
|
|
||||||
class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) :
|
class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) :
|
||||||
BaseFlexibleViewHolder(view, adapter),
|
BaseFlexibleViewHolder(view, adapter),
|
||||||
@ -38,13 +38,14 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) :
|
|||||||
val extension = item.extension
|
val extension = item.extension
|
||||||
setCardEdges(item)
|
setCardEdges(item)
|
||||||
|
|
||||||
// Set source name
|
|
||||||
ext_title.text = extension.name
|
ext_title.text = extension.name
|
||||||
version.text = extension.versionName
|
version.text = extension.versionName
|
||||||
lang.text = if (extension !is Extension.Untrusted) {
|
lang.text = LocaleHelper.getSourceDisplayName(extension.lang, itemView.context)
|
||||||
LocaleHelper.getSourceDisplayName(extension.lang, itemView.context)
|
warning.text = when {
|
||||||
} else {
|
extension is Extension.Untrusted -> itemView.context.getString(R.string.ext_untrusted).toUpperCase()
|
||||||
itemView.context.getString(R.string.ext_untrusted).toUpperCase()
|
extension is Extension.Installed && extension.isObsolete -> itemView.context.getString(R.string.ext_obsolete).toUpperCase()
|
||||||
|
extension is Extension.Installed && extension.isUnofficial -> itemView.context.getString(R.string.ext_unofficial).toUpperCase()
|
||||||
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
GlideApp.with(itemView.context).clear(image)
|
GlideApp.with(itemView.context).clear(image)
|
||||||
@ -63,8 +64,6 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) :
|
|||||||
isEnabled = true
|
isEnabled = true
|
||||||
isClickable = true
|
isClickable = true
|
||||||
|
|
||||||
setTextColor(context.getResourceColor(R.attr.colorAccent))
|
|
||||||
|
|
||||||
val extension = item.extension
|
val extension = item.extension
|
||||||
|
|
||||||
val installStep = item.installStep
|
val installStep = item.installStep
|
||||||
@ -87,16 +86,8 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) :
|
|||||||
extension.hasUpdate -> {
|
extension.hasUpdate -> {
|
||||||
setText(R.string.ext_update)
|
setText(R.string.ext_update)
|
||||||
}
|
}
|
||||||
extension.isObsolete -> {
|
|
||||||
setTextColor(context.getResourceColor(R.attr.colorError))
|
|
||||||
setText(R.string.ext_obsolete)
|
|
||||||
}
|
|
||||||
extension.isUnofficial -> {
|
|
||||||
setTextColor(context.getResourceColor(R.attr.colorError))
|
|
||||||
setText(R.string.ext_unofficial)
|
|
||||||
}
|
|
||||||
else -> {
|
else -> {
|
||||||
setText(R.string.ext_details)
|
setText(R.string.action_settings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (extension is Extension.Untrusted) {
|
} else if (extension is Extension.Untrusted) {
|
||||||
|
@ -64,6 +64,19 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/ext_title"
|
app:layout_constraintTop_toBottomOf="@+id/ext_title"
|
||||||
tools:text="Version" />
|
tools:text="Version" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/warning"
|
||||||
|
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="?attr/colorError"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/version"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/ext_title"
|
||||||
|
tools:text="Warning" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/ext_button"
|
android:id="@+id/ext_button"
|
||||||
style="@style/Theme.Widget.Button"
|
style="@style/Theme.Widget.Button"
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:background="@color/red_error"
|
android:background="?attr/colorError"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="?attr/colorOnError"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
@ -205,7 +205,6 @@
|
|||||||
|
|
||||||
<!-- Extension section -->
|
<!-- Extension section -->
|
||||||
<string name="all_lang">All</string>
|
<string name="all_lang">All</string>
|
||||||
<string name="ext_details">Details</string>
|
|
||||||
<string name="ext_updates_pending">Updates pending</string>
|
<string name="ext_updates_pending">Updates pending</string>
|
||||||
<string name="ext_update">Update</string>
|
<string name="ext_update">Update</string>
|
||||||
<string name="ext_obsolete">Obsolete</string>
|
<string name="ext_obsolete">Obsolete</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user