update protype
This commit is contained in:
parent
6bb471c51d
commit
9ddeeec4bc
|
@ -6,6 +6,7 @@ import android.support.v4.view.ViewPager;
|
|||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.deiniu.zhuike.Fragments.Fragment_booklist;
|
||||
import com.deiniu.zhuike.Fragments.Fragment_shudan_list;
|
||||
import com.flyco.tablayout.SlidingTabLayout;
|
||||
|
||||
|
@ -53,10 +54,10 @@ public class Activity_cate_books extends Activity_base {
|
|||
if(mFragments ==null || mFragments.size() ==0){
|
||||
mTitle = new String[]{"最热", "最新", "评分","完结"};
|
||||
mFragments = new ArrayList<>();
|
||||
mFragments.add(new Fragment_shudan_list());
|
||||
mFragments.add(new Fragment_shudan_list());
|
||||
mFragments.add(new Fragment_shudan_list());
|
||||
mFragments.add(new Fragment_shudan_list());
|
||||
mFragments.add(new Fragment_booklist());
|
||||
mFragments.add(new Fragment_booklist());
|
||||
mFragments.add(new Fragment_booklist());
|
||||
mFragments.add(new Fragment_booklist());
|
||||
Log.d(TAG,"initial fragments in tabs ");
|
||||
}
|
||||
Log.d(TAG,"set viewPager adapter ");
|
||||
|
|
|
@ -4,9 +4,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/7/18 0018.
|
||||
*/
|
||||
|
||||
public class Config {
|
||||
private final static String SP_NAME = "config";
|
||||
private final static String BOOK_BG_KEY = "bookbg";
|
||||
|
|
|
@ -27,9 +27,7 @@ import java.util.List;
|
|||
|
||||
import butterknife.BindView;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/7/11 0011.
|
||||
*/
|
||||
|
||||
public class FileActivity extends Activity_base {
|
||||
|
||||
@BindView(R.id.toolbar)
|
||||
|
|
|
@ -136,6 +136,11 @@ public abstract class BasicFragment extends Fragment {
|
|||
|
||||
void openBook(Book book, BookListAdapter mAdapter) {
|
||||
|
||||
//从新从数据库抓取该书的最新阅读进度
|
||||
|
||||
Book book1 = (Book)LitePal.find(Book.class,book.getId());
|
||||
book.setBegin(book1.getBegin());
|
||||
|
||||
Toast.makeText(activity, book.getBookname() + "加载", Toast.LENGTH_SHORT).show();
|
||||
|
||||
final String path = book.getBookpath();
|
||||
|
|
|
@ -82,11 +82,6 @@ public class CatalogFragment extends BasicFragment {
|
|||
catalogFragment.setArguments(bundle);
|
||||
return catalogFragment;
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
return super.onCreateView(inflater,container,savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,8 @@ public class Fragment_booklist extends BasicFragment {
|
|||
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
openBook(mData.get(position),mAdapter);
|
||||
showBookDetail(mData.get(position).getId());
|
||||
// openBook(mData.get(position),mAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,9 +19,7 @@ import java.util.ArrayList;
|
|||
|
||||
import butterknife.BindView;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/1/6.
|
||||
*/
|
||||
|
||||
public class MarkActivity extends Activity_base {
|
||||
|
||||
@BindView(R.id.toolbar)
|
||||
|
|
|
@ -53,9 +53,7 @@ import java.util.List;
|
|||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/7/15 0015.
|
||||
*/
|
||||
|
||||
public class ReadActivity extends Activity_base implements SpeechSynthesizerListener {
|
||||
private static final String TAG = "ReadActivity";
|
||||
private final static String EXTRA_BOOK = "book";
|
||||
|
|
|
@ -25,9 +25,7 @@ import java.util.Map;
|
|||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2015/12/19.
|
||||
*/
|
||||
|
||||
public class FileAdapter extends BaseAdapter {
|
||||
private List<File> files;
|
||||
private HashMap<File,Boolean> checkMap = new HashMap<>();
|
||||
|
|
|
@ -17,9 +17,7 @@ import com.deiniu.zhuike.utils.PageFactory;
|
|||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/1/3.
|
||||
*/
|
||||
|
||||
public class MarkAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<BookMarks> list ;
|
||||
|
|
|
@ -11,9 +11,7 @@ import com.deiniu.zhuike.Fragments.BookMarkFragment;
|
|||
import com.deiniu.zhuike.Fragments.CatalogFragment;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/1/12.
|
||||
*/
|
||||
|
||||
public class MyPagerAdapter extends FragmentPagerAdapter {
|
||||
private CatalogFragment catalogueFragment;
|
||||
private BookMarkFragment bookMarkFragment;
|
||||
|
|
|
@ -29,9 +29,7 @@ import java.util.List;
|
|||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2015/12/17.
|
||||
*/
|
||||
|
||||
public class ShelfAdapter extends BaseAdapter implements DragGridListener {
|
||||
private Context mContex;
|
||||
private List<Book> bilist;
|
||||
|
|
|
@ -2,9 +2,7 @@ package com.deiniu.zhuike.bean;
|
|||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/8/15 0015.
|
||||
*/
|
||||
|
||||
public class Cache {
|
||||
private long size;
|
||||
private WeakReference<char[]> data;
|
||||
|
|
|
@ -5,9 +5,7 @@ import org.litepal.crud.LitePalSupport;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2015/12/27.
|
||||
*/
|
||||
|
||||
public class Book extends LitePalSupport implements Serializable{
|
||||
private int id;
|
||||
private String bookname;
|
||||
|
|
|
@ -3,9 +3,7 @@ package com.deiniu.zhuike.db;
|
|||
|
||||
import org.litepal.crud.LitePalSupport;
|
||||
|
||||
/**
|
||||
* Created by Lxq on 2016/4/9.
|
||||
*/
|
||||
|
||||
public class BookChapter extends LitePalSupport {
|
||||
private int id;
|
||||
private String bookpath;
|
||||
|
|
|
@ -3,9 +3,7 @@ package com.deiniu.zhuike.db;
|
|||
|
||||
import org.litepal.crud.LitePalSupport;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2015/12/27.
|
||||
*/
|
||||
|
||||
public class BookMarks extends LitePalSupport {
|
||||
private int id ;
|
||||
// private int page;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.deiniu.zhuike.dialog;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/7/19 0019.
|
||||
*/
|
||||
|
||||
public interface BaseDialog {
|
||||
void show();
|
||||
|
||||
|
|
|
@ -17,9 +17,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/8/30 0030.
|
||||
*/
|
||||
|
||||
public class PageModeDialog extends Dialog {
|
||||
|
||||
@BindView(R.id.tv_simulation)
|
||||
|
|
|
@ -20,9 +20,7 @@ import com.deiniu.zhuike.view.BookPageWidget;
|
|||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/7/19 0019.
|
||||
*/
|
||||
|
||||
public class ReadSettingDialog implements BaseDialog,View.OnClickListener {
|
||||
|
||||
ImageButton btn_return;
|
||||
|
|
|
@ -22,9 +22,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/7/26 0026.
|
||||
*/
|
||||
|
||||
public class SettingDialog extends Dialog {
|
||||
|
||||
@BindView(R.id.tv_dark)
|
||||
|
|
|
@ -4,9 +4,7 @@ import android.content.res.Resources;
|
|||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/7/29 0029.
|
||||
*/
|
||||
|
||||
public class BitmapUtil {
|
||||
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId,
|
||||
int reqWidth, int reqHeight) {
|
||||
|
|
|
@ -23,9 +23,7 @@ import java.lang.ref.WeakReference;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/8/11 0011.
|
||||
*/
|
||||
|
||||
public class BookUtil {
|
||||
private static final String cachedPath = Environment.getExternalStorageDirectory() + "/treader/";
|
||||
//存储的字符数
|
||||
|
|
|
@ -6,9 +6,7 @@ import android.net.Uri;
|
|||
import android.provider.Settings;
|
||||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/7/27 0027.
|
||||
*/
|
||||
|
||||
public class BrightnessUtil {
|
||||
/**
|
||||
* 判断是否开启了自动亮度调节
|
||||
|
|
|
@ -12,9 +12,7 @@ import android.view.WindowManager;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/1/17.
|
||||
*/
|
||||
|
||||
public class CommonUtil {
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,9 +8,7 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/7/11 0011.
|
||||
*/
|
||||
|
||||
public class FileUtils {
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,9 +18,7 @@ import java.text.DecimalFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2015/12/22.
|
||||
*/
|
||||
|
||||
public class Fileutil {
|
||||
|
||||
public static String name ;
|
||||
|
|
|
@ -32,9 +32,9 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/7/20 0020.
|
||||
*/
|
||||
import static com.baidu.tts.loopj.AsyncHttpClient.log;
|
||||
|
||||
|
||||
public class PageFactory {
|
||||
private static final String TAG = "PageFactory";
|
||||
private static PageFactory pageFactory;
|
||||
|
@ -297,7 +297,8 @@ public class PageFactory {
|
|||
public void run() {
|
||||
super.run();
|
||||
values.put("begin",currentPage.getBegin());
|
||||
LitePal.update(Book.class,values,bookList.getId());
|
||||
int rows = LitePal.update(Book.class,values,bookList.getId());
|
||||
log.e(TAG,String.format("update book %s bigin %s, result %s",bookList.getBookname(),currentPage.getBegin(),rows) );
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@ package com.deiniu.zhuike.utils;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/8/11 0011.
|
||||
*/
|
||||
|
||||
public class TRPage {
|
||||
private long begin;
|
||||
private long end;
|
||||
|
|
|
@ -24,9 +24,7 @@ import android.widget.Scroller;
|
|||
import com.deiniu.zhuike.utils.PageFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/7/15 0015.
|
||||
*/
|
||||
|
||||
public class BookPageWidget extends View {
|
||||
private final static String TAG = "BookPageWidget";
|
||||
private int mScreenWidth = 0; // 屏幕宽
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.deiniu.zhuike.view;
|
||||
|
||||
/**
|
||||
* Created by Lxq on 2016/4/12.
|
||||
*/
|
||||
|
||||
public interface DragGridListener {
|
||||
/**
|
||||
* 重新排列数据
|
||||
|
|
|
@ -32,9 +32,7 @@ import com.deiniu.zhuike.utils.CommonUtil;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Lxq on 2016/4/12.
|
||||
*/
|
||||
|
||||
public class DragGridView extends GridView implements View.OnClickListener{
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,9 +24,7 @@ import com.deiniu.zhuike.view.animation.SlideAnimation;
|
|||
import static com.deiniu.zhuike.Config.*;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/8/29 0029.
|
||||
*/
|
||||
|
||||
public class PageWidget extends View {
|
||||
private final static String TAG = "BookPageWidget";
|
||||
private int mScreenWidth = 0; // 屏幕宽
|
||||
|
|
|
@ -5,9 +5,7 @@ import android.graphics.Canvas;
|
|||
import android.graphics.PointF;
|
||||
import android.widget.Scroller;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/8/1 0001.
|
||||
*/
|
||||
|
||||
public abstract class AnimationProvider {
|
||||
// static enum Mode {
|
||||
// NoScrolling(false),
|
||||
|
@ -38,6 +36,7 @@ public abstract class AnimationProvider {
|
|||
|
||||
// private Mode myMode = Mode.NoScrolling;
|
||||
|
||||
protected int duation =300;//翻页动画速度
|
||||
protected Bitmap mCurPageBitmap,mNextPageBitmap;
|
||||
protected float myStartX;
|
||||
protected float myStartY;
|
||||
|
|
|
@ -7,9 +7,7 @@ import android.graphics.drawable.GradientDrawable;
|
|||
import android.util.Log;
|
||||
import android.widget.Scroller;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/8/30 0030.
|
||||
*/
|
||||
|
||||
public class CoverAnimation extends AnimationProvider {
|
||||
|
||||
private Rect mSrcRect, mDestRect;
|
||||
|
@ -88,7 +86,7 @@ public class CoverAnimation extends AnimationProvider {
|
|||
}
|
||||
}
|
||||
//滑动速度保持一致
|
||||
int duration = (400 * Math.abs(dx)) / mScreenWidth;
|
||||
int duration = (duation * Math.abs(dx)) / mScreenWidth;
|
||||
Log.e("duration",duration + "");
|
||||
scroller.startScroll((int) mTouch.x, 0, dx, 0, duration);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,7 @@ import android.graphics.Bitmap;
|
|||
import android.graphics.Canvas;
|
||||
import android.widget.Scroller;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/8/30 0030.
|
||||
*/
|
||||
|
||||
public class NoneAnimation extends AnimationProvider {
|
||||
|
||||
public NoneAnimation(Bitmap mCurrentBitmap, Bitmap mNextBitmap, int width, int height) {
|
||||
|
|
|
@ -13,9 +13,7 @@ import android.graphics.drawable.GradientDrawable;
|
|||
import android.os.Build;
|
||||
import android.widget.Scroller;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/8/26 0026.
|
||||
*/
|
||||
|
||||
public class SimulationAnimation extends AnimationProvider {
|
||||
private int mCornerX = 1; // 拖拽点对应的页脚
|
||||
private int mCornerY = 1;
|
||||
|
@ -148,7 +146,7 @@ public class SimulationAnimation extends AnimationProvider {
|
|||
dy = (int) (1 - mTouch.y); // 防止mTouch.y最终变为0
|
||||
}
|
||||
}
|
||||
scroller.startScroll((int) mTouch.x, (int) mTouch.y, dx, dy, 400);
|
||||
scroller.startScroll((int) mTouch.x, (int) mTouch.y, dx, dy, duation);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,9 +6,7 @@ import android.graphics.Rect;
|
|||
import android.util.Log;
|
||||
import android.widget.Scroller;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2016/8/29 0029.
|
||||
*/
|
||||
|
||||
public class SlideAnimation extends AnimationProvider {
|
||||
private Rect mSrcRect, mDestRect,mNextSrcRect,mNextDestRect;
|
||||
|
||||
|
@ -92,7 +90,7 @@ public class SlideAnimation extends AnimationProvider {
|
|||
}
|
||||
}
|
||||
//滑动速度保持一致
|
||||
int duration = (400 * Math.abs(dx)) / mScreenWidth;
|
||||
int duration = (duation * Math.abs(dx)) / mScreenWidth;
|
||||
Log.e("duration",duration + "");
|
||||
scroller.startScroll((int) mTouch.x, 0, dx, 0, duration);
|
||||
}
|
||||
|
|
|
@ -9,10 +9,7 @@
|
|||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:theme="@style/AppTheme.AppBarOverlay"
|
||||
app:elevation="0dp">
|
||||
style="@style/barLayout">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
|
@ -40,7 +37,9 @@
|
|||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dip"
|
||||
android:background="@color/white"/>
|
||||
android:background="@color/white"
|
||||
|
||||
/>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
|
|
|
@ -179,7 +179,7 @@
|
|||
<item name="android:layout_marginRight">@dimen/marginRight</item>
|
||||
<item name="android:layout_marginLeft">@dimen/marginLeft</item>
|
||||
</style>
|
||||
|
||||
<!-- activity barlayout -->
|
||||
<style name="barLayout">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
|
|
Loading…
Reference in New Issue