目录列表添加更新时间显示

master^2
fengyuecanzhu 2 years ago
parent 2546c4fa5b
commit b45f95ce13
No known key found for this signature in database
GPG Key ID: 04B78AD06A9D6E6C
  1. 32
      .idea/assetWizardSettings.xml
  2. 8
      .idea/misc.xml
  3. 10
      app/src/main/java/xyz/fycz/myreader/ui/adapter/BookMarkAdapter.java
  4. 27
      app/src/main/java/xyz/fycz/myreader/ui/adapter/ChapterTitleAdapter.java
  5. 7
      app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/CatalogHolder.java
  6. 9
      app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/FindBookHolder.java
  7. 3
      app/src/main/java/xyz/fycz/myreader/ui/presenter/BookMarkPresenter.java
  8. 3
      app/src/main/java/xyz/fycz/myreader/ui/presenter/CatalogPresenter.java
  9. 33
      app/src/main/res/drawable/ic_cloud_download.xml
  10. 79
      app/src/main/res/layout/item_chapter.xml
  11. 9
      app/src/main/res/layout/layout_book_detail_content.xml
  12. 46
      app/src/main/res/layout/listview_chapter_title_item.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WizardSettings">
<option name="children">
<map>
<entry key="vectorWizard">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="vectorAssetStep">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="assetSourceType" value="FILE" />
<entry key="outputName" value="ic_cloud_download" />
<entry key="sourceFile" value="F:\SVG图标\cloud.svg" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</component>
</project>

@ -3,6 +3,10 @@
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/android/FYReader/app/src/main/res/drawable/ic_check.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_line.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_ad_setting.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_book_detail.xml" value="0.12132725430597771" />
@ -10,16 +14,20 @@
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_more_setting.xml" value="0.2" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_read.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_user_info.xml" value="0.2" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/fragment_catalog.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/fragment_private_bookcase.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/fragment_proxy_setting.xml" value="0.22826086956521738" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/fragment_webdav_setting.xml" value="0.2" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_book_source.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_change_source.xml" value="0.22826086956521738" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_chapter.xml" value="0.2296195652173913" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_find_source.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_search_word1.xml" value="0.2296195652173913" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_source_edit.xml" value="0.22826086956521738" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_subscribe_source.xml" value="0.2" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/layout_about_content.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/layout_book_detail_content.xml" value="0.2296195652173913" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/listview_chapter_title_item.xml" value="0.2296195652173913" />
</map>
</option>
</component>

