parent
0c3cf6bd9e
commit
e4da857c67
@ -0,0 +1,84 @@ |
||||
package xyz.fycz.myreader.greendao.entity; |
||||
|
||||
import org.greenrobot.greendao.annotation.Entity; |
||||
import org.greenrobot.greendao.annotation.Generated; |
||||
import org.greenrobot.greendao.annotation.Id; |
||||
|
||||
/** |
||||
* @author fengyue |
||||
* @date 2021/6/1 18:38 |
||||
*/ |
||||
@Entity |
||||
public class ReadRecord { |
||||
@Id |
||||
private String id; |
||||
private String bookImg; |
||||
private String bookName; |
||||
private String bookAuthor; |
||||
private long readTime; |
||||
private long updateTime; |
||||
|
||||
|
||||
@Generated(hash = 1191129215) |
||||
public ReadRecord() { |
||||
} |
||||
|
||||
@Generated(hash = 381392552) |
||||
public ReadRecord(String id, String bookImg, String bookName, String bookAuthor, |
||||
long readTime, long updateTime) { |
||||
this.id = id; |
||||
this.bookImg = bookImg; |
||||
this.bookName = bookName; |
||||
this.bookAuthor = bookAuthor; |
||||
this.readTime = readTime; |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
public String getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(String id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getBookName() { |
||||
return this.bookName; |
||||
} |
||||
|
||||
public void setBookName(String bookName) { |
||||
this.bookName = bookName; |
||||
} |
||||
|
||||
public String getBookAuthor() { |
||||
return this.bookAuthor; |
||||
} |
||||
|
||||
public void setBookAuthor(String bookAuthor) { |
||||
this.bookAuthor = bookAuthor; |
||||
} |
||||
|
||||
public long getUpdateTime() { |
||||
return this.updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(long updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
public String getBookImg() { |
||||
return this.bookImg; |
||||
} |
||||
|
||||
public void setBookImg(String bookImg) { |
||||
this.bookImg = bookImg; |
||||
} |
||||
|
||||
public long getReadTime() { |
||||
return this.readTime; |
||||
} |
||||
|
||||
public void setReadTime(long readTime) { |
||||
this.readTime = readTime; |
||||
} |
||||
} |
@ -0,0 +1,76 @@ |
||||
package xyz.fycz.myreader.greendao.service; |
||||
|
||||
import java.util.List; |
||||
|
||||
import io.reactivex.Single; |
||||
import xyz.fycz.myreader.greendao.DbManager; |
||||
import xyz.fycz.myreader.greendao.entity.Book; |
||||
import xyz.fycz.myreader.greendao.entity.ReadRecord; |
||||
import xyz.fycz.myreader.greendao.gen.BookDao; |
||||
import xyz.fycz.myreader.greendao.gen.ReadRecordDao; |
||||
|
||||
/** |
||||
* @author fengyue |
||||
* @date 2021/6/1 19:09 |
||||
*/ |
||||
public class ReadRecordService extends BaseService { |
||||
private static volatile ReadRecordService sInstance; |
||||
|
||||
public static ReadRecordService getInstance() { |
||||
if (sInstance == null) { |
||||
synchronized (ReadRecordService.class) { |
||||
if (sInstance == null) { |
||||
sInstance = new ReadRecordService(); |
||||
} |
||||
} |
||||
} |
||||
return sInstance; |
||||
} |
||||
|
||||
/** |
||||
* 获取所有书籍分组 |
||||
* |
||||
* @return |
||||
*/ |
||||
public Single<List<ReadRecord>> getAllRecordsByTime() { |
||||
return Single.create(emitter -> emitter.onSuccess(DbManager.getDaoSession().getReadRecordDao() |
||||
.queryBuilder() |
||||
.orderDesc(ReadRecordDao.Properties.UpdateTime) |
||||
.list())); |
||||
} |
||||
|
||||
public Single<Boolean> removeAll() { |
||||
return Single.create(emitter -> { |
||||
DbManager.getDaoSession().getReadRecordDao().deleteAll(); |
||||
emitter.onSuccess(true); |
||||
}); |
||||
} |
||||
|
||||
public Single<Boolean> removeAllTime(List<ReadRecord> records) { |
||||
return Single.create(emitter -> { |
||||
for (ReadRecord record : records) { |
||||
record.setReadTime(0); |
||||
record.setUpdateTime(0); |
||||
} |
||||
DbManager.getDaoSession().getReadRecordDao().insertOrReplaceInTx(records); |
||||
emitter.onSuccess(true); |
||||
}); |
||||
} |
||||
|
||||
public ReadRecord get(String bookName, String bookAuthor) { |
||||
try { |
||||
return DbManager.getInstance().getSession().getReadRecordDao() |
||||
.queryBuilder() |
||||
.where(ReadRecordDao.Properties.BookName.eq(bookName), |
||||
ReadRecordDao.Properties.BookAuthor.eq(bookAuthor)) |
||||
.unique(); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return DbManager.getInstance().getSession().getReadRecordDao() |
||||
.queryBuilder() |
||||
.where(ReadRecordDao.Properties.BookName.eq(bookName), |
||||
ReadRecordDao.Properties.BookAuthor.eq(bookAuthor)) |
||||
.list().get(0); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,206 @@ |
||||
package xyz.fycz.myreader.ui.activity; |
||||
|
||||
import android.content.Intent; |
||||
import android.os.Bundle; |
||||
import android.view.View; |
||||
|
||||
import androidx.appcompat.widget.Toolbar; |
||||
import androidx.recyclerview.widget.LinearLayoutManager; |
||||
|
||||
import com.kongzue.dialogx.dialogs.BottomMenu; |
||||
import com.kongzue.dialogx.interfaces.OnMenuItemClickListener; |
||||
import com.kongzue.dialogx.interfaces.OnMenuItemSelectListener; |
||||
|
||||
import org.jetbrains.annotations.NotNull; |
||||
|
||||
import java.util.List; |
||||
|
||||
import xyz.fycz.myreader.R; |
||||
import xyz.fycz.myreader.base.BaseActivity; |
||||
import xyz.fycz.myreader.base.BitIntentDataManager; |
||||
import xyz.fycz.myreader.base.adapter.BaseListAdapter; |
||||
import xyz.fycz.myreader.base.adapter.IViewHolder; |
||||
import xyz.fycz.myreader.base.observer.MySingleObserver; |
||||
import xyz.fycz.myreader.common.APPCONST; |
||||
import xyz.fycz.myreader.databinding.ActivityReadRecordBinding; |
||||
import xyz.fycz.myreader.greendao.DbManager; |
||||
import xyz.fycz.myreader.greendao.entity.Book; |
||||
import xyz.fycz.myreader.greendao.entity.ReadRecord; |
||||
import xyz.fycz.myreader.greendao.service.BookService; |
||||
import xyz.fycz.myreader.greendao.service.ReadRecordService; |
||||
import xyz.fycz.myreader.ui.adapter.holder.ReadRecordHolder; |
||||
import xyz.fycz.myreader.ui.dialog.DialogCreator; |
||||
import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog; |
||||
import xyz.fycz.myreader.util.ToastUtils; |
||||
import xyz.fycz.myreader.util.help.RelativeDateHelp; |
||||
import xyz.fycz.myreader.util.utils.RxUtils; |
||||
import xyz.fycz.myreader.widget.DividerItemDecoration; |
||||
|
||||
/** |
||||
* @author fengyue |
||||
* @date 2021/6/1 19:07 |
||||
*/ |
||||
public class ReadRecordActivity extends BaseActivity { |
||||
private ActivityReadRecordBinding binding; |
||||
private List<ReadRecord> records; |
||||
private long allTime; |
||||
private BaseListAdapter<ReadRecord> mAdapter; |
||||
private SourceExchangeDialog mSourceDia; |
||||
private ReadRecordService recordService; |
||||
|
||||
@Override |
||||
protected void bindView() { |
||||
binding = ActivityReadRecordBinding.inflate(getLayoutInflater()); |
||||
setContentView(binding.getRoot()); |
||||
} |
||||
|
||||
@Override |
||||
protected void setUpToolbar(Toolbar toolbar) { |
||||
super.setUpToolbar(toolbar); |
||||
setStatusBarColor(R.color.colorPrimary, true); |
||||
getSupportActionBar().setTitle(getString(R.string.read_record)); |
||||
} |
||||
|
||||
@Override |
||||
protected void initData(Bundle savedInstanceState) { |
||||
super.initData(savedInstanceState); |
||||
recordService = ReadRecordService.getInstance(); |
||||
recordService.getAllRecordsByTime().compose(RxUtils::toSimpleSingle) |
||||
.subscribe(new MySingleObserver<List<ReadRecord>>() { |
||||
@Override |
||||
public void onSuccess(@NotNull List<ReadRecord> readRecords) { |
||||
records = readRecords; |
||||
initRecords(); |
||||
} |
||||
|
||||
@Override |
||||
public void onError(Throwable e) { |
||||
ToastUtils.showError("数据加载失败\n" + e.getLocalizedMessage()); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void initAllTime() { |
||||
allTime = 0; |
||||
for (ReadRecord record : records) { |
||||
allTime += record.getReadTime(); |
||||
} |
||||
binding.tvAllRecord.setText(getString(R.string.all_read_time, |
||||
RelativeDateHelp.formatDuring(allTime))); |
||||
} |
||||
|
||||
private void initRecords() { |
||||
initAllTime(); |
||||
mAdapter = new BaseListAdapter<ReadRecord>() { |
||||
@Override |
||||
protected IViewHolder<ReadRecord> createViewHolder(int viewType) { |
||||
return new ReadRecordHolder((itemPos, menuPos) -> { |
||||
ReadRecord record = records.get(itemPos); |
||||
switch (menuPos) { |
||||
case 0: |
||||
DbManager.getDaoSession().getReadRecordDao().delete(record); |
||||
records.remove(itemPos); |
||||
mAdapter.removeItem(record); |
||||
ToastUtils.showSuccess(String.format("《%s》阅读记录移除成功", record.getBookName())); |
||||
break; |
||||
case 1: |
||||
record.setReadTime(0); |
||||
record.setUpdateTime(0); |
||||
DbManager.getDaoSession().getReadRecordDao().insertOrReplace(record); |
||||
mAdapter.notifyDataSetChanged(); |
||||
ToastUtils.showSuccess(String.format("《%s》阅读时长已清空", record.getBookName())); |
||||
break; |
||||
} |
||||
initAllTime(); |
||||
}); |
||||
} |
||||
}; |
||||
|
||||
//设置布局
|
||||
binding.rvRecords.setLayoutManager(new LinearLayoutManager(this)); |
||||
binding.rvRecords.setAdapter(mAdapter); |
||||
|
||||
mAdapter.refreshItems(records); |
||||
mAdapter.setOnItemClickListener((view, pos) -> { |
||||
ReadRecord record = records.get(pos); |
||||
Book book = BookService.getInstance().findBookByAuthorAndName(record.getBookName(), record.getBookAuthor()); |
||||
if (book == null) { |
||||
DialogCreator.createCommonDialog(this, "搜索书籍", |
||||
"当前书籍未加入书架,是否重新搜索?", false, (dialog, which) -> { |
||||
Book newBook = new Book(); |
||||
newBook.setName(record.getBookName()); |
||||
newBook.setAuthor(record.getBookAuthor()); |
||||
newBook.setImgUrl(record.getBookImg()); |
||||
mSourceDia = new SourceExchangeDialog(this, newBook); |
||||
mSourceDia.setOnSourceChangeListener((bean, pos1) -> { |
||||
Intent intent = new Intent(this, BookDetailedActivity.class); |
||||
BitIntentDataManager.getInstance().putData(intent, mSourceDia.getaBooks()); |
||||
intent.putExtra(APPCONST.SOURCE_INDEX, pos1); |
||||
ReadRecordActivity.this.startActivity(intent); |
||||
mSourceDia.dismiss(); |
||||
}); |
||||
mSourceDia.show(); |
||||
}, null); |
||||
} else { |
||||
Intent intent = new Intent(this, BookDetailedActivity.class); |
||||
BitIntentDataManager.getInstance().putData(intent, book); |
||||
startActivity(intent); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
protected void initClick() { |
||||
super.initClick(); |
||||
binding.ivMore.setOnClickListener(v -> { |
||||
String[] menu = new String[]{"移除所有记录", "清空阅读时长(不会删除记录)"}; |
||||
BottomMenu.show(menu) |
||||
.setTitle("总阅读记录") |
||||
.setOnMenuItemClickListener((dialog, text, which) -> { |
||||
if (records == null) { |
||||
ToastUtils.showWarring("数据未完成加载,无法进行操作!"); |
||||
return false; |
||||
} |
||||
switch (which) { |
||||
case 0: |
||||
recordService.removeAll().compose(RxUtils::toSimpleSingle) |
||||
.subscribe(new MySingleObserver<Boolean>() { |
||||
@Override |
||||
public void onSuccess(@NotNull Boolean aBoolean) { |
||||
ToastUtils.showSuccess("阅读记录已全部移除"); |
||||
records.clear(); |
||||
mAdapter.refreshItems(records); |
||||
initAllTime(); |
||||
} |
||||
|
||||
@Override |
||||
public void onError(Throwable e) { |
||||
super.onError(e); |
||||
ToastUtils.showError(e.getLocalizedMessage()); |
||||
} |
||||
}); |
||||
break; |
||||
case 1: |
||||
recordService.removeAllTime(records).compose(RxUtils::toSimpleSingle) |
||||
.subscribe(new MySingleObserver<Boolean>() { |
||||
@Override |
||||
public void onSuccess(@NotNull Boolean aBoolean) { |
||||
ToastUtils.showSuccess("阅读时长已全部清空"); |
||||
mAdapter.notifyDataSetChanged(); |
||||
initAllTime(); |
||||
} |
||||
|
||||
@Override |
||||
public void onError(Throwable e) { |
||||
super.onError(e); |
||||
ToastUtils.showError(e.getLocalizedMessage()); |
||||
} |
||||
}); |
||||
break; |
||||
} |
||||
return false; |
||||
}) |
||||
.setCancelButton(R.string.cancel); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,74 @@ |
||||
package xyz.fycz.myreader.ui.adapter.holder; |
||||
|
||||
import android.app.Activity; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.widget.ImageView; |
||||
import android.widget.TextView; |
||||
|
||||
import com.kongzue.dialogx.dialogs.BottomMenu; |
||||
import com.kongzue.dialogx.interfaces.OnMenuItemClickListener; |
||||
|
||||
import xyz.fycz.myreader.R; |
||||
import xyz.fycz.myreader.application.App; |
||||
import xyz.fycz.myreader.base.adapter.ViewHolderImpl; |
||||
import xyz.fycz.myreader.greendao.entity.ReadRecord; |
||||
import xyz.fycz.myreader.util.help.RelativeDateHelp; |
||||
import xyz.fycz.myreader.util.utils.NetworkUtils; |
||||
import xyz.fycz.myreader.widget.CoverImageView; |
||||
|
||||
/** |
||||
* @author fengyue |
||||
* @date 2021/6/1 19:31 |
||||
*/ |
||||
public class ReadRecordHolder extends ViewHolderImpl<ReadRecord> { |
||||
private OnMenuItemClickListener onMenuItemClickListener; |
||||
private CoverImageView ivBookImg; |
||||
private TextView tvBookName; |
||||
private TextView tvBookAuthor; |
||||
private TextView tvRecord; |
||||
private ImageView ivMore; |
||||
private final String[] menu = new String[]{"移除此记录", "清空阅读时长(不会删除记录)"}; |
||||
|
||||
public ReadRecordHolder(OnMenuItemClickListener onMenuItemClickListener) { |
||||
this.onMenuItemClickListener = onMenuItemClickListener; |
||||
} |
||||
|
||||
@Override |
||||
protected int getItemLayoutId() { |
||||
return R.layout.item_read_record; |
||||
} |
||||
|
||||
@Override |
||||
public void initView() { |
||||
ivBookImg = findById(R.id.iv_book_img); |
||||
tvBookName = findById(R.id.tv_book_name); |
||||
tvBookAuthor = findById(R.id.tv_book_author); |
||||
tvRecord = findById(R.id.tv_book_read_record); |
||||
ivMore = findById(R.id.iv_more); |
||||
} |
||||
|
||||
@Override |
||||
public void onBind(ReadRecord data, int pos) { |
||||
if (!App.isDestroy((Activity) getContext())) { |
||||
ivBookImg.load(data.getBookImg(), data.getBookName(), data.getBookAuthor()); |
||||
} |
||||
tvBookName.setText(data.getBookName()); |
||||
tvBookAuthor.setText(data.getBookAuthor()); |
||||
String lastTime = data.getUpdateTime() == 0 ? "无记录" |
||||
: RelativeDateHelp.format(data.getUpdateTime()); |
||||
tvRecord.setText(String.format("%s · %s", lastTime, |
||||
RelativeDateHelp.formatDuring(data.getReadTime()))); |
||||
ivMore.setOnClickListener(v -> BottomMenu.show(menu) |
||||
.setTitle(data.getBookName()) |
||||
.setOnMenuItemClickListener((dialog, text, which) -> { |
||||
onMenuItemClickListener.onClick(pos, which); |
||||
return false; |
||||
}) |
||||
.setCancelButton(R.string.cancel)); |
||||
} |
||||
|
||||
public interface OnMenuItemClickListener{ |
||||
void onClick(int itemPos, int menuPos); |
||||
} |
||||
} |
@ -1,4 +1,4 @@ |
||||
package xyz.fycz.myreader.util; |
||||
package xyz.fycz.myreader.util.help; |
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@ |
||||
package xyz.fycz.myreader.util; |
||||
package xyz.fycz.myreader.util.help; |
||||
|
||||
import java.sql.Timestamp; |
||||
import java.text.DateFormat; |
@ -1,10 +1,13 @@ |
||||
package xyz.fycz.myreader.util; |
||||
package xyz.fycz.myreader.util.help; |
||||
|
||||
import android.content.Context; |
||||
import android.content.Intent; |
||||
|
||||
import java.io.File; |
||||
|
||||
import xyz.fycz.myreader.util.ToastUtils; |
||||
import xyz.fycz.myreader.util.UriFileUtil; |
||||
|
||||
|
||||
public class OpenFileHelper { |
||||
private final static String[][] MIME_MapTable = { |
@ -0,0 +1,96 @@ |
||||
package xyz.fycz.myreader.util.help; |
||||
|
||||
import android.text.TextUtils; |
||||
|
||||
import xyz.fycz.myreader.entity.Date; |
||||
|
||||
/** |
||||
* @author fengyue |
||||
* @date 2021/6/1 19:20 |
||||
*/ |
||||
public class RelativeDateHelp { |
||||
private static final long ONE_MINUTE = 60000L; |
||||
private static final long ONE_HOUR = 3600000L; |
||||
private static final long ONE_DAY = 86400000L; |
||||
private static final long ONE_WEEK = 604800000L; |
||||
|
||||
private static final String ONE_SECOND_AGO = "秒前"; |
||||
private static final String ONE_MINUTE_AGO = "分钟前"; |
||||
private static final String ONE_HOUR_AGO = "小时前"; |
||||
private static final String ONE_DAY_AGO = "天前"; |
||||
private static final String ONE_MONTH_AGO = "月前"; |
||||
private static final String ONE_YEAR_AGO = "年前"; |
||||
|
||||
|
||||
//时间转换
|
||||
public static String format(long time) { |
||||
long delta = System.currentTimeMillis() - time; |
||||
if (delta < ONE_MINUTE) { |
||||
long seconds = toSeconds(delta); |
||||
return (seconds <= 0 ? 1 : seconds) + ONE_SECOND_AGO; |
||||
} |
||||
if (delta < 45L * ONE_MINUTE) { |
||||
long minutes = toMinutes(delta); |
||||
return (minutes <= 0 ? 1 : minutes) + ONE_MINUTE_AGO; |
||||
} |
||||
if (delta < 24L * ONE_HOUR) { |
||||
long hours = toHours(delta); |
||||
return (hours <= 0 ? 1 : hours) + ONE_HOUR_AGO; |
||||
} |
||||
if (delta < 48L * ONE_HOUR) { |
||||
return "昨天"; |
||||
} |
||||
if (delta < 30L * ONE_DAY) { |
||||
long days = toDays(delta); |
||||
return (days <= 0 ? 1 : days) + ONE_DAY_AGO; |
||||
} |
||||
if (delta < 12L * 4L * ONE_WEEK) { |
||||
long months = toMonths(delta); |
||||
return (months <= 0 ? 1 : months) + ONE_MONTH_AGO; |
||||
} else { |
||||
long years = toYears(delta); |
||||
return (years <= 0 ? 1 : years) + ONE_YEAR_AGO; |
||||
} |
||||
} |
||||
|
||||
private static long toSeconds(long date) { |
||||
return date / 1000L; |
||||
} |
||||
|
||||
private static long toMinutes(long date) { |
||||
return toSeconds(date) / 60L; |
||||
} |
||||
|
||||
private static long toHours(long date) { |
||||
return toMinutes(date) / 60L; |
||||
} |
||||
|
||||
private static long toDays(long date) { |
||||
return toHours(date) / 24L; |
||||
} |
||||
|
||||
private static long toMonths(long date) { |
||||
return toDays(date) / 30L; |
||||
} |
||||
|
||||
private static long toYears(long date) { |
||||
return toMonths(date) / 365L; |
||||
} |
||||
|
||||
public static String formatDuring(long time){ |
||||
long days = time / (1000 * 60 * 60 * 24); |
||||
long hours = time % (1000 * 60 * 60 * 24) / (1000 * 60 * 60); |
||||
long minutes = time % (1000 * 60 * 60) / (1000 * 60); |
||||
long seconds = time % (1000 * 60) / 1000; |
||||
String d = days > 0 ? days + "天" : ""; |
||||
String h = hours > 0 ? hours + "小时" : ""; |
||||
String m = minutes > 0 ? minutes + "分钟" : ""; |
||||
String s = seconds > 0 ? seconds + "秒" : ""; |
||||
String strTime = d + h + m + s; |
||||
if (TextUtils.isEmpty(strTime)) { |
||||
strTime = "0秒"; |
||||
} |
||||
return strTime; |
||||
} |
||||
|
||||
} |
@ -1,4 +1,4 @@ |
||||
package xyz.fycz.myreader.util; |
||||
package xyz.fycz.myreader.util.help; |
||||
|
||||
import xyz.fycz.myreader.util.utils.StringUtils; |
||||
|
@ -0,0 +1,15 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="1024" |
||||
android:viewportHeight="1024"> |
||||
<path |
||||
android:pathData="M512,298.65a85.35,85.35 0,1 0,0 -170.65,85.35 85.35,0 0,0 0,170.65z" |
||||
android:fillColor="#ffffff"/> |
||||
<path |
||||
android:pathData="M512,512m-85.35,0a85.35,85.35 0,1 0,170.7 0,85.35 85.35,0 1,0 -170.7,0Z" |
||||
android:fillColor="#ffffff"/> |
||||
<path |
||||
android:pathData="M512,896a85.35,85.35 0,1 0,0 -170.7,85.35 85.35,0 0,0 0,170.7z" |
||||
android:fillColor="#ffffff"/> |
||||
</vector> |
@ -0,0 +1,51 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<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="match_parent" |
||||
android:orientation="vertical"> |
||||
<include layout="@layout/toolbar"/> |
||||
<RelativeLayout |
||||
android:id="@+id/rl_all_record" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="60dp" |
||||
android:background="?android:attr/selectableItemBackground"> |
||||
|
||||
<ImageView |
||||
android:id="@+id/iv_all_record" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentStart="true" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginHorizontal="15dp" |
||||
android:src="@drawable/ic_history" |
||||
app:tint="@color/textPrimary" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_all_record" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_toEndOf="@id/iv_all_record" |
||||
android:text="@string/all_read_time" |
||||
android:textColor="@color/textPrimary" |
||||
android:textSize="@dimen/text_normal_size" /> |
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView |
||||
android:id="@+id/iv_more" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentEnd="true" |
||||
android:layout_centerVertical="true" |
||||
android:background="?android:attr/selectableItemBackground" |
||||
android:padding="5dp" |
||||
app:srcCompat="@drawable/ic_more" |
||||
app:tint="@color/textSecondary" /> |
||||
</RelativeLayout> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/rv_records" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content"/> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,113 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
android:id="@+id/rl_book_item" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical" |
||||
android:paddingStart="5dp" |
||||
android:paddingEnd="5dp"> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/ll_book_item" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="horizontal" |
||||
android:padding="5dp"> |
||||
|
||||
<CheckBox |
||||
android:id="@+id/cb_book_select" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="match_parent" |
||||
android:layout_gravity="center" |
||||
android:clickable="false" |
||||
android:enabled="true" |
||||
android:focusable="true" |
||||
android:paddingEnd="2dp" |
||||
android:theme="@style/MyCheckBox" |
||||
android:visibility="gone" /> |
||||
|
||||
<xyz.fycz.myreader.widget.CoverImageView |
||||
android:id="@+id/iv_book_img" |
||||
android:layout_width="48dp" |
||||
android:layout_height="66dp" |
||||
android:scaleType="fitXY" |
||||
app:srcCompat="@mipmap/default_cover" /> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/ll_book_read" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_book_name" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:maxLines="1" |
||||
android:padding="4dp" |
||||
android:text="bookname" |
||||
android:textColor="@color/textPrimary" |
||||
android:textSize="16dp" /> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:gravity="center_vertical" |
||||
android:orientation="horizontal"> |
||||
|
||||
<ImageView |
||||
android:layout_width="20dp" |
||||
android:layout_height="20dp" |
||||
android:padding="3dp" |
||||
app:srcCompat="@drawable/ic_author" |
||||
app:tint="@color/textSecondary" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_book_author" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:maxLines="1" |
||||
android:text="辰东" |
||||
android:textColor="@color/textSecondary" |
||||
android:textSize="12dp" /> |
||||
</LinearLayout> |
||||
|
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:gravity="center_vertical" |
||||
android:orientation="horizontal"> |
||||
|
||||
<ImageView |
||||
android:layout_width="20dp" |
||||
android:layout_height="20dp" |
||||
android:padding="3dp" |
||||
app:srcCompat="@drawable/ic_book_last" |
||||
app:tint="@color/textSecondary" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_book_read_record" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:ellipsize="end" |
||||
android:maxLines="1" |
||||
android:text="一天前 · 5分钟3秒" |
||||
android:textColor="@color/textSecondary" |
||||
android:textSize="@dimen/text_default_size" /> |
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
||||
</LinearLayout> |
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView |
||||
android:id="@+id/iv_more" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentEnd="true" |
||||
android:background="?android:attr/selectableItemBackground" |
||||
android:padding="5dp" |
||||
app:srcCompat="@drawable/ic_more" |
||||
app:tint="@color/textSecondary" /> |
||||
</RelativeLayout> |
@ -1,2 +1,2 @@ |
||||
#Tue Jun 01 08:59:40 CST 2021 |
||||
#Tue Jun 01 18:16:41 CST 2021 |
||||
VERSION_CODE=204 |
||||
|
Loading…
Reference in new issue