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 eea2358b2..7252e5eca 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 000000000..0a3e8eb23 --- /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 000000000..e78c6ec16 --- /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 000000000..c85ee3913 --- /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 d1152832e..3757b9bf5 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 d17e5bf43..ab9d9b675 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 000000000..73de4df07 --- /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 000000000..9273e00fe --- /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 2607d316f..97a108663 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 4cb278d90..a33b89da0 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 f631b1d5e..f657d1dc0 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 d071cde75..6a6141447 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 76d5fcfb4..233a3cb18 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 ba1ffcb5c..4027c126c 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 515647a5d..450783da1 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 c97adead6..28bfe2212 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 00d8fffec..975aef227 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 8518fd71f..4994a7c86 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