UI tweaks

This commit is contained in:
NoodleMage 2016-05-13 15:45:36 +02:00
parent 48a1e8f74c
commit 575eaee1d2
19 changed files with 298 additions and 186 deletions

View File

@ -14,8 +14,6 @@ import eu.kanade.tachiyomi.ui.download.DownloadFragment
import eu.kanade.tachiyomi.ui.library.LibraryFragment import eu.kanade.tachiyomi.ui.library.LibraryFragment
import eu.kanade.tachiyomi.ui.recent.RecentChaptersFragment import eu.kanade.tachiyomi.ui.recent.RecentChaptersFragment
import eu.kanade.tachiyomi.ui.setting.SettingsActivity 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.activity_main.*
import kotlinx.android.synthetic.main.toolbar.* import kotlinx.android.synthetic.main.toolbar.*
@ -45,8 +43,7 @@ class MainActivity : BaseActivity() {
// Set behavior of Navigation drawer // Set behavior of Navigation drawer
nav_view.setNavigationItemSelectedListener { item -> nav_view.setNavigationItemSelectedListener { item ->
// Make information view invisible // Make information view invisible
image_view.setImageResource(android.R.color.transparent) empty_view.hide()
text_label.text = ""
when (item.itemId) { when (item.itemId) {
R.id.nav_drawer_library -> setFragment(LibraryFragment.newInstance()) R.id.nav_drawer_library -> setFragment(LibraryFragment.newInstance())
@ -91,12 +88,6 @@ class MainActivity : BaseActivity() {
} }
fun updateEmptyView(show: Boolean, textResource: Int, drawable: Int) { fun updateEmptyView(show: Boolean, textResource: Int, drawable: Int) {
if (show) { if (show) empty_view.show(drawable, textResource) else empty_view.hide()
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 = ""
}
} }
} }

View File

@ -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
}
}

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorAccentDark"
>
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/selectorColorDark"/>
</item>
<item android:state_activated="true">
<color android:color="@color/selectorColorDark"/>
</item>
<item>
<color android:color="@color/backgroundDark"/>
</item>
</selector>
</item>
</ripple>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorAccentLight"
>
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/selectorColorLight"/>
</item>
<item android:state_activated="true">
<color android:color="@color/selectorColorLight"/>
</item>
<item>
<color android:color="@color/backgroundLight"/>
</item>
</selector>
</item>
</ripple>

View File

@ -14,7 +14,7 @@
</item> </item>
<item> <item>
<color android:color="@color/backgroundDark" /> <color android:color="@color/dialogDark"/>
</item> </item>
</selector> </selector>
</item> </item>

View File

@ -14,7 +14,7 @@
</item> </item>
<item> <item>
<color android:color="@color/backgroundLight" /> <color android:color="@color/dialogLight"/>
</item> </item>
</selector> </selector>
</item> </item>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector android:exitFadeDuration="@android:integer/config_longAnimTime"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@color/selectorColorDark"/>
<item android:state_pressed="true" android:drawable="@color/selectorColorDark"/>
<item android:state_activated="true" android:drawable="@color/selectorColorDark"/>
<item android:drawable="@color/backgroundDark"/>
</selector>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--<selector android:exitFadeDuration="@android:integer/config_longAnimTime"-->
<!--xmlns:android="http://schemas.android.com/apk/res/android">-->
<!--<item android:state_focused="true" android:drawable="?attr/colorAccent"/>-->
<!--<item android:state_pressed="true" android:drawable="?attr/colorAccent"/>-->
<!--<item android:state_activated="true" android:drawable="?attr/colorAccent"/>-->
<!--<item android:drawable="?android:attr/colorBackground"/>-->
<!--</selector>-->
<selector android:exitFadeDuration="@android:integer/config_longAnimTime"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@color/selectorColorLight"/>
<item android:state_pressed="true" android:drawable="@color/selectorColorLight"/>
<item android:state_activated="true" android:drawable="@color/selectorColorLight"/>
<item android:drawable="@color/backgroundLight"/>
</selector>

View File

@ -5,6 +5,6 @@
<item android:state_focused="true" android:drawable="@color/selectorColorDark"/> <item android:state_focused="true" android:drawable="@color/selectorColorDark"/>
<item android:state_pressed="true" android:drawable="@color/selectorColorDark"/> <item android:state_pressed="true" android:drawable="@color/selectorColorDark"/>
<item android:state_activated="true" android:drawable="@color/selectorColorDark"/> <item android:state_activated="true" android:drawable="@color/selectorColorDark"/>
<item android:drawable="@android:color/background_dark"/> <item android:drawable="@color/dialogDark"/>
</selector> </selector>

