Random kaomoji for empty view
This commit is contained in:
parent
d5ff5fd6f8
commit
d7d3731567
@ -120,7 +120,7 @@ class CategoryController : NucleusController<CategoryPresenter>(),
|
|||||||
selected.forEach { onItemLongClick(categories.indexOf(it)) }
|
selected.forEach { onItemLongClick(categories.indexOf(it)) }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
empty_view.show(R.drawable.ic_shape_black_128dp, R.string.information_empty_category)
|
empty_view.show(R.string.information_empty_category)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,8 +242,7 @@ class DownloadController : NucleusController<DownloadPresenter>() {
|
|||||||
*/
|
*/
|
||||||
private fun setInformationView() {
|
private fun setInformationView() {
|
||||||
if (presenter.downloadQueue.isEmpty()) {
|
if (presenter.downloadQueue.isEmpty()) {
|
||||||
empty_view?.show(R.drawable.ic_file_download_black_128dp,
|
empty_view?.show(R.string.information_no_downloads)
|
||||||
R.string.information_no_downloads)
|
|
||||||
} else {
|
} else {
|
||||||
empty_view?.hide()
|
empty_view?.hide()
|
||||||
}
|
}
|
||||||
|
@ -112,8 +112,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
extension_prefs_recycler.addItemDecoration(DividerItemDecoration(context, VERTICAL))
|
extension_prefs_recycler.addItemDecoration(DividerItemDecoration(context, VERTICAL))
|
||||||
|
|
||||||
if (screen.preferenceCount == 0) {
|
if (screen.preferenceCount == 0) {
|
||||||
extension_prefs_empty_view.show(R.drawable.ic_no_settings,
|
extension_prefs_empty_view.show(R.string.ext_empty_preferences)
|
||||||
R.string.ext_empty_preferences)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ class LibraryController(
|
|||||||
if (mangaMap.isNotEmpty()) {
|
if (mangaMap.isNotEmpty()) {
|
||||||
empty_view.hide()
|
empty_view.hide()
|
||||||
} else {
|
} else {
|
||||||
empty_view.show(R.drawable.ic_book_black_128dp, R.string.information_empty_library)
|
empty_view.show(R.string.information_empty_library)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the current active category.
|
// Get the current active category.
|
||||||
|
@ -81,7 +81,7 @@ class HistoryController : NucleusController<HistoryPresenter>(),
|
|||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
empty_view.hide()
|
empty_view.hide()
|
||||||
} else {
|
} else {
|
||||||
empty_view.show(R.drawable.ic_history_black_128dp, R.string.information_no_recent_manga)
|
empty_view.show(R.string.information_no_recent_manga)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ class UpdatesController : NucleusController<UpdatesPresenter>(),
|
|||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
empty_view?.hide()
|
empty_view?.hide()
|
||||||
} else {
|
} else {
|
||||||
empty_view?.show(R.drawable.ic_new_releases_black_128dp, R.string.information_no_recent)
|
empty_view?.show(R.string.information_no_recent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,12 +2,13 @@ package eu.kanade.tachiyomi.widget
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
|
import androidx.annotation.StringRes
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import kotlinx.android.synthetic.main.common_view_empty.view.image_view
|
import kotlin.random.Random
|
||||||
|
import kotlinx.android.synthetic.main.common_view_empty.view.text_face
|
||||||
import kotlinx.android.synthetic.main.common_view_empty.view.text_label
|
import kotlinx.android.synthetic.main.common_view_empty.view.text_label
|
||||||
|
|
||||||
class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||||
@ -21,17 +22,31 @@ class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
|||||||
* Hide the information view
|
* Hide the information view
|
||||||
*/
|
*/
|
||||||
fun hide() {
|
fun hide() {
|
||||||
this.visibility = View.GONE
|
this.gone()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the information view
|
* Show the information view
|
||||||
* @param drawable icon of information view
|
|
||||||
* @param textResource text of information view
|
* @param textResource text of information view
|
||||||
*/
|
*/
|
||||||
fun show(drawable: Int, textResource: Int) {
|
fun show(@StringRes textResource: Int) {
|
||||||
image_view.setVectorCompat(drawable, context.getResourceColor(android.R.attr.textColorHint))
|
text_face.text = getRandomErrorFace()
|
||||||
text_label.text = context.getString(textResource)
|
text_label.text = context.getString(textResource)
|
||||||
this.visibility = View.VISIBLE
|
this.visible()
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val ERROR_FACES = listOf(
|
||||||
|
"(・o・;)",
|
||||||
|
"Σ(ಠ_ಠ)",
|
||||||
|
"ಥ_ಥ",
|
||||||
|
"(˘・_・˘)",
|
||||||
|
"(; ̄Д ̄)",
|
||||||
|
"(・Д・。"
|
||||||
|
)
|
||||||
|
|
||||||
|
fun getRandomErrorFace(): String {
|
||||||
|
return ERROR_FACES[Random.nextInt(ERROR_FACES.size)]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="128dp"
|
|
||||||
android:height="128dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M18,2H6c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zM6,4h5v8l-2.5,-1.5L6,12V4z"/>
|
|
||||||
</vector>
|
|
@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="128dp"
|
|
||||||
android:height="128dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
|
|
||||||
</vector>
|
|
@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="128dp"
|
|
||||||
android:height="128dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z" />
|
|
||||||
</vector>
|
|
@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="128dp"
|
|
||||||
android:height="128dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M23,12l-2.44,-2.78 0.34,-3.68 -3.61,-0.82 -1.89,-3.18L12,3 8.6,1.54 6.71,4.72l-3.61,0.81 0.34,3.68L1,12l2.44,2.78 -0.34,3.69 3.61,0.82 1.89,3.18L12,21l3.4,1.46 1.89,-3.18 3.61,-0.82 -0.34,-3.68L23,12zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z" />
|
|
||||||
</vector>
|
|
@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M9.165,11.554C9.124,11.767 9.103,11.984 9.103,12.201 9.102,13.233 9.57,14.21 10.374,14.857 11.179,15.504 12.234,15.751 13.242,15.528ZM20.732,17.246L15.89,12.537C15.902,12.426 15.907,12.315 15.907,12.203 15.908,11.3 15.55,10.434 14.912,9.796 14.273,9.158 13.408,8.799 12.505,8.799c-0.142,0 -0.285,0.009 -0.426,0.026L8.866,5.698C9.157,5.523 9.462,5.372 9.778,5.247L10.137,2.671C10.175,2.432 10.381,2.256 10.623,2.256l3.881,0c0.24,-0.001 0.445,0.171 0.486,0.407L15.348,5.247c0.588,0.242 1.14,0.563 1.641,0.953l2.415,-0.972c0.221,-0.089 0.474,-0.001 0.593,0.206l1.94,3.365c0.118,0.209 0.065,0.473 -0.123,0.621L19.775,11.005c0.041,0.322 0.063,0.647 0.067,0.972 -0.004,0.313 -0.026,0.625 -0.067,0.935L21.814,14.534c0.186,0.15 0.235,0.413 0.116,0.621zM3.432,3.191L10.468,10.048 15.763,15.201 21.066,20.355 19.627,21.744 16.126,18.332c-0.251,0.142 -0.51,0.267 -0.778,0.374l-0.359,2.576c-0.041,0.236 -0.246,0.408 -0.486,0.407L10.623,21.689c-0.24,0.001 -0.445,-0.171 -0.486,-0.407L9.778,18.706C9.189,18.464 8.637,18.14 8.139,17.743L5.722,18.725C5.5,18.809 5.251,18.722 5.129,18.519L3.189,15.154C3.066,14.948 3.116,14.682 3.305,14.534l2.056,-1.615c-0.043,-0.31 -0.066,-0.622 -0.069,-0.935 0.004,-0.325 0.027,-0.65 0.069,-0.972l-2.056,-1.585C3.112,9.278 3.062,9.007 3.189,8.799l1.122,-1.961L2,4.58Z"/>
|
|
||||||
</vector>
|
|
@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="128dp"
|
|
||||||
android:height="128dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M11,13.5V21.5H3V13.5H11M12,2L17.5,11H6.5L12,2M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13Z" />
|
|
||||||
</vector>
|
|
@ -2,22 +2,29 @@
|
|||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_gravity="center">
|
android:layout_gravity="center">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<TextView
|
||||||
android:id="@+id/image_view"
|
android:id="@+id/text_face"
|
||||||
android:layout_width="128dp"
|
style="@style/TextAppearance.Medium.Body2.Hint"
|
||||||
android:layout_height="128dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_centerHorizontal="true" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="48sp"
|
||||||
|
tools:text="-_-" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_label"
|
android:id="@+id/text_label"
|
||||||
style="@style/TextAppearance.Medium.Body2.Hint"
|
style="@style/TextAppearance.Medium.Body2.Hint"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/image_view"
|
android:layout_below="@+id/text_face"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:gravity="center" />
|
android:gravity="center"
|
||||||
|
tools:text="Label" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user