diff --git a/app/src/main/java/com/novel/read/Ext.kt b/app/src/main/java/com/novel/read/Ext.kt index 32e739f..4927cc6 100644 --- a/app/src/main/java/com/novel/read/Ext.kt +++ b/app/src/main/java/com/novel/read/Ext.kt @@ -1,8 +1,9 @@ package com.novel.read import android.content.Context +import android.widget.ImageView import android.widget.Toast fun Context.showToast(msg:String){ Toast.makeText(this,msg,Toast.LENGTH_SHORT).show() -} \ No newline at end of file +} diff --git a/app/src/main/java/com/novel/read/adapter/BookAdapter.java b/app/src/main/java/com/novel/read/adapter/BookAdapter.java index 7a2222a..81310b0 100644 --- a/app/src/main/java/com/novel/read/adapter/BookAdapter.java +++ b/app/src/main/java/com/novel/read/adapter/BookAdapter.java @@ -63,7 +63,7 @@ public class BookAdapter extends RecyclerView.Adapter { } else { ((ViewHolder) viewHolder).mIvGeng.setVisibility(View.GONE); } - GlideImageLoader.displayCornerImage(mContext, mList.get(i).getCover(), ((ViewHolder) viewHolder).mIvBook); + GlideImageLoader.INSTANCE.displayCornerImage(mContext, mList.get(i).getCover(), ((ViewHolder) viewHolder).mIvBook); viewHolder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -92,7 +92,7 @@ public class BookAdapter extends RecyclerView.Adapter { } else { ((ViewHolder) viewHolder).mIvGeng.setVisibility(View.GONE); } - GlideImageLoader.displayCornerImage(mContext, mList.get(i).getCover(), ((ViewHolder) viewHolder).mIvBook); + GlideImageLoader.INSTANCE.displayCornerImage(mContext, mList.get(i).getCover(), ((ViewHolder) viewHolder).mIvBook); viewHolder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/java/com/novel/read/adapter/BookListAdapter.java b/app/src/main/java/com/novel/read/adapter/BookListAdapter.java index e4c5393..1f030f7 100644 --- a/app/src/main/java/com/novel/read/adapter/BookListAdapter.java +++ b/app/src/main/java/com/novel/read/adapter/BookListAdapter.java @@ -98,7 +98,7 @@ public class BookListAdapter extends RecyclerView.Adapter { ((ViewHolder) viewHolder).tvBookName.setText(bookBean.getTitle()); ((ViewHolder) viewHolder).tvBookAuthor.setText(bookBean.getAuthor()); ((ViewHolder) viewHolder).tvBookDescription.setText(bookBean.getDescription()); - GlideImageLoader.displayCornerImage(mContext,bookBean.getCover(),((ViewHolder) viewHolder).ivBook); + GlideImageLoader.INSTANCE.displayCornerImage(mContext,bookBean.getCover(),((ViewHolder) viewHolder).ivBook); viewHolder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/java/com/novel/read/adapter/EditRecommendAdapter.java b/app/src/main/java/com/novel/read/adapter/EditRecommendAdapter.java index 6dd20e6..5aee29d 100644 --- a/app/src/main/java/com/novel/read/adapter/EditRecommendAdapter.java +++ b/app/src/main/java/com/novel/read/adapter/EditRecommendAdapter.java @@ -49,7 +49,7 @@ public class EditRecommendAdapter extends RecyclerView.Adapter public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { viewHolder.mTvBookName.setText(mList.get(i).getBook_title()); viewHolder.mTvAuthor.setText(mList.get(i).getAuthor()); - GlideImageLoader.displayCornerImage(mContext,mList.get(i).getBook_cover(),viewHolder.mIvBook); + GlideImageLoader.INSTANCE.displayCornerImage(mContext,mList.get(i).getBook_cover(),viewHolder.mIvBook); viewHolder.itemView.setOnClickListener(view -> { Intent intent=new Intent(mContext, NovelBookDetailActivity.class); intent.putExtra(Constant.Bundle.BookId, mList.get(i).getBook_id()); diff --git a/app/src/main/java/com/novel/read/adapter/LoveLyAdapter.java b/app/src/main/java/com/novel/read/adapter/LoveLyAdapter.java index c1cff4c..89d9b82 100644 --- a/app/src/main/java/com/novel/read/adapter/LoveLyAdapter.java +++ b/app/src/main/java/com/novel/read/adapter/LoveLyAdapter.java @@ -46,7 +46,7 @@ public class LoveLyAdapter extends RecyclerView.Adapter { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) { if (viewHolder instanceof ViewHolder) { RecommendBookResp.BookBean bookBean = mList.get(i); - GlideImageLoader.displayCornerImage(mContext, bookBean.getCover(), ((ViewHolder) viewHolder).mIvBook); + GlideImageLoader.INSTANCE.displayCornerImage(mContext, bookBean.getCover(), ((ViewHolder) viewHolder).mIvBook); ((ViewHolder) viewHolder).mTvBookName.setText(bookBean.getTitle()); ((ViewHolder) viewHolder).mTvBookAuthor.setText(mContext.getString(R.string.author_zhu,bookBean.getAuthor())); ((ViewHolder) viewHolder).mTvDescription.setText(bookBean.getDescription()); diff --git a/app/src/main/java/com/novel/read/adapter/RankAdapter.java b/app/src/main/java/com/novel/read/adapter/RankAdapter.java index c58dca4..bc6c18a 100644 --- a/app/src/main/java/com/novel/read/adapter/RankAdapter.java +++ b/app/src/main/java/com/novel/read/adapter/RankAdapter.java @@ -47,7 +47,7 @@ public class RankAdapter extends RecyclerView.Adapter{ public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { viewHolder.mTvBookName.setText(mList.get(i).getBook_title()); viewHolder.mTvAuthor.setText(mList.get(i).getAuthor()); - GlideImageLoader.displayCornerImage(mContext,mList.get(i).getBook_cover(),viewHolder.mIvBook); + GlideImageLoader.INSTANCE.displayCornerImage(mContext,mList.get(i).getBook_cover(),viewHolder.mIvBook); viewHolder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/java/com/novel/read/adapter/RankListAdapter.java b/app/src/main/java/com/novel/read/adapter/RankListAdapter.java index ed04148..d0060d6 100644 --- a/app/src/main/java/com/novel/read/adapter/RankListAdapter.java +++ b/app/src/main/java/com/novel/read/adapter/RankListAdapter.java @@ -98,7 +98,7 @@ public class RankListAdapter extends RecyclerView.Adapter { ((ViewHolder) viewHolder).tvBookName.setText(bookBean.getTitle()); ((ViewHolder) viewHolder).tvBookAuthor.setText(bookBean.getAuthor()); ((ViewHolder) viewHolder).tvBookDescription.setText(bookBean.getDescription()); - GlideImageLoader.displayCornerImage(mContext,bookBean.getCover(),((ViewHolder) viewHolder).ivBook); + GlideImageLoader.INSTANCE.displayCornerImage(mContext,bookBean.getCover(),((ViewHolder) viewHolder).ivBook); viewHolder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/java/com/novel/read/adapter/SearchAdapter.java b/app/src/main/java/com/novel/read/adapter/SearchAdapter.java index d996a80..7260ef8 100644 --- a/app/src/main/java/com/novel/read/adapter/SearchAdapter.java +++ b/app/src/main/java/com/novel/read/adapter/SearchAdapter.java @@ -108,7 +108,7 @@ public class SearchAdapter extends RecyclerView.Adapter { ((BookHolder) viewHolder).tvBookName.setText(bookBean.getTitle()); ((BookHolder) viewHolder).tvBookAuthor.setText(bookBean.getAuthor()); ((BookHolder) viewHolder).tvBookDescription.setText(bookBean.getDescription()); - GlideImageLoader.displayCornerImage(mContext, bookBean.getCover(), ((BookHolder) viewHolder).ivBook); + GlideImageLoader.INSTANCE.displayCornerImage(mContext, bookBean.getCover(), ((BookHolder) viewHolder).ivBook); viewHolder.itemView.setOnClickListener(view -> { Intent intent = new Intent(mContext, NovelBookDetailActivity.class); intent.putExtra(Constant.Bundle.BookId, bookBean.getId()); diff --git a/app/src/main/java/com/novel/read/adapter/StackAdapter.java b/app/src/main/java/com/novel/read/adapter/StackAdapter.java index 5c50345..78eafaf 100644 --- a/app/src/main/java/com/novel/read/adapter/StackAdapter.java +++ b/app/src/main/java/com/novel/read/adapter/StackAdapter.java @@ -53,7 +53,7 @@ public class StackAdapter extends RecyclerView.Adapter { intent.putExtra(Constant.Bundle.mTitle, mList.get(i).getTitle()); mContext.startActivity(intent); }); - GlideImageLoader.displayCornerImage(mContext, mList.get(i).getCover(), ((ViewHolder) viewHolder).mIvType, R.drawable.ic_type_default); + GlideImageLoader.INSTANCE.displayCornerImage(mContext, mList.get(i).getCover(), ((ViewHolder) viewHolder).mIvType, R.drawable.ic_type_default); } } diff --git a/app/src/main/java/com/novel/read/http/AccountManager.kt b/app/src/main/java/com/novel/read/http/AccountManager.kt index e61d59e..ecc3db1 100644 --- a/app/src/main/java/com/novel/read/http/AccountManager.kt +++ b/app/src/main/java/com/novel/read/http/AccountManager.kt @@ -26,7 +26,6 @@ import com.novel.read.model.db.dbManage.BookRepository import com.novel.read.model.protocol.BookDetailResp import com.novel.read.model.protocol.RankByUpdateResp import com.novel.read.model.protocol.RecommendListResp -import com.novel.read.utlis.LogUtils import com.novel.read.utlis.PhoneUtils import com.novel.read.widget.page.TxtChapter diff --git a/app/src/main/java/com/novel/read/model/db/dbManage/BookRepository.java b/app/src/main/java/com/novel/read/model/db/dbManage/BookRepository.java index eb250dc..98000bc 100644 --- a/app/src/main/java/com/novel/read/model/db/dbManage/BookRepository.java +++ b/app/src/main/java/com/novel/read/model/db/dbManage/BookRepository.java @@ -145,7 +145,7 @@ public class BookRepository { writer.flush(); } catch (IOException e) { e.printStackTrace(); - IOUtils.close(writer); + IOUtils.INSTANCE.close(writer); } } @@ -219,7 +219,7 @@ public class BookRepository { } catch (IOException e) { e.printStackTrace(); } finally { - IOUtils.close(reader); + IOUtils.INSTANCE.close(reader); } ChapterInfoBean bean = new ChapterInfoBean(); diff --git a/app/src/main/java/com/novel/read/model/protocol/SearchResp.java b/app/src/main/java/com/novel/read/model/protocol/SearchResp.java index 2c468d7..349d190 100644 --- a/app/src/main/java/com/novel/read/model/protocol/SearchResp.java +++ b/app/src/main/java/com/novel/read/model/protocol/SearchResp.java @@ -85,7 +85,7 @@ public class SearchResp implements Serializable { } public String getCover() { - return cover; + return cover == null ? "" : cover; } public void setCover(String cover) { diff --git a/app/src/main/java/com/novel/read/service/DownloadService.java b/app/src/main/java/com/novel/read/service/DownloadService.java index ef652a9..752ca88 100644 --- a/app/src/main/java/com/novel/read/service/DownloadService.java +++ b/app/src/main/java/com/novel/read/service/DownloadService.java @@ -6,6 +6,7 @@ import android.os.Binder; import android.os.Handler; import android.os.IBinder; import android.text.TextUtils; +import android.util.Log; import androidx.annotation.Nullable; @@ -21,7 +22,6 @@ import com.novel.read.model.db.DownloadTaskBean; import com.novel.read.model.db.dbManage.BookManager; import com.novel.read.model.db.dbManage.BookRepository; import com.novel.read.utlis.LocalManageUtil; -import com.novel.read.utlis.LogUtils; import com.novel.read.utlis.NetworkUtils; import java.util.ArrayList; @@ -320,7 +320,7 @@ public class DownloadService extends BaseService { }, e -> { //当前进度加载错误(这里需要判断是什么问题,根据相应的问题做出相应的回答) - LogUtils.e(e); + Log.e(TAG, "loadChapter: " + e); //设置加载结果 result[0] = LOAD_ERROR; } diff --git a/app/src/main/java/com/novel/read/utlis/Charset.java b/app/src/main/java/com/novel/read/utlis/Charset.java index 3632774..e3e9fcf 100644 --- a/app/src/main/java/com/novel/read/utlis/Charset.java +++ b/app/src/main/java/com/novel/read/utlis/Charset.java @@ -9,7 +9,7 @@ public enum Charset { UTF16BE("UTF-16BE"), GBK("GBK"); - private String mName; + public String mName; public static final byte BLANK = 0x0a; Charset(String name) { diff --git a/app/src/main/java/com/novel/read/utlis/DateUtli.java b/app/src/main/java/com/novel/read/utlis/DateUtli.java deleted file mode 100644 index 089b1f8..0000000 --- a/app/src/main/java/com/novel/read/utlis/DateUtli.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.novel.read.utlis; - -import android.annotation.SuppressLint; - - -import com.novel.read.constants.Constant; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -@SuppressLint("SimpleDateFormat") -public class DateUtli { - - private static final int HOUR_OF_DAY = 24; - private static final int DAY_OF_YESTERDAY = 2; - private static final int TIME_UNIT = 60; - - //将时间转换成日期 - public static String dateConvert(long time, String pattern) { - Date date = new Date(time); - @SuppressLint("SimpleDateFormat") SimpleDateFormat format = new SimpleDateFormat(pattern); - return format.format(date); - } - - - public static String dateConvert(long timesamp, int flag) { - timesamp = timesamp * 1000; - String result; - Calendar todayCalendar = Calendar.getInstance(); - Calendar otherCalendar = Calendar.getInstance(); - otherCalendar.setTimeInMillis(timesamp); - - String timeFormat = "M月d日"; - String yearTimeFormat = "yyyy年M月d日"; - - boolean yearTemp = todayCalendar.get(Calendar.YEAR) == otherCalendar.get(Calendar.YEAR); - if (yearTemp) { - int todayMonth = todayCalendar.get(Calendar.MONTH); - int otherMonth = otherCalendar.get(Calendar.MONTH); - if (todayMonth == otherMonth) {//表示是同一个月 - int temp = todayCalendar.get(Calendar.DATE) - otherCalendar.get(Calendar.DATE); - switch (temp) { - case 0: - result = getHourAndMin(timesamp); - break; - case 1: - if (flag == 1) { - result = "昨天 "; - } else { - result = "昨天 " + getHourAndMin(timesamp); - } - break; - case 2: - case 3: - case 4: - case 5: - case 6: - int dayOfMonth = otherCalendar.get(Calendar.WEEK_OF_MONTH); - int todayOfMonth = todayCalendar.get(Calendar.WEEK_OF_MONTH); - if (dayOfMonth == todayOfMonth) {//表示是同一周 - int dayOfWeek = otherCalendar.get(Calendar.DAY_OF_WEEK); - if (dayOfWeek != 1) {//判断当前是不是星期日 如想显示为:周日 12:09 可去掉此判断 - result = dayNames[otherCalendar.get(Calendar.DAY_OF_WEEK) - 1]; - } else { - result = getTime(timesamp, timeFormat); - } - } else { - result = getTime(timesamp, timeFormat); - } - break; - default: - result = getTime(timesamp, timeFormat); - break; - } - } else { - result = getTime(timesamp, timeFormat); - } - } else { - result = getYearTime(timesamp, yearTimeFormat); - } - return result; - } - - /** - * 当天的显示时间格式 - */ - private static String getHourAndMin(long time) { - SimpleDateFormat format = new SimpleDateFormat("HH:mm"); - return format.format(new Date(time)); - } - - /** - * 不同一周的显示时间格式 - */ - private static String getTime(long time, String timeFormat) { - SimpleDateFormat format = new SimpleDateFormat(timeFormat); - return format.format(new Date(time)); - } - - /** - * 不同年的显示时间格式 - */ - private static String getYearTime(long time, String yearTimeFormat) { - SimpleDateFormat format = new SimpleDateFormat(yearTimeFormat); - return format.format(new Date(time)); - } - - /** - * 时间戳格式转换 - */ - private static String[] dayNames = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"}; - -} diff --git a/app/src/main/java/com/novel/read/utlis/DateUtli.kt b/app/src/main/java/com/novel/read/utlis/DateUtli.kt new file mode 100644 index 0000000..561130d --- /dev/null +++ b/app/src/main/java/com/novel/read/utlis/DateUtli.kt @@ -0,0 +1,104 @@ +package com.novel.read.utlis + +import android.annotation.SuppressLint + + +import com.novel.read.constants.Constant + +import java.text.SimpleDateFormat +import java.util.Calendar +import java.util.Date + +@SuppressLint("SimpleDateFormat") +object DateUtli { + + private val HOUR_OF_DAY = 24 + private val DAY_OF_YESTERDAY = 2 + private val TIME_UNIT = 60 + + /** + * 时间戳格式转换 + */ + private val dayNames = arrayOf("周日", "周一", "周二", "周三", "周四", "周五", "周六") + + //将时间转换成日期 + fun dateConvert(time: Long, pattern: String): String { + val date = Date(time) + @SuppressLint("SimpleDateFormat") val format = SimpleDateFormat(pattern) + return format.format(date) + } + + + fun dateConvert(timesamp: Long, flag: Int): String { + var time = timesamp + time *= 1000 + val result: String + val todayCalendar = Calendar.getInstance() + val otherCalendar = Calendar.getInstance() + otherCalendar.timeInMillis = time + + val timeFormat = "M月d日" + val yearTimeFormat = "yyyy年M月d日" + + val yearTemp = todayCalendar.get(Calendar.YEAR) == otherCalendar.get(Calendar.YEAR) + if (yearTemp) { + val todayMonth = todayCalendar.get(Calendar.MONTH) + val otherMonth = otherCalendar.get(Calendar.MONTH) + if (todayMonth == otherMonth) {//表示是同一个月 + when (todayCalendar.get(Calendar.DATE) - otherCalendar.get(Calendar.DATE)) { + 0 -> result = getHourAndMin(time) + 1 -> if (flag == 1) { + result = "昨天 " + } else { + result = "昨天 " + getHourAndMin(time) + } + 2, 3, 4, 5, 6 -> { + val dayOfMonth = otherCalendar.get(Calendar.WEEK_OF_MONTH) + val todayOfMonth = todayCalendar.get(Calendar.WEEK_OF_MONTH) + if (dayOfMonth == todayOfMonth) {//表示是同一周 + val dayOfWeek = otherCalendar.get(Calendar.DAY_OF_WEEK) + if (dayOfWeek != 1) {//判断当前是不是星期日 如想显示为:周日 12:09 可去掉此判断 + result = dayNames[otherCalendar.get(Calendar.DAY_OF_WEEK) - 1] + } else { + result = getTime(time, timeFormat) + } + } else { + result = getTime(time, timeFormat) + } + } + else -> result = getTime(time, timeFormat) + } + } else { + result = getTime(time, timeFormat) + } + } else { + result = getYearTime(time, yearTimeFormat) + } + return result + } + + /** + * 当天的显示时间格式 + */ + private fun getHourAndMin(time: Long): String { + val format = SimpleDateFormat("HH:mm") + return format.format(Date(time)) + } + + /** + * 不同一周的显示时间格式 + */ + private fun getTime(time: Long, timeFormat: String): String { + val format = SimpleDateFormat(timeFormat) + return format.format(Date(time)) + } + + /** + * 不同年的显示时间格式 + */ + private fun getYearTime(time: Long, yearTimeFormat: String): String { + val format = SimpleDateFormat(yearTimeFormat) + return format.format(Date(time)) + } + +} diff --git a/app/src/main/java/com/novel/read/utlis/FileUtils.java b/app/src/main/java/com/novel/read/utlis/FileUtils.java index 6ae81d8..14a6cf4 100644 --- a/app/src/main/java/com/novel/read/utlis/FileUtils.java +++ b/app/src/main/java/com/novel/read/utlis/FileUtils.java @@ -22,12 +22,12 @@ import io.reactivex.SingleEmitter; import io.reactivex.SingleOnSubscribe; /** - * Created by newbiechen on 17-5-11. + * Created by zlj */ public class FileUtils { //采用自己的格式去设置文件,防止文件被系统文件查询到 - public static final String SUFFIX_NB = ".nb"; + public static final String SUFFIX_NB = ".zlj"; public static final String SUFFIX_TXT = ".txt"; public static final String SUFFIX_EPUB = ".epub"; public static final String SUFFIX_PDF = ".pdf"; @@ -126,7 +126,7 @@ public class FileUtils { } catch (IOException e) { e.printStackTrace(); }finally { - IOUtils.close(reader); + IOUtils.INSTANCE.close(reader); } return sb.toString(); } @@ -249,7 +249,7 @@ public class FileUtils { continue; else break; - } else if (0xE0 <= read && read <= 0xEF) {// 也有可能出错,但是几率较小 + } else if (0xE0 <= read) {// 也有可能出错,但是几率较小 read = bis.read(); if (0x80 <= read && read <= 0xBF) { read = bis.read(); @@ -266,7 +266,7 @@ public class FileUtils { } catch (Exception e) { e.printStackTrace(); } finally { - IOUtils.close(bis); + IOUtils.INSTANCE.close(bis); } return charset; } diff --git a/app/src/main/java/com/novel/read/utlis/GlideImageLoader.java b/app/src/main/java/com/novel/read/utlis/GlideImageLoader.java deleted file mode 100644 index 9c982be..0000000 --- a/app/src/main/java/com/novel/read/utlis/GlideImageLoader.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.novel.read.utlis; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.graphics.drawable.Drawable; -import android.widget.ImageView; - -import androidx.annotation.DrawableRes; -import androidx.annotation.NonNull; - -import com.bumptech.glide.Glide; -import com.bumptech.glide.RequestBuilder; -import com.bumptech.glide.load.engine.DiskCacheStrategy; -import com.bumptech.glide.load.resource.bitmap.RoundedCorners; -import com.bumptech.glide.request.RequestOptions; -import com.novel.read.R; - - -/** - * create by 赵利君 on 2018/11/21 - * describe: - */ -public class GlideImageLoader { - - public static void displayImage(Context context, String path, ImageView imageView) { - Glide.with(context) - .load(path) - .into(imageView); - } - - //加载矩形圆角图片 - public static void displayCornerImage(Context context, String path, ImageView imageView) { - //设置图片圆角角度 - RoundedCorners roundedCorners = new RoundedCorners(10); - RequestOptions options = RequestOptions.bitmapTransform(roundedCorners) - .placeholder(R.drawable.cover_default) - .error(R.drawable.cover_default) - ; - - - Glide.with(context) - .load(path) - .apply(options) -// .thumbnail(loadTransform(context,R.drawable.cover_default,5)) -// .thumbnail(loadTransform(context,R.drawable.cover_default,5)) - .into(imageView); - - } - private static RequestBuilder loadTransform(Context context, @DrawableRes int placeholderId, float radius) { - - return Glide.with(context) - .load(placeholderId) - .apply(new RequestOptions().centerCrop() - .transform(new GlideRoundTransform(context, (int) radius))); - - } - - - - //加载矩形圆角图片 自动设置占位图 - public static void displayCornerImage(Context context, String path, ImageView imageView,int defaultId) { - //设置图片圆角角度 - RoundedCorners roundedCorners = new RoundedCorners(15); - RequestOptions options = RequestOptions.bitmapTransform(roundedCorners) - .placeholder(defaultId) - .error(defaultId); - Glide.with(context) - .load(path) - .apply(options) - .into(imageView); - - } - - //加载圆形图片 - @SuppressLint("CheckResult") - public static void loadCirCleImage(Context context, String path, ImageView imageView, int width, int height) { - RequestOptions myOptions = getRequestHeadOptions().circleCrop(); - myOptions.error(R.mipmap.ic_launcher); - myOptions.placeholder(R.mipmap.ic_launcher); - Glide.with(context.getApplicationContext()) - .load(path) - .apply(myOptions) - .into(imageView); - } - - @NonNull - private static RequestOptions getRequestHeadOptions() { - return new RequestOptions() - .error(R.mipmap.ic_launcher)//设置错误图片 - .placeholder(R.mipmap.ic_launcher) //设置占位图片 - .diskCacheStrategy(DiskCacheStrategy.ALL); - } - -} diff --git a/app/src/main/java/com/novel/read/utlis/GlideImageLoader.kt b/app/src/main/java/com/novel/read/utlis/GlideImageLoader.kt new file mode 100644 index 0000000..38a88a4 --- /dev/null +++ b/app/src/main/java/com/novel/read/utlis/GlideImageLoader.kt @@ -0,0 +1,88 @@ +package com.novel.read.utlis + +import android.annotation.SuppressLint +import android.content.Context +import android.graphics.drawable.Drawable +import android.widget.ImageView + +import androidx.annotation.DrawableRes + +import com.bumptech.glide.Glide +import com.bumptech.glide.RequestBuilder +import com.bumptech.glide.load.engine.DiskCacheStrategy +import com.bumptech.glide.load.resource.bitmap.RoundedCorners +import com.bumptech.glide.request.RequestOptions +import com.novel.read.R + + +/** + * create by 赵利君 on 2018/11/21 + * describe: + */ +object GlideImageLoader { + + private//设置错误图片 + //设置占位图片 + val requestHeadOptions: RequestOptions + get() = RequestOptions() + .error(R.mipmap.ic_launcher) + .placeholder(R.mipmap.ic_launcher) + .diskCacheStrategy(DiskCacheStrategy.ALL) + + fun displayImage(context: Context, path: String, imageView: ImageView) { + Glide.with(context) + .load(path) + .into(imageView) + } + + //加载矩形圆角图片 + fun displayCornerImage(context: Context, path: String, imageView: ImageView) { + //设置图片圆角角度 + val roundedCorners = RoundedCorners(10) + val options = RequestOptions.bitmapTransform(roundedCorners) + .placeholder(R.drawable.cover_default) + .error(R.drawable.cover_default) + + + Glide.with(context) + .load(path) + .apply(options) + .into(imageView) + + } + + + + //加载矩形圆角图片 自动设置占位图 + fun displayCornerImage(context: Context, path: String, imageView: ImageView, defaultId: Int) { + //设置图片圆角角度 + val roundedCorners = RoundedCorners(15) + val options = RequestOptions.bitmapTransform(roundedCorners) + .placeholder(defaultId) + .error(defaultId) + Glide.with(context) + .load(path) + .apply(options) + .into(imageView) + + } + + //加载圆形图片 + @SuppressLint("CheckResult") + fun loadCirCleImage( + context: Context, + path: String, + imageView: ImageView, + width: Int, + height: Int + ) { + val myOptions = requestHeadOptions.circleCrop() + myOptions.error(R.mipmap.ic_launcher) + myOptions.placeholder(R.mipmap.ic_launcher) + Glide.with(context.applicationContext) + .load(path) + .apply(myOptions) + .into(imageView) + } + +} diff --git a/app/src/main/java/com/novel/read/utlis/GlideRoundTransform.java b/app/src/main/java/com/novel/read/utlis/GlideRoundTransform.java deleted file mode 100644 index 1875339..0000000 --- a/app/src/main/java/com/novel/read/utlis/GlideRoundTransform.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.novel.read.utlis; - -import android.content.Context; -import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.BitmapShader; -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.RectF; - -import androidx.annotation.NonNull; - -import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; -import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; - -import java.security.MessageDigest; - -public class GlideRoundTransform extends BitmapTransformation { - private static float radius = 0f; - - public GlideRoundTransform(Context context) { - this(context, 4); - } - - public GlideRoundTransform(Context context, int dp) { - this.radius = Resources.getSystem().getDisplayMetrics().density * dp; - } - - - @Override protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) { - return roundCrop(pool, toTransform); - } - - private static Bitmap roundCrop(BitmapPool pool, Bitmap source) { - if (source == null) return null; - - Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888); - - Canvas canvas = new Canvas(result); - Paint paint = new Paint(); - paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP)); - paint.setAntiAlias(true); - RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight()); - canvas.drawRoundRect(rectF, radius, radius, paint); - return result; - } - - public String getId() { - return getClass().getName() + Math.round(radius); - } - - @Override - public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { - - } -} diff --git a/app/src/main/java/com/novel/read/utlis/IOUtils.java b/app/src/main/java/com/novel/read/utlis/IOUtils.java deleted file mode 100644 index 8f7cd8c..0000000 --- a/app/src/main/java/com/novel/read/utlis/IOUtils.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.novel.read.utlis; - -import java.io.Closeable; -import java.io.IOException; - -/** - * Created by newbiechen on 17-5-11. - */ - -public class IOUtils { - - public static void close(Closeable closeable){ - if (closeable == null) return; - try { - closeable.close(); - } catch (IOException e) { - e.printStackTrace(); - //close error - } - } -} diff --git a/app/src/main/java/com/novel/read/utlis/IOUtils.kt b/app/src/main/java/com/novel/read/utlis/IOUtils.kt new file mode 100644 index 0000000..12283c3 --- /dev/null +++ b/app/src/main/java/com/novel/read/utlis/IOUtils.kt @@ -0,0 +1,22 @@ +package com.novel.read.utlis + +import java.io.Closeable +import java.io.IOException + +/** + * Created by zlj + */ + +object IOUtils { + + fun close(closeable: Closeable?) { + if (closeable == null) return + try { + closeable.close() + } catch (e: IOException) { + e.printStackTrace() + //close error + } + + } +} diff --git a/app/src/main/java/com/novel/read/utlis/LogUtils.java b/app/src/main/java/com/novel/read/utlis/LogUtils.java deleted file mode 100644 index d1abff4..0000000 --- a/app/src/main/java/com/novel/read/utlis/LogUtils.java +++ /dev/null @@ -1,222 +0,0 @@ -package com.novel.read.utlis; - -import android.content.Context; -import android.os.Environment; -import android.util.Log; - -import com.novel.read.base.MyApp; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -/** - * Created by newbiechen on 17-4-27. - */ - -public class LogUtils { - private static Boolean LOG_SWITCH = true; // 日志文件总开关 - private static Boolean LOG_TO_FILE = false; // 日志写入文件开关 - private static String LOG_TAG = "IReader"; // 默认的tag - private static char LOG_TYPE = 'v';// 输入日志类型,v代表输出所有信息,w则只输出警告... - private static int LOG_SAVE_DAYS = 7;// sd卡中日志文件的最多保存天数 - - private final static SimpleDateFormat LOG_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 日志的输出格式 - private final static SimpleDateFormat FILE_SUFFIX = new SimpleDateFormat("yyyy-MM-dd");// 日志文件格式 - private static String LOG_FILE_PATH; // 日志文件保存路径 - private static String LOG_FILE_NAME;// 日志文件保存名称 - - public static void init(Context context) { // 在Application中初始化 - LOG_FILE_PATH = Environment.getExternalStorageDirectory().getPath() + File.separator + MyApp.Companion.getContext().getPackageName(); - LOG_FILE_NAME = "Log"; - } - - /**************************** - * Warn - *********************************/ - public static void w(Object msg) { - w(LOG_TAG, msg); - } - - public static void w(String tag, Object msg) { - w(tag, msg, null); - } - - public static void w(String tag, Object msg, Throwable tr) { - if (msg == null) return; - log(tag, msg.toString(), tr, 'w'); - } - - /*************************** - * Error - ********************************/ - public static void e(Object msg) { - e(LOG_TAG, msg); - } - - public static void e(String tag, Object msg) { - e(tag, msg, null); - } - - public static void e(String tag, Object msg, Throwable tr) { - if (msg == null) return; - log(tag, msg.toString(), tr, 'e'); - } - - /*************************** - * Debug - ********************************/ - public static void d(Object msg) { - d(LOG_TAG, msg); - } - - public static void d(String tag, Object msg) {// 调试信息 - d(tag, msg, null); - } - - public static void d(String tag, Object msg, Throwable tr) { - if (msg == null) return; - log(tag, msg.toString(), tr, 'd'); - } - - /**************************** - * Info - *********************************/ - public static void i(Object msg) { - i(LOG_TAG, msg); - } - - public static void i(String tag, Object msg) { - i(tag, msg, null); - } - - public static void i(String tag, Object msg, Throwable tr) { - if (msg == null) return; - log(tag, msg.toString(), tr, 'i'); - } - - /************************** - * Verbose - ********************************/ - public static void v(Object msg) { - v(LOG_TAG, msg); - } - - public static void v(String tag, Object msg) { - v(tag, msg, null); - } - - public static void v(String tag, Object msg, Throwable tr) { - if (msg == null) return; - log(tag, msg.toString(), tr, 'v'); - } - - /** - * 根据tag, msg和等级,输出日志 - * - * @param tag - * @param msg - * @param level - */ - private static void log(String tag, String msg, Throwable tr, char level) { - if (tag == null || msg == null || tr == null) return; - if (LOG_SWITCH) { - if ('e' == level && ('e' == LOG_TYPE || 'v' == LOG_TYPE)) { // 输出错误信息 - Log.e(tag, createMessage(msg), tr); - } else if ('w' == level && ('w' == LOG_TYPE || 'v' == LOG_TYPE)) { - Log.w(tag, createMessage(msg), tr); - } else if ('d' == level && ('d' == LOG_TYPE || 'v' == LOG_TYPE)) { - Log.d(tag, createMessage(msg), tr); - } else if ('i' == level && ('d' == LOG_TYPE || 'v' == LOG_TYPE)) { - Log.i(tag, createMessage(msg), tr); - } else { - Log.v(tag, createMessage(msg), tr); - } - if (LOG_TO_FILE) - log2File(String.valueOf(level), tag, msg + tr == null ? "" : "\n" + Log.getStackTraceString(tr)); - } - } - - private static String getFunctionName() { - StackTraceElement[] sts = Thread.currentThread().getStackTrace(); - if (sts == null) { - return null; - } - for (StackTraceElement st : sts) { - if (st.isNativeMethod()) { - continue; - } - if (st.getClassName().equals(Thread.class.getName())) { - continue; - } - if (st.getFileName().equals("LogUtils.java")) { - continue; - } - return "[" + Thread.currentThread().getName() + "(" - + Thread.currentThread().getId() + "): " + st.getFileName() - + ":" + st.getLineNumber() + "]"; - } - return null; - } - - private static String createMessage(String msg) { - String functionName = getFunctionName(); - String message = (functionName == null ? msg - : (functionName + " - " + msg)); - return message; - } - - /** - * 打开日志文件并写入日志 - * - * @return - **/ - private synchronized static void log2File(String mylogtype, String tag, String text) { - Date nowtime = new Date(); - String date = FILE_SUFFIX.format(nowtime); - String dateLogContent = LOG_FORMAT.format(nowtime) + ":" + mylogtype + ":" + tag + ":" + text; // 日志输出格式 - File destDir = new File(LOG_FILE_PATH); - if (!destDir.exists()) { - destDir.mkdirs(); - } - File file = new File(LOG_FILE_PATH, LOG_FILE_NAME + date); - try { - FileWriter filerWriter = new FileWriter(file, true); - BufferedWriter bufWriter = new BufferedWriter(filerWriter); - bufWriter.write(dateLogContent); - bufWriter.newLine(); - bufWriter.close(); - filerWriter.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 删除指定的日志文件 - */ - public static void delFile() {// 删除日志文件 - String needDelFiel = FILE_SUFFIX.format(getDateBefore()); - File file = new File(LOG_FILE_PATH, needDelFiel + LOG_FILE_NAME); - if (file.exists()) { - file.delete(); - } - } - - /** - * 得到LOG_SAVE_DAYS天前的日期 - * - * @return - */ - private static Date getDateBefore() { - Date nowtime = new Date(); - Calendar now = Calendar.getInstance(); - now.setTime(nowtime); - now.set(Calendar.DATE, now.get(Calendar.DATE) - LOG_SAVE_DAYS); - return now.getTime(); - } -} diff --git a/app/src/main/java/com/novel/read/utlis/RxUtils.java b/app/src/main/java/com/novel/read/utlis/RxUtils.java index 99fe4e2..d4f08c6 100644 --- a/app/src/main/java/com/novel/read/utlis/RxUtils.java +++ b/app/src/main/java/com/novel/read/utlis/RxUtils.java @@ -25,18 +25,6 @@ public class RxUtils { return new TwoTuple(first, second); } -// public static Single> toCommentDetail(Single detailSingle, -// Single> bestCommentsSingle, -// Single> commentsSingle){ -// return Single.zip(detailSingle, bestCommentsSingle, commentsSingle, -// new Function3, List, DetailBean>() { -// @Override -// public DetailBean apply(T t, List commentBeen, -// List commentBeen2) throws Exception { -// return new DetailBean(t,commentBeen,commentBeen2); -// } -// }); -// } public static class TwoTuple { public final A first; diff --git a/app/src/main/java/com/novel/read/utlis/SpUtil.java b/app/src/main/java/com/novel/read/utlis/SpUtil.java index 7ddb23e..6c4696e 100644 --- a/app/src/main/java/com/novel/read/utlis/SpUtil.java +++ b/app/src/main/java/com/novel/read/utlis/SpUtil.java @@ -10,6 +10,7 @@ public class SpUtil { static SharedPreferences sp; private static SpUtil sInstance; + public static void init(Context context) { sp = context.getSharedPreferences(context.getPackageName(), Context.MODE_PRIVATE); } diff --git a/app/src/main/java/com/novel/read/widget/page/LocalPageLoader.java b/app/src/main/java/com/novel/read/widget/page/LocalPageLoader.java index 0ae5115..bd58865 100644 --- a/app/src/main/java/com/novel/read/widget/page/LocalPageLoader.java +++ b/app/src/main/java/com/novel/read/widget/page/LocalPageLoader.java @@ -1,6 +1,7 @@ package com.novel.read.widget.page; import android.content.Context; +import android.util.Log; import com.novel.read.constants.Constant; import com.novel.read.model.db.BookChapterBean; @@ -10,7 +11,6 @@ import com.novel.read.utlis.Charset; import com.novel.read.utlis.DateUtli; import com.novel.read.utlis.FileUtils; import com.novel.read.utlis.IOUtils; -import com.novel.read.utlis.LogUtils; import com.novel.read.utlis.MD5Utils; import com.novel.read.utlis.RxUtils; import com.novel.read.utlis.StringUtils; @@ -258,7 +258,7 @@ public class LocalPageLoader extends PageLoader { } mChapterList = chapters; - IOUtils.close(bookStream); + IOUtils.INSTANCE.close(bookStream); System.gc(); System.runFinalization(); @@ -284,7 +284,7 @@ public class LocalPageLoader extends PageLoader { } catch (IOException e) { e.printStackTrace(); } finally { - IOUtils.close(bookStream); + IOUtils.INSTANCE.close(bookStream); } return new byte[0]; @@ -348,7 +348,7 @@ public class LocalPageLoader extends PageLoader { //获取文件编码 mCharset = FileUtils.getCharset(mBookFile.getAbsolutePath()); - String lastModified = DateUtli.dateConvert(mBookFile.lastModified(), Constant.FORMAT_BOOK_DATE); + String lastModified = DateUtli.INSTANCE.dateConvert(mBookFile.lastModified(), Constant.FORMAT_BOOK_DATE); // 判断文件是否已经加载过,并具有缓存 if (!mCollBook.isUpdate() && mCollBook.getUpdated() != null @@ -409,7 +409,7 @@ public class LocalPageLoader extends PageLoader { mCollBook.setBookChapters(bookChapterBeanList); mCollBook.setUpdated(lastModified); - BookRepository.getInstance().saveBookChaptersWithAsync(bookChapterBeanList,mCollBook); + BookRepository.getInstance().saveBookChaptersWithAsync(bookChapterBeanList, mCollBook); BookRepository.getInstance().saveCollBook(mCollBook); // 加载并显示当前章节 @@ -419,7 +419,7 @@ public class LocalPageLoader extends PageLoader { @Override public void onError(Throwable e) { chapterError(); - LogUtils.d(TAG, "file load error:" + e.toString()); + Log.e(TAG, "file load error: " + e.toString()); } }); } diff --git a/app/src/main/java/com/novel/read/widget/page/PageLoader.java b/app/src/main/java/com/novel/read/widget/page/PageLoader.java index 7d0f7d5..6f881b5 100644 --- a/app/src/main/java/com/novel/read/widget/page/PageLoader.java +++ b/app/src/main/java/com/novel/read/widget/page/PageLoader.java @@ -821,7 +821,7 @@ public abstract class PageLoader { //绘制当前时间 //底部的字显示的位置Y float y = mDisplayHeight - mTipPaint.getFontMetrics().bottom - tipMarginHeight; - String time = DateUtli.dateConvert(System.currentTimeMillis(), Constant.FORMAT_TIME); + String time = DateUtli.INSTANCE.dateConvert(System.currentTimeMillis(), Constant.FORMAT_TIME); float x = outFrameLeft - mTipPaint.measureText(time) - ScreenUtils.INSTANCE.dpToPx(4); canvas.drawText(time, x, y, mTipPaint); } @@ -1411,7 +1411,7 @@ public abstract class PageLoader { } catch (IOException e) { e.printStackTrace(); } finally { - IOUtils.close(br); + IOUtils.INSTANCE.close(br); } return pages; } diff --git a/app/src/main/java/com/novel/read/widget/page/PageView.java b/app/src/main/java/com/novel/read/widget/page/PageView.java index 6b459a2..44ec573 100644 --- a/app/src/main/java/com/novel/read/widget/page/PageView.java +++ b/app/src/main/java/com/novel/read/widget/page/PageView.java @@ -159,7 +159,7 @@ public class PageView extends View { //设置点击点 mPageAnim.setTouchPoint(x, y); //设置方向 - Boolean hasNext = hasNextPage(); + boolean hasNext = hasNextPage(); mPageAnim.setDirection(direction); if (!hasNext) { @@ -174,7 +174,7 @@ public class PageView extends View { mPageAnim.setTouchPoint(x, y); mPageAnim.setDirection(direction); //设置方向方向 - Boolean hashPrev = hasPrevPage(); + boolean hashPrev = hasPrevPage(); if (!hashPrev) { return; } diff --git a/app/src/main/java/com/novel/read/widget/page/ReadSettingManager.java b/app/src/main/java/com/novel/read/widget/page/ReadSettingManager.java index 6df8551..63b1609 100644 --- a/app/src/main/java/com/novel/read/widget/page/ReadSettingManager.java +++ b/app/src/main/java/com/novel/read/widget/page/ReadSettingManager.java @@ -26,8 +26,6 @@ public class ReadSettingManager { private static volatile ReadSettingManager sInstance; - private SpUtil sharedPreUtils; - public static ReadSettingManager getInstance() { if (sInstance == null) { synchronized (ReadSettingManager.class) { @@ -40,7 +38,6 @@ public class ReadSettingManager { } private ReadSettingManager() { - sharedPreUtils = SpUtil.getInstance(); } public void setPageStyle(PageStyle pageStyle) { diff --git a/app/src/main/java/com/novel/read/widget/page/anim/CoverPageAnim.kt b/app/src/main/java/com/novel/read/widget/page/anim/CoverPageAnim.kt index 216a893..4d41076 100644 --- a/app/src/main/java/com/novel/read/widget/page/anim/CoverPageAnim.kt +++ b/app/src/main/java/com/novel/read/widget/page/anim/CoverPageAnim.kt @@ -12,7 +12,7 @@ import com.novel.read.widget.page.PageAnimation * 覆盖动画 */ -class CoverPageAnim(w: Int, h: Int, view: View, listener: PageAnimation.OnPageChangeListener) : +class CoverPageAnim(w: Int, h: Int, view: View, listener: OnPageChangeListener) : HorizonPageAnim(w, h, view, listener) { private val mSrcRect: Rect = Rect(0, 0, mViewWidth, mViewHeight) diff --git a/app/src/main/java/com/novel/read/widget/page/anim/HorizonPageAnim.kt b/app/src/main/java/com/novel/read/widget/page/anim/HorizonPageAnim.kt index 4ac0243..23300a8 100644 --- a/app/src/main/java/com/novel/read/widget/page/anim/HorizonPageAnim.kt +++ b/app/src/main/java/com/novel/read/widget/page/anim/HorizonPageAnim.kt @@ -15,7 +15,7 @@ import com.novel.read.widget.page.PageAnimation abstract class HorizonPageAnim( w: Int, h: Int, marginWidth: Int, marginHeight: Int, - view: View, listener: PageAnimation.OnPageChangeListener + view: View, listener: OnPageChangeListener ) : PageAnimation(w, h, marginWidth, marginHeight, view, listener) { protected var mCurBitmap: Bitmap @@ -34,7 +34,7 @@ abstract class HorizonPageAnim( //是否没下一页或者上一页 private var noNext = false - constructor(w: Int, h: Int, view: View, listener: PageAnimation.OnPageChangeListener) : this( + constructor(w: Int, h: Int, view: View, listener: OnPageChangeListener) : this( w, h, 0, diff --git a/app/src/main/java/com/novel/read/widget/page/anim/NonePageAnim.kt b/app/src/main/java/com/novel/read/widget/page/anim/NonePageAnim.kt index f574eb7..6962fef 100644 --- a/app/src/main/java/com/novel/read/widget/page/anim/NonePageAnim.kt +++ b/app/src/main/java/com/novel/read/widget/page/anim/NonePageAnim.kt @@ -9,7 +9,7 @@ import com.novel.read.widget.page.PageAnimation * 无 */ -class NonePageAnim(w: Int, h: Int, view: View, listener: PageAnimation.OnPageChangeListener) : +class NonePageAnim(w: Int, h: Int, view: View, listener: OnPageChangeListener) : HorizonPageAnim(w, h, view, listener) { override fun drawStatic(canvas: Canvas) { diff --git a/app/src/main/java/com/novel/read/widget/page/anim/ScrollPageAnim.kt b/app/src/main/java/com/novel/read/widget/page/anim/ScrollPageAnim.kt index 453ad2e..4893d7a 100644 --- a/app/src/main/java/com/novel/read/widget/page/anim/ScrollPageAnim.kt +++ b/app/src/main/java/com/novel/read/widget/page/anim/ScrollPageAnim.kt @@ -22,7 +22,7 @@ import java.util.ArrayList */ class ScrollPageAnim( w: Int, h: Int, marginWidth: Int, marginHeight: Int, - view: View, listener: PageAnimation.OnPageChangeListener + view: View, listener: OnPageChangeListener ) : PageAnimation(w, h, marginWidth, marginHeight, view, listener) { private var mVelocity: VelocityTracker? = null diff --git a/app/src/main/java/com/novel/read/widget/page/anim/SimulationPageAnim.kt b/app/src/main/java/com/novel/read/widget/page/anim/SimulationPageAnim.kt index 9d9fb3b..3b36463 100644 --- a/app/src/main/java/com/novel/read/widget/page/anim/SimulationPageAnim.kt +++ b/app/src/main/java/com/novel/read/widget/page/anim/SimulationPageAnim.kt @@ -11,7 +11,7 @@ import com.novel.read.widget.page.PageAnimation * 仿真动画 */ -class SimulationPageAnim(w: Int, h: Int, view: View, listener: PageAnimation.OnPageChangeListener) : +class SimulationPageAnim(w: Int, h: Int, view: View, listener: OnPageChangeListener) : HorizonPageAnim(w, h, view, listener) { private var mCornerX = 1 // 拖拽点对应的页脚 diff --git a/app/src/main/java/com/novel/read/widget/page/anim/SlidePageAnim.kt b/app/src/main/java/com/novel/read/widget/page/anim/SlidePageAnim.kt index d9a01cf..6a27996 100644 --- a/app/src/main/java/com/novel/read/widget/page/anim/SlidePageAnim.kt +++ b/app/src/main/java/com/novel/read/widget/page/anim/SlidePageAnim.kt @@ -9,7 +9,7 @@ import com.novel.read.widget.page.PageAnimation * Created by zlj */ -class SlidePageAnim(w: Int, h: Int, view: View, listener: PageAnimation.OnPageChangeListener) : +class SlidePageAnim(w: Int, h: Int, view: View, listener: OnPageChangeListener) : HorizonPageAnim(w, h, view, listener) { private val mSrcRect: Rect = Rect(0, 0, mViewWidth, mViewHeight)