调整权限问题
This commit is contained in:
parent
a871acb164
commit
31e55ab093
|
@ -13,8 +13,8 @@ android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
buildToolsVersion "28.0.3"
|
buildToolsVersion "28.0.3"
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// applicationId "com.qq.e.union.demo"
|
applicationId "com.novelbook.android"
|
||||||
applicationId "com.zhushou.yueshu"
|
// applicationId "com.zhushou.yueshu"
|
||||||
minSdkVersion 19 //target 19 Android 4.4 以下版本仅占比4.1%
|
minSdkVersion 19 //target 19 Android 4.4 以下版本仅占比4.1%
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 6
|
versionCode 6
|
||||||
|
@ -40,7 +40,7 @@ android {
|
||||||
// 显示Log
|
// 显示Log
|
||||||
buildConfigField "boolean", "LOG_DEBUG", "true"
|
buildConfigField "boolean", "LOG_DEBUG", "true"
|
||||||
buildConfigField "String", "MAIN_HOST", '"http://dg.xiaoshuofenxiang.com/api/"'
|
buildConfigField "String", "MAIN_HOST", '"http://dg.xiaoshuofenxiang.com/api/"'
|
||||||
// buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/dg.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/d.p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\//d.r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\//d.s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\//d.n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\//d.nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\//d.u.xiaoshuofenxiang.com\\"]}"'
|
// buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/dg.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/d.p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\//d.r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\//d.s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\//d.n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\//d.nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\//d.u.xiaoshuofenxiang.com\\"]}"'
|
||||||
buildConfigField "String", "API_HOST", '""'
|
buildConfigField "String", "API_HOST", '""'
|
||||||
|
|
||||||
// buildConfigField "String", "CHANNEL",'"DEBUG"'
|
// buildConfigField "String", "CHANNEL",'"DEBUG"'
|
||||||
|
@ -52,7 +52,7 @@ android {
|
||||||
}
|
}
|
||||||
release {
|
release {
|
||||||
// 暂时显示Log 。。。。。。。。。。。。。。。上线时关闭
|
// 暂时显示Log 。。。。。。。。。。。。。。。上线时关闭
|
||||||
buildConfigField "boolean", "LOG_DEBUG", "true"
|
buildConfigField "boolean", "LOG_DEBUG", "false"
|
||||||
//混淆
|
//混淆
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
//Zipalign优化
|
//Zipalign优化
|
||||||
|
@ -62,58 +62,35 @@ android {
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
// versionCode 1
|
// versionCode 1
|
||||||
// versionName "v1.0"
|
// versionName "v1.0"
|
||||||
/* applicationVariants.all { variant ->
|
/*applicationVariants.all { variant ->
|
||||||
variant.outputs.all { output ->
|
variant.outputs.all { output ->
|
||||||
def outFile = output.outputFile
|
def outFile = output.outputFile
|
||||||
if (outFile != null && outFile.name.endsWith(".apk")) {
|
if (outFile != null && outFile.name.endsWith(".apk")) {
|
||||||
def fileName = "${defaultConfig.versionName}-" + "${releaseTime()}" + "-${variant.productFlavors[0].name}" + ".apk"
|
def fileName = "${defaultConfig.versionName}-" + "${releaseTime()}" + "-${variant.productFlavors[0].name}" + ".apk"
|
||||||
|
|
||||||
outputFileName = fileName;
|
outputFileName = fileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
}*/
|
|
||||||
signingConfig signingConfigs.releaseConfig
|
signingConfig signingConfigs.releaseConfig
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//渠道
|
//渠道
|
||||||
/* productFlavors {
|
/*productFlavors {
|
||||||
// googleplay {}
|
// googleplay {}
|
||||||
yingyonghui {
|
g {
|
||||||
applicationId "com.zhushou.yueshu"
|
|
||||||
versionName "v1.0"
|
|
||||||
buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"'
|
|
||||||
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\\"]}"'
|
|
||||||
|
|
||||||
}
|
|
||||||
yiwan {
|
|
||||||
applicationId "com.zhushou.yueshu"
|
applicationId "com.zhushou.yueshu"
|
||||||
versionName "v1.0"
|
versionName "v1.0"
|
||||||
buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"'
|
buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"'
|
||||||
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", '""'
|
||||||
|
|
||||||
}
|
}
|
||||||
haote {
|
|
||||||
applicationId "com.zhushou.yueshu"
|
|
||||||
versionName "v1.0"
|
|
||||||
buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"'
|
|
||||||
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\\"]}"'
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
anzhi {
|
|
||||||
applicationId "com.zhushou.yueshu"
|
|
||||||
versionName "v1.0"
|
|
||||||
buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"'
|
|
||||||
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\\"]}"'
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
google {
|
google {
|
||||||
applicationId "com.zhushou.yueshu"
|
applicationId "com.zhushou.yueshu"
|
||||||
versionName "v1.0"
|
versionName "v1.0"
|
||||||
buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"'
|
buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"'
|
||||||
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", '""'
|
||||||
}
|
}
|
||||||
|
|
||||||
//批量配置
|
//批量配置
|
||||||
|
@ -188,7 +165,8 @@ dependencies {
|
||||||
implementation 'com.umeng.umsdk:common:2.0.2'
|
implementation 'com.umeng.umsdk:common:2.0.2'
|
||||||
implementation 'q.rorbin:VerticalTabLayout:1.2.5'
|
implementation 'q.rorbin:VerticalTabLayout:1.2.5'
|
||||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'
|
||||||
implementation(name: 'open_ad_sdk', ext: 'aar')
|
//穿山甲广告
|
||||||
// implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.6'
|
// implementation(name: 'open_ad_sdk', ext: 'aar')
|
||||||
implementation 'com.google.android.gms:play-services-ads:17.2.1'
|
implementation 'com.google.android.gms:play-services-ads:17.2.1'
|
||||||
|
// implementation 'com.yanzhenjie:permission:2.0.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
<uses-permission android:name="android.permission.INTERNET" /> <!-- <uses-permission android:name="android.permission.VIBRATE" /> -->
|
<uses-permission android:name="android.permission.INTERNET" /> <!-- <uses-permission android:name="android.permission.VIBRATE" /> -->
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
|
||||||
<!-- chanshanjia-->
|
<!-- chanshanjia-->
|
||||||
<uses-permission android:name="android.permission.GET_TASKS"/>
|
<uses-permission android:name="android.permission.GET_TASKS"/>
|
||||||
<!--<uses-permission android:name="android.permission.WAKE_LOCK" />-->
|
<!--<uses-permission android:name="android.permission.WAKE_LOCK" />-->
|
||||||
|
@ -161,8 +162,8 @@
|
||||||
|
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
-->
|
-->
|
||||||
<uses-library
|
<!-- <uses-library
|
||||||
android:name="org.apache.http.legacy"
|
android:name="org.apache.http.legacy"
|
||||||
android:required="false" />
|
android:required="false" />
|
||||||
|
|
||||||
|
@ -178,8 +179,9 @@
|
||||||
<provider
|
<provider
|
||||||
android:name="com.bytedance.sdk.openadsdk.multipro.TTMultiProvider"
|
android:name="com.bytedance.sdk.openadsdk.multipro.TTMultiProvider"
|
||||||
android:authorities="${applicationId}.TTMultiProvider"
|
android:authorities="${applicationId}.TTMultiProvider"
|
||||||
android:exported="false" />
|
android:exported="false" />-->
|
||||||
<!-- chuanshanjia ad end-->
|
<!-- chuanshanjia ad end-->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<provider
|
<provider
|
||||||
android:name="android.support.v4.content.FileProvider"
|
android:name="android.support.v4.content.FileProvider"
|
||||||
|
|
|
@ -23,9 +23,9 @@ import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.bytedance.sdk.openadsdk.AdSlot;
|
/*import com.bytedance.sdk.openadsdk.AdSlot;
|
||||||
import com.bytedance.sdk.openadsdk.TTAdNative;
|
import com.bytedance.sdk.openadsdk.TTAdNative;
|
||||||
import com.bytedance.sdk.openadsdk.TTSplashAd;
|
import com.bytedance.sdk.openadsdk.TTSplashAd;*/
|
||||||
import com.google.android.gms.ads.AdListener;
|
import com.google.android.gms.ads.AdListener;
|
||||||
import com.google.android.gms.ads.AdRequest;
|
import com.google.android.gms.ads.AdRequest;
|
||||||
import com.google.android.gms.ads.InterstitialAd;
|
import com.google.android.gms.ads.InterstitialAd;
|
||||||
|
@ -97,7 +97,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
|
|
||||||
|
|
||||||
//------toutiao--->
|
//------toutiao--->
|
||||||
private TTAdNative mTTAdNative;
|
//private TTAdNative mTTAdNative;
|
||||||
|
|
||||||
//是否强制跳转到主页面
|
//是否强制跳转到主页面
|
||||||
private boolean mForceGoMain;
|
private boolean mForceGoMain;
|
||||||
|
@ -123,6 +123,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
boolean isGoToMain= getIntent().getBooleanExtra(EXTR_LUNCHER,true);
|
boolean isGoToMain= getIntent().getBooleanExtra(EXTR_LUNCHER,true);
|
||||||
|
Log.d(TAG, String.format("onCreate: isGotoMain %s,showAd %s",isGoToMain,Constants.AD_SETTING.isShowAdsense()));
|
||||||
if(!Constants.AD_SETTING.isShowAdsense() ||isGoToMain && !Constants.AD_SETTING.getSplash().isShow() ){
|
if(!Constants.AD_SETTING.isShowAdsense() ||isGoToMain && !Constants.AD_SETTING.getSplash().isShow() ){
|
||||||
goToMainActivity();
|
goToMainActivity();
|
||||||
return;
|
return;
|
||||||
|
@ -133,8 +134,9 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
if (Constants.AD_SETTING.getSplash().getSource() == Constants.AD_TENCENT_QQ) {
|
if (Constants.AD_SETTING.getSplash().getSource() == Constants.AD_TENCENT_QQ) {
|
||||||
rid = R.layout.ad_qq_activity_splash;
|
rid = R.layout.ad_qq_activity_splash;
|
||||||
} else if (Constants.AD_SETTING.getSplash().getSource() == Constants.AD_TOUTIAO) {
|
} else if (Constants.AD_SETTING.getSplash().getSource() == Constants.AD_TOUTIAO) {
|
||||||
rid = R.layout.ad_toutiao_activity_splash;
|
/* rid = R.layout.ad_toutiao_activity_splash;
|
||||||
splashSource=Constants.AD_TOUTIAO;
|
splashSource=Constants.AD_TOUTIAO;*/
|
||||||
|
goToMainActivity();return;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
goToMainActivity();return;
|
goToMainActivity();return;
|
||||||
|
@ -176,7 +178,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
tvTitle.setText(R.string.app_name);
|
tvTitle.setText(R.string.app_name);
|
||||||
//加载开屏广告
|
//加载开屏广告
|
||||||
if(splashSource == Constants.AD_TOUTIAO ) {
|
if(splashSource == Constants.AD_TOUTIAO ) {
|
||||||
mHandler.sendEmptyMessageDelayed(MSG_GO_MAIN, AD_TIME_OUT);
|
/* mHandler.sendEmptyMessageDelayed(MSG_GO_MAIN, AD_TIME_OUT);
|
||||||
//step2:创建TTAdNative对象
|
//step2:创建TTAdNative对象
|
||||||
try {
|
try {
|
||||||
mTTAdNative = TTAdManagerHolder.get().createAdNative(this);
|
mTTAdNative = TTAdManagerHolder.get().createAdNative(this);
|
||||||
|
@ -184,7 +186,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
goToMainActivity();
|
goToMainActivity();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadSplashAd();
|
loadSplashAd();*/
|
||||||
}else if(splashSource == Constants.AD_TENCENT_QQ ){
|
}else if(splashSource == Constants.AD_TENCENT_QQ ){
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
checkAndRequestPermission();
|
checkAndRequestPermission();
|
||||||
|
@ -254,7 +256,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
/**
|
/**
|
||||||
* 加载开屏广告
|
* 加载开屏广告
|
||||||
*/
|
*/
|
||||||
private void loadSplashAd() {
|
/*private void loadSplashAd() {
|
||||||
//step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档
|
//step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档
|
||||||
AdSlot adSlot = new AdSlot.Builder()
|
AdSlot adSlot = new AdSlot.Builder()
|
||||||
.setCodeId(Constants.AD_SETTING.getSplash().getSlotId(Constants.AD_TOUTIAO) )
|
.setCodeId(Constants.AD_SETTING.getSplash().getSlotId(Constants.AD_TOUTIAO) )
|
||||||
|
@ -329,7 +331,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, AD_TIME_OUT);
|
}, AD_TIME_OUT);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
private void showToast(String msg) {
|
private void showToast(String msg) {
|
||||||
|
@ -382,7 +384,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
lackedPermission.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
lackedPermission.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||||
}
|
}
|
||||||
if (!(checkSelfPermission(Manifest.permission.REQUEST_INSTALL_PACKAGES) == PackageManager.PERMISSION_GRANTED)) {
|
if (!(checkSelfPermission(Manifest.permission.REQUEST_INSTALL_PACKAGES) == PackageManager.PERMISSION_GRANTED)) {
|
||||||
CommonUtil.checkPermission(this,Manifest.permission.REQUEST_INSTALL_PACKAGES,1024,"更新程序内容需此权限,请允许");
|
CommonUtil.checkPermission(this,Manifest.permission.REQUEST_INSTALL_PACKAGES,1024,"更新程序内容需此权限,请允许");
|
||||||
//lackedPermission.add(Manifest.permission.REQUEST_INSTALL_PACKAGES);
|
//lackedPermission.add(Manifest.permission.REQUEST_INSTALL_PACKAGES);
|
||||||
}
|
}
|
||||||
/*if (!(checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)) {
|
/*if (!(checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)) {
|
||||||
|
@ -405,7 +407,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
String[] requestPermissions = new String[lackedPermission.size()];
|
String[] requestPermissions = new String[lackedPermission.size()];
|
||||||
lackedPermission.toArray(requestPermissions);
|
lackedPermission.toArray(requestPermissions);
|
||||||
Log.d(TAG, String.format("checkAndRequestPermission: lacked permission size %s",requestPermissions.length));
|
Log.d(TAG, String.format("checkAndRequestPermission: lacked permission size %s",requestPermissions.length));
|
||||||
requestPermissions(requestPermissions, 1024);
|
// requestPermissions(requestPermissions, 1024);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +418,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
|
|
||||||
|
|
||||||
if (grantResult == PackageManager.PERMISSION_DENIED) {
|
if (grantResult == PackageManager.PERMISSION_DENIED) {
|
||||||
// return false;
|
// return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.novelbook.android.AD.toutiao;
|
package com.novelbook.android.AD.toutiao;
|
||||||
|
|
||||||
import android.content.Context;
|
/*import android.content.Context;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
@ -11,13 +11,28 @@ import com.bytedance.sdk.openadsdk.TTAdSdk;
|
||||||
import com.novelbook.android.BuildConfig;
|
import com.novelbook.android.BuildConfig;
|
||||||
import com.novelbook.android.utils.Constants;
|
import com.novelbook.android.utils.Constants;
|
||||||
|
|
||||||
import static com.novelbook.android.bean.AdSetting.getAppID;
|
import static com.novelbook.android.bean.AdSetting.getAppID;*/
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用
|
* 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用
|
||||||
*/
|
*/
|
||||||
public class TTAdManagerHolder {
|
public class TTAdManagerHolder {
|
||||||
|
//step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
|
||||||
|
private static void doInit(Context context) {
|
||||||
|
/* if (!sInit) {
|
||||||
|
TTAdSdk.init(context, buildConfig(context));
|
||||||
|
sInit = true;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
public static void init(Context context) {
|
||||||
|
/* if( Constants.AD_SETTING.isShowAdsense() &&
|
||||||
|
!TextUtils.isEmpty(getAppID(Constants.AD_TOUTIAO)) ) {
|
||||||
|
doInit(context);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
/*
|
||||||
private static boolean sInit;
|
private static boolean sInit;
|
||||||
|
|
||||||
public static TTAdManager get() {
|
public static TTAdManager get() {
|
||||||
|
@ -34,13 +49,7 @@ public class TTAdManagerHolder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
|
|
||||||
private static void doInit(Context context) {
|
|
||||||
if (!sInit) {
|
|
||||||
TTAdSdk.init(context, buildConfig(context));
|
|
||||||
sInit = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static TTAdConfig buildConfig(Context context) {
|
private static TTAdConfig buildConfig(Context context) {
|
||||||
|
|
||||||
|
@ -59,8 +68,8 @@ public class TTAdManagerHolder {
|
||||||
// .age(20) //TODO: 年龄收集
|
// .age(20) //TODO: 年龄收集
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
}
|
}*/
|
||||||
public static void initOnSexChange(Context context){
|
public static void initOnSexChange(Context context){
|
||||||
buildConfig(context);
|
// buildConfig(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,19 +4,30 @@ import android.Manifest;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
|
import android.location.LocationManager;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
|
import android.support.annotation.StringRes;
|
||||||
|
import android.support.v4.app.ActivityCompat;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -29,21 +40,20 @@ import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.androidquery.AQuery;
|
|
||||||
import com.androidquery.callback.AQuery2;
|
|
||||||
import com.androidquery.callback.ImageOptions;
|
import com.androidquery.callback.ImageOptions;
|
||||||
|
|
||||||
|
/*import com.androidquery.AQuery;
|
||||||
|
import com.androidquery.callback.AQuery2;
|
||||||
import com.bytedance.sdk.openadsdk.AdSlot;
|
import com.bytedance.sdk.openadsdk.AdSlot;
|
||||||
import com.bytedance.sdk.openadsdk.TTAdConstant;
|
import com.bytedance.sdk.openadsdk.TTAdConstant;
|
||||||
import com.bytedance.sdk.openadsdk.TTAdDislike;
|
import com.bytedance.sdk.openadsdk.TTAdDislike;
|
||||||
import com.bytedance.sdk.openadsdk.TTAdNative;
|
import com.bytedance.sdk.openadsdk.TTAdNative;
|
||||||
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
|
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
|
||||||
import com.bytedance.sdk.openadsdk.TTBannerAd;
|
import com.bytedance.sdk.openadsdk.TTBannerAd;
|
||||||
|
|
||||||
import com.bytedance.sdk.openadsdk.TTFeedAd;
|
import com.bytedance.sdk.openadsdk.TTFeedAd;
|
||||||
import com.bytedance.sdk.openadsdk.TTImage;
|
import com.bytedance.sdk.openadsdk.TTImage;
|
||||||
import com.bytedance.sdk.openadsdk.TTInteractionAd;
|
import com.bytedance.sdk.openadsdk.TTInteractionAd;
|
||||||
import com.bytedance.sdk.openadsdk.TTNativeAd;
|
import com.bytedance.sdk.openadsdk.TTNativeAd;*/
|
||||||
import com.google.android.gms.ads.AdListener;
|
import com.google.android.gms.ads.AdListener;
|
||||||
import com.google.android.gms.ads.AdRequest;
|
import com.google.android.gms.ads.AdRequest;
|
||||||
import com.google.android.gms.ads.AdSize;
|
import com.google.android.gms.ads.AdSize;
|
||||||
|
@ -57,6 +67,7 @@ import com.novelbook.android.db.Novel;
|
||||||
|
|
||||||
import com.novelbook.android.netutils.NetUtil;
|
import com.novelbook.android.netutils.NetUtil;
|
||||||
|
|
||||||
|
//import com.novelbook.android.permision.RuntimeRationale;
|
||||||
import com.novelbook.android.upgrade.UpdateManager;
|
import com.novelbook.android.upgrade.UpdateManager;
|
||||||
import com.novelbook.android.utils.CommonUtil;
|
import com.novelbook.android.utils.CommonUtil;
|
||||||
|
|
||||||
|
@ -89,19 +100,25 @@ import com.qq.e.ads.nativ.NativeUnifiedADData;
|
||||||
import com.qq.e.comm.constants.AdPatternType;
|
import com.qq.e.comm.constants.AdPatternType;
|
||||||
import com.qq.e.comm.pi.AdData;
|
import com.qq.e.comm.pi.AdData;
|
||||||
import com.qq.e.comm.util.AdError;
|
import com.qq.e.comm.util.AdError;
|
||||||
|
/*import com.yanzhenjie.permission.Action;
|
||||||
|
import com.yanzhenjie.permission.AndPermission;
|
||||||
|
import com.yanzhenjie.permission.runtime.Permission;*/
|
||||||
|
|
||||||
|
import org.litepal.BuildConfig;
|
||||||
import org.litepal.util.Const;
|
import org.litepal.util.Const;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
|
||||||
|
import static com.novelbook.android.FileActivity.EXTERNAL_STORAGE_REQ_CODE;
|
||||||
|
import static com.novelbook.android.bean.AdSetting.getAppID;
|
||||||
import static com.novelbook.android.utils.Constants.AD_MOB;
|
import static com.novelbook.android.utils.Constants.AD_MOB;
|
||||||
import static com.novelbook.android.utils.Constants.AD_TENCENT_QQ;
|
import static com.novelbook.android.utils.Constants.AD_TENCENT_QQ;
|
||||||
import static com.novelbook.android.utils.Constants.AD_TOUTIAO;
|
import static com.novelbook.android.utils.Constants.AD_TOUTIAO;
|
||||||
|
|
||||||
public abstract class Activity_base extends AppCompatActivity implements NativeExpressAD.NativeExpressADListener,UnifiedBannerADListener {
|
public abstract class Activity_base extends AppCompatActivity implements NativeExpressAD.NativeExpressADListener,UnifiedBannerADListener {
|
||||||
|
private final int REQUEST_CODE_SETTING=1;
|
||||||
private static final int MSG_AD_LOAD =10 ;
|
private static final int MSG_AD_LOAD =10 ;
|
||||||
private static String TAG ="Activity_base";
|
private static String TAG ="Activity_base";
|
||||||
private ProgressDialog mProgressDialog;
|
private ProgressDialog mProgressDialog;
|
||||||
|
@ -112,6 +129,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
//---qq ad---->
|
//---qq ad---->
|
||||||
private NativeExpressAD nativeExpressAD;
|
private NativeExpressAD nativeExpressAD;
|
||||||
private NativeExpressADView nativeExpressADView;
|
private NativeExpressADView nativeExpressADView;
|
||||||
|
private QqNadListiner qqNadListiner;
|
||||||
//---qq ad end----
|
//---qq ad end----
|
||||||
@Nullable
|
@Nullable
|
||||||
@BindView(R.id.toolbar)
|
@BindView(R.id.toolbar)
|
||||||
|
@ -153,41 +171,17 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
setupToolbar();
|
setupToolbar();
|
||||||
// 初始化View注入
|
// 初始化View注入
|
||||||
this.mAQuery = new AQuery2(this);
|
// this.mAQuery = new AQuery2(this);
|
||||||
initializeAd();//initAD_TouTiao();
|
initializeAd();//initAD_TouTiao();
|
||||||
setTitle();
|
setTitle();
|
||||||
initData();
|
initData();
|
||||||
initViews();
|
initViews();
|
||||||
initNaviBanner();
|
initNaviBanner();
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
checkAndRequestPermission();
|
checkAndRequestPermission();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@TargetApi(Build.VERSION_CODES.M)
|
|
||||||
private void checkAndRequestPermission() {
|
|
||||||
List<String> lackedPermission = new ArrayList<String>();
|
|
||||||
if (!(checkSelfPermission(Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED)) {
|
|
||||||
lackedPermission.add(Manifest.permission.READ_PHONE_STATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)) {
|
|
||||||
lackedPermission.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)) {
|
|
||||||
lackedPermission.add(Manifest.permission.ACCESS_FINE_LOCATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 请求所缺少的权限,在onRequestPermissionsResult中再看是否获得权限,如果获得权限就可以调用SDK,否则不要调用SDK。
|
|
||||||
String[] requestPermissions = new String[lackedPermission.size()];
|
|
||||||
if(requestPermissions.length>0) {
|
|
||||||
lackedPermission.toArray(requestPermissions);
|
|
||||||
requestPermissions(requestPermissions, 1024);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
void initNaviBanner(){
|
void initNaviBanner(){
|
||||||
if(mBannerContainer==null){
|
if(mBannerContainer==null){
|
||||||
return;
|
return;
|
||||||
|
@ -382,7 +376,162 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
* @param errorText
|
* @param errorText
|
||||||
*/
|
*/
|
||||||
protected void checkPermission (Activity thisActivity, String permission, int requestCode, String errorText) {
|
protected void checkPermission (Activity thisActivity, String permission, int requestCode, String errorText) {
|
||||||
CommonUtil.checkPermission(thisActivity,permission,requestCode,errorText);
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
CommonUtil.checkPermission(thisActivity,permission,requestCode,errorText);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@TargetApi(Build.VERSION_CODES.M)
|
||||||
|
public void checkAndRequestPermission() {
|
||||||
|
List<String> lackedPermission = new ArrayList<String>();
|
||||||
|
if (!(checkSelfPermission(Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED)) {
|
||||||
|
lackedPermission.add(Manifest.permission.READ_PHONE_STATE);
|
||||||
|
// CommonUtil.checkPermission(this,Manifest.permission.READ_PHONE_STATE,1024,"识别用户身份需要此权限,请允许");
|
||||||
|
// return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)) {
|
||||||
|
lackedPermission.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||||
|
// CommonUtil.checkPermission(this,Manifest.permission.WRITE_EXTERNAL_STORAGE,1024,"缓存小说内容需此权限,请允许");
|
||||||
|
// return;
|
||||||
|
}
|
||||||
|
if(com.novelbook.android.BuildConfig.LOG_DEBUG || Constants.AD_SETTING.isShowAdsense() && Constants.AD_SETTING.getSplash().getSource() == AD_TENCENT_QQ)
|
||||||
|
if (!(checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)) {
|
||||||
|
|
||||||
|
lackedPermission.add(Manifest.permission.ACCESS_FINE_LOCATION);
|
||||||
|
// CommonUtil.checkPermission(this,Manifest.permission.ACCESS_FINE_LOCATION,1024,"精确推送小说内容需此权限,请允许");
|
||||||
|
|
||||||
|
Log.e(TAG, "checkAndRequestPermission: ACCESS_FINE_LOCATION result " + checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) );
|
||||||
|
// return;
|
||||||
|
}
|
||||||
|
if(com.novelbook.android.BuildConfig. LOG_DEBUG || Constants.AD_SETTING.isShowAdsense() && Constants.AD_SETTING.getSplash().getSource() == AD_TENCENT_QQ)
|
||||||
|
if (!(checkSelfPermission(Manifest.permission.REQUEST_INSTALL_PACKAGES) == PackageManager.PERMISSION_GRANTED)) {
|
||||||
|
// CommonUtil.checkPermission(this,Manifest.permission.REQUEST_INSTALL_PACKAGES,1024,"更新程序内容需此权限,请允许");
|
||||||
|
lackedPermission.add(Manifest.permission.REQUEST_INSTALL_PACKAGES);
|
||||||
|
// return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 请求所缺少的权限,在onRequestPermissionsResult中再看是否获得权限,如果获得权限就可以调用SDK,否则不要调用SDK。
|
||||||
|
String[] requestPermissions = new String[lackedPermission.size()];
|
||||||
|
if(requestPermissions.length>0) {
|
||||||
|
lackedPermission.toArray(requestPermissions);
|
||||||
|
requestPermissions(requestPermissions, 1024);
|
||||||
|
String p = "";
|
||||||
|
for(String s: requestPermissions) {
|
||||||
|
|
||||||
|
p+="," +s;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(requestPermissions.length>0){
|
||||||
|
p =p.substring(1);
|
||||||
|
Log.e(TAG, "checkAndRequestPermission: 缺少权限 " + p);
|
||||||
|
//requestPermission(this,p);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private boolean hasAllPermissionsGranted(int[] grantResults) {
|
||||||
|
for (int grantResult : grantResults) {
|
||||||
|
|
||||||
|
Log.e(TAG, "checkAndRequestPermission: grant result "+grantResult );
|
||||||
|
|
||||||
|
|
||||||
|
if (grantResult == PackageManager.PERMISSION_DENIED) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
if (requestCode == 1024 && hasAllPermissionsGranted(grantResults)) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, String.format("checkAndRequestPermission: permision result requestCode %s,",requestCode ));
|
||||||
|
// 如果用户没有授权,那么应该说明意图,引导用户去设置里面授权。
|
||||||
|
Toast.makeText(this, "应用缺少必要的权限!请点击\"权限\",打开所需要的权限。", Toast.LENGTH_LONG).show();
|
||||||
|
// Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||||
|
// intent.setData(Uri.parse("package:" + getPackageName()));
|
||||||
|
// startActivity(intent);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request permissions.
|
||||||
|
*/
|
||||||
|
/* private void requestPermission(Context activity, String... permissions) {
|
||||||
|
AndPermission.with(activity)
|
||||||
|
.runtime()
|
||||||
|
.permission(permissions)
|
||||||
|
.rationale(new RuntimeRationale())
|
||||||
|
.onGranted(new Action<List<String>>() {
|
||||||
|
@Override
|
||||||
|
public void onAction(List<String> permissions) {
|
||||||
|
toast(R.string.permision_successfully);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.onDenied(new Action<List<String>>() {
|
||||||
|
@Override
|
||||||
|
public void onAction(@NonNull List<String> permissions) {
|
||||||
|
toast(R.string.permision_failure);
|
||||||
|
if (AndPermission.hasAlwaysDeniedPermission( activity, permissions)) {
|
||||||
|
showSettingDialog(activity, permissions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
*//**
|
||||||
|
* Display setting dialog.
|
||||||
|
*//*
|
||||||
|
public void showSettingDialog(Context context, final List<String> permissions) {
|
||||||
|
List<String> permissionNames = Permission.transformText(context, permissions);
|
||||||
|
String message = context.getString(R.string.message_permission_always_failed,
|
||||||
|
TextUtils.join("\n", permissionNames));
|
||||||
|
|
||||||
|
new AlertDialog.Builder(context).setCancelable(false)
|
||||||
|
.setTitle(R.string.title_dialog)
|
||||||
|
.setMessage(message)
|
||||||
|
.setPositiveButton(R.string.setting, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
setPermission();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
*//**
|
||||||
|
* Set permissions.
|
||||||
|
*//*
|
||||||
|
private void setPermission() {
|
||||||
|
AndPermission.with(this).runtime().setting().start(REQUEST_CODE_SETTING);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
protected void toast(@StringRes int message) {
|
||||||
|
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
|
switch (requestCode) {
|
||||||
|
case REQUEST_CODE_SETTING: {
|
||||||
|
Toast.makeText( this, R.string.message_setting_comeback, Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void loadImageView(String url, ImageView imageView){
|
protected void loadImageView(String url, ImageView imageView){
|
||||||
|
@ -440,7 +589,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
if(Constants.AD_SETTING.getChapterContentBanner().getSource() == AD_TENCENT_QQ) {
|
if(Constants.AD_SETTING.getChapterContentBanner().getSource() == AD_TENCENT_QQ) {
|
||||||
loadNativeBanner_qq(-1, 388);
|
loadNativeBanner_qq(-1, 388);
|
||||||
}else if(Constants.AD_SETTING.getChapterContentBanner().getSource() == AD_TOUTIAO) {
|
}else if(Constants.AD_SETTING.getChapterContentBanner().getSource() == AD_TOUTIAO) {
|
||||||
loadNativeBanner_toutiao(mBannerContainer ,690,388);
|
// loadNativeBanner_toutiao(mBannerContainer ,690,388);
|
||||||
}else if(Constants.AD_SETTING.getChapterContentBanner().getSource() == AD_MOB) {
|
}else if(Constants.AD_SETTING.getChapterContentBanner().getSource() == AD_MOB) {
|
||||||
loadBanner_Mob(mBannerContainer, 699,388);
|
loadBanner_Mob(mBannerContainer, 699,388);
|
||||||
}
|
}
|
||||||
|
@ -463,7 +612,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
if(Constants.AD_SETTING.getChapterBanner().getSource()== AD_TENCENT_QQ) {
|
if(Constants.AD_SETTING.getChapterBanner().getSource()== AD_TENCENT_QQ) {
|
||||||
getBanner_qq();
|
getBanner_qq();
|
||||||
}else if(Constants.AD_SETTING.getChapterBanner().getSource()== AD_TOUTIAO) {
|
}else if(Constants.AD_SETTING.getChapterBanner().getSource()== AD_TOUTIAO) {
|
||||||
loadBanner_toutiao(mBannerContainer, width,height);
|
// loadBanner_toutiao(mBannerContainer, width,height);
|
||||||
|
|
||||||
}else if(Constants.AD_SETTING.getChapterBanner().getSource()== AD_MOB){
|
}else if(Constants.AD_SETTING.getChapterBanner().getSource()== AD_MOB){
|
||||||
loadBanner_Mob(mBannerContainer, width,height);
|
loadBanner_Mob(mBannerContainer, width,height);
|
||||||
|
@ -473,13 +622,14 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
|
|
||||||
void initializeAd(){
|
void initializeAd(){
|
||||||
if(Constants.AD_SETTING.isShowAdsense()) {
|
if(Constants.AD_SETTING.isShowAdsense()) {
|
||||||
initAD_TouTiao();
|
// initAD_TouTiao();
|
||||||
|
qqNadListiner = new QqNadListiner() ;
|
||||||
// initialMobileAd();
|
// initialMobileAd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------ 头条 ad -----
|
//------ 头条 ad -----
|
||||||
AQuery2 mAQuery;
|
/*AQuery2 mAQuery;
|
||||||
Button mCreativeButton;
|
Button mCreativeButton;
|
||||||
TTAdNative mTTAdNative;
|
TTAdNative mTTAdNative;
|
||||||
void initAD_TouTiao(){
|
void initAD_TouTiao(){
|
||||||
|
@ -503,10 +653,11 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
}
|
}
|
||||||
return mTTAdNative;
|
return mTTAdNative;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
//----toutiao ad ----
|
//----toutiao ad ----
|
||||||
// boolean mShowAd =false;
|
// boolean mShowAd =false;
|
||||||
|
@ -514,7 +665,8 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
//step4:创建广告请求参数AdSlot,具体参数含义参考文档
|
//step4:创建广告请求参数AdSlot,具体参数含义参考文档
|
||||||
if(!Constants.AD_SETTING.isShowAdsense() || getTTAdNative()==null ){return;}
|
if(!Constants.AD_SETTING.isShowAdsense() || getTTAdNative()==null ){return;}
|
||||||
String codeId = Constants.AD_SETTING.getChapterBanner().getSlotId(Constants.AD_TOUTIAO) ;
|
String codeId = Constants.AD_SETTING.getChapterBanner().getSlotId(Constants.AD_TOUTIAO) ;
|
||||||
/* if(height >390){
|
*/
|
||||||
|
/* if(height >390){
|
||||||
width =(int)(height*1.78);
|
width =(int)(height*1.78);
|
||||||
if(width > Constants.SCREEN_WIDTH_PIX-50 ){
|
if(width > Constants.SCREEN_WIDTH_PIX-50 ){
|
||||||
width= Constants.SCREEN_WIDTH_PIX-50;
|
width= Constants.SCREEN_WIDTH_PIX-50;
|
||||||
|
@ -522,7 +674,8 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
}
|
}
|
||||||
}else if(height >150){
|
}else if(height >150){
|
||||||
width =(int)(height*1.78);
|
width =(int)(height*1.78);
|
||||||
}*/
|
}*//*
|
||||||
|
|
||||||
// width =690;
|
// width =690;
|
||||||
//height=150;
|
//height=150;
|
||||||
// height=height > 500 ? 500: height;
|
// height=height > 500 ? 500: height;
|
||||||
|
@ -589,26 +742,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//获取网盟dislike dialog,您可以在您应用中本身自定义的dislike icon 按钮中设置 mTTAdDislike.showDislikeDialog();
|
|
||||||
/*mTTAdDislike = ad.getDislikeDialog(new TTAdDislike.DislikeInteractionCallback() {
|
|
||||||
@Override
|
|
||||||
public void onSelected(int position, String value) {
|
|
||||||
TToast.show(mContext, "点击 " + value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCancel() {
|
|
||||||
TToast.show(mContext, "点击取消 ");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (mTTAdDislike != null) {
|
|
||||||
XXX.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
mTTAdDislike.showDislikeDialog();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -728,14 +862,17 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
toutiaoNati_Banner_AdCache.containsKey(key)?toutiaoNati_Banner_AdCache.get(key).size() :0
|
toutiaoNati_Banner_AdCache.containsKey(key)?toutiaoNati_Banner_AdCache.get(key).size() :0
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
/* if (!toutiaoNati_Banner_AdCache.containsKey(key)){
|
*/
|
||||||
|
/* if (!toutiaoNati_Banner_AdCache.containsKey(key)){
|
||||||
loadNativeBannerAd(bannerContainer, codeId, width, height);
|
loadNativeBannerAd(bannerContainer, codeId, width, height);
|
||||||
Log.d(TAG, String.format("loadNativeBannerAd: load again ... containsKey(key) ? %s,ads size %s",toutiaoNati_Banner_AdCache.containsKey(key),
|
Log.d(TAG, String.format("loadNativeBannerAd: load again ... containsKey(key) ? %s,ads size %s",toutiaoNati_Banner_AdCache.containsKey(key),
|
||||||
toutiaoNati_Banner_AdCache.containsKey(key)?toutiaoNati_Banner_AdCache.get(key).size() :0
|
toutiaoNati_Banner_AdCache.containsKey(key)?toutiaoNati_Banner_AdCache.get(key).size() :0
|
||||||
));
|
));
|
||||||
}*/
|
}*//*
|
||||||
|
|
||||||
/* if (ads.get(0) == null || !mShowAd) {
|
|
||||||
|
*/
|
||||||
|
/* if (ads.get(0) == null || !mShowAd) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
View bannerView = LayoutInflater.from(oContext).inflate(R.layout.ad_toutiao_native_ad, bannerContainer, false);
|
View bannerView = LayoutInflater.from(oContext).inflate(R.layout.ad_toutiao_native_ad, bannerContainer, false);
|
||||||
|
@ -753,7 +890,8 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
bannerContainer.setBackgroundResource(R.color.mintcream); // @color/mintcream
|
bannerContainer.setBackgroundResource(R.color.mintcream); // @color/mintcream
|
||||||
Log.d(TAG, "loadBannerAd: set banner VISIBLE,mShowAd " + mShowAd);
|
Log.d(TAG, "loadBannerAd: set banner VISIBLE,mShowAd " + mShowAd);
|
||||||
//绑定原生广告的数据
|
//绑定原生广告的数据
|
||||||
setAdData(bannerContainer, bannerView, ads.get(0));*/
|
setAdData(bannerContainer, bannerView, ads.get(0));*//*
|
||||||
|
|
||||||
// mTTAdNative.loadNativeAd(adSlot,null);
|
// mTTAdNative.loadNativeAd(adSlot,null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1047,10 +1185,12 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
*/
|
||||||
|
/**
|
||||||
* 加载 toutiao feed广告
|
* 加载 toutiao feed广告
|
||||||
*/
|
*//*
|
||||||
public void loadListAd_toutiao(BookListAdapter adapter, int adCnt, boolean addFooter) {
|
|
||||||
|
private void loadListAd_toutiao(BookListAdapter adapter, int adCnt, boolean addFooter) {
|
||||||
//feed广告请求类型参数
|
//feed广告请求类型参数
|
||||||
AdSlot adSlot = new AdSlot.Builder()
|
AdSlot adSlot = new AdSlot.Builder()
|
||||||
.setCodeId( Constants.AD_SETTING.getInformationFlow().getSlotId(Constants.AD_TOUTIAO) )
|
.setCodeId( Constants.AD_SETTING.getInformationFlow().getSlotId(Constants.AD_TOUTIAO) )
|
||||||
|
@ -1083,6 +1223,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
// qq ad ------------------------------begin
|
// qq ad ------------------------------begin
|
||||||
|
@ -1496,6 +1637,113 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// qq ad ------------------------------begin
|
||||||
|
|
||||||
|
private boolean qqAddFooter;
|
||||||
|
private BookListAdapter qqAdapter;
|
||||||
|
private NativeExpressAD mADManager;
|
||||||
|
void loadListAd_qq(BookListAdapter adapter, int adCnt, boolean addFooter) {
|
||||||
|
ADSize adSize = new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT); // 消息流中用AUTO_HEIGHT
|
||||||
|
mADManager = new NativeExpressAD(this, adSize, getAppID(Constants.AD_TENCENT_QQ) ,
|
||||||
|
Constants.AD_SETTING.getInformationFlow().getSlotId(Constants.AD_TENCENT_QQ) , qqNadListiner);
|
||||||
|
mADManager.setMaxVideoDuration(5);
|
||||||
|
mADManager.loadAD(adCnt);
|
||||||
|
qqAdapter =adapter;
|
||||||
|
qqAddFooter=addFooter;
|
||||||
|
Log.d(TAG, "loadListAd_qq: ad requested");
|
||||||
|
}
|
||||||
|
|
||||||
|
class QqNadListiner implements NativeExpressAD.NativeExpressADListener{
|
||||||
|
@Override
|
||||||
|
public void onADCloseOverlay(NativeExpressADView adView) {
|
||||||
|
Log.i(TAG, "onADCloseOverlay");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADLoaded(List<NativeExpressADView> adList) {
|
||||||
|
Log.i(TAG, "onADLoaded: " + adList.size());
|
||||||
|
|
||||||
|
if(qqAdapter==null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(qqAddFooter) {
|
||||||
|
qqAdapter.AddFooterItem(adList);
|
||||||
|
}else{
|
||||||
|
qqAdapter.AddHeaderItem(adList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onRenderFail(NativeExpressADView adView) {
|
||||||
|
Log.i(TAG, "onRenderFail: " + adView.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRenderSuccess(NativeExpressADView adView) {
|
||||||
|
// Log.i(TAG, "onRenderSuccess: " + adView.toString() + ", adInfo: " + getAdInfo(adView));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADExposure(NativeExpressADView adView) {
|
||||||
|
Log.i(TAG, "onADExposure: " + adView.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADClicked(NativeExpressADView adView) {
|
||||||
|
Log.i(TAG, "onADClicked: " + adView.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADClosed(NativeExpressADView adView) {
|
||||||
|
Log.i(TAG, "onADClosed: " + adView.toString());
|
||||||
|
/* if (mAdapter != null) {
|
||||||
|
int removedPosition = mAdViewPositionMap.get(adView);
|
||||||
|
mAdapter.removeADView(removedPosition, adView);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADLeftApplication(NativeExpressADView adView) {
|
||||||
|
Log.i(TAG, "onADLeftApplication: " + adView.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADOpenOverlay(NativeExpressADView adView) {
|
||||||
|
Log.i(TAG, "onADOpenOverlay: " + adView.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNoAD(AdError adError) {
|
||||||
|
Log.d(TAG, "loadListAd_qq: ad onNoAD " );
|
||||||
|
Log.i(
|
||||||
|
TAG,
|
||||||
|
String.format("onNoAD, error code: %d, error msg: %s", adError.getErrorCode(),
|
||||||
|
adError.getErrorMsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//qq ad end<-------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载 toutiao feed广告
|
||||||
|
*/
|
||||||
|
public void loadListAd( BookListAdapter adapter, int adCnt, boolean addFooter) {
|
||||||
|
if(!Constants.AD_SETTING.isShowAdsense() || !Constants.AD_SETTING.getInformationFlow().isShow()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(Constants.AD_SETTING.getInformationFlow().getSource()==Constants.AD_TENCENT_QQ) {
|
||||||
|
loadListAd_qq(adapter, adCnt, addFooter);
|
||||||
|
}else if(Constants.AD_SETTING.getInformationFlow().getSource()==Constants.AD_TOUTIAO){
|
||||||
|
// loadListAd_toutiao(adapter, adCnt, addFooter);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
|
@ -203,10 +203,8 @@ public class BookActivity extends Activity_base {
|
||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
|
|
||||||
|
checkPermission(BookActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE, EXTERNAL_STORAGE_REQ_CODE, "添加图书需要此权限,请允许");
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
checkPermission(BookActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE, EXTERNAL_STORAGE_REQ_CODE, "添加图书需要此权限,请允许");
|
|
||||||
}
|
|
||||||
pageFactory = PageFactory.getInstance(getApplicationContext());
|
pageFactory = PageFactory.getInstance(getApplicationContext());
|
||||||
// pageFactory.clear();
|
// pageFactory.clear();
|
||||||
setBookInfo();//set title ,data from novel list
|
setBookInfo();//set title ,data from novel list
|
||||||
|
@ -252,7 +250,7 @@ public class BookActivity extends Activity_base {
|
||||||
rvBooklistAuthor.setLayoutManager(new LinearLayoutManager(this));
|
rvBooklistAuthor.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
|
||||||
rvBooklistAuthor.setAdapter(mAdapterAuthor);
|
rvBooklistAuthor.setAdapter(mAdapterAuthor);
|
||||||
loadListAd_toutiao(mAdapterAuthor, 1 ,false);
|
loadListAd(mAdapterAuthor, 1 ,false);
|
||||||
|
|
||||||
}
|
}
|
||||||
private void setNovelsRelated(){
|
private void setNovelsRelated(){
|
||||||
|
@ -271,7 +269,7 @@ public class BookActivity extends Activity_base {
|
||||||
rvBooklistRelated.setLayoutManager(new LinearLayoutManager(this));
|
rvBooklistRelated.setLayoutManager(new LinearLayoutManager(this));
|
||||||
rvBooklistRelated.setAdapter(mAdapterRelated);
|
rvBooklistRelated.setAdapter(mAdapterRelated);
|
||||||
|
|
||||||
loadListAd_toutiao(mAdapterRelated, 1 ,false);
|
loadListAd (mAdapterRelated, 1 ,false);
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,19 +31,9 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
|
||||||
import com.bytedance.sdk.openadsdk.AdSlot;
|
|
||||||
import com.bytedance.sdk.openadsdk.TTAdDislike;
|
|
||||||
import com.bytedance.sdk.openadsdk.TTAdNative;
|
|
||||||
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
|
|
||||||
import com.bytedance.sdk.openadsdk.TTBannerAd;
|
|
||||||
import com.bytedance.sdk.openadsdk.TTFeedAd;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import com.novelbook.android.AD.toutiao.TToast;
|
|
||||||
import com.novelbook.android.Activity_base;
|
import com.novelbook.android.Activity_base;
|
||||||
|
|
||||||
import com.novelbook.android.Activity_paihangbang;
|
import com.novelbook.android.Activity_paihangbang;
|
||||||
|
@ -95,7 +85,7 @@ import static com.novelbook.android.bean.AdSetting.getAppID;
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
*/
|
*/
|
||||||
public abstract class BasicFragment extends Fragment implements /* NativeADUnifiedListener,*/NativeExpressAD.NativeExpressADListener {
|
public abstract class BasicFragment extends Fragment /*implements NativeADUnifiedListener,NativeExpressAD.NativeExpressADListener*/ {
|
||||||
|
|
||||||
private static String TAG = BasicFragment.class.getSimpleName();
|
private static String TAG = BasicFragment.class.getSimpleName();
|
||||||
protected View rootView;
|
protected View rootView;
|
||||||
|
@ -163,7 +153,7 @@ public abstract class BasicFragment extends Fragment implements /* NativeADUnif
|
||||||
initData();
|
initData();
|
||||||
initViews();
|
initViews();
|
||||||
initSwipeRefreshLayout();
|
initSwipeRefreshLayout();
|
||||||
if (mBannerContainer!=null && !Constants.AD_SETTING.isShowAdsense()) {
|
if (mBannerContainer!=null && (!Constants.AD_SETTING.isShowAdsense() || !Constants.AD_SETTING.getFixBanner().isShow() )) {
|
||||||
if( mBannerContainer.getVisibility() !=View.GONE) {
|
if( mBannerContainer.getVisibility() !=View.GONE) {
|
||||||
mBannerContainer.setVisibility(View.GONE);
|
mBannerContainer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -480,147 +470,8 @@ void initTabs(){
|
||||||
if( mBannerContainer.getVisibility() !=View.VISIBLE)
|
if( mBannerContainer.getVisibility() !=View.VISIBLE)
|
||||||
mBannerContainer.setVisibility(View.VISIBLE);
|
mBannerContainer.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
void loadListAd( BookListAdapter adapter, int adCnt, boolean addFooter) {
|
||||||
// qq ad ------------------------------begin
|
activity.loadListAd(adapter,adCnt,addFooter);
|
||||||
/* private NativeUnifiedAD mAdManager;
|
|
||||||
private List<NativeUnifiedADData> mAds = new ArrayList<>();
|
|
||||||
public void loadListAd_qq(BookListAdapter adapter, int adCnt, boolean addFooter) {
|
|
||||||
if(mAdManager==null) {
|
|
||||||
mAdManager = new NativeUnifiedAD(activity,
|
|
||||||
getAppID(Constants.AD_TENCENT_QQ),
|
|
||||||
Constants.AD_SETTING.getInformationFlow().getSlotId(Constants.AD_TENCENT_QQ),
|
|
||||||
this);
|
|
||||||
}
|
|
||||||
mAdManager.loadData(adCnt);
|
|
||||||
qqAdapter =adapter;
|
|
||||||
qqAddFooter=addFooter;
|
|
||||||
Log.d(TAG, "loadListAd_qq: ad requested");
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
private boolean qqAddFooter;
|
|
||||||
private BookListAdapter qqAdapter;
|
|
||||||
/* @Override
|
|
||||||
public void onADLoaded(List<NativeUnifiedADData> ads) {
|
|
||||||
Log.d(TAG, "loadListAd_qq: ad onADLoaded,qqAddFooter? "+qqAddFooter);
|
|
||||||
// mIsLoading = false;
|
|
||||||
// 防止在onDestory后网络回包
|
|
||||||
if(qqAdapter==null){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(qqAddFooter) {
|
|
||||||
qqAdapter.AddFooterItem(ads);
|
|
||||||
}else{
|
|
||||||
qqAdapter.AddHeaderItem(ads);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
@Override
|
|
||||||
public void onNoAD(AdError adError) {
|
|
||||||
Log.d(TAG, "loadListAd_qq: ad onNoAD " );
|
|
||||||
Log.i(
|
|
||||||
TAG,
|
|
||||||
String.format("onNoAD, error code: %d, error msg: %s", adError.getErrorCode(),
|
|
||||||
adError.getErrorMsg()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private NativeExpressAD mADManager;
|
|
||||||
void loadListAd_qq(BookListAdapter adapter, int adCnt, boolean addFooter) {
|
|
||||||
ADSize adSize = new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT); // 消息流中用AUTO_HEIGHT
|
|
||||||
mADManager = new NativeExpressAD(activity, adSize, getAppID(Constants.AD_TENCENT_QQ) ,
|
|
||||||
Constants.AD_SETTING.getInformationFlow().getSlotId(Constants.AD_TENCENT_QQ) , this);
|
|
||||||
mADManager.setMaxVideoDuration(5);
|
|
||||||
mADManager.loadAD(adCnt);
|
|
||||||
qqAdapter =adapter;
|
|
||||||
qqAddFooter=addFooter;
|
|
||||||
Log.d(TAG, "loadListAd_qq: ad requested");
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onADLoaded(List<NativeExpressADView> adList) {
|
|
||||||
Log.i(TAG, "onADLoaded: " + adList.size());
|
|
||||||
/* mAdViewList = adList;
|
|
||||||
for (int i = 0; i < mAdViewList.size(); i++) {
|
|
||||||
int position = FIRST_AD_POSITION + ITEMS_PER_AD * i;
|
|
||||||
if (position < mNormalDataList.size()) {
|
|
||||||
NativeExpressADView view = mAdViewList.get(i);
|
|
||||||
GDTLogger.i("ad load[" + i + "]: " + getAdInfo(view));
|
|
||||||
if (view.getBoundData().getAdPatternType() == AdPatternType.NATIVE_VIDEO) {
|
|
||||||
view.setMediaListener(mediaListener);
|
|
||||||
}
|
|
||||||
mAdViewPositionMap.put(view, position); // 把每个广告在列表中位置记录下来
|
|
||||||
mAdapter.addADViewToPosition(position, mAdViewList.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mAdapter.notifyDataSetChanged();*/
|
|
||||||
if(qqAdapter==null){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(qqAddFooter) {
|
|
||||||
qqAdapter.AddFooterItem(adList);
|
|
||||||
}else{
|
|
||||||
qqAdapter.AddHeaderItem(adList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onRenderFail(NativeExpressADView adView) {
|
|
||||||
Log.i(TAG, "onRenderFail: " + adView.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRenderSuccess(NativeExpressADView adView) {
|
|
||||||
// Log.i(TAG, "onRenderSuccess: " + adView.toString() + ", adInfo: " + getAdInfo(adView));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onADExposure(NativeExpressADView adView) {
|
|
||||||
Log.i(TAG, "onADExposure: " + adView.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onADClicked(NativeExpressADView adView) {
|
|
||||||
Log.i(TAG, "onADClicked: " + adView.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onADClosed(NativeExpressADView adView) {
|
|
||||||
Log.i(TAG, "onADClosed: " + adView.toString());
|
|
||||||
/* if (mAdapter != null) {
|
|
||||||
int removedPosition = mAdViewPositionMap.get(adView);
|
|
||||||
mAdapter.removeADView(removedPosition, adView);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onADLeftApplication(NativeExpressADView adView) {
|
|
||||||
Log.i(TAG, "onADLeftApplication: " + adView.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onADOpenOverlay(NativeExpressADView adView) {
|
|
||||||
Log.i(TAG, "onADOpenOverlay: " + adView.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onADCloseOverlay(NativeExpressADView adView) {
|
|
||||||
Log.i(TAG, "onADCloseOverlay");
|
|
||||||
}
|
|
||||||
|
|
||||||
//qq ad end<-------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载 toutiao feed广告
|
|
||||||
*/
|
|
||||||
void loadListAd( BookListAdapter adapter, int adCnt, boolean addFooter) {
|
|
||||||
if(!Constants.AD_SETTING.isShowAdsense()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(Constants.AD_SETTING.getInformationFlow().getSource()==Constants.AD_TENCENT_QQ) {
|
|
||||||
loadListAd_qq(adapter, adCnt, addFooter);
|
|
||||||
}else if(Constants.AD_SETTING.getInformationFlow().getSource()==Constants.AD_TOUTIAO){
|
|
||||||
activity.loadListAd_toutiao(adapter, adCnt, addFooter);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.support.v7.widget.GridLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -25,9 +26,9 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.androidquery.callback.AQuery2;
|
/*import com.androidquery.callback.AQuery2;
|
||||||
import com.novelbook.android.AD.toutiao.TTAdManagerHolder;
|
import com.novelbook.android.AD.toutiao.TTAdManagerHolder;
|
||||||
import com.novelbook.android.BuildConfig;
|
import com.novelbook.android.BuildConfig;*/
|
||||||
import com.novelbook.android.Main2Activity;
|
import com.novelbook.android.Main2Activity;
|
||||||
import com.novelbook.android.R;
|
import com.novelbook.android.R;
|
||||||
import com.novelbook.android.db.Chapter;
|
import com.novelbook.android.db.Chapter;
|
||||||
|
@ -111,11 +112,11 @@ public class Fragment_Shelf extends BasicFragment {
|
||||||
,Fileutil.formatFileSize( LitePal.getDatabase().getMaximumSize())
|
,Fileutil.formatFileSize( LitePal.getDatabase().getMaximumSize())
|
||||||
));
|
));
|
||||||
|
|
||||||
try{
|
/* try{
|
||||||
throw new Exception("show trace");
|
throw new Exception("show trace");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
Log.e(TAG, "loadNovelsOnShelf: ",e);
|
Log.e(TAG, "loadNovelsOnShelf: ",e);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
bookLists = Novel.getNovelsOnShelf();
|
bookLists = Novel.getNovelsOnShelf();
|
||||||
noveIds = "";
|
noveIds = "";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.novelbook.android.Fragments;
|
package com.novelbook.android.Fragments;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
@ -12,22 +12,8 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.bytedance.sdk.openadsdk.AdSlot;
|
|
||||||
import com.bytedance.sdk.openadsdk.TTAdNative;
|
|
||||||
import com.bytedance.sdk.openadsdk.TTFeedAd;
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import com.novelbook.android.AD.toutiao.TToast;
|
|
||||||
import com.novelbook.android.Activity_Search;
|
|
||||||
import com.novelbook.android.Activity_base;
|
|
||||||
import com.novelbook.android.BuildConfig;
|
|
||||||
import com.novelbook.android.Main2Activity;
|
|
||||||
import com.novelbook.android.R;
|
import com.novelbook.android.R;
|
||||||
import com.novelbook.android.activity_cates;
|
|
||||||
import com.novelbook.android.adapter.BandanAdapterNew;
|
|
||||||
import com.novelbook.android.bean.NovelBlock;
|
|
||||||
import com.novelbook.android.db.Novel;
|
import com.novelbook.android.db.Novel;
|
||||||
import com.novelbook.android.netsubscribe.BookSubscribe;
|
import com.novelbook.android.netsubscribe.BookSubscribe;
|
||||||
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
|
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
|
||||||
|
@ -39,11 +25,9 @@ import com.novelbook.android.adapter.BookListAdapter;
|
||||||
import com.umeng.analytics.MobclickAgent;
|
import com.umeng.analytics.MobclickAgent;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.litepal.LitePal;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class Main2Activity extends Activity_base
|
||||||
// requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
// requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
||||||
config =Config.getInstance();
|
config =Config.getInstance();
|
||||||
// ButterKnife.bind(this);
|
// ButterKnife.bind(this);
|
||||||
|
CommonUtil.checkPermission(this, Manifest.permission.INSTALL_PACKAGES, 1000, "下载更新需要此权限,请允许");
|
||||||
initialSexOption();
|
initialSexOption();
|
||||||
//checkUpdate(true);
|
//checkUpdate(true);
|
||||||
CommonUtil.getSearchTabTtitle(this);
|
CommonUtil.getSearchTabTtitle(this);
|
||||||
|
@ -432,6 +432,11 @@ private int bottomSelectedIndex;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isShelfZhengli){
|
||||||
|
udateShelfZhengli();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int cnt=0;
|
int cnt=0;
|
||||||
long secondTime = System.currentTimeMillis();
|
long secondTime = System.currentTimeMillis();
|
||||||
if (secondTime - firstTime > 800) {//如果两次按键时间间隔大于800毫秒,则不退出
|
if (secondTime - firstTime > 800) {//如果两次按键时间间隔大于800毫秒,则不退出
|
||||||
|
@ -488,7 +493,7 @@ private int bottomSelectedIndex;
|
||||||
private void setSexOption(){
|
private void setSexOption(){
|
||||||
int s = rgSex.getCheckedRadioButtonId() == R.id.radioButtonBoy ?1:2;
|
int s = rgSex.getCheckedRadioButtonId() == R.id.radioButtonBoy ?1:2;
|
||||||
if(s!= Constants.SEX){
|
if(s!= Constants.SEX){
|
||||||
TTAdManagerHolder.initOnSexChange(MyApp.applicationContext);
|
TTAdManagerHolder.initOnSexChange(MyApp.applicationContext);
|
||||||
Constants.SEX=s;
|
Constants.SEX=s;
|
||||||
config.setSexOption(s);
|
config.setSexOption(s);
|
||||||
Fragment current = getSupportFragmentManager().findFragmentById(R.id.realtabcontent);
|
Fragment current = getSupportFragmentManager().findFragmentById(R.id.realtabcontent);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.graphics.Typeface;
|
||||||
import android.support.design.widget.AppBarLayout;
|
import android.support.design.widget.AppBarLayout;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -103,8 +104,9 @@ TextView tvSource;
|
||||||
if (getSupportActionBar() != null) {
|
if (getSupportActionBar() != null) {
|
||||||
getSupportActionBar().setTitle(pageFactory.getBookName());
|
getSupportActionBar().setTitle(pageFactory.getBookName());
|
||||||
}
|
}
|
||||||
tvSource.setText(String.format("以下目录及内容来自%s%s",pageFactory.getSite().getName(), Constants.SHOW_NOVEL_CHAPTER_URL ? pageFactory.getSite().getMuluUrl():""));
|
if(!TextUtils.isEmpty(pageFactory.getSite().getName())) {
|
||||||
|
tvSource.setText(String.format("以下目录及内容来自%s%s", pageFactory.getSite().getName(), Constants.SHOW_NOVEL_CHAPTER_URL ? pageFactory.getSite().getMuluUrl() : ""));
|
||||||
|
}
|
||||||
pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager(),pageFactory.getNovle().getId()));
|
pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager(),pageFactory.getNovle().getId()));
|
||||||
tabLayout.setViewPager(pager);
|
tabLayout.setViewPager(pager);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.provider.SyncStateContract;
|
import android.provider.SyncStateContract;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
/*
|
||||||
import com.bytedance.sdk.openadsdk.TTAdConfig;
|
import com.bytedance.sdk.openadsdk.TTAdConfig;
|
||||||
import com.bytedance.sdk.openadsdk.TTAdConstant;
|
import com.bytedance.sdk.openadsdk.TTAdConstant;
|
||||||
import com.bytedance.sdk.openadsdk.TTAdSdk;
|
import com.bytedance.sdk.openadsdk.TTAdSdk;*/
|
||||||
import com.google.android.gms.ads.MobileAds;
|
import com.google.android.gms.ads.MobileAds;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.novelbook.android.AD.toutiao.TTAdManagerHolder;
|
import com.novelbook.android.AD.toutiao.TTAdManagerHolder;
|
||||||
|
@ -71,7 +71,7 @@ public class MyApp extends Application {
|
||||||
initAD_AdMob();
|
initAD_AdMob();
|
||||||
}
|
}
|
||||||
private void initAD_ChuanShanJia(){
|
private void initAD_ChuanShanJia(){
|
||||||
TTAdManagerHolder.init(applicationContext);
|
// TTAdManagerHolder.init(applicationContext);
|
||||||
}
|
}
|
||||||
private void initAD_AdMob(){
|
private void initAD_AdMob(){
|
||||||
if(AdSetting.getAppID(Constants.AD_MOB).length()>0){
|
if(AdSetting.getAppID(Constants.AD_MOB).length()>0){
|
||||||
|
@ -92,15 +92,15 @@ public class MyApp extends Application {
|
||||||
/**
|
/**
|
||||||
* 添加Activity
|
* 添加Activity
|
||||||
*/
|
*/
|
||||||
public void addActivity_(Activity activity) {
|
public void addActivity_(Activity_base activity) {
|
||||||
// 判断当前集合中不存在该Activity
|
// 判断当前集合中不存在该Activity
|
||||||
if (!oList.contains(activity)) {
|
if (!oList.contains(activity)) {
|
||||||
oList.add(activity);//把当前Activity添加到集合中
|
oList.add(activity);//把当前Activity添加到集合中
|
||||||
}
|
}
|
||||||
currentAct=activity;
|
currentAct=activity;
|
||||||
}
|
}
|
||||||
private static Activity currentAct =null;
|
private static Activity_base currentAct =null;
|
||||||
public static Activity getCurrentActivity(){
|
public static Activity_base getCurrentActivity(){
|
||||||
return currentAct;
|
return currentAct;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.androidquery.callback.AQuery2;
|
/*import com.androidquery.callback.AQuery2;
|
||||||
import com.androidquery.callback.ImageOptions;
|
import com.androidquery.callback.ImageOptions;
|
||||||
import com.bytedance.sdk.openadsdk.AdSlot;
|
import com.bytedance.sdk.openadsdk.AdSlot;
|
||||||
import com.bytedance.sdk.openadsdk.TTAdConstant;
|
import com.bytedance.sdk.openadsdk.TTAdConstant;
|
||||||
|
@ -52,7 +52,7 @@ import com.bytedance.sdk.openadsdk.TTAdNative;
|
||||||
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
|
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
|
||||||
import com.bytedance.sdk.openadsdk.TTBannerAd;
|
import com.bytedance.sdk.openadsdk.TTBannerAd;
|
||||||
import com.bytedance.sdk.openadsdk.TTImage;
|
import com.bytedance.sdk.openadsdk.TTImage;
|
||||||
import com.bytedance.sdk.openadsdk.TTNativeAd;
|
import com.bytedance.sdk.openadsdk.TTNativeAd;*/
|
||||||
import com.novelbook.android.AD.SplashAdManager;
|
import com.novelbook.android.AD.SplashAdManager;
|
||||||
import com.novelbook.android.AD.toutiao.TTAdManagerHolder;
|
import com.novelbook.android.AD.toutiao.TTAdManagerHolder;
|
||||||
import com.novelbook.android.AD.toutiao.TToast;
|
import com.novelbook.android.AD.toutiao.TToast;
|
||||||
|
|
|
@ -19,16 +19,16 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.androidquery.callback.AQuery2;
|
//import com.androidquery.callback.AQuery2;
|
||||||
import com.androidquery.callback.ImageOptions;
|
import com.androidquery.callback.ImageOptions;
|
||||||
import com.bytedance.sdk.openadsdk.DownloadStatusController;
|
/*import com.bytedance.sdk.openadsdk.DownloadStatusController;
|
||||||
import com.bytedance.sdk.openadsdk.TTAdConstant;
|
import com.bytedance.sdk.openadsdk.TTAdConstant;
|
||||||
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
|
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
|
||||||
import com.bytedance.sdk.openadsdk.TTFeedAd;
|
import com.bytedance.sdk.openadsdk.TTFeedAd;
|
||||||
import com.bytedance.sdk.openadsdk.TTImage;
|
import com.bytedance.sdk.openadsdk.TTImage;
|
||||||
import com.bytedance.sdk.openadsdk.TTNativeAd;
|
import com.bytedance.sdk.openadsdk.TTNativeAd;
|
||||||
import com.novelbook.android.AD.toutiao.TToast;
|
import com.novelbook.android.AD.toutiao.TToast;
|
||||||
import com.novelbook.android.BookActivity;
|
import com.novelbook.android.BookActivity;*/
|
||||||
import com.novelbook.android.R;
|
import com.novelbook.android.R;
|
||||||
import com.novelbook.android.db.Novel;
|
import com.novelbook.android.db.Novel;
|
||||||
|
|
||||||
|
@ -106,8 +106,8 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
this.percent = percent;
|
this.percent = percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AQuery2 mAQuery;
|
// private AQuery2 mAQuery;
|
||||||
private Map<AdViewHolder, TTAppDownloadListener> mTTAppDownloadListenerMap = new WeakHashMap<>();
|
// private Map<AdViewHolder, TTAppDownloadListener> mTTAppDownloadListenerMap = new WeakHashMap<>();
|
||||||
public void setShowFootView(boolean showFootView) {
|
public void setShowFootView(boolean showFootView) {
|
||||||
this.showFootView = showFootView;
|
this.showFootView = showFootView;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mInflater = LayoutInflater.from(mContext);
|
mInflater = LayoutInflater.from(mContext);
|
||||||
mDatas = datas;
|
mDatas = datas;
|
||||||
this.mAQuery = new AQuery2(context);
|
// this.mAQuery = new AQuery2(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BookListAdapter(Context context, List<Novel> mBooks, int listItemID, OnItemClickListener clickLitener) {
|
public BookListAdapter(Context context, List<Novel> mBooks, int listItemID, OnItemClickListener clickLitener) {
|
||||||
|
@ -125,7 +125,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
this.mOnItemClickListener = clickLitener;
|
this.mOnItemClickListener = clickLitener;
|
||||||
this.listItemID = listItemID;
|
this.listItemID = listItemID;
|
||||||
mInflater = LayoutInflater.from(mContext);
|
mInflater = LayoutInflater.from(mContext);
|
||||||
this.mAQuery = new AQuery2(context);
|
// this.mAQuery = new AQuery2(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
public BookListAdapter(Context context, OnItemClickListener clickLitener) {
|
public BookListAdapter(Context context, OnItemClickListener clickLitener) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
this.mOnItemClickListener = clickLitener;
|
this.mOnItemClickListener = clickLitener;
|
||||||
this.mAQuery = new AQuery2(context);
|
// this.mAQuery = new AQuery2(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListener(OnItemClickListener clickLitener){
|
public void setListener(OnItemClickListener clickLitener){
|
||||||
|
@ -150,7 +150,8 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
//最后一个item设置为footerView
|
//最后一个item设置为footerView
|
||||||
if (mDatas.get(position) instanceof Novel) {
|
if (mDatas.get(position) instanceof Novel) {
|
||||||
return TYPE_ITEM;
|
return TYPE_ITEM;
|
||||||
} else if (mDatas.get(position) instanceof TTFeedAd) {
|
}
|
||||||
|
/* else if (mDatas.get(position) instanceof TTFeedAd) {
|
||||||
TTFeedAd ad = (TTFeedAd) mDatas.get(position);
|
TTFeedAd ad = (TTFeedAd) mDatas.get(position);
|
||||||
Log.d(TAG, "getItemViewType: ad.getImageMode()= " +ad.getImageMode());
|
Log.d(TAG, "getItemViewType: ad.getImageMode()= " +ad.getImageMode());
|
||||||
if (ad.getImageMode() == TTAdConstant.IMAGE_MODE_SMALL_IMG) {
|
if (ad.getImageMode() == TTAdConstant.IMAGE_MODE_SMALL_IMG) {
|
||||||
|
@ -163,7 +164,8 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
return ITEM_VIEW_TYPE_VIDEO;
|
return ITEM_VIEW_TYPE_VIDEO;
|
||||||
}
|
}
|
||||||
return ITEM_VIEW_TYPE_SMALL_PIC_AD;
|
return ITEM_VIEW_TYPE_SMALL_PIC_AD;
|
||||||
}else if(mDatas.get(position) instanceof NativeExpressADView ){
|
}*/
|
||||||
|
else if(mDatas.get(position) instanceof NativeExpressADView ){
|
||||||
return ITEM_VIEW_TYPE_QQ_NATIVE_EXPRESS;
|
return ITEM_VIEW_TYPE_QQ_NATIVE_EXPRESS;
|
||||||
}
|
}
|
||||||
Log.d(TAG, String.format("getItemViewType exception 1: position %s, mDatas.get(position) %s ,mDatas.size %s",position, mDatas.get(position),mDatas.size() ));
|
Log.d(TAG, String.format("getItemViewType exception 1: position %s, mDatas.get(position) %s ,mDatas.size %s",position, mDatas.get(position),mDatas.size() ));
|
||||||
|
@ -232,7 +234,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(RecyclerView.ViewHolder hd, int position) {
|
public void onBindViewHolder(RecyclerView.ViewHolder hd, int position) {
|
||||||
|
|
||||||
TTFeedAd ttFeedAd;
|
// TTFeedAd ttFeedAd;
|
||||||
if (hd instanceof FooterViewHolder) {
|
if (hd instanceof FooterViewHolder) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -368,7 +370,8 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else if (hd instanceof SmallAdViewHolder) {
|
}
|
||||||
|
/* else if (hd instanceof SmallAdViewHolder) {
|
||||||
ttFeedAd =(TTFeedAd) mDatas.get(position);
|
ttFeedAd =(TTFeedAd) mDatas.get(position);
|
||||||
SmallAdViewHolder smallAdViewHolder = (SmallAdViewHolder) hd;
|
SmallAdViewHolder smallAdViewHolder = (SmallAdViewHolder) hd;
|
||||||
bindData(smallAdViewHolder, ttFeedAd);
|
bindData(smallAdViewHolder, ttFeedAd);
|
||||||
|
@ -449,7 +452,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -501,10 +504,14 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void AddHeaderItem(List items) {
|
public void AddHeaderItem(List items) {
|
||||||
if(mDatas.size()>3 &&( mDatas.get(3) instanceof TTFeedAd) ){
|
if(mDatas.size()>3 &&( mDatas.get(3) instanceof NativeExpressADView
|
||||||
|
/*|| mDatas.get(3) instanceof TTFeedAd*/) ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int p = mDatas.size()>3?3:0;
|
int p = mDatas.size()>3?3:0;
|
||||||
|
if( mDatas.get(p) instanceof NativeExpressADView){
|
||||||
|
return;
|
||||||
|
}
|
||||||
mDatas.addAll(p, items);
|
mDatas.addAll(p, items);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
@ -666,7 +673,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
private void bindData(final AdViewHolder adViewHolder, TTFeedAd ad) {
|
private void bindData(final AdViewHolder adViewHolder, TTFeedAd ad) {
|
||||||
//可以被点击的view, 也可以把convertView放进来意味item可被点击
|
//可以被点击的view, 也可以把convertView放进来意味item可被点击
|
||||||
List<View> clickViewList = new ArrayList<>();
|
List<View> clickViewList = new ArrayList<>();
|
||||||
|
@ -745,7 +752,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
|
|
||||||
private void bindDownLoadStatusController(AdViewHolder adViewHolder, final TTFeedAd ad) {
|
private void bindDownLoadStatusController(AdViewHolder adViewHolder, final TTFeedAd ad) {
|
||||||
final DownloadStatusController controller = ad.getDownloadStatusController();
|
final DownloadStatusController controller = ad.getDownloadStatusController();
|
||||||
/* adViewHolder.mStopButton.setOnClickListener(new View.OnClickListener() {
|
*//* adViewHolder.mStopButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
|
@ -765,7 +772,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
Log.d(TAG, "取消下载");
|
Log.d(TAG, "取消下载");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});*/
|
});*//*
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindDownloadListener(final Button adCreativeButton, final AdViewHolder adViewHolder, TTFeedAd ad) {
|
private void bindDownloadListener(final Button adCreativeButton, final AdViewHolder adViewHolder, TTFeedAd ad) {
|
||||||
|
@ -842,6 +849,6 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
//一个ViewHolder对应一个downloadListener, isValid判断当前ViewHolder绑定的listener是不是自己
|
//一个ViewHolder对应一个downloadListener, isValid判断当前ViewHolder绑定的listener是不是自己
|
||||||
ad.setDownloadListener(downloadListener); // 注册下载监听器
|
ad.setDownloadListener(downloadListener); // 注册下载监听器
|
||||||
mTTAppDownloadListenerMap.put(adViewHolder, downloadListener);
|
mTTAppDownloadListenerMap.put(adViewHolder, downloadListener);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import io.reactivex.Observable;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.FieldMap;
|
||||||
|
import retrofit2.http.FormUrlEncoded;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.POST;
|
import retrofit2.http.POST;
|
||||||
import retrofit2.http.Path;
|
import retrofit2.http.Path;
|
||||||
|
@ -100,5 +102,8 @@ public interface HttpApi {
|
||||||
Observable<ResponseBody> getPaihangBangByCate(@Query("sex") int Sex,@Query("cid") int cid);
|
Observable<ResponseBody> getPaihangBangByCate(@Query("sex") int Sex,@Query("cid") int cid);
|
||||||
@GET("page/siterank")
|
@GET("page/siterank")
|
||||||
Observable<ResponseBody> getPaihangBangList(@Query("sex") int Sex,@Query("cid") int cid,@Query("pn")int pageNo);
|
Observable<ResponseBody> getPaihangBangList(@Query("sex") int Sex,@Query("cid") int cid,@Query("pn")int pageNo);
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("r/{actionType}.shtml") //{action type}.shtml?msg=${msg}
|
||||||
|
Observable<ResponseBody> reportMsg(@Path("actionType")String actionType, @FieldMap Map<String, String> map);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package com.novelbook.android.netsubscribe;
|
package com.novelbook.android.netsubscribe;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.novelbook.android.netutils.HttpMethods;
|
import com.novelbook.android.netutils.HttpMethods;
|
||||||
|
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
|
||||||
|
import com.novelbook.android.netutils.OnSuccessAndFaultSub;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -8,8 +12,10 @@ import java.util.Map;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.observers.DisposableObserver;
|
import io.reactivex.observers.DisposableObserver;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
|
import retrofit2.http.Path;
|
||||||
|
|
||||||
public class BookSubscribe {
|
public class BookSubscribe {
|
||||||
|
public final static String TAG = BookSubscribe.class.getSimpleName();
|
||||||
public static void getData(int pageNumber, int count, DisposableObserver<ResponseBody> subscriber) {
|
public static void getData(int pageNumber, int count, DisposableObserver<ResponseBody> subscriber) {
|
||||||
Map<String,Integer> map = new HashMap<>();
|
Map<String,Integer> map = new HashMap<>();
|
||||||
map.put("start",pageNumber);
|
map.put("start",pageNumber);
|
||||||
|
@ -104,4 +110,25 @@ public class BookSubscribe {
|
||||||
Observable<ResponseBody> observable = HttpMethods.getInstance("page/siterank").getHttpApi().getPaihangBangList(sex,cid,pageNo);
|
Observable<ResponseBody> observable = HttpMethods.getInstance("page/siterank").getHttpApi().getPaihangBangList(sex,cid,pageNo);
|
||||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void reportMsg(String actionType, String msg ){
|
||||||
|
Map<String,String> map = new HashMap<>();
|
||||||
|
map.put("msg",msg );
|
||||||
|
|
||||||
|
Observable<ResponseBody> observable = HttpMethods.getInstance("r/").getHttpApi().reportMsg( actionType, map);
|
||||||
|
Log.d( TAG,String.format("report actionType %s, msg %s",actionType,msg));
|
||||||
|
DisposableObserver<ResponseBody> subscriber = new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String result) {
|
||||||
|
Log.d( TAG,String.format("report result %s",result));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFault(String errorMsg) {
|
||||||
|
Log.e( TAG,String.format("report error %s",errorMsg));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import android.util.Log;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.novelbook.android.AD.toutiao.TTAdManagerHolder;
|
import com.novelbook.android.AD.toutiao.TTAdManagerHolder;
|
||||||
|
import com.novelbook.android.Activity_base;
|
||||||
import com.novelbook.android.BookActivity;
|
import com.novelbook.android.BookActivity;
|
||||||
import com.novelbook.android.BuildConfig;
|
import com.novelbook.android.BuildConfig;
|
||||||
import com.novelbook.android.Main2Activity;
|
import com.novelbook.android.Main2Activity;
|
||||||
|
@ -447,7 +448,7 @@ public class NetUtil {
|
||||||
}
|
}
|
||||||
public static void checkUpdate(boolean isSilence){
|
public static void checkUpdate(boolean isSilence){
|
||||||
|
|
||||||
Activity currentActivity = MyApp.getCurrentActivity();
|
Activity_base currentActivity = MyApp.getCurrentActivity();
|
||||||
if(currentActivity==null){
|
if(currentActivity==null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* Copyright © Zhenjie Yan
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*//*
|
||||||
|
|
||||||
|
package com.novelbook.android.permision;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.novelbook.android.R;
|
||||||
|
*/
|
||||||
|
/*import com.yanzhenjie.permission.Permission;
|
||||||
|
import com.yanzhenjie.permission.Rationale;
|
||||||
|
import com.yanzhenjie.permission.RequestExecutor;*//*
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Created by Zhenjie Yan on 2018/1/1.
|
||||||
|
*//*
|
||||||
|
|
||||||
|
public final class RuntimeRationale implements Rationale<List<String>> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showRationale(Context context, List<String> permissions, final RequestExecutor executor) {
|
||||||
|
List<String> permissionNames = Permission.transformText(context, permissions);
|
||||||
|
String message = context.getString(R.string.message_permission_rationale,
|
||||||
|
TextUtils.join("\n", permissionNames));
|
||||||
|
|
||||||
|
new AlertDialog.Builder(context).setCancelable(false)
|
||||||
|
.setTitle(R.string.title_dialog)
|
||||||
|
.setMessage(message)
|
||||||
|
.setPositiveButton(R.string.resume, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
executor.execute();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
executor.cancel();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
}*/
|
|
@ -34,6 +34,7 @@ import android.view.View;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.novelbook.android.Activity_base;
|
||||||
import com.novelbook.android.BookActivity;
|
import com.novelbook.android.BookActivity;
|
||||||
import com.novelbook.android.BuildConfig;
|
import com.novelbook.android.BuildConfig;
|
||||||
import com.novelbook.android.MyApp;
|
import com.novelbook.android.MyApp;
|
||||||
|
@ -71,7 +72,7 @@ public class UpdateManager {
|
||||||
private String mSavePath;
|
private String mSavePath;
|
||||||
private int progress;
|
private int progress;
|
||||||
private boolean cancelUpdate = false;
|
private boolean cancelUpdate = false;
|
||||||
private Activity mContext;
|
private Activity_base mContext;
|
||||||
private ProgressBar mProgress;
|
private ProgressBar mProgress;
|
||||||
private Dialog mDownloadDialog;
|
private Dialog mDownloadDialog;
|
||||||
private boolean isForceRefresh;
|
private boolean isForceRefresh;
|
||||||
|
@ -98,7 +99,7 @@ public class UpdateManager {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
public UpdateManager(Activity context)
|
public UpdateManager(Activity_base context)
|
||||||
{
|
{
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
// app =(QiYouApplication)context;
|
// app =(QiYouApplication)context;
|
||||||
|
@ -214,7 +215,7 @@ public class UpdateManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUpdate)
|
if (isUpdate )
|
||||||
{
|
{
|
||||||
mHandler.sendEmptyMessage(showDialog);
|
mHandler.sendEmptyMessage(showDialog);
|
||||||
|
|
||||||
|
@ -320,6 +321,7 @@ public class UpdateManager {
|
||||||
{
|
{
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
CommonUtil.checkPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE, EXTERNAL_STORAGE_REQ_CODE, "下载更新需要此权限,请允许");
|
CommonUtil.checkPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE, EXTERNAL_STORAGE_REQ_CODE, "下载更新需要此权限,请允许");
|
||||||
|
CommonUtil.checkPermission(mContext, Manifest.permission.INSTALL_PACKAGES, 1024, "下载更新需要此权限,请允许");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 閺嬪嫰锟界<EFBFBD>纭呯樈濡楋拷
|
// 閺嬪嫰锟界<EFBFBD>纭呯樈濡楋拷
|
||||||
|
@ -357,6 +359,7 @@ public class UpdateManager {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Dialog noticeDialog = builder.create();
|
Dialog noticeDialog = builder.create();
|
||||||
|
noticeDialog.setCancelable(false);
|
||||||
noticeDialog.show();
|
noticeDialog.show();
|
||||||
|
|
||||||
|
|
||||||
|
@ -390,7 +393,7 @@ public class UpdateManager {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mDownloadDialog = builder.create();
|
mDownloadDialog = builder.create();
|
||||||
mDownloadDialog.setCancelable(false);
|
mDownloadDialog.setCancelable(true);
|
||||||
mDownloadDialog.show();
|
mDownloadDialog.show();
|
||||||
// 閻滄澘婀弬鍥︽
|
// 閻滄澘婀弬鍥︽
|
||||||
downloadApk();
|
downloadApk();
|
||||||
|
@ -465,9 +468,16 @@ public class UpdateManager {
|
||||||
}
|
}
|
||||||
} catch (MalformedURLException e)
|
} catch (MalformedURLException e)
|
||||||
{
|
{
|
||||||
|
if(isForceRefresh){
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
Log.e(TAG, "run: ", e);
|
Log.e(TAG, "run: ", e);
|
||||||
} catch (IOException e)
|
} catch (IOException e)
|
||||||
{
|
{
|
||||||
|
mContext.checkAndRequestPermission();
|
||||||
|
if(isForceRefresh){
|
||||||
|
// exit(-1);
|
||||||
|
}
|
||||||
Log.e(TAG, "run: ", e);
|
Log.e(TAG, "run: ", e);
|
||||||
}
|
}
|
||||||
// 閸欐牗绉锋稉瀣祰鐎电鐦藉鍡樻▔缁<EFBFBD>拷
|
// 閸欐牗绉锋稉瀣祰鐎电鐦藉鍡樻▔缁<EFBFBD>拷
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.novelbook.android.BuildConfig;
|
||||||
import com.novelbook.android.MyApp;
|
import com.novelbook.android.MyApp;
|
||||||
import com.novelbook.android.bean.Cache;
|
import com.novelbook.android.bean.Cache;
|
||||||
import com.novelbook.android.bean.NovelSites;
|
import com.novelbook.android.bean.NovelSites;
|
||||||
|
@ -32,6 +33,7 @@ import com.novelbook.android.netutils.OnSuccessAndFaultSub;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.litepal.LitePal;
|
import org.litepal.LitePal;
|
||||||
|
import org.litepal.util.Const;
|
||||||
import org.w3c.dom.Text;
|
import org.w3c.dom.Text;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -439,13 +441,30 @@ public class BookUtil {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reportMsg(String reportType,String url,String content,String headers,String httpStatus){
|
||||||
|
|
||||||
|
String msg = String.format("{\"type\":%s, \"id\":%s ,\"name\":\"%s\",\"site\":\"%s\",\"url\":\"%s\",\"content\":\"%s\",\"requestHeader\":\"%s\",\"httpStatus\":\"%s\"}," ,
|
||||||
|
reportType ,mNovel.getId(),mNovel.getName(),mSite.getDomain(),url ,content,headers,httpStatus);
|
||||||
|
|
||||||
|
msg = String.format("{\"type\":%s, \"novelId\":%s ,\"site\":\"%s\",\"url\":\"%s\",\"httpStatus\":\"%s\",\"content\":\"%s\"}," ,
|
||||||
|
reportType ,mNovel.getNovelId(),mSite.getDomain(),url ,httpStatus,content);
|
||||||
|
|
||||||
|
BookSubscribe.reportMsg(reportType ,msg);
|
||||||
|
}
|
||||||
private void checkLastUpdatedChapter() {
|
private void checkLastUpdatedChapter() {
|
||||||
|
if(BuildConfig.LOG_DEBUG) {
|
||||||
|
if(mChapters.size()>1) {
|
||||||
|
reportMsg(Constants.REPORT_NEW_UPDATE, mChapters.get(mChapters.size() - 1).getChapterUrl(), mNovel.getChapterName(), "", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i=mChapters.size()-1;i>0;i--) {
|
for (int i=mChapters.size()-1;i>0;i--) {
|
||||||
if(mChapters.get(i).getChapterName().equals(mNovel.getChapterName())){
|
if(mChapters.get(i).getChapterName().equals(mNovel.getChapterName())){
|
||||||
if(i<mChapters.size()-1){
|
if(i<mChapters.size()-1){
|
||||||
|
|
||||||
mNovel.setChapterName(mChapters.get(mChapters.size()-1).getChapterName());
|
mNovel.setChapterName(mChapters.get(mChapters.size()-1).getChapterName());
|
||||||
Log.d(TAG, "prepare book: set novel lastchaptname " + mNovel.getLastReadChapt());
|
Log.d(TAG, "prepare book: set novel lastchaptname " + mNovel.getLastReadChapt());
|
||||||
|
|
||||||
|
reportMsg(Constants.REPORT_NEW_UPDATE,mChapters.get(mChapters.size()-1).getChapterUrl(),mNovel.getChapterName(),"","");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -902,6 +921,7 @@ int muluRetryCount =0;
|
||||||
|
|
||||||
// mMuluStatus = MuluStatus.failed;
|
// mMuluStatus = MuluStatus.failed;
|
||||||
|
|
||||||
|
reportMsg( Constants.REPORT_REX_MULU_ERROR,url,"",getRequestHeader(request), "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -939,7 +959,9 @@ int muluRetryCount =0;
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response){
|
public void onResponse(Call call, Response response){
|
||||||
ResponseBody body = response.body();
|
ResponseBody body = response.body();
|
||||||
|
if(BuildConfig.LOG_DEBUG) {
|
||||||
|
reportMsg( Constants.REPORT_REX_MULU_ERROR,url,"",getRequestHeader(request),response.code()+"");
|
||||||
|
}
|
||||||
if(response.code()!=200){
|
if(response.code()!=200){
|
||||||
Log.d(TAG,String.format("prepare book loadChapts----failed, %s 目录 from %s,return code %s", mNovel.getName() ,url,response.code() ));
|
Log.d(TAG,String.format("prepare book loadChapts----failed, %s 目录 from %s,return code %s", mNovel.getName() ,url,response.code() ));
|
||||||
// handler.sendEmptyMessage(3);
|
// handler.sendEmptyMessage(3);
|
||||||
|
@ -948,6 +970,9 @@ int muluRetryCount =0;
|
||||||
Log.d(TAG,String.format("prepare book loadChapts----failed, response code %s retrying count %s",response.code(), muluRetryCount ));
|
Log.d(TAG,String.format("prepare book loadChapts----failed, response code %s retrying count %s",response.code(), muluRetryCount ));
|
||||||
muluRetryCount++;
|
muluRetryCount++;
|
||||||
readChaptersAsync();
|
readChaptersAsync();
|
||||||
|
}else{
|
||||||
|
|
||||||
|
reportMsg( Constants.REPORT_REX_MULU_ERROR,url,"",getRequestHeader(request),response.code()+"");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1771,6 +1796,9 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
|
||||||
siteJson.put("chapterContentRegex", mSiteRule.getChapterContentRegex());
|
siteJson.put("chapterContentRegex", mSiteRule.getChapterContentRegex());
|
||||||
siteJson.put("chapterContentDumpRegex", mSiteRule.getChapterContentDumpRegex());
|
siteJson.put("chapterContentDumpRegex", mSiteRule.getChapterContentDumpRegex());
|
||||||
Request request = getTagRequest(url, refUrl,-1);
|
Request request = getTagRequest(url, refUrl,-1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HttpMethods.getOkClient().newCall(request).enqueue(new Callback() {
|
HttpMethods.getOkClient().newCall(request).enqueue(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, IOException e) {
|
public void onFailure(Call call, IOException e) {
|
||||||
|
@ -1815,14 +1843,31 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
|
||||||
}*/
|
}*/
|
||||||
// String bodyStr = body.string();
|
// String bodyStr = body.string();
|
||||||
// bodyStr =NovelParseUtil.enconding(bodyStr,mSiteRule.getEncoding());
|
// bodyStr =NovelParseUtil.enconding(bodyStr,mSiteRule.getEncoding());
|
||||||
|
|
||||||
|
// Log.d( TAG,String.format("prepare book content %s", body ));
|
||||||
|
|
||||||
|
|
||||||
String bodyStr =NovelParseUtil.enconding(body,mSiteRule.getEncoding());
|
String bodyStr =NovelParseUtil.enconding(body,mSiteRule.getEncoding());
|
||||||
if(TextUtils.isEmpty(bodyStr)){
|
if(TextUtils.isEmpty(bodyStr)){
|
||||||
|
Log.d( TAG,String.format("prepare book loadChaptContent %s isEmpty,retry....", index, Thread.currentThread().getName()));
|
||||||
|
chaptDownStatus.put(index,DownloadStatus.failure);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Log.d( TAG,String.format("prepare book encoded content %s", bodyStr ));
|
||||||
|
bodyStr = NovelParseUtil.getChapterContent(bodyStr, siteJson);
|
||||||
|
if(BuildConfig.LOG_DEBUG) {
|
||||||
|
reportMsg(Constants.REPORT_REX_CHAPTER_CONTENT_ERROR, mSite.getMuluUrl(),"",getRequestHeader(request),200+"");//TODO: remove
|
||||||
|
}
|
||||||
|
if(TextUtils.isEmpty(bodyStr) || bodyStr.trim().length()<10 ){
|
||||||
Log.d( TAG,String.format("prepare book loadChaptContent %s isEmpty,retry....", index, Thread.currentThread().getName()));
|
Log.d( TAG,String.format("prepare book loadChaptContent %s isEmpty,retry....", index, Thread.currentThread().getName()));
|
||||||
chaptDownStatus.put(index,DownloadStatus.failure);
|
|
||||||
|
reportMsg(Constants.REPORT_REX_CHAPTER_CONTENT_ERROR, mSite.getMuluUrl(),bodyStr,getRequestHeader(request),200+"");
|
||||||
|
// bodyStr += Constants.BAD_CHAR +Constants.BAD_CHAR +"内容正在搜索中,请稍后刷新内容";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String title = chapter.getChapterName();
|
String title = chapter.getChapterName();
|
||||||
String chapterContent = title+ "\n" + NovelParseUtil.getChapterContent(bodyStr, siteJson);
|
String chapterContent = title+ "\n" + bodyStr;
|
||||||
char[] buf = chapterContent.toCharArray();
|
char[] buf = chapterContent.toCharArray();
|
||||||
File file = new File(fileChapterName(index));
|
File file = new File(fileChapterName(index));
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
|
@ -1898,26 +1943,30 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
|
||||||
builder.removeHeader("User-Agent").addHeader("User-Agent", HttpMethods.USERAGENT);
|
builder.removeHeader("User-Agent").addHeader("User-Agent", HttpMethods.USERAGENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// .header( "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
|
|
||||||
// .header( "Upgrade-Insecure-Requests", "1")
|
|
||||||
// .header("content-type", "text/html; charset=utf-8")
|
|
||||||
// .header("Content-Type", "text/plain; charset=utf-8")
|
|
||||||
// .header( "Accept", "*/*")
|
|
||||||
;
|
|
||||||
/* if(mSiteRule!=null && !TextUtils.isEmpty(mSiteRule.getEncoding()) ){
|
|
||||||
builder.header("Accept-Encoding",mSiteRule.getEncoding());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (maxAge > 0) {
|
if (maxAge > 0) {
|
||||||
builder.header("Cache-Control", "public, max-age=" + maxAge);
|
builder.header("Cache-Control", "public, max-age=" + maxAge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getRequestHeader(Request request) {
|
||||||
|
|
||||||
|
String head = String.format("\"Referer\":\"%s\",\"User-Agent\":\"%s\",\"Cache-Control\":\"%s\"",
|
||||||
|
request.header("Referer"),request.header("User-Agent"), request.header("Cache-Control")
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < mSiteRule.getHeaders().length; i += 2) {
|
||||||
|
|
||||||
|
head += String.format(",\"%s\":\"%s\"",mSiteRule.getHeaders()[i], mSiteRule.getHeaders()[i + 1]) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return "{" + head +"}";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isChapterTitle(String line){
|
public boolean isChapterTitle(String line){
|
||||||
return (line.length() <= 30 && (line.matches(".*第.{1,8}章.*") || line.matches(".*第.{1,8}节.*"))) ;
|
return (line.length() <= 30 && (line.matches(".*第.{1,8}章.*") || line.matches(".*第.{1,8}节.*"))) ;
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
package com.novelbook.android.utils;
|
package com.novelbook.android.utils;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
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.content.res.Resources;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.widget.ContentLoadingProgressBar;
|
import android.support.v4.widget.ContentLoadingProgressBar;
|
||||||
|
@ -27,6 +32,7 @@ import android.widget.Toast;
|
||||||
import com.novelbook.android.netsubscribe.BookSubscribe;
|
import com.novelbook.android.netsubscribe.BookSubscribe;
|
||||||
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
|
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
|
||||||
import com.novelbook.android.netutils.OnSuccessAndFaultSub;
|
import com.novelbook.android.netutils.OnSuccessAndFaultSub;
|
||||||
|
//import com.yanzhenjie.permission.AndPermission;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
@ -338,6 +344,7 @@ public class CommonUtil {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getVersionCodeLong(Context context) {
|
public static int getVersionCodeLong(Context context) {
|
||||||
if(Constants.version >0){
|
if(Constants.version >0){
|
||||||
return Constants.version;
|
return Constants.version;
|
||||||
|
@ -345,7 +352,9 @@ public class CommonUtil {
|
||||||
try {
|
try {
|
||||||
PackageManager manager = context.getPackageManager();
|
PackageManager manager = context.getPackageManager();
|
||||||
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
|
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
|
||||||
Constants.version = (int) info.getLongVersionCode();
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
|
Constants.version = (int) info.getLongVersionCode();
|
||||||
|
}else return getVersionCode(context);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -525,10 +534,20 @@ public class CommonUtil {
|
||||||
}
|
}
|
||||||
public static void checkPermission (Activity thisActivity, String permission, int requestCode, String errorText) {
|
public static void checkPermission (Activity thisActivity, String permission, int requestCode, String errorText) {
|
||||||
//判断当前Activity是否已经获得了该权限
|
//判断当前Activity是否已经获得了该权限
|
||||||
if(ContextCompat.checkSelfPermission(thisActivity,permission) != PackageManager.PERMISSION_GRANTED) {
|
boolean hasPermision =true;
|
||||||
|
try{
|
||||||
|
hasPermision = ContextCompat.checkSelfPermission(thisActivity,permission) == PackageManager.PERMISSION_GRANTED;
|
||||||
|
}catch (Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
Log.e(TAG, String.format("checkAndRequestPermission: %s 有权限? ",hasPermision) );
|
||||||
|
if(!hasPermision) {
|
||||||
|
Log.e(TAG, String.format("checkAndRequestPermission: %s 曾经被用户拒绝过? %s",permission,ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
|
||||||
|
permission)) );
|
||||||
//如果App的权限申请曾经被用户拒绝过,就需要在这里跟用户做出解释
|
//如果App的权限申请曾经被用户拒绝过,就需要在这里跟用户做出解释
|
||||||
if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
|
if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
|
||||||
permission)) {
|
permission)) {
|
||||||
|
|
||||||
Toast.makeText(thisActivity,errorText,Toast.LENGTH_SHORT).show();
|
Toast.makeText(thisActivity,errorText,Toast.LENGTH_SHORT).show();
|
||||||
//进行权限请求
|
//进行权限请求
|
||||||
ActivityCompat.requestPermissions(thisActivity,
|
ActivityCompat.requestPermissions(thisActivity,
|
||||||
|
@ -536,15 +555,61 @@ public class CommonUtil {
|
||||||
requestCode);
|
requestCode);
|
||||||
} else {
|
} else {
|
||||||
//进行权限请求
|
//进行权限请求
|
||||||
ActivityCompat.requestPermissions(thisActivity,
|
Log.e(TAG, String.format("checkAndRequestPermission: %s start requestperimisions ",permission ) );
|
||||||
new String[]{permission},
|
// startAppSettingActivity(thisActivity);
|
||||||
requestCode);
|
ActivityCompat.requestPermissions(thisActivity, new String[]{permission}, requestCode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private static boolean isSDK2API23() {
|
||||||
|
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isHavePermission(Context context, String permission) {
|
||||||
|
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(context, permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isUserNoShowPermissionDialig(Activity activity, String permission) {
|
||||||
|
return !(ActivityCompat.shouldShowRequestPermissionRationale(activity, permission));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void startAppSettingActivity(Activity activity) {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||||
|
intent.setData(Uri.parse("package:" + activity.getPackageName()));
|
||||||
|
|
||||||
|
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
||||||
|
activity.startActivityForResult(intent, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*private void requestPermission(Activity thisActivity,String permission) {
|
||||||
|
AndPermission.with(thisActivity).runtime()
|
||||||
|
.permission(permission)
|
||||||
|
// 准备方法,和 okhttp 的拦截器一样,在请求权限之前先运行改方法,已经拥有权限不会触发该方法
|
||||||
|
.rationale((context, permissions, executor) -> {
|
||||||
|
// 此处可以选择显示提示弹窗
|
||||||
|
executor.execute();
|
||||||
|
})
|
||||||
|
// 用户给权限了
|
||||||
|
|
||||||
|
// 用户拒绝权限,包括不再显示权限弹窗也在此列
|
||||||
|
.onDenied(permissions -> {
|
||||||
|
// 判断用户是不是不再显示权限弹窗了,若不再显示的话进入权限设置页
|
||||||
|
if (AndPermission.hasAlwaysDeniedPermission(thisActivity, permissions)) {
|
||||||
|
// 打开权限设置页
|
||||||
|
// AndPermission.with(thisActivity).permissionSetting(thisActivity).execute();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.start();
|
||||||
|
}*/
|
||||||
public static void getSearchTabTtitle(Context context){
|
public static void getSearchTabTtitle(Context context){
|
||||||
|
|
||||||
BookSubscribe.getSearchTitles(Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
BookSubscribe.getSearchTitles(Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class Config {
|
||||||
//String defaultHost =CommonUtil.getMeta(MyApp.applicationContext,"MAINHOST");
|
//String defaultHost =CommonUtil.getMeta(MyApp.applicationContext,"MAINHOST");
|
||||||
|
|
||||||
String defaultHost = BuildConfig.MAIN_HOST;
|
String defaultHost = BuildConfig.MAIN_HOST;
|
||||||
String rt =sp.getString(KEY_ROOT_URL,defaultHost);
|
// String rt =sp.getString(KEY_ROOT_URL,defaultHost);
|
||||||
return sp.getString(KEY_ROOT_URL,defaultHost);
|
return sp.getString(KEY_ROOT_URL,defaultHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,9 @@ public class Constants {
|
||||||
|
|
||||||
public static AdSetting AD_SETTING;
|
public static AdSetting AD_SETTING;
|
||||||
public static final int AD_TENCENT_QQ =1;
|
public static final int AD_TENCENT_QQ =1;
|
||||||
public static final int AD_TOUTIAO =2;
|
public static final int AD_MOB =2;
|
||||||
public static final int AD_MOB =3;
|
public static final int AD_TOUTIAO =3;
|
||||||
|
|
||||||
public static final int AD_BANNER_TOP =1;
|
public static final int AD_BANNER_TOP =1;
|
||||||
public static final int AD_BANNER_BOTTOM =2;
|
public static final int AD_BANNER_BOTTOM =2;
|
||||||
|
|
||||||
|
@ -75,5 +76,11 @@ public class Constants {
|
||||||
public final static int MAX_SLEEP_4_CHAPT_DOWNLOAD =10000;//最多等待时间10s
|
public final static int MAX_SLEEP_4_CHAPT_DOWNLOAD =10000;//最多等待时间10s
|
||||||
public final static int MAX_SHELF_CNT =100;
|
public final static int MAX_SHELF_CNT =100;
|
||||||
|
|
||||||
|
public static final String REPORT_NEW_UPDATE ="HasNewUpdate"; //其它源有新章节
|
||||||
|
public static final String REPORT_REX_CHAPTER_CONTENT_ERROR ="EmptyText";//章节内容解析错误
|
||||||
|
public static final String REPORT_REX_MULU_ERROR ="NovelNotFound";//目录获取错误 ,或书不存在
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB |
|
@ -38,6 +38,7 @@
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
android:background="@drawable/background_circle"
|
android:background="@drawable/background_circle"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/click_to_skip"
|
android:text="@string/click_to_skip"
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/llTitle"
|
android:layout_below="@id/llTitle"
|
||||||
android:src="@drawable/toutiao_splash_banner"
|
|
||||||
|
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
|
@ -60,12 +60,16 @@
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
tools:ignore="UseCompoundDrawables">
|
tools:ignore="UseCompoundDrawables">
|
||||||
<ImageView
|
<!-- <ImageView
|
||||||
android:id="@+id/img_native_dislike"
|
android:id="@+id/img_native_dislike"
|
||||||
android:layout_width="20dp"
|
android:layout_width="20dp"
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:background="@drawable/tt_dislike_icon" />
|
android:background="@drawable/tt_dislike_icon" />-->
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_native_dislike"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
/>
|
||||||
<TextView
|
<TextView
|
||||||
|
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
android:id="@+id/tablayout"
|
android:id="@+id/tablayout"
|
||||||
android:layout_width="80dp"
|
android:layout_width="80dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#EDEDED"
|
android:background="@color/colorPrimaryLight"
|
||||||
app:indicator_color="#FFFFFF"
|
app:indicator_color="#FFFFFF"
|
||||||
app:indicator_gravity="fill"
|
app:indicator_gravity="fill"
|
||||||
app:tab_height="50dp"
|
app:tab_height="50dp"
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#FF7F50</color>
|
<color name="colorPrimary">#FF7F50</color>
|
||||||
<color name="colorPrimaryDark">#FF6347</color>
|
<color name="colorPrimaryDark">#FF6347</color>
|
||||||
|
<color name="colorPrimaryLight">#FFFAFA</color><!--雪白色 -->
|
||||||
<color name="colorPrimary3">#008577</color>
|
<color name="colorPrimary3">#008577</color>
|
||||||
<color name="colorPrimaryDark3">#00574B</color>
|
<color name="colorPrimaryDark3">#00574B</color>
|
||||||
|
|
||||||
|
|
||||||
<color name="colorAccent">#D81B60</color>
|
<color name="colorAccent">#D81B60</color>
|
||||||
<color name="black">#000000</color>
|
<color name="black">#000000</color>
|
||||||
<color name="gray">#000000</color>
|
<color name="gray">#000000</color>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">网书助手(测试)</string>
|
<string name="app_name">网书助手</string>
|
||||||
<string name="title_home">书架</string>
|
<string name="title_home">书架</string>
|
||||||
<string name="title_dashboard">书城</string>
|
<string name="title_dashboard">书城</string>
|
||||||
<string name="title_notifications">排行榜</string>
|
<string name="title_notifications">排行榜</string>
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
<string name="refresh">重试</string>
|
<string name="refresh">重试</string>
|
||||||
<string name="soft_update_no">已是最新版本</string>
|
<string name="soft_update_no">已是最新版本</string>
|
||||||
<string name="soft_update_title">有新版本了</string>
|
<string name="soft_update_title">有新版本了</string>
|
||||||
<string name="soft_force_update_title">强制更新</string>
|
<string name="soft_force_update_title">您版本太低,请升级版本</string>
|
||||||
<string name="soft_update_info">更新日志</string>
|
<string name="soft_update_info">更新日志</string>
|
||||||
<string name="soft_update_updatebtn">更新</string>
|
<string name="soft_update_updatebtn">更新</string>
|
||||||
<string name="soft_update_later">以后再说</string>
|
<string name="soft_update_later">以后再说</string>
|
||||||
|
@ -153,6 +153,15 @@
|
||||||
<string name="gdtslogan">gdtslogan</string>
|
<string name="gdtslogan">gdtslogan</string>
|
||||||
<string name="click_to_skip">点击跳过</string>
|
<string name="click_to_skip">点击跳过</string>
|
||||||
<string name="noCache">没有缓存</string>
|
<string name="noCache">没有缓存</string>
|
||||||
|
<!--<string name="successfully">成功</string>-->
|
||||||
|
<string name="permision_successfully">授权成功</string>
|
||||||
|
<string name="permision_failure">授权失败</string>
|
||||||
|
|
||||||
|
<string name="title_dialog">说明</string>
|
||||||
|
<string name="message_permission_rationale">Grant the following permissions to continue the program:\n\n%1$s</string>
|
||||||
|
<string name="setting">设置</string>
|
||||||
|
<string name="resume">继续</string>
|
||||||
|
<string name="cancel">取消</string>
|
||||||
|
<string name="message_permission_always_failed">Please give us permission in the settings:\n\n%1$s</string>
|
||||||
|
<string name="message_setting_comeback">The user comes back from the settings page.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/src/debug/res;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
|
||||||
|
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
|
||||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||||
</configuration>
|
</configuration>
|
||||||
</facet>
|
</facet>
|
||||||
|
@ -92,6 +93,7 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundle_manifest" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundle_manifest" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check_manifest_result" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check_manifest_result" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/duplicate_classes_check" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
|
||||||
|
@ -102,32 +104,33 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_split_apk_resources" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_split_apk_resources" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/legacy_multidex_aapt_derived_proguard_rules" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/legacy_multidex_aapt_derived_proguard_rules" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/legacy_multidex_main_dex_list" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/legacy_multidex_main_dex_list" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint_jar" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_jni_libs" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_shaders" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/metadata_feature_manifest" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/metadata_feature_manifest" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/signing_config" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/signing_config" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/validate_signing_config" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-ads-identifier:16.0.0@aar" level="project" />
|
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-ads-identifier:16.0.0@aar" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: :open_ad_sdk:@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: com.android.support:localbroadcastmanager:28.0.0@aar" level="project" />
|
<orderEntry type="library" name="Gradle: com.android.support:localbroadcastmanager:28.0.0@aar" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: __local_aars__:E.\reading\android\asProjects\zhuike\libs\juniversalchardet-1.0.3.jar:unspecified@jar" level="project" />
|
<orderEntry type="library" name="Gradle: __local_aars__:E.\reading\android\asProjects\zhuike\libs\juniversalchardet-1.0.3.jar:unspecified@jar" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: com.android.support:loader:28.0.0@aar" level="project" />
|
<orderEntry type="library" name="Gradle: com.android.support:loader:28.0.0@aar" level="project" />
|
||||||
|
@ -191,7 +194,6 @@
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
|
<orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: com.squareup.okio:okio:1.17.2@jar" level="project" />
|
<orderEntry type="library" name="Gradle: com.squareup.okio:okio:1.17.2@jar" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: __local_aars__:E.\reading\android\asProjects\zhuike\libs\android-query-full.0.26.7.jar:unspecified@jar" level="project" />
|
<orderEntry type="library" name="Gradle: __local_aars__:E.\reading\android\asProjects\zhuike\libs\android-query-full.0.26.7.jar:unspecified@jar" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: q.rorbin:badgeview:1.1.2@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: com.android.support:cardview-v7:28.0.0@aar" level="project" />
|
<orderEntry type="library" name="Gradle: com.android.support:cardview-v7:28.0.0@aar" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-audience:16.0.0@aar" level="project" />
|
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-audience:16.0.0@aar" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: com.astuetz:pagerslidingtabstrip:1.0.1@aar" level="project" />
|
<orderEntry type="library" name="Gradle: com.astuetz:pagerslidingtabstrip:1.0.1@aar" level="project" />
|
||||||
|
|
Loading…
Reference in New Issue