View File

@ -14,6 +14,6 @@
<item android:state_focused="true" android:drawable="@color/selectorColorLight"/> <item android:state_focused="true" android:drawable="@color/selectorColorLight"/>
<item android:state_pressed="true" android:drawable="@color/selectorColorLight"/> <item android:state_pressed="true" android:drawable="@color/selectorColorLight"/>
<item android:state_activated="true" android:drawable="@color/selectorColorLight"/> <item android:state_activated="true" android:drawable="@color/selectorColorLight"/>
<item android:drawable="@color/backgroundLight"/> <item android:drawable="@color/dialogLight"/>
</selector> </selector>

View File

@ -41,27 +41,12 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@id/appbar"> android:layout_below="@id/appbar">
<RelativeLayout <eu.kanade.tachiyomi.widget.EmptyView
android:id="@+id/information_layout" android:id="@+id/empty_view"
android:visibility="gone"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_gravity="center"
android:layout_gravity="center"> android:layout_height="wrap_content"/>
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image_view"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_centerHorizontal="true"/>
<TextView
android:id="@+id/text_label"
style="@style/TextAppearance.Medium.Body2.Hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/image_view"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
</FrameLayout> </FrameLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -1,9 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cv_mal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_margin="@dimen/card_margin"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/card_margin">
<RelativeLayout <RelativeLayout
android:id="@+id/myanimelist_title_layout" android:id="@+id/myanimelist_title_layout"
@ -15,20 +23,20 @@
android:paddingRight="?android:listPreferredItemPaddingRight"> android:paddingRight="?android:listPreferredItemPaddingRight">
<TextView <TextView
style="@style/TextAppearance.Regular.Body1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:text="Title" android:text="Title"/>
style="@style/TextAppearance.Regular.Body1"/>
<TextView <TextView
android:id="@+id/myanimelist_title" android:id="@+id/myanimelist_title"
style="@style/TextAppearance.Medium.Button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:text="@string/action_edit" android:text="@string/action_edit"/>
style="@style/TextAppearance.Medium.Button"/>
</RelativeLayout> </RelativeLayout>
@ -37,7 +45,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_below="@id/myanimelist_title_layout" android:layout_below="@id/myanimelist_title_layout"
android:background="?android:attr/divider" /> android:background="?android:attr/divider"/>
<RelativeLayout <RelativeLayout
android:id="@+id/myanimelist_status_layout" android:id="@+id/myanimelist_status_layout"
@ -51,20 +59,20 @@
> >
<TextView <TextView
style="@style/TextAppearance.Regular.Body1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:text="Status" android:text="Status"/>
style="@style/TextAppearance.Regular.Body1"/>
<TextView <TextView
android:id="@+id/myanimelist_status" android:id="@+id/myanimelist_status"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
tools:text="Reading" tools:text="Reading"/>
style="@style/TextAppearance.Regular.Body1.Secondary"/>
</RelativeLayout> </RelativeLayout>
@ -73,7 +81,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_below="@id/myanimelist_status_layout" android:layout_below="@id/myanimelist_status_layout"
android:background="?android:attr/divider" /> android:background="?android:attr/divider"/>
<RelativeLayout <RelativeLayout
android:id="@+id/myanimelist_chapters_layout" android:id="@+id/myanimelist_chapters_layout"
@ -86,20 +94,20 @@
android:paddingRight="?android:listPreferredItemPaddingRight"> android:paddingRight="?android:listPreferredItemPaddingRight">
<TextView <TextView
style="@style/TextAppearance.Regular.Body1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:text="Chapters" android:text="Chapters"/>
style="@style/TextAppearance.Regular.Body1"/>
<TextView <TextView
android:id="@+id/myanimelist_chapters" android:id="@+id/myanimelist_chapters"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
tools:text="12/24" tools:text="12/24"/>
style="@style/TextAppearance.Regular.Body1.Secondary"/>
</RelativeLayout> </RelativeLayout>
@ -108,7 +116,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_below="@id/myanimelist_chapters_layout" android:layout_below="@id/myanimelist_chapters_layout"
android:background="?android:attr/divider" /> android:background="?android:attr/divider"/>
<RelativeLayout <RelativeLayout
android:id="@+id/myanimelist_score_layout" android:id="@+id/myanimelist_score_layout"
@ -121,22 +129,23 @@
android:paddingRight="?android:listPreferredItemPaddingRight"> android:paddingRight="?android:listPreferredItemPaddingRight">
<TextView <TextView
style="@style/TextAppearance.Regular.Body1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:text="@string/score" android:text="@string/score"/>
style="@style/TextAppearance.Regular.Body1"/>
<TextView <TextView
android:id="@+id/myanimelist_score" android:id="@+id/myanimelist_score"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
tools:text="10" tools:text="10"/>
style="@style/TextAppearance.Regular.Body1.Secondary"/>
</RelativeLayout> </RelativeLayout>
</RelativeLayout>
</RelativeLayout> </android.support.v7.widget.CardView>

