优化目录显示

master^2
fengyuecanzhu 2 years ago
parent cb19cf19f3
commit 6e9cfbd0c1
No known key found for this signature in database
GPG Key ID: 04B78AD06A9D6E6C
  1. 1
      .idea/misc.xml
  2. 8
      app/src/main/java/xyz/fycz/myreader/ui/adapter/ChapterTitleAdapter.java
  3. 5
      app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/CatalogHolder.java
  4. BIN
      app/src/main/res/drawable-xhdpi/ic_item_category_download.png
  5. BIN
      app/src/main/res/drawable-xhdpi/ic_item_category_normal.png
  6. 25
      app/src/main/res/drawable/selector_category_load.xml
  7. 25
      app/src/main/res/drawable/selector_category_unload.xml
  8. 2
      app/src/main/res/layout/item_chapter.xml

@ -8,6 +8,7 @@
<entry key="..\:/android/FYReader/app/src/main/res/drawable/ic_cloud_download.xml" value="0.118" /> <entry key="..\:/android/FYReader/app/src/main/res/drawable/ic_cloud_download.xml" value="0.118" />
<entry key="..\:/android/FYReader/app/src/main/res/drawable/ic_download.xml" value="0.118" /> <entry key="..\:/android/FYReader/app/src/main/res/drawable/ic_download.xml" value="0.118" />
<entry key="..\:/android/FYReader/app/src/main/res/drawable/ic_download_line.xml" value="0.118" /> <entry key="..\:/android/FYReader/app/src/main/res/drawable/ic_download_line.xml" value="0.118" />
<entry key="..\:/android/FYReader/app/src/main/res/drawable/selector_category_load.xml" value="0.118" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_about.xml" value="0.2296195652173913" /> <entry key="..\:/android/FYReader/app/src/main/res/layout/activity_about.xml" value="0.2296195652173913" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_ad_setting.xml" value="0.12132725430597771" /> <entry key="..\:/android/FYReader/app/src/main/res/layout/activity_ad_setting.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_book_detail.xml" value="0.12132725430597771" /> <entry key="..\:/android/FYReader/app/src/main/res/layout/activity_book_detail.xml" value="0.12132725430597771" />

@ -74,9 +74,9 @@ public class ChapterTitleAdapter extends ArrayAdapter<Chapter> {
if (convertView == null) { if (convertView == null) {
viewHolder = new ViewHolder(); viewHolder = new ViewHolder();
convertView = LayoutInflater.from(getContext()).inflate(mResourceId, null); convertView = LayoutInflater.from(getContext()).inflate(mResourceId, null);
viewHolder.tvTitle = (TextView) convertView.findViewById(R.id.tv_chapter_title); viewHolder.tvTitle = convertView.findViewById(R.id.tv_chapter_title);
viewHolder.tvTag = (TextView) convertView.findViewById(R.id.tv_tag); viewHolder.tvTag = convertView.findViewById(R.id.tv_tag);
viewHolder.ivIcon = (ImageView) convertView.findViewById(R.id.iv_icon); viewHolder.ivIcon = convertView.findViewById(R.id.iv_icon);
convertView.setTag(viewHolder); convertView.setTag(viewHolder);
} else { } else {
viewHolder = (ViewHolder) convertView.getTag(); viewHolder = (ViewHolder) convertView.getTag();
@ -91,7 +91,7 @@ public class ChapterTitleAdapter extends ArrayAdapter<Chapter> {
viewHolder.tvTitle.setText(chapter.getTitle()); viewHolder.tvTitle.setText(chapter.getTitle());
//viewHolder.ivIcon.setImageResource(R.drawable.ic_cloud_download); //viewHolder.ivIcon.setImageResource(R.drawable.ic_cloud_download);
if (ChapterService.isChapterCached(chapter) || chapter.getEnd() > 0) { if (ChapterService.isChapterCached(chapter) || chapter.getEnd() > 0) {
viewHolder.ivIcon.setVisibility(View.GONE); viewHolder.ivIcon.setVisibility(View.INVISIBLE);
viewHolder.tvTitle.setTextColor(getContext().getResources().getColor(R.color.textPrimary)); viewHolder.tvTitle.setTextColor(getContext().getResources().getColor(R.color.textPrimary));
} else { } else {
viewHolder.ivIcon.setVisibility(View.VISIBLE); viewHolder.ivIcon.setVisibility(View.VISIBLE);

@ -18,6 +18,8 @@
package xyz.fycz.myreader.ui.adapter.holder; package xyz.fycz.myreader.ui.adapter.holder;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
@ -34,6 +36,7 @@ import xyz.fycz.myreader.greendao.service.ChapterService;
*/ */
public class CatalogHolder extends ViewHolderImpl<Chapter> { public class CatalogHolder extends ViewHolderImpl<Chapter> {
private TextView tvTitle; private TextView tvTitle;
private ImageView ivIcon;
@Override @Override
protected int getItemLayoutId() { protected int getItemLayoutId() {
return R.layout.item_chapter; return R.layout.item_chapter;
@ -42,10 +45,12 @@ public class CatalogHolder extends ViewHolderImpl<Chapter> {
@Override @Override
public void initView() { public void initView() {
tvTitle = findById(R.id.tv_chapter_title); tvTitle = findById(R.id.tv_chapter_title);
ivIcon = findById(R.id.iv_icon);
} }
@Override @Override
public void onBind(RecyclerView.ViewHolder holder, Chapter data, int pos) { public void onBind(RecyclerView.ViewHolder holder, Chapter data, int pos) {
tvTitle.setText(data.getTitle()); tvTitle.setText(data.getTitle());
ivIcon.setVisibility(View.GONE);
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of FYReader.
~ FYReader is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ FYReader is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with FYReader. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2020 - 2022 fengyuecanzhu
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 没有焦点时字体颜色 -->
<item
android:state_selected="false"
android:drawable="@drawable/ic_item_category_download"/>
</selector>

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of FYReader.
~ FYReader is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ FYReader is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with FYReader. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2020 - 2022 fengyuecanzhu
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 没有焦点时字体颜色 -->
<item
android:state_selected="false"
android:drawable="@drawable/ic_item_category_normal"/>
</selector>

@ -62,7 +62,7 @@
android:contentDescription="@string/success" android:contentDescription="@string/success"
android:padding="3.5dp" android:padding="3.5dp"
android:src="@drawable/ic_cloud_download" android:src="@drawable/ic_cloud_download"
android:visibility="gone" android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"

Loading…
Cancel
Save