转换部分java代码

old
zlj 5 years ago
parent 1c0f80809b
commit aa8e511414
  1. 3
      app/src/main/java/com/novel/read/Ext.kt
  2. 4
      app/src/main/java/com/novel/read/adapter/BookAdapter.java
  3. 2
      app/src/main/java/com/novel/read/adapter/BookListAdapter.java
  4. 2
      app/src/main/java/com/novel/read/adapter/EditRecommendAdapter.java
  5. 2
      app/src/main/java/com/novel/read/adapter/HumanAdapter.java
  6. 2
      app/src/main/java/com/novel/read/adapter/LoveLyAdapter.java
  7. 2
      app/src/main/java/com/novel/read/adapter/RankAdapter.java
  8. 2
      app/src/main/java/com/novel/read/adapter/RankListAdapter.java
  9. 2
      app/src/main/java/com/novel/read/adapter/SearchAdapter.java
  10. 2
      app/src/main/java/com/novel/read/adapter/StackAdapter.java
  11. 1
      app/src/main/java/com/novel/read/http/AccountManager.kt
  12. 4
      app/src/main/java/com/novel/read/model/db/dbManage/BookRepository.java
  13. 2
      app/src/main/java/com/novel/read/model/protocol/SearchResp.java
  14. 4
      app/src/main/java/com/novel/read/service/DownloadService.java
  15. 2
      app/src/main/java/com/novel/read/utlis/Charset.java
  16. 114
      app/src/main/java/com/novel/read/utlis/DateUtli.java
  17. 104
      app/src/main/java/com/novel/read/utlis/DateUtli.kt
  18. 10
      app/src/main/java/com/novel/read/utlis/FileUtils.java
  19. 94
      app/src/main/java/com/novel/read/utlis/GlideImageLoader.java
  20. 88
      app/src/main/java/com/novel/read/utlis/GlideImageLoader.kt
  21. 56
      app/src/main/java/com/novel/read/utlis/GlideRoundTransform.java
  22. 21
      app/src/main/java/com/novel/read/utlis/IOUtils.java
  23. 22
      app/src/main/java/com/novel/read/utlis/IOUtils.kt
  24. 222
      app/src/main/java/com/novel/read/utlis/LogUtils.java
  25. 12
      app/src/main/java/com/novel/read/utlis/RxUtils.java
  26. 1
      app/src/main/java/com/novel/read/utlis/SpUtil.java
  27. 12
      app/src/main/java/com/novel/read/widget/page/LocalPageLoader.java
  28. 4
      app/src/main/java/com/novel/read/widget/page/PageLoader.java
  29. 4
      app/src/main/java/com/novel/read/widget/page/PageView.java
  30. 3
      app/src/main/java/com/novel/read/widget/page/ReadSettingManager.java
  31. 2
      app/src/main/java/com/novel/read/widget/page/anim/CoverPageAnim.kt
  32. 4
      app/src/main/java/com/novel/read/widget/page/anim/HorizonPageAnim.kt
  33. 2
      app/src/main/java/com/novel/read/widget/page/anim/NonePageAnim.kt
  34. 2
      app/src/main/java/com/novel/read/widget/page/anim/ScrollPageAnim.kt
  35. 2
      app/src/main/java/com/novel/read/widget/page/anim/SimulationPageAnim.kt
  36. 2
      app/src/main/java/com/novel/read/widget/page/anim/SlidePageAnim.kt

@ -1,8 +1,9 @@
package com.novel.read package com.novel.read
import android.content.Context import android.content.Context
import android.widget.ImageView
import android.widget.Toast import android.widget.Toast
fun Context.showToast(msg:String){ fun Context.showToast(msg:String){
Toast.makeText(this,msg,Toast.LENGTH_SHORT).show() Toast.makeText(this,msg,Toast.LENGTH_SHORT).show()
} }