View File

@ -4,24 +4,14 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical">
android:paddingBottom="@dimen/margin_bottom"
android:paddingLeft="@dimen/margin_left"
android:paddingRight="@dimen/margin_right"
android:paddingTop="@dimen/margin_top">
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/card_myanimelist_personal"/> <include layout="@layout/card_myanimelist_personal"/>
</android.support.v7.widget.CardView>
</ScrollView> </ScrollView>
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>

View File

@ -5,7 +5,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectable_list_drawable"> android:background="?attr/selectable_library_drawable">
<FrameLayout <FrameLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -26,7 +26,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@drawable/gradient_shape" /> android:background="@drawable/gradient_shape"/>
<TextView <TextView
android:id="@+id/unread_text" android:id="@+id/unread_text"

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image_view"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_centerHorizontal="true"/>
<TextView
android:id="@+id/text_label"
style="@style/TextAppearance.Medium.Body2.Hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/image_view"
android:layout_centerHorizontal="true"/>
</RelativeLayout>

View File

@ -19,5 +19,6 @@
<attr name="navigation_view_theme" format="reference"/> <attr name="navigation_view_theme" format="reference"/>
<attr name="selectable_list_drawable" format="reference|integer" /> <attr name="selectable_list_drawable" format="reference|integer" />
<attr name="selectable_library_drawable" format="reference|integer"/>
<attr name="divider_drawable" format="reference|integer" /> <attr name="divider_drawable" format="reference|integer" />
</resources> </resources>

View File

@ -7,6 +7,7 @@
<dimen name="margin_left">16dp</dimen> <dimen name="margin_left">16dp</dimen>
<dimen name="margin_right">16dp</dimen> <dimen name="margin_right">16dp</dimen>
<dimen name="fab_margin">16dp</dimen> <dimen name="fab_margin">16dp</dimen>
<dimen name="card_margin">16dp</dimen>
<dimen name="fab_size">56dp</dimen> <dimen name="fab_size">56dp</dimen>
<dimen name="dialog_content_padding">24dp</dimen> <dimen name="dialog_content_padding">24dp</dimen>

View File

@ -4,11 +4,14 @@
<!--========--> <!--========-->
<!--Toolbars--> <!--Toolbars-->
<!--========--> <!--========-->
<style name="Theme.ActionBar" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <style name="Theme.ActionBar" parent="@style/ThemeOverlay.AppCompat.ActionBar">
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="android:spinnerDropDownItemStyle">@style/ActionBarSpinnerItem</item> <item name="android:spinnerDropDownItemStyle">@style/ActionBarSpinnerItem</item>
</style> </style>
<style name="Theme.ActionBar.Light" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
<!--====--> <!--====-->
<!--Tabs--> <!--Tabs-->
<!--====--> <!--====-->

View File

@ -25,13 +25,12 @@
<!-- Themes --> <!-- Themes -->
<item name="windowActionModeOverlay">true</item> <item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">?colorPrimaryDark</item> <item name="actionBarTheme">@style/Theme.ActionBar.Light</item>
<item name="actionBarTheme">@style/Theme.ActionBar</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<!-- Custom Attributes--> <!-- Custom Attributes-->
<item name="selectable_list_drawable">@drawable/list_item_selector_light</item> <item name="selectable_list_drawable">@drawable/list_item_selector_light</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_light</item>
<item name="divider_drawable">@drawable/line_divider_light</item> <item name="divider_drawable">@drawable/line_divider_light</item>
</style> </style>
@ -58,7 +57,6 @@
<!-- Themes --> <!-- Themes -->
<item name="windowActionModeOverlay">true</item> <item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">?colorPrimaryDark</item>
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat</item> <item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
@ -66,6 +64,7 @@
<!-- Custom Attributes--> <!-- Custom Attributes-->
<item name="navigation_view_theme">@style/Theme.Widget.NavigationView.Dark</item> <item name="navigation_view_theme">@style/Theme.Widget.NavigationView.Dark</item>
<item name="selectable_list_drawable">@drawable/list_item_selector_dark</item> <item name="selectable_list_drawable">@drawable/list_item_selector_dark</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_dark</item>
<item name="divider_drawable">@drawable/line_divider_dark</item> <item name="divider_drawable">@drawable/line_divider_dark</item>
</style> </style>