@ -67,7 +67,6 @@ public class BookMarkAdapter extends ArrayAdapter<BookMark> {
viewHolder = new ViewHolder();
convertView = LayoutInflater.from(getContext()).inflate(mResourceId,null);
viewHolder.tvTitle = (TextView) convertView.findViewById(R.id.tv_chapter_title);
viewHolder.vLine = (View) convertView.findViewById(R.id.v_line);
convertView.setTag(viewHolder);
}else {
viewHolder = (ViewHolder) convertView.getTag();
@ -78,14 +77,7 @@ public class BookMarkAdapter extends ArrayAdapter<BookMark> {
private void initView(int postion,final ViewHolder viewHolder){
final BookMark bookMark = getItem(postion);
assert bookMark != null;
viewHolder.tvTitle.setText(String.format("%s[%s]", bookMark.getTitle(), bookMark.getBookMarkReadPosition() + 1));
if (ChapterService.isChapterCached(bookMark)){
viewHolder.tvTitle.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(getContext(), R.drawable.selector_category_load),null,null,null);
} else {
viewHolder.tvTitle.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(getContext(),R.drawable.selector_category_unload),null,null,null);
}
viewHolder.tvTitle.setTextColor(getContext().getResources().getColor(R.color.textSecondary));
/*if (!setting.isDayStyle()) {
viewHolder.tvTitle.setTextColor(getContext().getResources().getColor(R.color.sys_night_word));
viewHolder.vLine.setBackground(getContext().getDrawable(R.color.sys_dialog_setting_line));
@ -134,9 +126,7 @@ public class BookMarkAdapter extends ArrayAdapter<BookMark> {
}
class ViewHolder{
TextView tvTitle;
View vLine;
}
}

@ -19,12 +19,15 @@
package xyz.fycz.myreader.ui.adapter;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Filter;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
@ -37,7 +40,6 @@ import xyz.fycz.myreader.greendao.entity.Chapter;
import xyz.fycz.myreader.greendao.service.ChapterService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -73,7 +75,8 @@ public class ChapterTitleAdapter extends ArrayAdapter<Chapter> {
viewHolder = new ViewHolder();
convertView = LayoutInflater.from(getContext()).inflate(mResourceId, null);
viewHolder.tvTitle = (TextView) convertView.findViewById(R.id.tv_chapter_title);
viewHolder.vLine = (View) convertView.findViewById(R.id.v_line);
viewHolder.tvTag = (TextView) convertView.findViewById(R.id.tv_tag);
viewHolder.ivIcon = (ImageView) convertView.findViewById(R.id.iv_icon);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
@ -86,21 +89,30 @@ public class ChapterTitleAdapter extends ArrayAdapter<Chapter> {
final Chapter chapter = getItem(postion);
// viewHolder.tvTitle.setText("【" + chapter.getTitle() + "】");
viewHolder.tvTitle.setText(chapter.getTitle());
//viewHolder.ivIcon.setImageResource(R.drawable.ic_cloud_download);
if (ChapterService.isChapterCached(chapter) || chapter.getEnd() > 0) {
viewHolder.tvTitle.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(getContext(),R.drawable.selector_category_load), null, null, null);
viewHolder.ivIcon.setVisibility(View.GONE);
viewHolder.tvTitle.setTextColor(getContext().getResources().getColor(R.color.textPrimary));
} else {
viewHolder.tvTitle.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(getContext(),R.drawable.selector_category_unload), null, null, null);
}
viewHolder.ivIcon.setVisibility(View.VISIBLE);
viewHolder.tvTitle.setTextColor(getContext().getResources().getColor(R.color.textSecondary));
}
/*if (!setting.isDayStyle()) {
viewHolder.tvTitle.setTextColor(getContext().getResources().getColor(R.color.sys_night_word));
viewHolder.vLine.setBackground(getContext().getDrawable(R.color.sys_dialog_setting_line));
}else {
viewHolder.tvTitle.setTextColor(getContext().getColor(R.color.title_black));
}*/
if (TextUtils.isEmpty(chapter.getUpdateTime())) {
viewHolder.tvTag.setVisibility(View.GONE);
} else {
viewHolder.tvTag.setText(chapter.getUpdateTime());
viewHolder.tvTag.setVisibility(View.VISIBLE);
}
if (chapter.getNumber() == mBook.getHisttoryChapterNum()) {
viewHolder.tvTitle.setTextColor(getContext().getResources().getColor(R.color.colorAccent));
/*viewHolder.ivIcon.setImageResource(R.drawable.ic_check);
viewHolder.ivIcon.setVisibility(View.VISIBLE);*/
}
}
@ -152,7 +164,8 @@ public class ChapterTitleAdapter extends ArrayAdapter<Chapter> {
class ViewHolder {
TextView tvTitle;
View vLine;
TextView tvTag;
ImageView ivIcon;
}

@ -36,7 +36,7 @@ public class CatalogHolder extends ViewHolderImpl<Chapter> {
private TextView tvTitle;
@Override
protected int getItemLayoutId() {
return R.layout.listview_chapter_title_item;
return R.layout.item_chapter;
}
@Override
@ -46,11 +46,6 @@ public class CatalogHolder extends ViewHolderImpl<Chapter> {
@Override
public void onBind(RecyclerView.ViewHolder holder, Chapter data, int pos) {
if (ChapterService.isChapterCached(data) || data.getEnd() > 0) {
tvTitle.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(getContext(),R.drawable.selector_category_load), null, null, null);
} else {
tvTitle.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(getContext(),R.drawable.selector_category_unload), null, null, null);
}
tvTitle.setText(data.getTitle());
}
}

