diff --git a/zhuike/build.gradle b/zhuike/build.gradle
index 5ef57cc..8c33394 100644
--- a/zhuike/build.gradle
+++ b/zhuike/build.gradle
@@ -16,8 +16,8 @@ android {
applicationId "com.novelbook.android"
minSdkVersion 19 //target 19 Android 4.4 以下版本仅占比4.1%
targetSdkVersion 28
- versionCode 3
- versionName "3.0"
+ versionCode 5
+ versionName "5.0"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -31,14 +31,15 @@ android {
multiDexEnabled true //突破65535
manifestPlaceholders = [UMENG_CHANNEL_CALUE: "umeng"] //默认为uMeng
- flavorDimensions "default" //debug时注销
+ flavorDimensions "default" //debug时注销
}
buildTypes {
debug {
// 显示Log
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "String", "MAIN_HOST", '"http://xiaoshuofenxiang.com/api/"'
- buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
+ buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/g.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
+ // buildConfigField "String", "API_HOST", '""'
versionNameSuffix "-debug"
minifyEnabled false
zipAlignEnabled false
@@ -70,36 +71,36 @@ android {
}
}
//渠道
- productFlavors {
+ productFlavors {
// googleplay {}
qxs {
applicationId "com.novelbook.android.qxs"
- versionName "version-a-1.0"
+ versionName "vn-qxs-5.0"
buildConfigField "String", "MAIN_HOST", '"http://chqxs.xiaoshuofenxiang.com/api/"'
- // buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/qxs.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
- buildConfigField "String", "API_HOST", '""'
+ buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/qxs.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
+ //buildConfigField "String", "API_HOST", '""'
}
wzzw {
applicationId "com.novelbook.android.wzzw"
- versionName "version-b-1.0"
+ versionName "vn-wzzw-5.0"
buildConfigField "String", "MAIN_HOST", '"http://chwzzw.xiaoshuofenxiang.com/api/"'
- // buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/wzzw.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
- buildConfigField "String", "API_HOST", '""'
+ buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/wzzw.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
+ // buildConfigField "String", "API_HOST", '""'
}
bo {
applicationId "com.novelbook.android.bo"
- versionName "version-c-1.0"
+ versionName "vn-bo-5.0"
buildConfigField "String", "MAIN_HOST", '"http://chbo.xiaoshuofenxiang.com/api/"'
- // buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/bo.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
- buildConfigField "String", "API_HOST", '""'
+ buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/bo.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
+ // buildConfigField "String", "API_HOST", '""'
}
g {
applicationId "com.novelbook.android.g"
- versionName "version-d-1.0"
+ versionName "vn-g-5.0"
buildConfigField "String", "MAIN_HOST", '"http://chg.xiaoshuofenxiang.com/api/"'
- // buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
- buildConfigField "String", "API_HOST", '""'
+ buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/g.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
+ // buildConfigField "String", "API_HOST", '""'
}
//批量配置
productFlavors.all { flavor ->
diff --git a/zhuike/src/A/res/values/strings.xml b/zhuike/src/A/res/values/strings.xml
deleted file mode 100644
index 325e7cd..0000000
--- a/zhuike/src/A/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- A小说
-
-
diff --git a/zhuike/src/B/res/values/strings.xml b/zhuike/src/B/res/values/strings.xml
deleted file mode 100644
index 7eb1948..0000000
--- a/zhuike/src/B/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- B小说
-
-
diff --git a/zhuike/src/C/res/values/strings.xml b/zhuike/src/C/res/values/strings.xml
deleted file mode 100644
index 841586e..0000000
--- a/zhuike/src/C/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- C小说
-
-
diff --git a/zhuike/src/D/res/values/strings.xml b/zhuike/src/D/res/values/strings.xml
deleted file mode 100644
index 467090f..0000000
--- a/zhuike/src/D/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- D小说
-
-
diff --git a/zhuike/src/main/AndroidManifest.xml b/zhuike/src/main/AndroidManifest.xml
index 732f6e7..1c1bf3e 100644
--- a/zhuike/src/main/AndroidManifest.xml
+++ b/zhuike/src/main/AndroidManifest.xml
@@ -99,7 +99,7 @@
-
+
diff --git a/zhuike/src/main/java/com/novelbook/android/Activity_base.java b/zhuike/src/main/java/com/novelbook/android/Activity_base.java
index 3b442a9..fad8ed6 100644
--- a/zhuike/src/main/java/com/novelbook/android/Activity_base.java
+++ b/zhuike/src/main/java/com/novelbook/android/Activity_base.java
@@ -28,6 +28,7 @@ import com.novelbook.android.netutils.NetUtil;
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
import com.novelbook.android.netutils.OnSuccessAndFaultSub;
import com.novelbook.android.upgrade.UpdateManager;
+import com.novelbook.android.utils.CommonUtil;
import com.novelbook.android.utils.ImageUtil;
import com.novelbook.android.utils.MyImageLoader;
import com.novelbook.android.utils.OnItemClickListener;
@@ -240,25 +241,7 @@ public abstract class Activity_base extends AppCompatActivity {
* @param errorText
*/
protected void checkPermission (Activity thisActivity, String permission, int requestCode, String errorText) {
- //判断当前Activity是否已经获得了该权限
- if(ContextCompat.checkSelfPermission(thisActivity,permission) != PackageManager.PERMISSION_GRANTED) {
- //如果App的权限申请曾经被用户拒绝过,就需要在这里跟用户做出解释
- if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
- permission)) {
- Toast.makeText(this,errorText,Toast.LENGTH_SHORT).show();
- //进行权限请求
- ActivityCompat.requestPermissions(thisActivity,
- new String[]{permission},
- requestCode);
- } else {
- //进行权限请求
- ActivityCompat.requestPermissions(thisActivity,
- new String[]{permission},
- requestCode);
- }
- } else {
-
- }
+ CommonUtil.checkPermission(thisActivity,permission,requestCode,errorText);
}
protected void loadImageView(String url, ImageView imageView){
diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/BasicFragment.java b/zhuike/src/main/java/com/novelbook/android/Fragments/BasicFragment.java
index 6202e47..c9a409e 100644
--- a/zhuike/src/main/java/com/novelbook/android/Fragments/BasicFragment.java
+++ b/zhuike/src/main/java/com/novelbook/android/Fragments/BasicFragment.java
@@ -75,7 +75,7 @@ import butterknife.ButterKnife;
*/
public abstract class BasicFragment extends Fragment {
- public static String TAG = "need to be replaced";
+ public static String TAG = BasicFragment.class.getSimpleName();
protected View rootView;
protected int pageNo=1;
protected int pageCount;
@@ -91,6 +91,9 @@ public abstract class BasicFragment extends Fragment {
@Nullable
@BindView(R.id.swipeLayout)
SwipeRefreshLayout mSwipeRefresh;
+
+ int MSG_INIT_TAB =99;
+
public BasicFragment() {
// Required empty public constructor
}
@@ -150,17 +153,12 @@ public abstract class BasicFragment extends Fragment {
Log.e(TAG, "handleMessage: filldata error ", e);
}
- } else if (msg.what == 2) //
+ } else if (msg.what == MSG_INIT_TAB) //
{
-
-
+ initTabs();
// Toast.makeText(getActivity(), "数据请求失败 ", Toast.LENGTH_LONG).show();
- } else if (msg.what == 3) {
-
- // Toast.makeText(getActivity(), " ", Toast.LENGTH_LONG).show();
}
-
if(getActivity()!=null && !NetUtil.isNetworkConnected()){
Toast.makeText(getActivity(),"好像没有网络啦",Toast.LENGTH_LONG).show();
}
@@ -170,7 +168,9 @@ public abstract class BasicFragment extends Fragment {
}
};
+void initTabs(){
+}
//--------------------------------------------------------------book list adapter------------------------------------------------
/* interface mOnItemClickListener
@@ -207,8 +207,13 @@ public abstract class BasicFragment extends Fragment {
void getBookInfo(Novel novel){
int novelId = novel.getNovelId();
long id = novel.getId();
+ Log.d(TAG, String.format("prepare book %s ,start to loading book info from host ",novel.getName()));
+ // showProgressDialog(false,"正在加载...");
+ PageFactory pageFactory =PageFactory.getInstance(activity ) ;
+ pageFactory.initBookUtil();
+ ReadActivity.openBook(novel ,activity);
+
- showProgressDialog(false,"正在加载...");
BookSubscribe.getNovel(novel.getNovelId(),new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
@Override
public void onSuccess(String result) {
@@ -222,7 +227,7 @@ public abstract class BasicFragment extends Fragment {
}else {
nv.save();
}
-
+ Log.d(TAG, String.format("prepare book %s ,start to loading book info from host -----------done",novel.getName()));
Log.d(TAG, String.format("prepare book %s ,lastchapt %s, last pos %s ,开始prepare.",nv.getName(),nv.getLastReadChapt(),nv.getLastReadPos()) );
// final Novel novel = nv;
/* new Thread(){
@@ -232,12 +237,12 @@ public abstract class BasicFragment extends Fragment {
}
}.start();*/
-
+ // ReadActivity.openBook(nv ,activity);
// PageFactory.getInstance(activity.getApplicationContext()).prepareBook(nv ); //打开本地小说内容
- PageFactory.getInstance(activity ).prepareBook(nv ); //打开本地小说内容
-
+ //PageFactory.getInstance(activity ).prepareBook(nv ); //打开本地小说内容
+ pageFactory.prepareBook(nv );
Log.d(TAG, String.format("prepare book %s 开始open book.",nv.getName()) );
- ReadActivity.openBook(nv ,activity);
+
handler.sendEmptyMessage(99);
}
@@ -245,8 +250,8 @@ public abstract class BasicFragment extends Fragment {
public void onFault(String errorMsg) {
//失败
Toast.makeText(getActivity(),"Novel 请求失败:"+errorMsg,Toast.LENGTH_SHORT).show();
- PageFactory.getInstance(activity ).prepareBook(novel ); //打开本地小说内容
- ReadActivity.openBook(novel ,activity);
+ // PageFactory.getInstance(activity ).prepareBook(novel ); //打开本地小说内容
+ // ReadActivity.openBook(novel ,activity);
handler.sendEmptyMessage(99);
}
},getActivity()));
diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_bookStore.java b/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_bookStore.java
index 545bd81..90373ac 100644
--- a/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_bookStore.java
+++ b/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_bookStore.java
@@ -31,7 +31,9 @@ public class Fragment_bookStore extends BasicFragment {
private ArrayList mFragments_cp;
ArrayList mList;
String[] mTitle;
-
+ Fragment_jingxuan fragment_jingxuan;
+ FragmentCates fragmentCates;
+ Fragment_bangdans fragment_bangdans;
protected void processArguments(){
if (getArguments() != null) {
Bundle bundle = getArguments() ;
@@ -56,10 +58,10 @@ public class Fragment_bookStore extends BasicFragment {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG,"Fragment_bookStore fragment onCreate ");
- if (getArguments() != null) {
- // mParam1 = getArguments().getString(ARG_PARAM1);
- // mParam2 = getArguments().getString(ARG_PARAM2);
- }
+ fragment_jingxuan = new Fragment_jingxuan();
+ fragmentCates =FragmentCates.newInstance();
+ fragment_bangdans = new Fragment_bangdans();
+
}
@@ -76,17 +78,22 @@ public class Fragment_bookStore extends BasicFragment {
}
public void onSexSwitch(){
if(mAdapter!=null) {
- for(BasicFragment bf: mFragments_cp){
+ /* for(BasicFragment bf: mFragments_cp){
bf.initData();
- }
+ }*/
/* for(int i=0;i();
- mFragments.add(new Fragment_jingxuan());
- mFragments.add(FragmentCates.newInstance());
- mFragments.add(new Fragment_bangdans());
+ mFragments.add(fragment_jingxuan);
+ mFragments.add(fragmentCates);
+ mFragments.add(fragment_bangdans);
mFragments_cp = new ArrayList<>();
mFragments_cp.addAll(mFragments);
// mFragments.add(new Fragment_shudan());
diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_paihang.java b/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_paihang.java
index a9ab208..8754c84 100644
--- a/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_paihang.java
+++ b/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_paihang.java
@@ -1,5 +1,6 @@
package com.novelbook.android.Fragments;
+import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -22,6 +23,7 @@ import com.novelbook.android.netsubscribe.BookSubscribe;
import com.novelbook.android.netutils.NetUtil;
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
import com.novelbook.android.netutils.OnSuccessAndFaultSub;
+import com.novelbook.android.utils.CommonUtil;
import com.novelbook.android.utils.Constants;
import com.novelbook.android.utils.GsonUtil;
import com.novelbook.android.utils.OnItemClickListener;
@@ -215,37 +217,36 @@ public static final String TAG = Fragment_paihang.class.getSimpleName();
public void initViews(){
appBarLayout.setVisibility(View.GONE);
if(lstNt==null) {
- // getSearchTabTtitle();
+ CommonUtil.getSearchTabTtitle(getActivity());
+ showProgressDialog(false,"正在加载...");
+ new Thread(){
+ @Override
+ public void run() {
+ Log.d(TAG, "prepare book to load options for search" );
+ while(lstNt==null){
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ handler.sendEmptyMessage(MSG_INIT_TAB);
+ }
+ }.start();
+
}
else {
initTabs();
}
- showProgressDialog(false,"正在加载...");
- new Thread(){
- @Override
- public void run() {
- Log.d(TAG, "prepare book to load options for search" );
- while(lstNt==null){
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- // initTabs();
- handler.sendEmptyMessage(2);
- }
- }.start();
- // getSearchTabTtitle();
- //setScrollListner();
initLoadMoreListener();
- //initTabs();
+
}
-
- private void initTabs() {
+ @Override
+ void initTabs() {
tmp=0;
/*
while(lstNt==null){
@@ -312,7 +313,7 @@ public static final String TAG = Fragment_paihang.class.getSimpleName();
mData2.get(tab2Pos).getTabTitle() +" " +
mData3.get(tab3Pos).getTabTitle() ;
*/
- if(lstSex==null) return;
+ if(lstSex==null || lstSex.size()==0) return;
pageNo=1;
@@ -328,7 +329,7 @@ public static final String TAG = Fragment_paihang.class.getSimpleName();
tvHint.setText(selectedKey);
Log.d(TAG, String.format("tabChanged: to load data %s,pageno %s, tmp %s" , selectedKey,pageNo ,tmp));
- if( tmp versionCode;
- isForceRefresh = serviceCode versionCode;
+ isForceRefresh = versionCode = Build.VERSION_CODES.M) {
+ CommonUtil.checkPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE, EXTERNAL_STORAGE_REQ_CODE, "下载更新需要此权限,请允许");
+ }
// 閺嬪嫰锟界�纭呯樈濡楋拷
Builder builder = new Builder(mContext);
@@ -317,7 +331,9 @@ public class UpdateManager {
}
String upgradeDetails=mHashMap.get("details");
String forceRefresh =isForceRefresh? "本地版本过低,请升级新版本\n":"";
- builder.setMessage( forceRefresh + mContext.getPackageName() + " "+getVersionCode(mContext) +" " +mContext.getString(R.string.soft_update_info) + upgradeDetails );
+ builder.setMessage( forceRefresh +mContext.getPackageName() + "\n当前版本:"+getVersionCode(mContext) +"\n"
+ +"最新版本:"+ serviceCode +"\n"
+ + mContext.getString(R.string.soft_update_info) + upgradeDetails );
builder.setPositiveButton(R.string.soft_update_updatebtn, new OnClickListener()
{
@Override
@@ -384,6 +400,7 @@ public class UpdateManager {
*/
private void downloadApk()
{
+
// 閸氼垰濮╅弬鎵殠缁嬪绗呮潪鍊熻拫娴狅拷
new downloadApkThread().start();
}
diff --git a/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java b/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java
index 878641e..3552217 100644
--- a/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java
+++ b/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java
@@ -1377,7 +1377,11 @@ int muluRetryCount =0;
// isDownloadChapt =true;
Log.d(TAG,String.format("handler msg, download %s",true) );
}else if(msg.what==99){
- Toast.makeText(mContext,"网络拥堵,已帮您切换其它源",Toast.LENGTH_LONG).show();
+ try {
+ Toast.makeText(mContext, "网络拥堵,已帮您切换其它源", Toast.LENGTH_LONG).show();
+ }catch (Exception e){
+ Log.e(TAG, "handlerMsg:toast error ", e);
+ }
// getSiteRule();
// pagefactory .changeChapter(getChapterNo());
diff --git a/zhuike/src/main/java/com/novelbook/android/utils/CommonUtil.java b/zhuike/src/main/java/com/novelbook/android/utils/CommonUtil.java
index e329369..2e8f6f9 100644
--- a/zhuike/src/main/java/com/novelbook/android/utils/CommonUtil.java
+++ b/zhuike/src/main/java/com/novelbook/android/utils/CommonUtil.java
@@ -8,6 +8,8 @@ import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Point;
import android.os.Build;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
import android.support.v4.widget.ContentLoadingProgressBar;
import android.text.TextUtils;
import android.util.DisplayMetrics;
@@ -22,6 +24,10 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
+import com.novelbook.android.netsubscribe.BookSubscribe;
+import com.novelbook.android.netutils.OnSuccessAndFaultListener;
+import com.novelbook.android.netutils.OnSuccessAndFaultSub;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.Timestamp;
@@ -332,11 +338,14 @@ public class CommonUtil {
return 0;
}
}
- public static long getVersionCodeLong(Context context) {
+ public static int getVersionCodeLong(Context context) {
+ if(Constants.version >0){
+ return Constants.version;
+ }
try {
PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
- return info.getLongVersionCode();
+ Constants.version = (int) info.getLongVersionCode();
} catch (Exception e) {
e.printStackTrace();
return 0;
@@ -344,6 +353,7 @@ public class CommonUtil {
e.printStackTrace();
return 0;
}
+ return Constants.version;
}
public static String getPackageName(Context context) {
try {
@@ -513,7 +523,61 @@ public class CommonUtil {
}
return "";
}
+ public static void checkPermission (Activity thisActivity, String permission, int requestCode, String errorText) {
+ //判断当前Activity是否已经获得了该权限
+ if(ContextCompat.checkSelfPermission(thisActivity,permission) != PackageManager.PERMISSION_GRANTED) {
+ //如果App的权限申请曾经被用户拒绝过,就需要在这里跟用户做出解释
+ if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
+ permission)) {
+ Toast.makeText(thisActivity,errorText,Toast.LENGTH_SHORT).show();
+ //进行权限请求
+ ActivityCompat.requestPermissions(thisActivity,
+ new String[]{permission},
+ requestCode);
+ } else {
+ //进行权限请求
+ ActivityCompat.requestPermissions(thisActivity,
+ new String[]{permission},
+ requestCode);
+ }
+ } else {
+ }
+ }
+
+ public static void getSearchTabTtitle(Context context){
+
+ BookSubscribe.getSearchTitles(Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
+ @Override
+ public void onSuccess(String result) {
+
+ // mFirstPage= gson.fromJson(result, FirstPage.class);
+ try {
+
+ Constants.lstSex = GsonUtil.parserStringBlocks(result,"sex");
+ Constants.lstNt =GsonUtil.parserStringBlocks(result,"nt");
+ Constants.lstProgressType =GsonUtil.parserProgressType(result,"progress");
+
+ // initTabs();
+ // loadSearchData();
+ } catch (Exception e) {
+ Log.e(TAG, "onSuccess: prepare book",e );
+ e.printStackTrace();
+ }
+
+
+ }
+
+ @Override
+ public void onFault(String errorMsg) {
+ //失败
+
+ // getSearchTabTtitle();
+
+ }
+ },context));
+
+ }
/* public static boolean isNavigationBarShow(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
Display display = getActivity().getWindowManager().getDefaultDisplay();
diff --git a/zhuike/src/main/java/com/novelbook/android/utils/Constants.java b/zhuike/src/main/java/com/novelbook/android/utils/Constants.java
index 8524f26..f8af054 100644
--- a/zhuike/src/main/java/com/novelbook/android/utils/Constants.java
+++ b/zhuike/src/main/java/com/novelbook/android/utils/Constants.java
@@ -32,5 +32,6 @@ public class Constants {
public static String announcement ="免责声明:阅读内容均来自互联网,本软件仅提供转码服务";
public static String email ="";
public static int minVersion =0;
+ public static int version =0;
public static String updateUrl="http://xiaoshuofenxiang.com/version.xml";;
}
diff --git a/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java b/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java
index e087f70..44040ac 100644
--- a/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java
+++ b/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java
@@ -709,6 +709,12 @@ private void hideSysUI(){
case FAIL:
status = "读取错误,请稍后重试";
mAd.showRefresh(View.VISIBLE);
+ try {
+ throw new Exception("error on reading");
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.d(TAG, "prepare book: why fail ",e);
+ }
break;
case NETWORKFAILE:
status = "请开启网络";
@@ -1112,7 +1118,9 @@ private void hideSysUI(){
this.mBookUtil.setNovel(book);
this.mBookUtil.getTargetSites();
}
-
+ public void initBookUtil() {
+ mBookUtil = null;
+ }
/**
* 打开书本
* @throws IOException
@@ -1200,9 +1208,18 @@ private void hideSysUI(){
chapter = params[0];
begin = params[1];
currentChapter = (int) chapter;
+
try {
+ int slept=0;
+ while(getNovel() ==null){
+ Thread.sleep(10);
+ slept++;
+ }
+
+ Log.d(TAG, "prepare book:waiting for bookutil book slept "+slept*10);
mBookUtil.openBook(getNovel(),chapter);
} catch (Exception e) {
+ Log.e(TAG, "prepare book: backgroud error", e);
e.printStackTrace();
return false;
}
@@ -1695,7 +1712,6 @@ private void hideSysUI(){
if(chaptMap!=null){
chaptMap.clear();
}
- //mBookUtil=null;
currentChapter = 0;
bookPath = "";
bookName = "";
diff --git a/zhuike/src/main/res/drawable/button_chk_bg.xml b/zhuike/src/main/res/drawable/button_chk_bg.xml
index e90e44f..c73f313 100644
--- a/zhuike/src/main/res/drawable/button_chk_bg.xml
+++ b/zhuike/src/main/res/drawable/button_chk_bg.xml
@@ -10,11 +10,11 @@
+ android:radius="2dp" />