From 575eaee1d2570f44b9dd8f44dc4227bce038e895 Mon Sep 17 00:00:00 2001 From: NoodleMage Date: Fri, 13 May 2016 15:45:36 +0200 Subject: [PATCH] UI tweaks --- .../kanade/tachiyomi/ui/main/MainActivity.kt | 13 +- .../eu/kanade/tachiyomi/widget/EmptyView.kt | 36 +++ .../library_item_selector_dark.xml | 23 ++ .../library_item_selector_light.xml | 23 ++ .../drawable-v21/list_item_selector_dark.xml | 2 +- .../drawable-v21/list_item_selector_light.xml | 2 +- .../drawable/library_item_selector_dark.xml | 10 + .../drawable/library_item_selector_light.xml | 19 ++ .../res/drawable/list_item_selector_dark.xml | 2 +- .../res/drawable/list_item_selector_light.xml | 2 +- app/src/main/res/layout/activity_main.xml | 25 +- .../res/layout/card_myanimelist_personal.xml | 269 +++++++++--------- .../main/res/layout/fragment_myanimelist.xml | 14 +- .../main/res/layout/item_catalogue_grid.xml | 4 +- app/src/main/res/layout/view_empty.xml | 22 ++ app/src/main/res/values/attrs.xml | 3 +- app/src/main/res/values/dimens.xml | 1 + app/src/main/res/values/styles.xml | 7 +- app/src/main/res/values/themes.xml | 7 +- 19 files changed, 298 insertions(+), 186 deletions(-) create mode 100644 app/src/main/java/eu/kanade/tachiyomi/widget/EmptyView.kt create mode 100644 app/src/main/res/drawable-v21/library_item_selector_dark.xml create mode 100644 app/src/main/res/drawable-v21/library_item_selector_light.xml create mode 100644 app/src/main/res/drawable/library_item_selector_dark.xml create mode 100644 app/src/main/res/drawable/library_item_selector_light.xml create mode 100644 app/src/main/res/layout/view_empty.xml diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index eea2358b2f..7252e5ecae 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -14,8 +14,6 @@ import eu.kanade.tachiyomi.ui.download.DownloadFragment import eu.kanade.tachiyomi.ui.library.LibraryFragment import eu.kanade.tachiyomi.ui.recent.RecentChaptersFragment import eu.kanade.tachiyomi.ui.setting.SettingsActivity -import eu.kanade.tachiyomi.util.getResourceColor -import eu.kanade.tachiyomi.util.setVectorCompat import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.toolbar.* @@ -45,8 +43,7 @@ class MainActivity : BaseActivity() { // Set behavior of Navigation drawer nav_view.setNavigationItemSelectedListener { item -> // Make information view invisible - image_view.setImageResource(android.R.color.transparent) - text_label.text = "" + empty_view.hide() when (item.itemId) { R.id.nav_drawer_library -> setFragment(LibraryFragment.newInstance()) @@ -91,12 +88,6 @@ class MainActivity : BaseActivity() { } fun updateEmptyView(show: Boolean, textResource: Int, drawable: Int) { - if (show) { - image_view.setVectorCompat(drawable, theme.getResourceColor(android.R.attr.textColorHint)) - text_label.text = getString(textResource) - } else { - image_view.setImageResource(android.R.color.transparent) - text_label.text = "" - } + if (show) empty_view.show(drawable, textResource) else empty_view.hide() } } \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/EmptyView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/EmptyView.kt new file mode 100644 index 0000000000..0a3e8eb236 --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/EmptyView.kt @@ -0,0 +1,36 @@ +package eu.kanade.tachiyomi.widget + +import android.content.Context +import android.util.AttributeSet +import android.view.View +import android.widget.RelativeLayout +import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.util.getResourceColor +import eu.kanade.tachiyomi.util.setVectorCompat +import kotlinx.android.synthetic.main.view_empty.view.* + +class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : + RelativeLayout (context, attrs) { + + init { + inflate(context, R.layout.view_empty, this) + } + + /** + * Hide the information view + */ + fun hide() { + this.visibility = View.GONE + } + + /** + * Show the information view + * @param drawable icon of information view + * @param textResource text of information view + */ + fun show(drawable: Int, textResource: Int) { + image_view.setVectorCompat(drawable, context.theme.getResourceColor(android.R.attr.textColorHint)) + text_label.text = context.getString(textResource) + this.visibility = View.VISIBLE + } +} diff --git a/app/src/main/res/drawable-v21/library_item_selector_dark.xml b/app/src/main/res/drawable-v21/library_item_selector_dark.xml new file mode 100644 index 0000000000..e78c6ec16e --- /dev/null +++ b/app/src/main/res/drawable-v21/library_item_selector_dark.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-v21/library_item_selector_light.xml b/app/src/main/res/drawable-v21/library_item_selector_light.xml new file mode 100644 index 0000000000..c85ee39136 --- /dev/null +++ b/app/src/main/res/drawable-v21/library_item_selector_light.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-v21/list_item_selector_dark.xml b/app/src/main/res/drawable-v21/list_item_selector_dark.xml index d1152832e7..3757b9bf58 100644 --- a/app/src/main/res/drawable-v21/list_item_selector_dark.xml +++ b/app/src/main/res/drawable-v21/list_item_selector_dark.xml @@ -14,7 +14,7 @@ - + diff --git a/app/src/main/res/drawable-v21/list_item_selector_light.xml b/app/src/main/res/drawable-v21/list_item_selector_light.xml index d17e5bf434..ab9d9b675b 100644 --- a/app/src/main/res/drawable-v21/list_item_selector_light.xml +++ b/app/src/main/res/drawable-v21/list_item_selector_light.xml @@ -14,7 +14,7 @@ - + diff --git a/app/src/main/res/drawable/library_item_selector_dark.xml b/app/src/main/res/drawable/library_item_selector_dark.xml new file mode 100644 index 0000000000..73de4df076 --- /dev/null +++ b/app/src/main/res/drawable/library_item_selector_dark.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/app/src/main/res/drawable/library_item_selector_light.xml b/app/src/main/res/drawable/library_item_selector_light.xml new file mode 100644 index 0000000000..9273e00fe3 --- /dev/null +++ b/app/src/main/res/drawable/library_item_selector_light.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/list_item_selector_dark.xml b/app/src/main/res/drawable/list_item_selector_dark.xml index 2607d316f3..97a1086633 100644 --- a/app/src/main/res/drawable/list_item_selector_dark.xml +++ b/app/src/main/res/drawable/list_item_selector_dark.xml @@ -5,6 +5,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/list_item_selector_light.xml b/app/src/main/res/drawable/list_item_selector_light.xml index 4cb278d904..a33b89da0c 100644 --- a/app/src/main/res/drawable/list_item_selector_light.xml +++ b/app/src/main/res/drawable/list_item_selector_light.xml @@ -14,6 +14,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index f631b1d5e8..f657d1dc01 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -41,27 +41,12 @@ android:layout_height="match_parent" android:layout_below="@id/appbar"> - - - - - - - + android:layout_gravity="center" + android:layout_height="wrap_content"/> diff --git a/app/src/main/res/layout/card_myanimelist_personal.xml b/app/src/main/res/layout/card_myanimelist_personal.xml index d071cde750..6a6141447b 100644 --- a/app/src/main/res/layout/card_myanimelist_personal.xml +++ b/app/src/main/res/layout/card_myanimelist_personal.xml @@ -1,142 +1,151 @@ - + android:layout_height="wrap_content" + android:layout_margin="@dimen/card_margin" + > + android:layout_height="wrap_content" + android:padding="@dimen/card_margin"> - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_myanimelist.xml b/app/src/main/res/layout/fragment_myanimelist.xml index 76d5fcfb41..233a3cb181 100644 --- a/app/src/main/res/layout/fragment_myanimelist.xml +++ b/app/src/main/res/layout/fragment_myanimelist.xml @@ -4,23 +4,13 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" - android:paddingBottom="@dimen/margin_bottom" - android:paddingLeft="@dimen/margin_left" - android:paddingRight="@dimen/margin_right" - android:paddingTop="@dimen/margin_top"> + android:orientation="vertical"> - - - - - + diff --git a/app/src/main/res/layout/item_catalogue_grid.xml b/app/src/main/res/layout/item_catalogue_grid.xml index ba1ffcb5c3..4027c126c8 100644 --- a/app/src/main/res/layout/item_catalogue_grid.xml +++ b/app/src/main/res/layout/item_catalogue_grid.xml @@ -5,7 +5,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?attr/selectable_list_drawable"> + android:background="?attr/selectable_library_drawable"> + android:background="@drawable/gradient_shape"/> + + + + + + + diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 515647a5d4..450783da10 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -19,5 +19,6 @@ + - \ No newline at end of file + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index c97adead63..28bfe22127 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -7,6 +7,7 @@ 16dp 16dp 16dp + 16dp 56dp 24dp diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 00d8fffec3..975aef2275 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -4,11 +4,14 @@ - + + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 8518fd71fd..4994a7c86e 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -25,13 +25,12 @@ true - ?colorPrimaryDark - @style/Theme.ActionBar - @style/ThemeOverlay.AppCompat.Light + @style/Theme.ActionBar.Light @style/PreferenceThemeOverlay.v14.Material @drawable/list_item_selector_light + @drawable/library_item_selector_light @drawable/line_divider_light @@ -58,7 +57,6 @@ true - ?colorPrimaryDark @style/ThemeOverlay.AppCompat.Dark.ActionBar @style/ThemeOverlay.AppCompat @style/PreferenceThemeOverlay.v14.Material @@ -66,6 +64,7 @@ @style/Theme.Widget.NavigationView.Dark @drawable/list_item_selector_dark + @drawable/library_item_selector_dark @drawable/line_divider_dark