@ -49,6 +49,7 @@ import xyz.fycz.myreader.webapi.BookApi;
import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil;
import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler;
import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler;
import xyz.fycz.myreader.webapi.crawler.source.ThirdCrawler;
import xyz.fycz.myreader.widget.CoverImageView;
/**
@ -96,7 +97,7 @@ public class FindBookHolder extends ViewHolderImpl<Book> {
tvBookName.setText(data.getName());
if (!StringHelper.isEmpty(data.getAuthor())) {
tvAuthor.setText(data.getAuthor());
}else {
} else {
tvAuthor.setText("");
}
initTagList(data);
@ -114,7 +115,7 @@ public class FindBookHolder extends ViewHolderImpl<Book> {
}
if (!StringHelper.isEmpty(source.getSourceName()) && !"未知书源".equals(source.getSourceName()))
tvSource.setText(String.format("书源:%s", source.getSourceName()));
if (needGetInfo(data) && rc instanceof BookInfoCrawler) {
if (!(rc instanceof ThirdCrawler) && rc instanceof BookInfoCrawler && needGetInfo(data)) {
Log.i(data.getName(), "initOtherInfo");
BookInfoCrawler bic = (BookInfoCrawler) rc;
BookApi.getBookInfo(data, bic).compose(RxUtils::toSimpleSingle)
@ -163,6 +164,7 @@ public class FindBookHolder extends ViewHolderImpl<Book> {
tflBookTag.setAdapter(new BookTagAdapter(getContext(), tagList, 11));
}
}
private boolean needGetInfo(Book bookBean) {
if (StringHelper.isEmpty(bookBean.getAuthor())) return true;
if (StringHelper.isEmpty(bookBean.getType())) return true;
@ -170,10 +172,11 @@ public class FindBookHolder extends ViewHolderImpl<Book> {
if (StringHelper.isEmpty(bookBean.getNewestChapterTitle())) return true;
return StringHelper.isEmpty(bookBean.getImgUrl());
}
/**
* Here is the key method to apply the animation
*/
protected void setAnimation(View viewToAnimate, int position){
protected void setAnimation(View viewToAnimate, int position) {
// If the bound view wasn't previously displayed on screen, it's animated
Animation animation =
AnimationUtils.loadAnimation(viewToAnimate.getContext(), R.anim.anim_recycle_item);

@ -21,7 +21,6 @@ package xyz.fycz.myreader.ui.presenter;
import android.app.Activity;
import android.content.Intent;
import xyz.fycz.myreader.R;
import xyz.fycz.myreader.application.SysManager;
import xyz.fycz.myreader.base.BasePresenter;
import xyz.fycz.myreader.common.APPCONST;
import xyz.fycz.myreader.greendao.entity.Book;
@ -74,7 +73,7 @@ public class BookMarkPresenter implements BasePresenter {
private void initBookMarkList() {
mBookMarks = (ArrayList<BookMark>) mBookMarkService.findBookAllBookMarkByBookId(mBook.getId());
mBookMarkAdapter = new BookMarkAdapter(mBookMarkFragment.getActivity(), R.layout.listview_chapter_title_item, mBookMarks);
mBookMarkAdapter = new BookMarkAdapter(mBookMarkFragment.getActivity(), R.layout.item_chapter, mBookMarks);
mBookMarkFragment.getLvBookmarkList().setAdapter(mBookMarkAdapter);
}

@ -24,7 +24,6 @@ import android.view.View;
import org.jetbrains.annotations.NotNull;
import io.reactivex.disposables.Disposable;
import xyz.fycz.myreader.R;
import xyz.fycz.myreader.application.App;
import xyz.fycz.myreader.base.BasePresenter;
@ -137,7 +136,7 @@ public class CatalogPresenter implements BasePresenter {
//设置布局管理器
int curChapterPosition;
curChapterPosition = mBook.getHisttoryChapterNum();
mChapterTitleAdapter = new ChapterTitleAdapter(mCatalogFragment.getContext(), R.layout.listview_chapter_title_item, mChapters, mBook);
mChapterTitleAdapter = new ChapterTitleAdapter(mCatalogFragment.getContext(), R.layout.item_chapter, mChapters, mBook);
mCatalogFragment.getLvChapterList().setAdapter(mChapterTitleAdapter);
mCatalogFragment.getLvChapterList().setSelection(curChapterPosition);
}

@ -0,0 +1,33 @@
<?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
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M22.5,40.3180195 L22.5,26.5 C22.5,19.5964406 28.0964406,14 35,14 C41.0751322,14 46,18.9248678 46,25 C46,31.0751322 41.0751322,36 35,36 L28.5,36 L28.5,33 L35,33 C39.418278,33 43,29.418278 43,25 C43,20.581722 39.418278,17 35,17 C29.7532949,17 25.5,21.2532949 25.5,26.5 L25.5,40.3180195 L27.9393398,37.8786797 L30.0606602,40 L24,46.0606602 L17.9393398,40 L20.0606602,37.8786797 L22.5,40.3180195 Z"
android:strokeWidth="1.0" />
<path
android:fillColor="#FFFFFFFF"
android:pathData="M33.8258342,11.0485401 C32.0120952,7.45657788 28.2870652,5 24,5 C18.0506258,5 13.1836471,9.7309997 13.0050811,15.6619804 L12.9676728,16.9044801 L11.7398391,17.098463 C7.8813734,17.7080539 5,21.0505922 5,25 C5,29.418278 8.581722,33 13,33 L19.5,33 L19.5,36 L13,36 C6.92486775,36 2,31.0751322 2,25 C2,19.9793459 5.38459981,15.6735816 10.0917391,14.3885641 C10.8920106,7.40161656 16.8277534,2 24,2 C30.0211876,2 35.1709114,5.80695411 37.1422625,11.1628739 C36.443846,11.0556302 35.7284196,11 35,11 C34.6045681,11 34.2129653,11.0163942 33.8258342,11.0485401 L33.8258342,11.0485401 Z"
android:strokeWidth="1.0" />
</vector>

@ -0,0 +1,79 @@
<?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
-->
<LinearLayout 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="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/tv_chapter_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="13dp">
<TextView
android:id="@+id/tv_chapter_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="@color/textSecondary"
android:textSize="15sp"
app:layout_constraintBottom_toTopOf="@id/tv_tag"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/iv_icon"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_tag"
android:layout_marginTop="2dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="@color/textAssist"
android:textSize="@dimen/text_default_size"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/iv_icon"
app:layout_constraintTop_toBottomOf="@+id/tv_chapter_title" />
<ImageView
android:id="@+id/iv_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:contentDescription="@string/success"
android:padding="3.5dp"
android:src="@drawable/ic_cloud_download"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="@color/textAssist" />
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/v_line"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_gravity="bottom"
android:background="@color/colorDivider"
android:layerType="software" />
</LinearLayout>

@ -64,7 +64,7 @@
android:id="@+id/book_detail_tv_catalog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="15dp"
android:padding="12dp"
android:text="最新章节"
android:textColor="@color/textPrimary"
android:textSize="15sp" />
@ -73,8 +73,8 @@
android:id="@+id/book_detail_tv_catalog_more"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:padding="15dp"
android:gravity="end"
android:padding="12dp"
android:text="更多"
android:textColor="@color/textSecondary"
android:textSize="15sp" />
@ -84,7 +84,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/book_detail_tv_catalog"
android:foregroundGravity="center" />
android:foregroundGravity="center"
android:paddingHorizontal="4dp" />
</RelativeLayout>
<LinearLayout

@ -1,46 +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
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_chapter_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:drawableLeft="@drawable/selector_category_unload"
android:textColor="@color/textSecondary"
android:text="chapter"
android:drawablePadding="10dp"
android:padding="13dp"
android:textSize="15sp" />
<View
android:id="@+id/v_line"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_gravity="bottom"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:background="@color/colorDivider"
android:layerType="software" />
</LinearLayout>
Loading…
Cancel
Save