From 1ece88762e4dffcb5224a72a77021257484d93b0 Mon Sep 17 00:00:00 2001 From: yangyxd Date: Fri, 20 Mar 2020 15:59:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E9=A6=96=E9=A1=B5=E5=9B=BE?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/main/MainActivity.kt | 6 +++ .../ui/main/bookshelf/BookshelfFragment.kt | 4 ++ .../main/java/io/legado/app/utils/UIUtils.kt | 27 ++++++++++++ app/src/main/res/drawable/ic_add.xml | 20 ++++----- app/src/main/res/drawable/ic_add_online.xml | 26 ++++++----- app/src/main/res/drawable/ic_arrange.xml | 38 +++++++++------- .../main/res/drawable/ic_download_line.xml | 26 +++++------ app/src/main/res/drawable/ic_groups.xml | 29 ++++-------- app/src/main/res/drawable/ic_more.xml | 15 +++++++ app/src/main/res/drawable/ic_search.xml | 17 ++++--- app/src/main/res/drawable/ic_view_quilt.xml | 44 ++++++++----------- .../main/res/layout/item_bookshelf_list.xml | 9 +--- 12 files changed, 147 insertions(+), 114 deletions(-) create mode 100644 app/src/main/java/io/legado/app/utils/UIUtils.kt create mode 100644 app/src/main/res/drawable/ic_more.xml diff --git a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt index 0aa49ede7..859f63d9e 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt @@ -1,8 +1,13 @@ package io.legado.app.ui.main +import android.graphics.drawable.Drawable +import android.os.Build import android.os.Bundle import android.view.KeyEvent import android.view.MenuItem +import android.widget.Toolbar +import androidx.annotation.RequiresApi +import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentStatePagerAdapter @@ -25,6 +30,7 @@ import io.legado.app.ui.main.rss.RssFragment import io.legado.app.ui.widget.dialog.TextDialog import io.legado.app.utils.* import kotlinx.android.synthetic.main.activity_main.* +import kotlinx.android.synthetic.main.view_title_bar.* class MainActivity : VMBaseActivity(R.layout.activity_main), BottomNavigationView.OnNavigationItemSelectedListener, diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt index 55dca8d77..ec3debf64 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt @@ -1,12 +1,15 @@ package io.legado.app.ui.main.bookshelf import android.annotation.SuppressLint +import android.os.Build import android.os.Bundle import android.view.LayoutInflater import android.view.Menu import android.view.MenuItem import android.view.View import androidx.appcompat.widget.SearchView +import androidx.appcompat.widget.Toolbar +import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentStatePagerAdapter @@ -58,6 +61,7 @@ class BookshelfFragment : VMBaseFragment(R.layout.fragment_b setSupportToolbar(toolbar) initView() initBookGroupData() + UIUtils.setToolbarMoreIconCustomColor(toolbar) } override fun onCompatCreateOptionsMenu(menu: Menu) { diff --git a/app/src/main/java/io/legado/app/utils/UIUtils.kt b/app/src/main/java/io/legado/app/utils/UIUtils.kt new file mode 100644 index 000000000..e5ffa1881 --- /dev/null +++ b/app/src/main/java/io/legado/app/utils/UIUtils.kt @@ -0,0 +1,27 @@ +package io.legado.app.utils + +import android.graphics.ColorFilter +import android.graphics.PorterDuff +import android.graphics.PorterDuffColorFilter +import android.os.Build +import androidx.appcompat.widget.Toolbar +import androidx.core.content.ContextCompat +import io.legado.app.R + +@Suppress("unused") +object UIUtils { + + /** 设置更多工具条图标和颜色 */ + fun setToolbarMoreIconCustomColor(toolbar: Toolbar, colorId: Int? = null) { + if (toolbar == null) + return + val moreIcon = ContextCompat.getDrawable(toolbar.context, R.drawable.ic_more) + if(moreIcon != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if (colorId != null ) { + moreIcon.colorFilter = PorterDuffColorFilter(ContextCompat.getColor(toolbar.context, colorId), PorterDuff.Mode.SRC_ATOP) + } + toolbar.overflowIcon = moreIcon + } + } + +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_add.xml b/app/src/main/res/drawable/ic_add.xml index c7542ba87..97328c410 100644 --- a/app/src/main/res/drawable/ic_add.xml +++ b/app/src/main/res/drawable/ic_add.xml @@ -1,11 +1,9 @@ - - - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable/ic_add_online.xml b/app/src/main/res/drawable/ic_add_online.xml index 8a3cc9b8b..c7f649fd4 100644 --- a/app/src/main/res/drawable/ic_add_online.xml +++ b/app/src/main/res/drawable/ic_add_online.xml @@ -1,11 +1,15 @@ - - - - - \ No newline at end of file + + + + + diff --git a/app/src/main/res/drawable/ic_arrange.xml b/app/src/main/res/drawable/ic_arrange.xml index ce2d50152..cf0600e77 100644 --- a/app/src/main/res/drawable/ic_arrange.xml +++ b/app/src/main/res/drawable/ic_arrange.xml @@ -1,17 +1,21 @@ - - - - - - - \ No newline at end of file + + + + + + + diff --git a/app/src/main/res/drawable/ic_download_line.xml b/app/src/main/res/drawable/ic_download_line.xml index 3b0ae72ea..7f9bcad59 100644 --- a/app/src/main/res/drawable/ic_download_line.xml +++ b/app/src/main/res/drawable/ic_download_line.xml @@ -1,14 +1,12 @@ - - - - - - \ No newline at end of file + + + + diff --git a/app/src/main/res/drawable/ic_groups.xml b/app/src/main/res/drawable/ic_groups.xml index 0ebcd4526..165d4b705 100644 --- a/app/src/main/res/drawable/ic_groups.xml +++ b/app/src/main/res/drawable/ic_groups.xml @@ -1,20 +1,9 @@ - - - - - - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable/ic_more.xml b/app/src/main/res/drawable/ic_more.xml new file mode 100644 index 000000000..b0357ce02 --- /dev/null +++ b/app/src/main/res/drawable/ic_more.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_search.xml b/app/src/main/res/drawable/ic_search.xml index b6805e004..f207ed0a4 100644 --- a/app/src/main/res/drawable/ic_search.xml +++ b/app/src/main/res/drawable/ic_search.xml @@ -1,12 +1,15 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:pathData="M11,5.49A5.49,5.49 0,1 1,7.1 7.1,5.44 5.44,0 0,1 11,5.49M11,4a7,7 0,1 0,4.94 2A7,7 0,0 0,11 4Z" + android:fillColor="#202020"/> + + android:pathData="M17.14,16.39a0.74,0.74 0,0 0,-0.53 0.22,0.75 0.75,0 0,0 0,1.06l2.11,2.11a0.74,0.74 0,0 0,0.53 0.22,0.73 0.73,0 0,0 0.53,-0.22 0.75,0.75 0,0 0,0 -1.06l-2.11,-2.11a0.74,0.74 0,0 0,-0.53 -0.22Z"/> diff --git a/app/src/main/res/drawable/ic_view_quilt.xml b/app/src/main/res/drawable/ic_view_quilt.xml index a0fb3d300..eecbde250 100644 --- a/app/src/main/res/drawable/ic_view_quilt.xml +++ b/app/src/main/res/drawable/ic_view_quilt.xml @@ -1,26 +1,18 @@ - - - - - - - - \ No newline at end of file + + + + + + diff --git a/app/src/main/res/layout/item_bookshelf_list.xml b/app/src/main/res/layout/item_bookshelf_list.xml index d715009d6..3d6f71213 100644 --- a/app/src/main/res/layout/item_bookshelf_list.xml +++ b/app/src/main/res/layout/item_bookshelf_list.xml @@ -56,7 +56,7 @@ android:id="@+id/tv_name" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginLeft="16dp" + android:layout_marginLeft="10dp" android:layout_marginTop="12dp" android:includeFontPadding="false" android:paddingBottom="4dp" @@ -175,12 +175,5 @@ app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" /> - \ No newline at end of file