Merge pull request #303 from NoodleMage/myanimelist_cardview

UI tweaks
This commit is contained in:
inorichi 2016-05-21 17:45:49 +02:00
commit 02e43bafd6
23 changed files with 365 additions and 231 deletions

View File

@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.ui.main
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.view.GravityCompat
@ -14,8 +13,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.*
@ -31,22 +28,17 @@ class MainActivity : BaseActivity() {
return
}
// Inflate activity_edit_categories.xml.
// Inflate activity_main.xml.
setContentView(R.layout.activity_main)
// Handle Toolbar
setupToolbar(toolbar, backNavigation = false)
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp)
if (Build.VERSION.SDK_INT >= 21) {
window.statusBarColor = android.R.color.transparent
}
// 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 +83,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()
}
}

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>
<color android:color="@color/backgroundDark" />
<color android:color="@color/dialogDark"/>
</item>
</selector>
</item>

View File

@ -14,7 +14,7 @@
</item>
<item>
<color android:color="@color/backgroundLight" />
<color android:color="@color/dialogLight"/>
</item>
</selector>
</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_pressed="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>

View File

@ -14,6 +14,6 @@
<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"/>
<item android:drawable="@color/dialogLight"/>
</selector>

View File

@ -5,7 +5,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
android:gravity="center"
android:fitsSystemWindows="true">
<include layout="@layout/toolbar"/>

View File

@ -41,27 +41,12 @@
android:layout_height="match_parent"
android:layout_below="@id/appbar">
<RelativeLayout
android:id="@+id/information_layout"
<eu.kanade.tachiyomi.widget.EmptyView
android:id="@+id/empty_view"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<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>
android:layout_gravity="center"
android:layout_height="wrap_content"/>
</FrameLayout>
</RelativeLayout>

View File

@ -1,9 +1,16 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="eu.kanade.tachiyomi.ui.manga.MangaActivity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context="eu.kanade.tachiyomi.ui.manga.MangaActivity">
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
@ -29,4 +36,6 @@
android:layout_height="0px"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -1,16 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/toolbar"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/settings_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>

View File

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

View File

@ -4,24 +4,14 @@
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">
<ScrollView
android:layout_width="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"/>
</android.support.v7.widget.CardView>
</ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>

View File

@ -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">
<FrameLayout
android:layout_width="wrap_content"
@ -26,7 +26,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/gradient_shape" />
android:background="@drawable/gradient_shape"/>
<TextView
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

@ -6,7 +6,7 @@
<style name="Theme.Tachiyomi" parent="Theme.Base">
<!-- Attributes specific for SDK 21 and up -->
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
<item name="android:alertDialogTheme">@style/Theme.AlertDialog.Light</item>
</style>
@ -17,7 +17,7 @@
<style name="Theme.Tachiyomi.Dark" parent="Theme.Base.Dark">
<!-- Attributes specific for SDK 21 and up -->
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
<item name="android:alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
</style>

View File

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

View File

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

View File

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

View File

@ -25,13 +25,12 @@
<!-- Themes -->
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">?colorPrimaryDark</item>
<item name="actionBarTheme">@style/Theme.ActionBar</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="actionBarTheme">@style/Theme.ActionBar.Light</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<!-- Custom Attributes-->
<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>
</style>
@ -58,7 +57,6 @@
<!-- Themes -->
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">?colorPrimaryDark</item>
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
@ -66,6 +64,7 @@
<!-- Custom Attributes-->
<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_library_drawable">@drawable/library_item_selector_dark</item>
<item name="divider_drawable">@drawable/line_divider_dark</item>
</style>