@ -63,7 +63,7 @@ public class BookAdapter extends RecyclerView.Adapter {
} else { } else {
((ViewHolder) viewHolder).mIvGeng.setVisibility(View.GONE); ((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() { viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -92,7 +92,7 @@ public class BookAdapter extends RecyclerView.Adapter {
} else { } else {
((ViewHolder) viewHolder).mIvGeng.setVisibility(View.GONE); ((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() { viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {

@ -98,7 +98,7 @@ public class BookListAdapter extends RecyclerView.Adapter {
((ViewHolder) viewHolder).tvBookName.setText(bookBean.getTitle()); ((ViewHolder) viewHolder).tvBookName.setText(bookBean.getTitle());
((ViewHolder) viewHolder).tvBookAuthor.setText(bookBean.getAuthor()); ((ViewHolder) viewHolder).tvBookAuthor.setText(bookBean.getAuthor());
((ViewHolder) viewHolder).tvBookDescription.setText(bookBean.getDescription()); ((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() { viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {

@ -49,7 +49,7 @@ public class EditRecommendAdapter extends RecyclerView.Adapter<EditRecommendAdap
viewHolder.mTvDescription.setText(listBean.getDescription()); viewHolder.mTvDescription.setText(listBean.getDescription());
viewHolder.mTvHumanNum.setText(listBean.getHot()); viewHolder.mTvHumanNum.setText(listBean.getHot());
viewHolder.mTvLoveNum.setText(listBean.getLike()); viewHolder.mTvLoveNum.setText(listBean.getLike());
GlideImageLoader.displayCornerImage(mContext,listBean.getBook_cover(),viewHolder.mIvBook); GlideImageLoader.INSTANCE.displayCornerImage(mContext,listBean.getBook_cover(),viewHolder.mIvBook);
viewHolder.itemView.setOnClickListener(new View.OnClickListener() { viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {

@ -46,7 +46,7 @@ public class HumanAdapter extends RecyclerView.Adapter<HumanAdapter.ViewHolder>
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
viewHolder.mTvBookName.setText(mList.get(i).getBook_title()); viewHolder.mTvBookName.setText(mList.get(i).getBook_title());
viewHolder.mTvAuthor.setText(mList.get(i).getAuthor()); 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 -> { viewHolder.itemView.setOnClickListener(view -> {
Intent intent=new Intent(mContext, NovelBookDetailActivity.class); Intent intent=new Intent(mContext, NovelBookDetailActivity.class);
intent.putExtra(Constant.Bundle.BookId, mList.get(i).getBook_id()); intent.putExtra(Constant.Bundle.BookId, mList.get(i).getBook_id());

@ -46,7 +46,7 @@ public class LoveLyAdapter extends RecyclerView.Adapter {
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
if (viewHolder instanceof ViewHolder) { if (viewHolder instanceof ViewHolder) {
RecommendBookResp.BookBean bookBean = mList.get(i); 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).mTvBookName.setText(bookBean.getTitle());
((ViewHolder) viewHolder).mTvBookAuthor.setText(mContext.getString(R.string.author_zhu,bookBean.getAuthor())); ((ViewHolder) viewHolder).mTvBookAuthor.setText(mContext.getString(R.string.author_zhu,bookBean.getAuthor()));
((ViewHolder) viewHolder).mTvDescription.setText(bookBean.getDescription()); ((ViewHolder) viewHolder).mTvDescription.setText(bookBean.getDescription());

@ -47,7 +47,7 @@ public class RankAdapter extends RecyclerView.Adapter<RankAdapter.ViewHolder>{
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
viewHolder.mTvBookName.setText(mList.get(i).getBook_title()); viewHolder.mTvBookName.setText(mList.get(i).getBook_title());
viewHolder.mTvAuthor.setText(mList.get(i).getAuthor()); 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() { viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {

@ -98,7 +98,7 @@ public class RankListAdapter extends RecyclerView.Adapter {
((ViewHolder) viewHolder).tvBookName.setText(bookBean.getTitle()); ((ViewHolder) viewHolder).tvBookName.setText(bookBean.getTitle());
((ViewHolder) viewHolder).tvBookAuthor.setText(bookBean.getAuthor()); ((ViewHolder) viewHolder).tvBookAuthor.setText(bookBean.getAuthor());
((ViewHolder) viewHolder).tvBookDescription.setText(bookBean.getDescription()); ((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() { viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {

@ -108,7 +108,7 @@ public class SearchAdapter extends RecyclerView.Adapter {
((BookHolder) viewHolder).tvBookName.setText(bookBean.getTitle()); ((BookHolder) viewHolder).tvBookName.setText(bookBean.getTitle());
((BookHolder) viewHolder).tvBookAuthor.setText(bookBean.getAuthor()); ((BookHolder) viewHolder).tvBookAuthor.setText(bookBean.getAuthor());
((BookHolder) viewHolder).tvBookDescription.setText(bookBean.getDescription()); ((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 -> { viewHolder.itemView.setOnClickListener(view -> {
Intent intent = new Intent(mContext, NovelBookDetailActivity.class); Intent intent = new Intent(mContext, NovelBookDetailActivity.class);
intent.putExtra(Constant.Bundle.BookId, bookBean.getId()); intent.putExtra(Constant.Bundle.BookId, bookBean.getId());

@ -53,7 +53,7 @@ public class StackAdapter extends RecyclerView.Adapter {
intent.putExtra(Constant.Bundle.mTitle, mList.get(i).getTitle()); intent.putExtra(Constant.Bundle.mTitle, mList.get(i).getTitle());
mContext.startActivity(intent); 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);
} }
} }

@ -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.BookDetailResp
import com.novel.read.model.protocol.RankByUpdateResp import com.novel.read.model.protocol.RankByUpdateResp
import com.novel.read.model.protocol.RecommendListResp import com.novel.read.model.protocol.RecommendListResp
import com.novel.read.utlis.LogUtils
import com.novel.read.utlis.PhoneUtils import com.novel.read.utlis.PhoneUtils
import com.novel.read.widget.page.TxtChapter import com.novel.read.widget.page.TxtChapter

@ -145,7 +145,7 @@ public class BookRepository {
writer.flush(); writer.flush();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
IOUtils.close(writer); IOUtils.INSTANCE.close(writer);
} }
} }
@ -219,7 +219,7 @@ public class BookRepository {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
IOUtils.close(reader); IOUtils.INSTANCE.close(reader);
} }
ChapterInfoBean bean = new ChapterInfoBean(); ChapterInfoBean bean = new ChapterInfoBean();

@ -85,7 +85,7 @@ public class SearchResp implements Serializable {
} }
public String getCover() { public String getCover() {
return cover; return cover == null ? "" : cover;
} }
public void setCover(String cover) { public void setCover(String cover) {

@ -6,6 +6,7 @@ import android.os.Binder;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable; 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.BookManager;
import com.novel.read.model.db.dbManage.BookRepository; import com.novel.read.model.db.dbManage.BookRepository;
import com.novel.read.utlis.LocalManageUtil; import com.novel.read.utlis.LocalManageUtil;
import com.novel.read.utlis.LogUtils;
import com.novel.read.utlis.NetworkUtils; import com.novel.read.utlis.NetworkUtils;
import java.util.ArrayList; import java.util.ArrayList;
@ -320,7 +320,7 @@ public class DownloadService extends BaseService {
}, },
e -> { e -> {
//当前进度加载错误(这里需要判断是什么问题,根据相应的问题做出相应的回答) //当前进度加载错误(这里需要判断是什么问题,根据相应的问题做出相应的回答)
LogUtils.e(e); Log.e(TAG, "loadChapter: " + e);
//设置加载结果 //设置加载结果
result[0] = LOAD_ERROR; result[0] = LOAD_ERROR;
} }

@ -9,7 +9,7 @@ public enum Charset {
UTF16BE("UTF-16BE"), UTF16BE("UTF-16BE"),
GBK("GBK"); GBK("GBK");
private String mName; public String mName;
public static final byte BLANK = 0x0a; public static final byte BLANK = 0x0a;
Charset(String name) { Charset(String name) {

@ -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 = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"};
}

@ -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))
}
}

@ -22,12 +22,12 @@ import io.reactivex.SingleEmitter;
import io.reactivex.SingleOnSubscribe; import io.reactivex.SingleOnSubscribe;
/** /**
* Created by newbiechen on 17-5-11. * Created by zlj
*/ */
public class FileUtils { 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_TXT = ".txt";
public static final String SUFFIX_EPUB = ".epub"; public static final String SUFFIX_EPUB = ".epub";
public static final String SUFFIX_PDF = ".pdf"; public static final String SUFFIX_PDF = ".pdf";
@ -126,7 +126,7 @@ public class FileUtils {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
}finally { }finally {
IOUtils.close(reader); IOUtils.INSTANCE.close(reader);
} }
return sb.toString(); return sb.toString();
} }
@ -249,7 +249,7 @@ public class FileUtils {
continue; continue;
else else
break; break;
} else if (0xE0 <= read && read <= 0xEF) {// 也有可能出错,但是几率较小 } else if (0xE0 <= read) {// 也有可能出错,但是几率较小
read = bis.read(); read = bis.read();
if (0x80 <= read && read <= 0xBF) { if (0x80 <= read && read <= 0xBF) {
read = bis.read(); read = bis.read();
@ -266,7 +266,7 @@ public class FileUtils {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
IOUtils.close(bis); IOUtils.INSTANCE.close(bis);
} }
return charset; return charset;
} }

@ -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<Drawable> 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);
}
}

@ -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)
}
}

@ -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) {
}
}

@ -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
}
}
}

@ -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
}
}
}

@ -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();
}
}

@ -25,18 +25,6 @@ public class RxUtils {
return new TwoTuple<T, R>(first, second); return new TwoTuple<T, R>(first, second);
} }
// public static <T> Single<DetailBean<T>> toCommentDetail(Single<T> detailSingle,
// Single<List<CommentBean>> bestCommentsSingle,
// Single<List<CommentBean>> commentsSingle){
// return Single.zip(detailSingle, bestCommentsSingle, commentsSingle,
// new Function3<T, List<CommentBean>, List<CommentBean>, DetailBean<T>>() {
// @Override
// public DetailBean<T> apply(T t, List<CommentBean> commentBeen,
// List<CommentBean> commentBeen2) throws Exception {
// return new DetailBean<T>(t,commentBeen,commentBeen2);
// }
// });
// }
public static class TwoTuple<A, B> { public static class TwoTuple<A, B> {
public final A first; public final A first;

@ -10,6 +10,7 @@ public class SpUtil {
static SharedPreferences sp; static SharedPreferences sp;
private static SpUtil sInstance; private static SpUtil sInstance;
public static void init(Context context) { public static void init(Context context) {
sp = context.getSharedPreferences(context.getPackageName(), Context.MODE_PRIVATE); sp = context.getSharedPreferences(context.getPackageName(), Context.MODE_PRIVATE);
} }

@ -1,6 +1,7 @@
package com.novel.read.widget.page; package com.novel.read.widget.page;
import android.content.Context; import android.content.Context;
import android.util.Log;
import com.novel.read.constants.Constant; import com.novel.read.constants.Constant;
import com.novel.read.model.db.BookChapterBean; 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.DateUtli;
import com.novel.read.utlis.FileUtils; import com.novel.read.utlis.FileUtils;
import com.novel.read.utlis.IOUtils; import com.novel.read.utlis.IOUtils;
import com.novel.read.utlis.LogUtils;
import com.novel.read.utlis.MD5Utils; import com.novel.read.utlis.MD5Utils;
import com.novel.read.utlis.RxUtils; import com.novel.read.utlis.RxUtils;
import com.novel.read.utlis.StringUtils; import com.novel.read.utlis.StringUtils;
@ -258,7 +258,7 @@ public class LocalPageLoader extends PageLoader {
} }
mChapterList = chapters; mChapterList = chapters;
IOUtils.close(bookStream); IOUtils.INSTANCE.close(bookStream);
System.gc(); System.gc();
System.runFinalization(); System.runFinalization();
@ -284,7 +284,7 @@ public class LocalPageLoader extends PageLoader {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
IOUtils.close(bookStream); IOUtils.INSTANCE.close(bookStream);
} }
return new byte[0]; return new byte[0];
@ -348,7 +348,7 @@ public class LocalPageLoader extends PageLoader {
//获取文件编码 //获取文件编码
mCharset = FileUtils.getCharset(mBookFile.getAbsolutePath()); 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 if (!mCollBook.isUpdate() && mCollBook.getUpdated() != null
@ -409,7 +409,7 @@ public class LocalPageLoader extends PageLoader {
mCollBook.setBookChapters(bookChapterBeanList); mCollBook.setBookChapters(bookChapterBeanList);
mCollBook.setUpdated(lastModified); mCollBook.setUpdated(lastModified);
BookRepository.getInstance().saveBookChaptersWithAsync(bookChapterBeanList,mCollBook); BookRepository.getInstance().saveBookChaptersWithAsync(bookChapterBeanList, mCollBook);
BookRepository.getInstance().saveCollBook(mCollBook); BookRepository.getInstance().saveCollBook(mCollBook);
// 加载并显示当前章节 // 加载并显示当前章节
@ -419,7 +419,7 @@ public class LocalPageLoader extends PageLoader {
@Override @Override
public void onError(Throwable e) { public void onError(Throwable e) {
chapterError(); chapterError();
LogUtils.d(TAG, "file load error:" + e.toString()); Log.e(TAG, "file load error: " + e.toString());
} }
}); });
} }

@ -821,7 +821,7 @@ public abstract class PageLoader {
//绘制当前时间 //绘制当前时间
//底部的字显示的位置Y //底部的字显示的位置Y
float y = mDisplayHeight - mTipPaint.getFontMetrics().bottom - tipMarginHeight; 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); float x = outFrameLeft - mTipPaint.measureText(time) - ScreenUtils.INSTANCE.dpToPx(4);
canvas.drawText(time, x, y, mTipPaint); canvas.drawText(time, x, y, mTipPaint);
} }
@ -1411,7 +1411,7 @@ public abstract class PageLoader {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
IOUtils.close(br); IOUtils.INSTANCE.close(br);
} }
return pages; return pages;
} }

@ -159,7 +159,7 @@ public class PageView extends View {
//设置点击点 //设置点击点
mPageAnim.setTouchPoint(x, y); mPageAnim.setTouchPoint(x, y);
//设置方向 //设置方向
Boolean hasNext = hasNextPage(); boolean hasNext = hasNextPage();
mPageAnim.setDirection(direction); mPageAnim.setDirection(direction);
if (!hasNext) { if (!hasNext) {
@ -174,7 +174,7 @@ public class PageView extends View {
mPageAnim.setTouchPoint(x, y); mPageAnim.setTouchPoint(x, y);
mPageAnim.setDirection(direction); mPageAnim.setDirection(direction);
//设置方向方向 //设置方向方向
Boolean hashPrev = hasPrevPage(); boolean hashPrev = hasPrevPage();
if (!hashPrev) { if (!hashPrev) {
return; return;
} }

@ -26,8 +26,6 @@ public class ReadSettingManager {
private static volatile ReadSettingManager sInstance; private static volatile ReadSettingManager sInstance;
private SpUtil sharedPreUtils;
public static ReadSettingManager getInstance() { public static ReadSettingManager getInstance() {
if (sInstance == null) { if (sInstance == null) {
synchronized (ReadSettingManager.class) { synchronized (ReadSettingManager.class) {
@ -40,7 +38,6 @@ public class ReadSettingManager {
} }
private ReadSettingManager() { private ReadSettingManager() {
sharedPreUtils = SpUtil.getInstance();
} }
public void setPageStyle(PageStyle pageStyle) { public void setPageStyle(PageStyle pageStyle) {

@ -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) { HorizonPageAnim(w, h, view, listener) {
private val mSrcRect: Rect = Rect(0, 0, mViewWidth, mViewHeight) private val mSrcRect: Rect = Rect(0, 0, mViewWidth, mViewHeight)

@ -15,7 +15,7 @@ import com.novel.read.widget.page.PageAnimation
abstract class HorizonPageAnim( abstract class HorizonPageAnim(
w: Int, h: Int, marginWidth: Int, marginHeight: Int, w: Int, h: Int, marginWidth: Int, marginHeight: Int,
view: View, listener: PageAnimation.OnPageChangeListener view: View, listener: OnPageChangeListener
) : PageAnimation(w, h, marginWidth, marginHeight, view, listener) { ) : PageAnimation(w, h, marginWidth, marginHeight, view, listener) {
protected var mCurBitmap: Bitmap protected var mCurBitmap: Bitmap
@ -34,7 +34,7 @@ abstract class HorizonPageAnim(
//是否没下一页或者上一页 //是否没下一页或者上一页
private var noNext = false 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, w,
h, h,
0, 0,

@ -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) { HorizonPageAnim(w, h, view, listener) {
override fun drawStatic(canvas: Canvas) { override fun drawStatic(canvas: Canvas) {

@ -22,7 +22,7 @@ import java.util.ArrayList
*/ */
class ScrollPageAnim( class ScrollPageAnim(
w: Int, h: Int, marginWidth: Int, marginHeight: Int, w: Int, h: Int, marginWidth: Int, marginHeight: Int,
view: View, listener: PageAnimation.OnPageChangeListener view: View, listener: OnPageChangeListener
) : PageAnimation(w, h, marginWidth, marginHeight, view, listener) { ) : PageAnimation(w, h, marginWidth, marginHeight, view, listener) {
private var mVelocity: VelocityTracker? = null private var mVelocity: VelocityTracker? = null

@ -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) { HorizonPageAnim(w, h, view, listener) {
private var mCornerX = 1 // 拖拽点对应的页脚 private var mCornerX = 1 // 拖拽点对应的页脚

@ -9,7 +9,7 @@ import com.novel.read.widget.page.PageAnimation
* Created by zlj * 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) { HorizonPageAnim(w, h, view, listener) {
private val mSrcRect: Rect = Rect(0, 0, mViewWidth, mViewHeight) private val mSrcRect: Rect = Rect(0, 0, mViewWidth, mViewHeight)

Loading…
Cancel
Save