导航状态条高度问题
This commit is contained in:
parent
82c1c1ee3d
commit
7e813c9c6c
|
@ -91,6 +91,11 @@ public class Activity_ChgSource extends Activity_base {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillData() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnItemClickListener
|
interface OnItemClickListener
|
||||||
|
|
|
@ -3,8 +3,11 @@ package com.novelbook.android;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
@ -60,7 +63,7 @@ public abstract class Activity_base extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
setContentView(getLayoutRes());
|
setContentView(getLayoutRes());
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
setupToolbar();
|
setupToolbar();
|
||||||
|
@ -149,7 +152,30 @@ public abstract class Activity_base extends AppCompatActivity {
|
||||||
return mDatas;
|
return mDatas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract void fillData();
|
||||||
|
|
||||||
|
Handler handler = new Handler() {
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
|
||||||
|
int wt = msg.what;
|
||||||
|
|
||||||
|
if (msg.what == 1) {
|
||||||
|
fillData();
|
||||||
|
} else if (msg.what == 2) //
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
Toast.makeText(Activity_base.this, " 请求失败", Toast.LENGTH_LONG).show();
|
||||||
|
} else if (msg.what == 3) {
|
||||||
|
|
||||||
|
Toast.makeText(Activity_base.this, " ", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
hideProgress();
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class MyViewHolder extends RecyclerView.ViewHolder {
|
class MyViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
|
@ -54,6 +54,11 @@ public class Activity_cate_books extends Activity_base {
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillData() {
|
||||||
|
|
||||||
|
}
|
||||||
//---------tabs-------------
|
//---------tabs-------------
|
||||||
|
|
||||||
void initTabs() {
|
void initTabs() {
|
||||||
|
|
|
@ -116,6 +116,11 @@ public class Activity_createShudan extends Activity_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillData() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveShudan() {
|
private void saveShudan() {
|
||||||
|
|
|
@ -74,6 +74,11 @@ public static String TAG ="com.novelbook.android.paihangbang";
|
||||||
creatToolbar();
|
creatToolbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------tabs-------------
|
//---------tabs-------------
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,10 @@ public class Activity_shudan extends Activity_base {
|
||||||
mAdapter = getBookListAdapter( mData,R.layout.recycle_list_item_horizon);
|
mAdapter = getBookListAdapter( mData,R.layout.recycle_list_item_horizon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -57,6 +57,11 @@ public static String TAG ="com.novelbook.android.Activity_shudan_my";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void initTabs() {
|
void initTabs() {
|
||||||
|
|
||||||
|
|
|
@ -699,6 +699,12 @@ void onResponseProcess( String content ,String url){
|
||||||
super.onPause();
|
super.onPause();
|
||||||
unregisterReceiver(receiver);
|
unregisterReceiver(receiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
|
@ -92,6 +92,11 @@ public class FileActivity extends Activity_base {
|
||||||
initListener();
|
initListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void initListener() {
|
protected void initListener() {
|
||||||
lvFileDrawer.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
lvFileDrawer.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class CatalogFragment extends BasicFragment {
|
||||||
lv_catalogue.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
lv_catalogue.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
showProgressDialog(true,"请稍等");
|
// showProgressDialog(true,"请稍等");
|
||||||
Log.d(TAG, String .format("prepare book: getPageWidget is null? %s",pageFactory.getPageWidget()==null));
|
Log.d(TAG, String .format("prepare book: getPageWidget is null? %s",pageFactory.getPageWidget()==null));
|
||||||
// if(pageFactory.getPageWidget()==null){
|
// if(pageFactory.getPageWidget()==null){
|
||||||
|
|
||||||
|
@ -116,8 +116,8 @@ public class CatalogFragment extends BasicFragment {
|
||||||
if(novel!=null){
|
if(novel!=null){
|
||||||
novel.setLastReadChapt(position+1);
|
novel.setLastReadChapt(position+1);
|
||||||
novel.setLastReadPos(1);
|
novel.setLastReadPos(1);
|
||||||
|
ReadActivity.openBook(novel, getActivity());
|
||||||
new Thread() {
|
/* new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
@ -126,13 +126,13 @@ public class CatalogFragment extends BasicFragment {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
ReadActivity.openBook(novel, getActivity());
|
ReadActivity.openBook(novel, getActivity());
|
||||||
}}.start();
|
}}.start();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// }else {
|
// }else {
|
||||||
// pageFactory.changeChapter(position+1);
|
// pageFactory.changeChapter(position+1);
|
||||||
// }
|
// }
|
||||||
new Thread() {
|
/*new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
|
@ -163,11 +163,11 @@ public class CatalogFragment extends BasicFragment {
|
||||||
Log.d(TAG, String .format("prepare book: total slept %s for loading chapter content %s,chapter.getid %s " , slepttime*50, chapid,pageFactory.getChapters().get(chapid-1).getId()));
|
Log.d(TAG, String .format("prepare book: total slept %s for loading chapter content %s,chapter.getid %s " , slepttime*50, chapid,pageFactory.getChapters().get(chapid-1).getId()));
|
||||||
|
|
||||||
handler.sendEmptyMessage(2);
|
handler.sendEmptyMessage(2);
|
||||||
/* if(getActivity()!=null) {
|
*//* if(getActivity()!=null) {
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
}*/
|
}*//*
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();*/
|
||||||
|
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,16 @@ import com.novelbook.android.Fragments.BasicFragment;
|
||||||
import com.novelbook.android.Fragments.Fragment_Shelf;
|
import com.novelbook.android.Fragments.Fragment_Shelf;
|
||||||
import com.novelbook.android.Fragments.Fragment_bookStore;
|
import com.novelbook.android.Fragments.Fragment_bookStore;
|
||||||
import com.novelbook.android.Fragments.Fragment_paihang;
|
import com.novelbook.android.Fragments.Fragment_paihang;
|
||||||
|
import com.novelbook.android.netsubscribe.BookSubscribe;
|
||||||
|
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
|
||||||
|
import com.novelbook.android.netutils.OnSuccessAndFaultSub;
|
||||||
import com.novelbook.android.utils.Config;
|
import com.novelbook.android.utils.Config;
|
||||||
import com.novelbook.android.utils.Constants;
|
import com.novelbook.android.utils.Constants;
|
||||||
|
import com.novelbook.android.utils.PageFactory;
|
||||||
|
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
|
|
||||||
|
@ -61,6 +67,7 @@ public class Main2Activity extends Activity_base
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
PageFactory.createPageFactory(this);
|
||||||
app =(MyApp) getApplicationContext();
|
app =(MyApp) getApplicationContext();
|
||||||
// requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
// requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
||||||
config =Config.getInstance();
|
config =Config.getInstance();
|
||||||
|
@ -427,6 +434,11 @@ private int bottomSelectedIndex;
|
||||||
// swithToolbarItems( );
|
// swithToolbarItems( );
|
||||||
// setTitle("title on resume");
|
// setTitle("title on resume");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillData() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSexOption(){
|
private void setSexOption(){
|
||||||
|
@ -436,7 +448,9 @@ private void setSexOption(){
|
||||||
config.setSexOption(s);
|
config.setSexOption(s);
|
||||||
Fragment current = getSupportFragmentManager().findFragmentById(R.id.realtabcontent);
|
Fragment current = getSupportFragmentManager().findFragmentById(R.id.realtabcontent);
|
||||||
if (current != null && current instanceof BasicFragment){
|
if (current != null && current instanceof BasicFragment){
|
||||||
|
|
||||||
((BasicFragment)current).reload();
|
((BasicFragment)current).reload();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -481,6 +495,33 @@ private void setSexOption(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----get master domain
|
||||||
|
|
||||||
|
private void getHostPolicy(){
|
||||||
|
BookSubscribe.getMastDomain(new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String result) {
|
||||||
|
|
||||||
|
// mFirstPage= gson.fromJson(result, FirstPage.class);
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = new JSONObject(result);
|
||||||
|
String resultstr = jsonObject.getString("nts");
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
handler.sendEmptyMessage(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFault(String errorMsg) {
|
||||||
|
//失败
|
||||||
|
Log.d(TAG, "error on get firstpage: " + errorMsg);
|
||||||
|
handler.sendEmptyMessage(2);
|
||||||
|
}
|
||||||
|
}, this));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,10 @@ public class MarkActivity extends Activity_base {
|
||||||
tabLayout.setViewPager(pager);
|
tabLayout.setViewPager(pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void initListener() {
|
protected void initListener() {
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class MyApp extends Application {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
applicationContext = getApplicationContext();
|
applicationContext = getApplicationContext();
|
||||||
Config.createConfig(this);
|
Config.createConfig(this);
|
||||||
PageFactory.createPageFactory(this);
|
// PageFactory.createPageFactory(this);
|
||||||
|
|
||||||
|
|
||||||
// BlurKit.init(this);
|
// BlurKit.init(this);
|
||||||
|
|
|
@ -43,6 +43,7 @@ import com.novelbook.android.netutils.NetUtil;
|
||||||
import com.novelbook.android.utils.AdInterface;
|
import com.novelbook.android.utils.AdInterface;
|
||||||
import com.novelbook.android.utils.BrightnessUtil;
|
import com.novelbook.android.utils.BrightnessUtil;
|
||||||
import com.novelbook.android.utils.Config;
|
import com.novelbook.android.utils.Config;
|
||||||
|
import com.novelbook.android.utils.Constants;
|
||||||
import com.novelbook.android.utils.PageFactory;
|
import com.novelbook.android.utils.PageFactory;
|
||||||
import com.novelbook.android.view.PageWidget;
|
import com.novelbook.android.view.PageWidget;
|
||||||
|
|
||||||
|
@ -225,7 +226,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
hideSystemUI();
|
hideSystemUI();
|
||||||
pageFactory.openBook(book, this);
|
pageFactory.openBook(book, this);
|
||||||
|
|
||||||
showProgressDialog(true, "正在加载");
|
/*showProgressDialog(true, "正在加载");
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -263,7 +264,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
|
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
*/
|
||||||
|
|
||||||
hideSystemUI();
|
hideSystemUI();
|
||||||
|
|
||||||
|
@ -345,6 +346,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
@Override
|
@Override
|
||||||
public void changeFontSize(int fontSize) {
|
public void changeFontSize(int fontSize) {
|
||||||
pageFactory.changeFontSize(fontSize);
|
pageFactory.changeFontSize(fontSize);
|
||||||
|
showSystemUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -360,6 +362,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
@Override
|
@Override
|
||||||
public void changeLineHeight(int lineHeight) {
|
public void changeLineHeight(int lineHeight) {
|
||||||
pageFactory.changeLineHight(lineHeight);
|
pageFactory.changeLineHight(lineHeight);
|
||||||
|
showSystemUI();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -480,7 +483,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
Log.d(TAG, "onKeyDown: pressed key");
|
Log.d(TAG, "onKeyDown: pressed key");
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
Log.d(TAG, "onKeyDown: pressed back");
|
Log.d(TAG, "onKeyDown: pressed back");
|
||||||
if (isShow){
|
/* if (isShow){
|
||||||
hideReadSetting();
|
hideReadSetting();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -491,7 +494,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
if (mPageModeDialog.isShowing()){
|
if (mPageModeDialog.isShowing()){
|
||||||
mPageModeDialog.hide();
|
mPageModeDialog.hide();
|
||||||
return true;
|
return true;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
if(!pageFactory.canExitSilent()){
|
if(!pageFactory.canExitSilent()){
|
||||||
|
@ -620,6 +623,11 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean openBook(final Novel book, Activity context) {
|
public static boolean openBook(final Novel book, Activity context) {
|
||||||
if (book == null){
|
if (book == null){
|
||||||
|
@ -670,16 +678,18 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||||
);
|
);
|
||||||
|
|
||||||
|
getWindow().setNavigationBarColor(getResources().getColor(R.color.read_dialog_bg));
|
||||||
|
pageFactory.setBusy(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showSystemUI() {
|
private void showSystemUI() {
|
||||||
getWindow().getDecorView().setSystemUiVisibility(
|
getWindow().getDecorView().setSystemUiVisibility(
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||||
);
|
);
|
||||||
|
pageFactory.setBusy(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//显示书本进度
|
//显示书本进度
|
||||||
|
@ -818,7 +828,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick({R.id.tv_progress, R.id.rl_progress, R.id.tv_pre, R.id.sb_progress, R.id.tv_next, R.id.tv_directory,
|
@OnClick({R.id.tv_progress, R.id.rl_progress, R.id.tv_pre, R.id.sb_progress, R.id.tv_next, R.id.tv_directory,
|
||||||
R.id.tv_dayornight,R.id.tv_pagemode, R.id.tv_setting, R.id.bookpop_bottom, R.id.rl_bottom,R.id.tv_stop_read
|
R.id.tv_dayornight,R.id.tv_pagemode, R.id.tv_setting, R.id.bookpop_bottom, /*R.id.rl_bottom,*/R.id.tv_stop_read
|
||||||
,R.id.llTopAd})
|
,R.id.llTopAd})
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if( pageFactory.isReady())
|
if( pageFactory.isReady())
|
||||||
|
@ -850,15 +860,18 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
case R.id.tv_pagemode:
|
case R.id.tv_pagemode:
|
||||||
hideReadSetting();
|
hideReadSetting();
|
||||||
mPageModeDialog.show();
|
mPageModeDialog.show();
|
||||||
|
showSystemUI();
|
||||||
|
// getWindow().setNavigationBarColor(getResources().getColor(R.color.read_dialog_bg));
|
||||||
break;
|
break;
|
||||||
case R.id.tv_setting:
|
case R.id.tv_setting:
|
||||||
hideReadSetting();
|
hideReadSetting();
|
||||||
mSettingDialog.show();
|
mSettingDialog.show();
|
||||||
|
showSystemUI();
|
||||||
break;
|
break;
|
||||||
case R.id.bookpop_bottom:
|
case R.id.bookpop_bottom:
|
||||||
break;
|
break;
|
||||||
case R.id.rl_bottom:
|
/* case R.id.rl_bottom:
|
||||||
break;
|
break;*/
|
||||||
case R.id.tv_stop_read:
|
case R.id.tv_stop_read:
|
||||||
if (mSpeechSynthesizer!=null){
|
if (mSpeechSynthesizer!=null){
|
||||||
mSpeechSynthesizer.stop();
|
mSpeechSynthesizer.stop();
|
||||||
|
@ -878,7 +891,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
// dismissProgressDialog();
|
// dismissProgressDialog();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
hideSystemUI();
|
// hideSystemUI();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
ProgressDialog progressDialog;
|
ProgressDialog progressDialog;
|
||||||
|
@ -984,9 +997,12 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showAd(boolean showAd ,int adHeight,int adY) {
|
public void showAd(boolean showAd ,int adHeight,int adY) {
|
||||||
|
|
||||||
hideSystemUI();
|
hideSystemUI();
|
||||||
llTopAd.setVisibility(View.GONE);
|
llTopAd.setVisibility(View.GONE);
|
||||||
|
if(!Constants.SHOWAD){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(!showAd){
|
if(!showAd){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,30 +62,9 @@ public class activity_cates extends Activity_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Handler handler = new Handler() {
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void fillData() {
|
||||||
|
|
||||||
int wt = msg.what;
|
|
||||||
|
|
||||||
if (msg.what == 1) {
|
|
||||||
fillData();
|
|
||||||
} else if (msg.what == 2) //
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
Toast.makeText(activity_cates.this, " 请求失败", Toast.LENGTH_LONG).show();
|
|
||||||
} else if (msg.what == 3) {
|
|
||||||
|
|
||||||
Toast.makeText(activity_cates.this, " ", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
hideProgress();
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void fillData() {
|
|
||||||
List<Cataloge> cates = new ArrayList<>();
|
List<Cataloge> cates = new ArrayList<>();
|
||||||
for(Cataloge cate:mCataloges){
|
for(Cataloge cate:mCataloges){
|
||||||
if(cate!=null && cate.getNovelCount()>0){
|
if(cate!=null && cate.getNovelCount()>0){
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class PageModeDialog extends Dialog {
|
||||||
|
|
||||||
config = Config.getInstance();
|
config = Config.getInstance();
|
||||||
selectPageMode(config.getPageMode());
|
selectPageMode(config.getPageMode());
|
||||||
|
// getWindow().setNavigationBarColor(getResources().getColor(R.color.read_dialog_bg));
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick({R.id.tv_simulation, R.id.tv_cover, R.id.tv_slide, R.id.tv_none})
|
@OnClick({R.id.tv_simulation, R.id.tv_cover, R.id.tv_slide, R.id.tv_none})
|
||||||
|
|
|
@ -14,6 +14,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
import com.baidu.android.common.logging.Log;
|
import com.baidu.android.common.logging.Log;
|
||||||
|
import com.novelbook.android.utils.CommonUtil;
|
||||||
import com.novelbook.android.utils.Config;
|
import com.novelbook.android.utils.Config;
|
||||||
import com.novelbook.android.R;
|
import com.novelbook.android.R;
|
||||||
import com.novelbook.android.utils.DisplayUtils;
|
import com.novelbook.android.utils.DisplayUtils;
|
||||||
|
@ -64,6 +65,8 @@ public class SettingDialog extends Dialog {
|
||||||
TextView tv_bysong;
|
TextView tv_bysong;
|
||||||
@BindView(R.id.tv_lhsize)
|
@BindView(R.id.tv_lhsize)
|
||||||
TextView tv_lineSpace;
|
TextView tv_lineSpace;
|
||||||
|
@BindView(R.id.tv_lhsize_default)
|
||||||
|
TextView tv_lhsize_default;
|
||||||
|
|
||||||
|
|
||||||
private Config config;
|
private Config config;
|
||||||
|
@ -76,10 +79,11 @@ public class SettingDialog extends Dialog {
|
||||||
private int LINE_SPACE_MIN;
|
private int LINE_SPACE_MIN;
|
||||||
private int LINE_SPACE_MAX;
|
private int LINE_SPACE_MAX;
|
||||||
private int currentLineSpace;
|
private int currentLineSpace;
|
||||||
|
Context mContext;
|
||||||
|
|
||||||
private SettingDialog(Context context, boolean flag, OnCancelListener listener) {
|
private SettingDialog(Context context, boolean flag, OnCancelListener listener) {
|
||||||
super(context, flag, listener);
|
super(context, flag, listener);
|
||||||
|
mContext =context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SettingDialog(Context context) {
|
public SettingDialog(Context context) {
|
||||||
|
@ -88,7 +92,7 @@ public class SettingDialog extends Dialog {
|
||||||
|
|
||||||
public SettingDialog(Context context, int themeResId) {
|
public SettingDialog(Context context, int themeResId) {
|
||||||
super(context, themeResId);
|
super(context, themeResId);
|
||||||
|
mContext=context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,6 +107,7 @@ public class SettingDialog extends Dialog {
|
||||||
Display d = m.getDefaultDisplay();
|
Display d = m.getDefaultDisplay();
|
||||||
WindowManager.LayoutParams p = getWindow().getAttributes();
|
WindowManager.LayoutParams p = getWindow().getAttributes();
|
||||||
p.width = d.getWidth();
|
p.width = d.getWidth();
|
||||||
|
// p.height = CommonUtil.getDpi(mContext);
|
||||||
getWindow().setAttributes(p);
|
getWindow().setAttributes(p);
|
||||||
|
|
||||||
FONT_SIZE_MIN = (int) getContext().getResources().getDimension(R.dimen.reading_min_text_size);
|
FONT_SIZE_MIN = (int) getContext().getResources().getDimension(R.dimen.reading_min_text_size);
|
||||||
|
@ -120,10 +125,11 @@ public class SettingDialog extends Dialog {
|
||||||
//初始化字体大小
|
//初始化字体大小
|
||||||
currentFontSize = (int) config.getFontSize();
|
currentFontSize = (int) config.getFontSize();
|
||||||
tv_size.setText(currentFontSize + "");
|
tv_size.setText(currentFontSize + "");
|
||||||
|
setTextViewSelect(tv_size_default, currentFontSize ==60);
|
||||||
//初始化行间距
|
//初始化行间距
|
||||||
currentLineSpace =(int) config.getLineSpace();
|
currentLineSpace =(int) config.getLineSpace();
|
||||||
tv_lineSpace.setText(currentLineSpace+"");
|
tv_lineSpace.setText(currentLineSpace+"");
|
||||||
|
setTextViewSelect(tv_lhsize_default, currentLineSpace==45);
|
||||||
|
|
||||||
//初始化字体
|
//初始化字体
|
||||||
tv_default.setTypeface(config.getTypeface(Config.FONTTYPE_DEFAULT));
|
tv_default.setTypeface(config.getTypeface(Config.FONTTYPE_DEFAULT));
|
||||||
|
@ -384,6 +390,7 @@ public class SettingDialog extends Dialog {
|
||||||
if (currentLineSpace < LINE_SPACE_MAX) {
|
if (currentLineSpace < LINE_SPACE_MAX) {
|
||||||
currentLineSpace += 1;
|
currentLineSpace += 1;
|
||||||
tv_lineSpace.setText(currentLineSpace + "");
|
tv_lineSpace.setText(currentLineSpace + "");
|
||||||
|
setTextViewSelect(tv_lhsize_default,false);
|
||||||
config.setLineSpace(currentLineSpace);
|
config.setLineSpace(currentLineSpace);
|
||||||
if (mSettingListener != null) {
|
if (mSettingListener != null) {
|
||||||
mSettingListener.changeLineHeight(currentLineSpace);
|
mSettingListener.changeLineHeight(currentLineSpace);
|
||||||
|
@ -394,6 +401,7 @@ public class SettingDialog extends Dialog {
|
||||||
private void defaultLineSpace() {
|
private void defaultLineSpace() {
|
||||||
currentLineSpace = (int) getContext().getResources().getDimension(R.dimen.reading_line_spacing);
|
currentLineSpace = (int) getContext().getResources().getDimension(R.dimen.reading_line_spacing);
|
||||||
tv_lineSpace.setText(currentLineSpace + "");
|
tv_lineSpace.setText(currentLineSpace + "");
|
||||||
|
setTextViewSelect(tv_lhsize_default,true);
|
||||||
config.setLineSpace(currentLineSpace);
|
config.setLineSpace(currentLineSpace);
|
||||||
if (mSettingListener != null) {
|
if (mSettingListener != null) {
|
||||||
mSettingListener.changeLineHeight(currentLineSpace);
|
mSettingListener.changeLineHeight(currentLineSpace);
|
||||||
|
@ -403,6 +411,7 @@ public class SettingDialog extends Dialog {
|
||||||
private void subtractLineSpace() {
|
private void subtractLineSpace() {
|
||||||
if (currentLineSpace > LINE_SPACE_MIN) {
|
if (currentLineSpace > LINE_SPACE_MIN) {
|
||||||
currentLineSpace -= 1;
|
currentLineSpace -= 1;
|
||||||
|
setTextViewSelect(tv_lhsize_default,false);
|
||||||
tv_lineSpace.setText(currentLineSpace + "");
|
tv_lineSpace.setText(currentLineSpace + "");
|
||||||
config.setLineSpace(currentLineSpace);
|
config.setLineSpace(currentLineSpace);
|
||||||
if (mSettingListener != null) {
|
if (mSettingListener != null) {
|
||||||
|
@ -417,6 +426,7 @@ public class SettingDialog extends Dialog {
|
||||||
if (currentFontSize < FONT_SIZE_MAX) {
|
if (currentFontSize < FONT_SIZE_MAX) {
|
||||||
currentFontSize += 1;
|
currentFontSize += 1;
|
||||||
tv_size.setText(currentFontSize + "");
|
tv_size.setText(currentFontSize + "");
|
||||||
|
setTextViewSelect(tv_size_default,false);
|
||||||
config.setFontSize(currentFontSize);
|
config.setFontSize(currentFontSize);
|
||||||
if (mSettingListener != null) {
|
if (mSettingListener != null) {
|
||||||
mSettingListener.changeFontSize(currentFontSize);
|
mSettingListener.changeFontSize(currentFontSize);
|
||||||
|
@ -427,6 +437,7 @@ public class SettingDialog extends Dialog {
|
||||||
private void defaultFontSize() {
|
private void defaultFontSize() {
|
||||||
currentFontSize = (int) getContext().getResources().getDimension(R.dimen.reading_default_text_size);
|
currentFontSize = (int) getContext().getResources().getDimension(R.dimen.reading_default_text_size);
|
||||||
tv_size.setText(currentFontSize + "");
|
tv_size.setText(currentFontSize + "");
|
||||||
|
setTextViewSelect(tv_size_default,true);
|
||||||
config.setFontSize(currentFontSize);
|
config.setFontSize(currentFontSize);
|
||||||
if (mSettingListener != null) {
|
if (mSettingListener != null) {
|
||||||
mSettingListener.changeFontSize(currentFontSize);
|
mSettingListener.changeFontSize(currentFontSize);
|
||||||
|
@ -437,6 +448,7 @@ public class SettingDialog extends Dialog {
|
||||||
private void subtractFontSize() {
|
private void subtractFontSize() {
|
||||||
if (currentFontSize > FONT_SIZE_MIN) {
|
if (currentFontSize > FONT_SIZE_MIN) {
|
||||||
currentFontSize -= 1;
|
currentFontSize -= 1;
|
||||||
|
setTextViewSelect(tv_size_default,false);
|
||||||
tv_size.setText(currentFontSize + "");
|
tv_size.setText(currentFontSize + "");
|
||||||
config.setFontSize(currentFontSize);
|
config.setFontSize(currentFontSize);
|
||||||
if (mSettingListener != null) {
|
if (mSettingListener != null) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ public interface HttpApi {
|
||||||
//请填写自己的接口名
|
//请填写自己的接口名
|
||||||
// @POST("abc")
|
// @POST("abc")
|
||||||
// Observable<ResponseBody> getDataForBean(@Body DouBanMovieRequest bean);
|
// Observable<ResponseBody> getDataForBean(@Body DouBanMovieRequest bean);
|
||||||
//请填写自己的接口名
|
|
||||||
@GET("top250")
|
@GET("top250")
|
||||||
Observable<ResponseBody> getDataForMap(@QueryMap Map<String, Integer> map);
|
Observable<ResponseBody> getDataForMap(@QueryMap Map<String, Integer> map);
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,10 +1,47 @@
|
||||||
package com.novelbook.android.netapi;
|
package com.novelbook.android.netapi;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.novelbook.android.utils.Config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by 眼神 on 2018/3/27.
|
* Created by 眼神 on 2018/3/27.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class URLConstant {
|
public class URLConstant {
|
||||||
//存放全部的URL(可分为开发、测试、正式)
|
//存放全部的URL(可分为开发、测试、正式)
|
||||||
public static String BASE_URL = "http://xiaoshuofenxiang.com/api/";//https://api.douban.com/v2/movie/";
|
private static String BASE_URL = Config.getInstance().getBaseUrl() ;//https://api.douban.com/v2/movie/";
|
||||||
|
public static String[] BASE_URLS = {"http://xiaoshuofenxiang.com/api/"};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取新的baseURL
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String newBaseUrl(){
|
||||||
|
for (String url:BASE_URLS) {
|
||||||
|
if(!url.equals(BASE_URL)){
|
||||||
|
BASE_URL = url;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(! Config.getInstance().getBaseUrl().equals(BASE_URL)){
|
||||||
|
Config.getInstance().setBaseUrl(BASE_URL);
|
||||||
|
}
|
||||||
|
return BASE_URL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app初始化取上次保存的baseurl
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getBaseUrl(){
|
||||||
|
BASE_URL=Config.getInstance().getBaseUrl();
|
||||||
|
if(TextUtils.isEmpty(BASE_URL)){
|
||||||
|
BASE_URL = newBaseUrl();
|
||||||
|
}
|
||||||
|
return BASE_URL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,10 @@ public class BookSubscribe {
|
||||||
Observable<ResponseBody> observable = HttpMethods.getInstance().getHttpApi().getDataForMap(map);
|
Observable<ResponseBody> observable = HttpMethods.getInstance().getHttpApi().getDataForMap(map);
|
||||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||||
}
|
}
|
||||||
|
public static void getMastDomain(DisposableObserver<ResponseBody> subscriber){
|
||||||
|
Observable<ResponseBody> observable = HttpMethods.getInstance().getHttpApi().getMasterDomain();
|
||||||
|
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||||
|
}
|
||||||
public static void getNovel(int novelId,DisposableObserver<ResponseBody> subscriber){
|
public static void getNovel(int novelId,DisposableObserver<ResponseBody> subscriber){
|
||||||
Observable<ResponseBody> observable = HttpMethods.getInstance().getHttpApi().getNovel(novelId);
|
Observable<ResponseBody> observable = HttpMethods.getInstance().getHttpApi().getNovel(novelId);
|
||||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||||
|
|
|
@ -33,14 +33,13 @@ import retrofit2.Retrofit;
|
||||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||||
import retrofit2.converter.gson.GsonConverterFactory;
|
import retrofit2.converter.gson.GsonConverterFactory;
|
||||||
|
|
||||||
/**
|
import static com.novelbook.android.netapi.URLConstant.getBaseUrl;
|
||||||
* Created by 眼神 on 2018/3/27.
|
import static com.novelbook.android.netapi.URLConstant.newBaseUrl;
|
||||||
*/
|
|
||||||
|
|
||||||
public class HttpMethods {
|
public class HttpMethods {
|
||||||
public String TAG = "HttpMethods";
|
public String TAG = "HttpMethods";
|
||||||
public static final String CACHE_NAME = "ZHUIKE";
|
public static final String CACHE_NAME = "ZHUIKE";
|
||||||
public static String BASE_URL = URLConstant.BASE_URL;
|
//public static String BASE_URL = getBaseUrl();
|
||||||
private static final int DEFAULT_CONNECT_TIMEOUT = 30;
|
private static final int DEFAULT_CONNECT_TIMEOUT = 30;
|
||||||
private static final int DEFAULT_WRITE_TIMEOUT = 30;
|
private static final int DEFAULT_WRITE_TIMEOUT = 30;
|
||||||
private static final int DEFAULT_READ_TIMEOUT = 30;
|
private static final int DEFAULT_READ_TIMEOUT = 30;
|
||||||
|
@ -61,7 +60,7 @@ public class HttpMethods {
|
||||||
.client(okHttpClient)
|
.client(okHttpClient)
|
||||||
.addConverterFactory(GsonConverterFactory.create())//json转换成JavaBean
|
.addConverterFactory(GsonConverterFactory.create())//json转换成JavaBean
|
||||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||||
.baseUrl(BASE_URL)
|
.baseUrl(getBaseUrl())
|
||||||
.build();
|
.build();
|
||||||
httpApi = retrofit.create(HttpApi.class);
|
httpApi = retrofit.create(HttpApi.class);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +83,7 @@ public class HttpMethods {
|
||||||
/**
|
/**
|
||||||
* 获取retrofit
|
* 获取retrofit
|
||||||
*
|
*
|
||||||
* @return
|
* @returnc
|
||||||
*/
|
*/
|
||||||
public Retrofit getRetrofit() {
|
public Retrofit getRetrofit() {
|
||||||
return retrofit;
|
return retrofit;
|
||||||
|
@ -99,7 +98,9 @@ public class HttpMethods {
|
||||||
.build();
|
.build();
|
||||||
httpApi = retrofit.create(HttpApi.class);
|
httpApi = retrofit.create(HttpApi.class);
|
||||||
}
|
}
|
||||||
|
public void changeBaseUrl() {
|
||||||
|
changeBaseUrl(newBaseUrl());
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 获取httpService
|
* 获取httpService
|
||||||
*
|
*
|
||||||
|
|
|
@ -135,6 +135,7 @@ public class OnSuccessAndFaultSub extends DisposableObserver<ResponseBody>
|
||||||
// Toast.makeText(context,"网关错误 ,请检查您的网络状态",Toast.LENGTH_LONG).show();
|
// Toast.makeText(context,"网关错误 ,请检查您的网络状态",Toast.LENGTH_LONG).show();
|
||||||
mOnSuccessAndFaultListener.onFault("服务错误");
|
mOnSuccessAndFaultListener.onFault("服务错误");
|
||||||
}else if(code == 502) {
|
}else if(code == 502) {
|
||||||
|
HttpMethods.getInstance().changeBaseUrl(); //更新基本信息
|
||||||
Toast.makeText(context,"网关错误 ,请检查您的网络状态",Toast.LENGTH_LONG).show();
|
Toast.makeText(context,"网关错误 ,请检查您的网络状态",Toast.LENGTH_LONG).show();
|
||||||
mOnSuccessAndFaultListener.onFault("服务错误");
|
mOnSuccessAndFaultListener.onFault("服务错误");
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class BookUtil {
|
||||||
Thread.sleep(50);
|
Thread.sleep(50);
|
||||||
Log.d(TAG,String.format("prepare book %s waiting for mulu downloading ,mMuluStatus %s,msiteRule %s" ,mNovel.getName(),mMuluStatus,mSiteRule));
|
Log.d(TAG,String.format("prepare book %s waiting for mulu downloading ,mMuluStatus %s,msiteRule %s" ,mNovel.getName(),mMuluStatus,mSiteRule));
|
||||||
if(mMuluStatus == MuluStatus.failed){
|
if(mMuluStatus == MuluStatus.failed){
|
||||||
dismissProgressDialog();
|
|
||||||
throw new RuntimeException("读取资源失败,请检查网络");
|
throw new RuntimeException("读取资源失败,请检查网络");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ public class BookUtil {
|
||||||
}
|
}
|
||||||
setSiteInfo();
|
setSiteInfo();
|
||||||
|
|
||||||
showProgressDialog("正在换源",false);
|
|
||||||
isChangeSource = true;
|
isChangeSource = true;
|
||||||
mChapters.clear();
|
mChapters.clear();
|
||||||
getSiteRule();
|
getSiteRule();
|
||||||
|
@ -495,7 +495,7 @@ public class BookUtil {
|
||||||
isDone,
|
isDone,
|
||||||
failed
|
failed
|
||||||
}
|
}
|
||||||
private void showProgressDialog(String title,boolean canBreak) {
|
/*private void showProgressDialog(String title,boolean canBreak) {
|
||||||
if ( null == progressDialog) {
|
if ( null == progressDialog) {
|
||||||
progressDialog =new ProgressDialog(mContext);
|
progressDialog =new ProgressDialog(mContext);
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ public class BookUtil {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
private void checkAndCreateDir(String path){
|
private void checkAndCreateDir(String path){
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
if (!file.exists()){
|
if (!file.exists()){
|
||||||
|
@ -1035,8 +1035,6 @@ public class BookUtil {
|
||||||
|
|
||||||
handlerMsg(msg);
|
handlerMsg(msg);
|
||||||
|
|
||||||
|
|
||||||
dismissProgressDialog();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1106,7 +1104,7 @@ public class BookUtil {
|
||||||
File file = new File(fileChapterName(index));
|
File file = new File(fileChapterName(index));
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
showProgressDialog("请稍候",false);
|
|
||||||
new Thread(){
|
new Thread(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -1190,7 +1188,7 @@ public class BookUtil {
|
||||||
}
|
}
|
||||||
Log.d("loadChaptContent",String.format("loadChaptContent slept %s for downloading ",slepttime ) );
|
Log.d("loadChaptContent",String.format("loadChaptContent slept %s for downloading ",slepttime ) );
|
||||||
Log.d( "loadChaptContent",String.format("dismissing dialog " ));
|
Log.d( "loadChaptContent",String.format("dismissing dialog " ));
|
||||||
dismissProgressDialog();
|
|
||||||
Log.d(TAG,String.format("loadChaptContent slept %s for downloading chaptercontent ",slepttime ));
|
Log.d(TAG,String.format("loadChaptContent slept %s for downloading chaptercontent ",slepttime ));
|
||||||
}
|
}
|
||||||
Log.d( "loadChaptContent",String.format(" %s, file.exists()? %s", file.getPath(),file.exists()));
|
Log.d( "loadChaptContent",String.format(" %s, file.exists()? %s", file.getPath(),file.exists()));
|
||||||
|
@ -1243,7 +1241,7 @@ public class BookUtil {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}finally {
|
}finally {
|
||||||
dismissProgressDialog();
|
|
||||||
}
|
}
|
||||||
Cache cache = new Cache();
|
Cache cache = new Cache();
|
||||||
cache.setSize(block.length);
|
cache.setSize(block.length);
|
||||||
|
|
|
@ -4,14 +4,22 @@ import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.os.Build;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
|
import android.view.KeyCharacterMap;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.TextureView;
|
import android.view.TextureView;
|
||||||
|
import android.view.ViewConfiguration;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -20,6 +28,147 @@ import java.util.Locale;
|
||||||
|
|
||||||
public class CommonUtil {
|
public class CommonUtil {
|
||||||
|
|
||||||
|
private static final String TAG= CommonUtil.class.getSimpleName();
|
||||||
|
public static int getScreenHeight(Context context){
|
||||||
|
|
||||||
|
if(checkDeviceHasNavigationBar(context)){
|
||||||
|
return getDpi(context);
|
||||||
|
|
||||||
|
}
|
||||||
|
return getScreenHeightWithOutBottomBar(context);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取是否存在NavigationBar
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean checkDeviceHasNavigationBar(Context context) {
|
||||||
|
Point appUsableSize = getAppUsableScreenSize(context);
|
||||||
|
Point realScreenSize = getRealScreenSize(context);
|
||||||
|
|
||||||
|
Log.d(TAG, String.format("getNavigationBarSize: usablesize.y %s,realScreenSize.y %s,realScreenSize.y -usablesize.y =%s, statusbar height %s"
|
||||||
|
,appUsableSize.y ,realScreenSize.y, realScreenSize.y-appUsableSize.y ,getStatusBarHeight(context) ));
|
||||||
|
Point p = getNavigationBarSize(context);
|
||||||
|
return realScreenSize.y-appUsableSize.y - getStatusBarHeight(context)>0;
|
||||||
|
|
||||||
|
}
|
||||||
|
public static Point getNavigationBarSize(Context context) {
|
||||||
|
Point appUsableSize = getAppUsableScreenSize(context);
|
||||||
|
Point realScreenSize = getRealScreenSize(context);
|
||||||
|
|
||||||
|
Log.d(TAG, String.format("getNavigationBarSize: usablesize.y %s,realScreenSize.y %s,realScreenSize.y -usablesize.y =%s, statusbar height %s"
|
||||||
|
,appUsableSize.y ,realScreenSize.y, realScreenSize.y-appUsableSize.y ,getStatusBarHeight(context) ));
|
||||||
|
// navigation bar on the side
|
||||||
|
if (appUsableSize.x < realScreenSize.x) {
|
||||||
|
return new Point(realScreenSize.x - appUsableSize.x, appUsableSize.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// navigation bar at the bottom
|
||||||
|
if (appUsableSize.y < realScreenSize.y) {
|
||||||
|
return new Point(appUsableSize.x, realScreenSize.y - appUsableSize.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// navigation bar is not present
|
||||||
|
return new Point();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Point getAppUsableScreenSize(Context context) {
|
||||||
|
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
Display display = windowManager.getDefaultDisplay();
|
||||||
|
Point size = new Point();
|
||||||
|
display.getSize(size);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Point getRealScreenSize(Context context) {
|
||||||
|
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
Display display = windowManager.getDefaultDisplay();
|
||||||
|
Point size = new Point();
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 17) {
|
||||||
|
display.getRealSize(size);
|
||||||
|
} else if (Build.VERSION.SDK_INT >= 14) {
|
||||||
|
try {
|
||||||
|
size.x = (Integer) Display.class.getMethod("getRawWidth").invoke(display);
|
||||||
|
size.y = (Integer) Display.class.getMethod("getRawHeight").invoke(display);
|
||||||
|
} catch (IllegalAccessException e) {} catch (InvocationTargetException e) {} catch (NoSuchMethodException e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
public static int getStatusBarHeight(Context c) {
|
||||||
|
int resourceId = c.getResources()
|
||||||
|
.getIdentifier("status_bar_height", "dimen", "android");
|
||||||
|
if (resourceId > 0) {
|
||||||
|
return c.getResources().getDimensionPixelSize(resourceId);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* public static boolean isNavigationBarShow(){
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
|
Display display = getActivity().getWindowManager().getDefaultDisplay();
|
||||||
|
Point size = new Point();
|
||||||
|
Point realSize = new Point();
|
||||||
|
display.getSize(size);
|
||||||
|
display.getRealSize(realSize);
|
||||||
|
boolean result = realSize.y!=size.y;
|
||||||
|
return realSize.y!=size.y;
|
||||||
|
}else {
|
||||||
|
boolean menu = ViewConfiguration.get(getActivity()).hasPermanentMenuKey();
|
||||||
|
boolean back = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
|
||||||
|
if(menu || back) {
|
||||||
|
return false;
|
||||||
|
}else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取是否有虚拟按键
|
||||||
|
* 通过判断是否有物理返回键反向判断是否有虚拟按键
|
||||||
|
* mate20 不行
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
/* public static boolean checkDeviceHasNavigationBar2(Context context) {
|
||||||
|
|
||||||
|
boolean hasMenuKey = ViewConfiguration.get(context)
|
||||||
|
.hasPermanentMenuKey();
|
||||||
|
boolean hasBackKey = KeyCharacterMap
|
||||||
|
.deviceHasKey(KeyEvent.KEYCODE_BACK);
|
||||||
|
if (!hasMenuKey & !hasBackKey) {
|
||||||
|
// 做任何你需要做的,这个设备有一个导航栏
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取虚拟功能键高度
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int getVirtualBarHeigh(Context context) {
|
||||||
|
int vh = 0;
|
||||||
|
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
Display display = windowManager.getDefaultDisplay();
|
||||||
|
DisplayMetrics dm = new DisplayMetrics();
|
||||||
|
try {
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
Class c = Class.forName("android.view.Display");
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Method method = c.getMethod("getRealMetrics", DisplayMetrics.class);
|
||||||
|
method.invoke(display, dm);
|
||||||
|
vh = dm.heightPixels - windowManager.getDefaultDisplay().getHeight();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return vh;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取屏幕原始尺寸高度,包括虚拟功能键高度
|
* 获取屏幕原始尺寸高度,包括虚拟功能键高度
|
||||||
* @param context
|
* @param context
|
||||||
|
@ -63,7 +212,7 @@ public class CommonUtil {
|
||||||
* @param context
|
* @param context
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static int getScreenHeight(Context context)
|
public static int getScreenHeightWithOutBottomBar(Context context)
|
||||||
{
|
{
|
||||||
WindowManager wm = (WindowManager) context
|
WindowManager wm = (WindowManager) context
|
||||||
.getSystemService(Context.WINDOW_SERVICE);
|
.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
|
|
@ -17,6 +17,7 @@ public class Config {
|
||||||
private final static String LIGHT_KEY = "light";
|
private final static String LIGHT_KEY = "light";
|
||||||
private final static String SYSTEM_LIGHT_KEY = "systemlight";
|
private final static String SYSTEM_LIGHT_KEY = "systemlight";
|
||||||
private final static String PAGE_MODE_KEY = "pagemode";
|
private final static String PAGE_MODE_KEY = "pagemode";
|
||||||
|
private final static String KEY_BASE_URY = "baseurl";
|
||||||
|
|
||||||
public final static String FONTTYPE_DEFAULT = "";
|
public final static String FONTTYPE_DEFAULT = "";
|
||||||
public final static String FONTTYPE_QIHEI = "font/qihei.ttf";
|
public final static String FONTTYPE_QIHEI = "font/qihei.ttf";
|
||||||
|
@ -179,4 +180,15 @@ public class Config {
|
||||||
this.light = light;
|
this.light = light;
|
||||||
sp.edit().putFloat(LIGHT_KEY,light).commit();
|
sp.edit().putFloat(LIGHT_KEY,light).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getBaseUrl(){
|
||||||
|
return sp.getString(KEY_BASE_URY,"");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBaseUrl(String baseUrl){
|
||||||
|
sp.edit().putString(KEY_BASE_URY,baseUrl).commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.novelbook.android.utils;
|
||||||
public class Constants {
|
public class Constants {
|
||||||
public static final String BLOCK_TITLE_NOVELS = "ns";
|
public static final String BLOCK_TITLE_NOVELS = "ns";
|
||||||
public static final int NOVEL_SPAN_CNT =3 ; //grid columns
|
public static final int NOVEL_SPAN_CNT =3 ; //grid columns
|
||||||
|
public static final boolean SHOWAD =false ;
|
||||||
public static int SEX=1;
|
public static int SEX=1;
|
||||||
public static String A_Regex = "<a[^>]+href[\\s]*=[\\s]*['\"]?([^'\"]+)['\"\\s]?[^>]*>([^<]+)<"; //TODO: 从服务器更新
|
public static String A_Regex = "<a[^>]+href[\\s]*=[\\s]*['\"]?([^'\"]+)['\"\\s]?[^>]*>([^<]+)<"; //TODO: 从服务器更新
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.novelbook.android.utils;
|
package com.novelbook.android.utils;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
|
@ -8,7 +9,11 @@ import com.bumptech.glide.Glide;
|
||||||
public class MyImageLoader extends com.youth.banner.loader.ImageLoader {
|
public class MyImageLoader extends com.youth.banner.loader.ImageLoader {
|
||||||
@Override
|
@Override
|
||||||
public void displayImage(Context context, Object path, ImageView imageView) {
|
public void displayImage(Context context, Object path, ImageView imageView) {
|
||||||
|
try {
|
||||||
Glide.with(context).load((String) path).into(imageView);
|
Glide.with(context).load((String) path).into(imageView);
|
||||||
|
}catch (Exception e){
|
||||||
|
Log.e("MyImageLoader", "displayImage: ",e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ import android.graphics.RectF;
|
||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
@ -156,7 +158,7 @@ public class PageFactory implements ChangeSource{
|
||||||
private TRPage currentPage;
|
private TRPage currentPage;
|
||||||
private TRPage prePage;
|
private TRPage prePage;
|
||||||
private TRPage cancelPage;
|
private TRPage cancelPage;
|
||||||
private BookTask bookTask;
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,9 +167,30 @@ public class PageFactory implements ChangeSource{
|
||||||
private List<TRPage> preChaptPages;
|
private List<TRPage> preChaptPages;
|
||||||
|
|
||||||
private AdInterface mAd;
|
private AdInterface mAd;
|
||||||
|
private BookTask bookTask;
|
||||||
|
|
||||||
public void setAd(AdInterface ad){
|
public void setAd(AdInterface ad){
|
||||||
mAd =ad;
|
mAd =ad;
|
||||||
}
|
}
|
||||||
|
Handler handler = new Handler() {
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
|
||||||
|
int wt = msg.what;
|
||||||
|
|
||||||
|
handlerMsg(msg);
|
||||||
|
|
||||||
|
dismissProgressDialog();
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void handlerMsg(Message msg) {
|
||||||
|
if (msg.what == 1) {
|
||||||
|
changeChapter(currentChapter);
|
||||||
|
}
|
||||||
|
}
|
||||||
private List<TRPage> loadCurrentChapt(int chaptId){
|
private List<TRPage> loadCurrentChapt(int chaptId){
|
||||||
|
|
||||||
chaptId = chaptId >getChapters().size()?getChapters().size():chaptId;
|
chaptId = chaptId >getChapters().size()?getChapters().size():chaptId;
|
||||||
|
@ -185,9 +208,10 @@ public class PageFactory implements ChangeSource{
|
||||||
drawStatus(mBookPageWidget.getCurPage());
|
drawStatus(mBookPageWidget.getCurPage());
|
||||||
drawStatus(mBookPageWidget.getNextPage());
|
drawStatus(mBookPageWidget.getNextPage());
|
||||||
|
|
||||||
File file = new File(getChapterFileName(chaptId));
|
final File file = new File(getChapterFileName(chaptId));
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
|
Log.d(TAG, String.format("prepare book to open chapter %s ,file is not download",chaptId ) );
|
||||||
|
mStatus = Status.OPENING;
|
||||||
if( !NetUtil.isNetworkConnected()){ //TODO: 500错误处理
|
if( !NetUtil.isNetworkConnected()){ //TODO: 500错误处理
|
||||||
mStatus = Status.NETWORKFAILE;
|
mStatus = Status.NETWORKFAILE;
|
||||||
drawStatus(mBookPageWidget.getCurPage());
|
drawStatus(mBookPageWidget.getCurPage());
|
||||||
|
@ -195,6 +219,46 @@ public class PageFactory implements ChangeSource{
|
||||||
return chaptPages;
|
return chaptPages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// showProgressDialog();
|
||||||
|
final int chid = chaptId;
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Log.d(TAG, String.format("prepare book to download chapter %s ,thread.name %s",chid,Thread.currentThread().getName() ) );
|
||||||
|
mBookUtil.chaptChars(chid);
|
||||||
|
|
||||||
|
super.run();
|
||||||
|
}}.start();
|
||||||
|
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
int slepttime =0;
|
||||||
|
while( !file.exists() && slepttime <100){
|
||||||
|
try {
|
||||||
|
sleep(50);
|
||||||
|
slepttime++;
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.d(TAG, String.format("prepare book to download chapter %s ,slepted %s ,thread.name %s",chid,slepttime*50 ,Thread.currentThread().getName() ) );
|
||||||
|
mStatus = Status.FINISH;
|
||||||
|
//notice file done
|
||||||
|
handler.sendEmptyMessage(1);
|
||||||
|
|
||||||
|
|
||||||
|
super.run();
|
||||||
|
}}.start();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
drawStatus(mBookPageWidget.getCurPage());
|
||||||
|
drawStatus(mBookPageWidget.getNextPage());
|
||||||
|
return chaptPages;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(getChapters().size()==0) {
|
}else if(getChapters().size()==0) {
|
||||||
|
@ -262,8 +326,14 @@ public class PageFactory implements ChangeSource{
|
||||||
private void showProgressDialog() {
|
private void showProgressDialog() {
|
||||||
if ( null == progressDialog) {
|
if ( null == progressDialog) {
|
||||||
progressDialog =new ProgressDialog(mContext);
|
progressDialog =new ProgressDialog(mContext);
|
||||||
|
progressDialog.setMessage("正在努力加载...");
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
|
}catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.e(TAG, "prepare book: ", e);
|
||||||
|
}
|
||||||
// progressDialog.show(mContext,"网络不给力","正努力加载",false,true);
|
// progressDialog.show(mContext,"网络不给力","正努力加载",false,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,6 +363,13 @@ public class PageFactory implements ChangeSource{
|
||||||
return mBookUtil.fileChapterName(chapid);
|
return mBookUtil.fileChapterName(chapid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isBusy =false;
|
||||||
|
public void setBusy(boolean isBusy) {
|
||||||
|
this.isBusy = isBusy;
|
||||||
|
}
|
||||||
|
public static boolean busy(){
|
||||||
|
return isBusy;
|
||||||
|
}
|
||||||
|
|
||||||
public enum Status {
|
public enum Status {
|
||||||
OPENING,
|
OPENING,
|
||||||
|
@ -322,8 +399,9 @@ public class PageFactory implements ChangeSource{
|
||||||
DisplayMetrics metric = new DisplayMetrics();
|
DisplayMetrics metric = new DisplayMetrics();
|
||||||
wm.getDefaultDisplay().getMetrics(metric);
|
wm.getDefaultDisplay().getMetrics(metric);
|
||||||
mWidth = metric.widthPixels;
|
mWidth = metric.widthPixels;
|
||||||
mHeight = metric.heightPixels;
|
// mHeight = metric.heightPixels;
|
||||||
|
// mHeight = CommonUtil.getDpi(context);
|
||||||
|
mHeight = CommonUtil.getScreenHeight(context);
|
||||||
sdf = new SimpleDateFormat("HH:mm");//HH:mm为24小时制,hh:mm为12小时制
|
sdf = new SimpleDateFormat("HH:mm");//HH:mm为24小时制,hh:mm为12小时制
|
||||||
date = sdf.format(new java.util.Date());
|
date = sdf.format(new java.util.Date());
|
||||||
df = new DecimalFormat("#0.0");
|
df = new DecimalFormat("#0.0");
|
||||||
|
@ -415,7 +493,7 @@ public class PageFactory implements ChangeSource{
|
||||||
String status = "";
|
String status = "";
|
||||||
switch (mStatus){
|
switch (mStatus){
|
||||||
case OPENING:
|
case OPENING:
|
||||||
status = "正在打开书本...";
|
status = "正在拼命加载...";
|
||||||
break;
|
break;
|
||||||
case FAIL:
|
case FAIL:
|
||||||
status = "打开书本失败!";
|
status = "打开书本失败!";
|
||||||
|
@ -472,12 +550,9 @@ public class PageFactory implements ChangeSource{
|
||||||
// * column won't be updated.
|
// * column won't be updated.
|
||||||
// mBook.save();
|
// mBook.save();
|
||||||
|
|
||||||
|
/* Novel nv = LitePal.find(Novel.class,mBook.getId());
|
||||||
|
|
||||||
Novel nv = LitePal.find(Novel.class,mBook.getId());
|
|
||||||
|
|
||||||
Log.d(TAG,String.format("prepare book saved lastchapt %s,lastpos %s, db lastchapt %s last pos %s",
|
Log.d(TAG,String.format("prepare book saved lastchapt %s,lastpos %s, db lastchapt %s last pos %s",
|
||||||
currentChapter,currentPage.getBegin(),nv.getLastReadChapt(),nv.getLastReadPos()));
|
currentChapter,currentPage.getBegin(),nv.getLastReadChapt(),nv.getLastReadPos()));*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -687,6 +762,7 @@ public class PageFactory implements ChangeSource{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log.d(TAG, "prepareBook: .start prepare book " + book.getName());
|
// Log.d(TAG, "prepareBook: .start prepare book " + book.getName());
|
||||||
this.mBook = book ;
|
this.mBook = book ;
|
||||||
mBookUtil = new BookUtil();
|
mBookUtil = new BookUtil();
|
||||||
|
@ -705,6 +781,7 @@ public class PageFactory implements ChangeSource{
|
||||||
mBookUtil = new BookUtil();
|
mBookUtil = new BookUtil();
|
||||||
}
|
}
|
||||||
mBookUtil.setContext(context);
|
mBookUtil.setContext(context);
|
||||||
|
mContext =context;
|
||||||
mBookUtil.pagefactory=this;
|
mBookUtil.pagefactory=this;
|
||||||
//清空数据
|
//清空数据
|
||||||
currentChapter = 0;
|
currentChapter = 0;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.view.WindowManager;
|
||||||
import android.view.animation.LinearInterpolator;
|
import android.view.animation.LinearInterpolator;
|
||||||
import android.widget.Scroller;
|
import android.widget.Scroller;
|
||||||
|
|
||||||
|
import com.novelbook.android.utils.CommonUtil;
|
||||||
import com.novelbook.android.utils.PageFactory;
|
import com.novelbook.android.utils.PageFactory;
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +125,9 @@ public class BookPageWidget extends View {
|
||||||
DisplayMetrics metric = new DisplayMetrics();
|
DisplayMetrics metric = new DisplayMetrics();
|
||||||
wm.getDefaultDisplay().getMetrics(metric);
|
wm.getDefaultDisplay().getMetrics(metric);
|
||||||
mScreenWidth = metric.widthPixels;
|
mScreenWidth = metric.widthPixels;
|
||||||
mScreenHeight = metric.heightPixels;
|
// mScreenHeight = metric.heightPixels;
|
||||||
|
// mScreenHeight = CommonUtil.getDpi(mContext);
|
||||||
|
mScreenHeight = CommonUtil.getScreenHeight(mContext);
|
||||||
mCurPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.RGB_565); //android:LargeHeap=true use in manifest application
|
mCurPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.RGB_565); //android:LargeHeap=true use in manifest application
|
||||||
mNextPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.RGB_565);
|
mNextPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.RGB_565);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.view.WindowManager;
|
||||||
import android.view.animation.LinearInterpolator;
|
import android.view.animation.LinearInterpolator;
|
||||||
import android.widget.Scroller;
|
import android.widget.Scroller;
|
||||||
|
|
||||||
|
import com.novelbook.android.utils.CommonUtil;
|
||||||
import com.novelbook.android.utils.PageFactory;
|
import com.novelbook.android.utils.PageFactory;
|
||||||
import com.novelbook.android.view.animation.AnimationProvider;
|
import com.novelbook.android.view.animation.AnimationProvider;
|
||||||
import com.novelbook.android.view.animation.CoverAnimation;
|
import com.novelbook.android.view.animation.CoverAnimation;
|
||||||
|
@ -75,7 +76,9 @@ public class PageWidget extends View {
|
||||||
DisplayMetrics metric = new DisplayMetrics();
|
DisplayMetrics metric = new DisplayMetrics();
|
||||||
wm.getDefaultDisplay().getMetrics(metric);
|
wm.getDefaultDisplay().getMetrics(metric);
|
||||||
mScreenWidth = metric.widthPixels;
|
mScreenWidth = metric.widthPixels;
|
||||||
mScreenHeight = metric.heightPixels;
|
// mScreenHeight = metric.heightPixels;
|
||||||
|
// mScreenHeight = CommonUtil.getDpi(mContext);
|
||||||
|
mScreenHeight = CommonUtil.getScreenHeight(mContext);
|
||||||
mCurPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.RGB_565); //android:LargeHeap=true use in manifest application
|
mCurPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.RGB_565); //android:LargeHeap=true use in manifest application
|
||||||
mNextPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.RGB_565);
|
mNextPageBitmap = Bitmap.createBitmap(mScreenWidth, mScreenHeight, Bitmap.Config.RGB_565);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
|
|
||||||
|
|
||||||
/>
|
android:contentDescription="TODO" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:text="00.00%"
|
android:text="@string/_00_00"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
android:background="@color/read_dialog_bg"
|
android:background="@color/read_dialog_bg"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -1,24 +1,25 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/book_pop"
|
android:id="@+id/book_pop"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<!-- <LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/rl_progress"
|
android:id="@+id/rl_progress"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|center_horizontal"
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
android:layout_marginBottom="20dp"
|
android:layout_marginBottom="20dp"
|
||||||
android:padding="20dp"
|
|
||||||
android:background="@color/black"
|
android:background="@color/black"
|
||||||
|
android:padding="20dp"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -26,100 +27,100 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
|
android:text="00.00%"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp" />
|
||||||
android:text="00.00%"/>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/bookpop_bottom"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/bookpop_bottom"
|
|
||||||
android:baselineAligned="false"
|
|
||||||
android:background="@color/read_dialog_bg"
|
android:background="@color/read_dialog_bg"
|
||||||
|
android:baselineAligned="false"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="70dp"
|
android:layout_height="70dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_pre"
|
android:id="@+id/tv_pre"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/read_setting_pre"
|
android:text="@string/read_setting_pre"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textSize="16sp"
|
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:layout_gravity="center_vertical"
|
android:textSize="16sp" />
|
||||||
/>
|
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/sb_progress"
|
android:id="@+id/sb_progress"
|
||||||
android:layout_width="150dp"
|
android:layout_width="150dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:max="10000"
|
android:max="10000"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"></SeekBar>
|
||||||
android:layout_gravity="center_vertical">
|
|
||||||
</SeekBar>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_next"
|
android:id="@+id/tv_next"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
android:text="@string/read_setting_next"
|
android:text="@string/read_setting_next"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textSize="16sp"
|
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:layout_gravity="center_vertical"
|
android:textSize="16sp" />
|
||||||
/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/text_style"
|
|
||||||
android:id="@+id/tv_directory"
|
android:id="@+id/tv_directory"
|
||||||
|
style="@style/text_style"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:paddingBottom="5dp"
|
android:gravity="center"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingRight="10dp"
|
android:paddingRight="10dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
android:text="@string/read_setting_directory" />
|
android:text="@string/read_setting_directory" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/text_style"
|
|
||||||
android:id="@+id/tv_dayornight"
|
android:id="@+id/tv_dayornight"
|
||||||
|
style="@style/text_style"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:paddingBottom="5dp"
|
android:gravity="center"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingRight="10dp"
|
android:paddingRight="10dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
android:text="@string/read_setting_night" />
|
android:text="@string/read_setting_night" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/text_style"
|
|
||||||
android:id="@+id/tv_setting"
|
android:id="@+id/tv_setting"
|
||||||
|
style="@style/text_style"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:paddingBottom="5dp"
|
android:gravity="center"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingRight="10dp"
|
android:paddingRight="10dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
android:text="@string/read_setting_set" />
|
android:text="@string/read_setting_set" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>-->
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/sb_brightness"
|
android:id="@+id/sb_brightness"
|
||||||
android:layout_width="150dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="4"
|
android:layout_weight="3"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:max="100"
|
android:max="100"
|
||||||
android:layout_gravity="center_vertical">
|
android:layout_gravity="center_vertical">
|
||||||
|
@ -51,7 +51,9 @@
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_xitong"
|
android:id="@+id/tv_xitong"
|
||||||
|
android:layout_weight="0"
|
||||||
style="@style/setting_dialog_button"
|
style="@style/setting_dialog_button"
|
||||||
|
android:layout_width="65dp"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="20dp"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:text="@string/setting_system" />
|
android:text="@string/setting_system" />
|
||||||
|
@ -93,7 +95,8 @@
|
||||||
android:id="@+id/tv_size_default"
|
android:id="@+id/tv_size_default"
|
||||||
style="@style/setting_dialog_button"
|
style="@style/setting_dialog_button"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="20dp"
|
||||||
android:textColor="@color/white"
|
android:layout_width="65dp"
|
||||||
|
android:textSize="16sp"
|
||||||
android:text="@string/setting_default" />
|
android:text="@string/setting_default" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -132,7 +135,8 @@
|
||||||
android:id="@+id/tv_lhsize_default"
|
android:id="@+id/tv_lhsize_default"
|
||||||
style="@style/setting_dialog_button"
|
style="@style/setting_dialog_button"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="20dp"
|
||||||
android:textColor="@color/white"
|
android:layout_width="65dp"
|
||||||
|
android:textSize="16sp"
|
||||||
android:text="@string/setting_default" />
|
android:text="@string/setting_default" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -186,6 +186,7 @@
|
||||||
<string name="aboutContent">如风小说阅读是专注于提供更舒适的阅读体验,主打本地阅读,操作方式简单易上手,目前支持txt格式。</string>
|
<string name="aboutContent">如风小说阅读是专注于提供更舒适的阅读体验,主打本地阅读,操作方式简单易上手,目前支持txt格式。</string>
|
||||||
<string name="noRecord">没有数据</string>
|
<string name="noRecord">没有数据</string>
|
||||||
<string name="title_Activity_ChgSource">换源</string>
|
<string name="title_Activity_ChgSource">换源</string>
|
||||||
|
<string name="_00_00">00.00%</string>
|
||||||
|
|
||||||
<string-array name="voicer_cloud_entries">
|
<string-array name="voicer_cloud_entries">
|
||||||
<item>小燕—女青、中英、普通话</item>
|
<item>小燕—女青、中英、普通话</item>
|
||||||
|
|
|
@ -261,7 +261,7 @@
|
||||||
<item name="android:layout_gravity">center_vertical</item>
|
<item name="android:layout_gravity">center_vertical</item>
|
||||||
<item name="android:gravity">center</item>
|
<item name="android:gravity">center</item>
|
||||||
<item name="android:background">@drawable/rb_nobtn_selector</item>
|
<item name="android:background">@drawable/rb_nobtn_selector</item>
|
||||||
<item name="android:textColor">@color/darkcyan</item>
|
<item name="android:textColor">@color/white</item>
|
||||||
<item name="android:textSize">16sp</item>
|
<item name="android:textSize">16sp</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="text_style">
|
<style name="text_style">
|
||||||
|
|
Loading…
Reference in New Issue