update tencent ad
This commit is contained in:
parent
95546f9b90
commit
a871acb164
|
@ -14,7 +14,7 @@ android {
|
||||||
buildToolsVersion "28.0.3"
|
buildToolsVersion "28.0.3"
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// applicationId "com.qq.e.union.demo"
|
// applicationId "com.qq.e.union.demo"
|
||||||
applicationId "com.novelbook.android"
|
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
|
||||||
|
@ -62,7 +62,7 @@ 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")) {
|
||||||
|
@ -77,103 +77,45 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//渠道
|
//渠道
|
||||||
/* productFlavors {
|
/* productFlavors {
|
||||||
// googleplay {}
|
// googleplay {}
|
||||||
huawei {
|
yingyonghui {
|
||||||
|
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", '"{\\"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 {
|
haote {
|
||||||
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", '"{\\"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\\"]}"'
|
||||||
}
|
|
||||||
ali {
|
|
||||||
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 {
|
||||||
qq {
|
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", '"{\\"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", '""'
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xiaomi {
|
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", '"{\\"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\\"]}"'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
kuan {
|
|
||||||
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\\"]}"'
|
|
||||||
|
|
||||||
}
|
|
||||||
m360 {
|
|
||||||
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\\"]}"'
|
|
||||||
|
|
||||||
}
|
|
||||||
baidu {
|
|
||||||
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\\"]}"'
|
|
||||||
|
|
||||||
}
|
|
||||||
m91 {
|
|
||||||
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\\"]}"'
|
|
||||||
|
|
||||||
}
|
|
||||||
wzzw {
|
|
||||||
applicationId "com.novelbook.android.wzzw"
|
|
||||||
versionName "v-wzzw-5.0"
|
|
||||||
buildConfigField "String", "MAIN_HOST", '"http://chwzzw.xiaoshuofenxiang.com/api/"'
|
|
||||||
buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/wzzw.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
|
|
||||||
// buildConfigField "String", "API_HOST", '""'
|
|
||||||
}
|
|
||||||
bo {
|
|
||||||
applicationId "com.novelbook.android.bo"
|
|
||||||
versionName "v-bo-5.0"
|
|
||||||
buildConfigField "String", "MAIN_HOST", '"http://chbo.xiaoshuofenxiang.com/api/"'
|
|
||||||
buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/bo.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
|
|
||||||
// buildConfigField "String", "API_HOST", '""'
|
|
||||||
}
|
|
||||||
g {
|
|
||||||
applicationId "com.novelbook.android.g"
|
|
||||||
versionName "v-g-5.0"
|
|
||||||
buildConfigField "String", "MAIN_HOST", '"http://chg.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", '""'
|
|
||||||
}
|
|
||||||
//批量配置
|
//批量配置
|
||||||
productFlavors.all { flavor ->
|
productFlavors.all { flavor ->
|
||||||
flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
|
flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
|
||||||
|
@ -247,6 +189,6 @@ dependencies {
|
||||||
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(name: 'open_ad_sdk', ext: 'aar')
|
||||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.6'
|
// implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.6'
|
||||||
implementation 'com.google.android.gms:play-services-ads:17.2.1'
|
implementation 'com.google.android.gms:play-services-ads:17.2.1'
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,14 +115,12 @@
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<!-- qq ad -->
|
<!-- qq ad -->
|
||||||
<!-- chuanshanjia ad -->
|
<!-- chuanshanjia ad -->
|
||||||
<activity
|
<!-- <activity
|
||||||
android:name=".AD.qq.SplashActivity"
|
android:name=".AD.qq.SplashActivity"
|
||||||
android:configChanges="keyboard|orientation|screenSize"
|
android:configChanges="keyboard|orientation|screenSize"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Theme.Splash">
|
android:theme="@style/Theme.Splash">
|
||||||
|
</activity>-->
|
||||||
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="com.qq.e.comm.DownloadService"
|
android:name="com.qq.e.comm.DownloadService"
|
||||||
|
@ -198,7 +196,7 @@
|
||||||
android:name="UMENG_APPKEY"
|
android:name="UMENG_APPKEY"
|
||||||
android:value="5cd6238a570df375c3000cc9" /> <!-- <meta-data android:name="UMENG_CHANNEL" android:value="${UMENG_CHANNEL_VALUE}"/> -->
|
android:value="5cd6238a570df375c3000cc9" /> <!-- <meta-data android:name="UMENG_CHANNEL" android:value="${UMENG_CHANNEL_VALUE}"/> -->
|
||||||
<meta-data android:name="UMENG_CHANNEL" android:value="debug" />
|
<meta-data android:name="UMENG_CHANNEL" android:value="debug" />
|
||||||
<!--<meta-data android:name="UMENG_CHANNEL" android:value="${UMENG_CHANNEL_VALUE}" />-->
|
<!--<meta-data android:name="UMENG_CHANNEL" android:value="${UMENG_CHANNEL_VALUE}" />-->
|
||||||
<!-- google ad-->
|
<!-- google ad-->
|
||||||
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
|
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
|
||||||
<meta-data
|
<meta-data
|
||||||
|
|
|
@ -36,6 +36,7 @@ import com.novelbook.android.AD.toutiao.WeakHandler;
|
||||||
import com.novelbook.android.Main2Activity;
|
import com.novelbook.android.Main2Activity;
|
||||||
|
|
||||||
import com.novelbook.android.R;
|
import com.novelbook.android.R;
|
||||||
|
import com.novelbook.android.utils.CommonUtil;
|
||||||
import com.novelbook.android.utils.Constants;
|
import com.novelbook.android.utils.Constants;
|
||||||
import com.qq.e.ads.splash.SplashAD;
|
import com.qq.e.ads.splash.SplashAD;
|
||||||
import com.qq.e.ads.splash.SplashADListener;
|
import com.qq.e.ads.splash.SplashADListener;
|
||||||
|
@ -381,27 +382,41 @@ 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)) {
|
||||||
lackedPermission.add(Manifest.permission.REQUEST_INSTALL_PACKAGES);
|
CommonUtil.checkPermission(this,Manifest.permission.REQUEST_INSTALL_PACKAGES,1024,"更新程序内容需此权限,请允许");
|
||||||
|
//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)) {
|
||||||
lackedPermission.add(Manifest.permission.ACCESS_FINE_LOCATION);
|
lackedPermission.add(Manifest.permission.ACCESS_FINE_LOCATION);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
for(String s: lackedPermission){
|
||||||
|
Log.e(TAG, "checkAndRequestPermission: lack permission "+s );
|
||||||
|
}
|
||||||
|
|
||||||
// 权限都已经有了,那么直接调用SDK
|
// 权限都已经有了,那么直接调用SDK
|
||||||
if (lackedPermission.size() == 0) {
|
if (lackedPermission.size() == 0) {
|
||||||
fetchSplashAD(this, mSplashContainer, skipView, getAppID(Constants.AD_TENCENT_QQ), getPosId(), this, 0);
|
fetchSplashAD(this, mSplashContainer, skipView, getAppID(Constants.AD_TENCENT_QQ), getPosId(), this, 0);
|
||||||
} else {
|
} else {
|
||||||
// 请求所缺少的权限,在onRequestPermissionsResult中再看是否获得权限,如果获得权限就可以调用SDK,否则不要调用SDK。
|
// 请求所缺少的权限,在onRequestPermissionsResult中再看是否获得权限,如果获得权限就可以调用SDK,否则不要调用SDK。
|
||||||
|
Log.e(TAG, "checkAndRequestPermission: lack permission to ask user grant permission" );
|
||||||
|
for(String s: lackedPermission){
|
||||||
|
Log.e(TAG, "checkAndRequestPermission: lack permission "+s );
|
||||||
|
}
|
||||||
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));
|
||||||
requestPermissions(requestPermissions, 1024);
|
requestPermissions(requestPermissions, 1024);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasAllPermissionsGranted(int[] grantResults) {
|
private boolean hasAllPermissionsGranted(int[] grantResults) {
|
||||||
for (int grantResult : grantResults) {
|
for (int grantResult : grantResults) {
|
||||||
|
|
||||||
|
Log.e(TAG, "checkAndRequestPermission: grant result "+grantResult );
|
||||||
|
|
||||||
|
|
||||||
if (grantResult == PackageManager.PERMISSION_DENIED) {
|
if (grantResult == PackageManager.PERMISSION_DENIED) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -413,6 +428,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
if (requestCode == 1024 && hasAllPermissionsGranted(grantResults)) {
|
if (requestCode == 1024 && hasAllPermissionsGranted(grantResults)) {
|
||||||
fetchSplashAD(this, mSplashContainer, skipView, getAppID(Constants.AD_TENCENT_QQ), getPosId(), this, 0);
|
fetchSplashAD(this, mSplashContainer, skipView, getAppID(Constants.AD_TENCENT_QQ), getPosId(), this, 0);
|
||||||
} else {
|
} else {
|
||||||
|
Log.d(TAG, String.format("checkAndRequestPermission: permision result requestCode %s,",requestCode ));
|
||||||
// 如果用户没有授权,那么应该说明意图,引导用户去设置里面授权。
|
// 如果用户没有授权,那么应该说明意图,引导用户去设置里面授权。
|
||||||
Toast.makeText(this, "应用缺少必要的权限!请点击\"权限\",打开所需要的权限。", Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "应用缺少必要的权限!请点击\"权限\",打开所需要的权限。", Toast.LENGTH_LONG).show();
|
||||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||||
|
@ -486,7 +502,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
@Override
|
@Override
|
||||||
public void onNoAD(AdError error) {
|
public void onNoAD(AdError error) {
|
||||||
Log.i(
|
Log.i(
|
||||||
"AD_DEMO",
|
TAG,
|
||||||
String.format("LoadSplashADFail, eCode=%d, errorMsg=%s", error.getErrorCode(),
|
String.format("LoadSplashADFail, eCode=%d, errorMsg=%s", error.getErrorCode(),
|
||||||
error.getErrorMsg()));
|
error.getErrorMsg()));
|
||||||
/**
|
/**
|
||||||
|
@ -528,7 +544,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
//----qq ad end <---
|
//----qq ad end <---
|
||||||
|
|
||||||
void getAdMob(){
|
void getAdMob(){
|
||||||
MobileAds.initialize(this,"ca-app-pub-3940256099942544~3347511713");
|
MobileAds.initialize(this,"ca-app-pub-7589200066914535~9227821515");
|
||||||
|
|
||||||
mInterstitialAd = new InterstitialAd(this);
|
mInterstitialAd = new InterstitialAd(this);
|
||||||
mInterstitialAd.setAdListener(new AdListener() {
|
mInterstitialAd.setAdListener(new AdListener() {
|
||||||
|
@ -572,7 +588,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
|
||||||
goToMainActivity();
|
goToMainActivity();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
|
mInterstitialAd.setAdUnitId("ca-app-pub-7589200066914535/7573202335");
|
||||||
|
|
||||||
mInterstitialAd.loadAd(new AdRequest.Builder().build());
|
mInterstitialAd.loadAd(new AdRequest.Builder().build());
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,9 @@ public class SplashAdManager implements Application.ActivityLifecycleCallbacks,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||||
|
if(activity instanceof SplashActivity){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(Constants.AD_SETTING.getSplash2() .getSource() == Constants.AD_MOB) {
|
if(Constants.AD_SETTING.getSplash2() .getSource() == Constants.AD_MOB) {
|
||||||
getAdMob(activity);
|
getAdMob(activity);
|
||||||
}
|
}
|
||||||
|
@ -75,12 +78,16 @@ public class SplashAdManager implements Application.ActivityLifecycleCallbacks,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResumed(Activity activity) {
|
public void onActivityResumed(Activity activity) {
|
||||||
|
|
||||||
|
if(activity instanceof SplashActivity){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (mIsBackground) {
|
if (mIsBackground) {
|
||||||
mIsBackground = false;
|
mIsBackground = false;
|
||||||
|
|
||||||
showSplashAd(activity);
|
showSplash2Ad(activity);
|
||||||
|
|
||||||
Log.d(TAG, "从广告页回到前台");
|
Log.d(TAG, "从广告页回到前台 "+activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +133,7 @@ public class SplashAdManager implements Application.ActivityLifecycleCallbacks,
|
||||||
static void showInterAd(Activity activity){
|
static void showInterAd(Activity activity){
|
||||||
clearPages();
|
clearPages();
|
||||||
}
|
}
|
||||||
static void showSplashAd(Activity activity){
|
static void showSplash2Ad(Activity activity){
|
||||||
if(canShowAd()) {
|
if(canShowAd()) {
|
||||||
lastAd = new Date().getTime();
|
lastAd = new Date().getTime();
|
||||||
|
|
||||||
|
@ -160,7 +167,7 @@ public class SplashAdManager implements Application.ActivityLifecycleCallbacks,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
long in = new Date().getTime() -lastAd;
|
long in = new Date().getTime() -lastAd;
|
||||||
int interVal = Constants.AD_SETTING.getSplash2().getInterval4Display()*10;
|
int interVal = Constants.AD_SETTING.getSplash2().getInterval4Display()*1000;
|
||||||
Log.d(TAG, "canShowAd: interval is, " +in + ", canshow? "+ (in >interVal));
|
Log.d(TAG, "canShowAd: interval is, " +in + ", canshow? "+ (in >interVal));
|
||||||
return in >interVal;
|
return in >interVal;
|
||||||
}
|
}
|
||||||
|
@ -173,8 +180,10 @@ public class SplashAdManager implements Application.ActivityLifecycleCallbacks,
|
||||||
int pcnt =Constants.AD_SETTING.getSplash2().getPageCount4Display();;
|
int pcnt =Constants.AD_SETTING.getSplash2().getPageCount4Display();;
|
||||||
|
|
||||||
if(pages > pcnt){
|
if(pages > pcnt){
|
||||||
|
Log.d(TAG, String.format("canShowAd: plusPage pages %s, maxpage %s ", pages,pcnt));
|
||||||
clearPages();
|
clearPages();
|
||||||
showSplashAd(activity);
|
|
||||||
|
showSplash2Ad(activity);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,292 +0,0 @@
|
||||||
package com.novelbook.android.AD.qq;
|
|
||||||
|
|
||||||
import android.Manifest;
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.provider.Settings;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.KeyEvent;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.novelbook.android.Main2Activity;
|
|
||||||
import com.novelbook.android.R;
|
|
||||||
import com.novelbook.android.utils.Constants;
|
|
||||||
import com.qq.e.ads.splash.SplashAD;
|
|
||||||
import com.qq.e.ads.splash.SplashADListener;
|
|
||||||
import com.qq.e.comm.util.AdError;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.novelbook.android.bean.AdSetting.getAppID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 这是demo工程的入口Activity,在这里会首次调用广点通的SDK。
|
|
||||||
*
|
|
||||||
* 在调用SDK之前,如果您的App的targetSDKVersion >= 23,那么一定要把"READ_PHONE_STATE"、"WRITE_EXTERNAL_STORAGE"、"ACCESS_FINE_LOCATION"这几个权限申请到,否则SDK将不会工作。
|
|
||||||
*/
|
|
||||||
public class SplashActivity extends Activity implements SplashADListener {
|
|
||||||
|
|
||||||
private SplashAD splashAD;
|
|
||||||
private ViewGroup container;
|
|
||||||
private TextView skipView;
|
|
||||||
//private ImageView splashHolder;
|
|
||||||
private TextView splashHolder;
|
|
||||||
private TextView tvTitle;
|
|
||||||
private static final String SKIP_TEXT = "点击跳过 %d";
|
|
||||||
|
|
||||||
public boolean canJump = false;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 为防止无广告时造成视觉上类似于"闪退"的情况,设定无广告时页面跳转根据需要延迟一定时间,demo
|
|
||||||
* 给出的延时逻辑是从拉取广告开始算开屏最少持续多久,仅供参考,开发者可自定义延时逻辑,如果开发者采用demo
|
|
||||||
* 中给出的延时逻辑,也建议开发者考虑自定义minSplashTimeWhenNoAD的值(单位ms)
|
|
||||||
**/
|
|
||||||
private int minSplashTimeWhenNoAD = 2000;
|
|
||||||
/**
|
|
||||||
* 记录拉取广告的时间
|
|
||||||
*/
|
|
||||||
private long fetchSplashADTime = 0;
|
|
||||||
private Handler handler = new Handler(Looper.getMainLooper());
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.ad_qq_activity_splash );
|
|
||||||
container = (ViewGroup) this.findViewById(R.id.splash_container);
|
|
||||||
skipView = (TextView) findViewById(R.id.skip_view);
|
|
||||||
tvTitle = (TextView) findViewById(R.id.textTile);
|
|
||||||
splashHolder = (TextView) findViewById(R.id.splash_holder);
|
|
||||||
|
|
||||||
tvTitle.setText(R.string.app_name);
|
|
||||||
getWindow().getDecorView().setSystemUiVisibility(
|
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
||||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
|
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
|
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
|
||||||
// | View.SYSTEM_UI_FLAG_IMMERSIVE
|
|
||||||
);
|
|
||||||
|
|
||||||
/* boolean needLogo = getIntent().getBooleanExtra("need_logo", true);
|
|
||||||
needStartDemoList = getIntent().getBooleanExtra("need_start_demo_list", true);
|
|
||||||
if (!needLogo) {
|
|
||||||
findViewById(R.id.app_logo).setVisibility(View.GONE);
|
|
||||||
}*/
|
|
||||||
// 如果targetSDKVersion >= 23,就要申请好权限。如果您的App没有适配到Android6.0(即targetSDKVersion < 23),那么只需要在这里直接调用fetchSplashAD接口。
|
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
|
||||||
checkAndRequestPermission();
|
|
||||||
} else {
|
|
||||||
// 如果是Android6.0以下的机器,默认在安装时获得了所有权限,可以直接调用SDK
|
|
||||||
fetchSplashAD(this, container, skipView, getAppID(Constants.AD_TENCENT_QQ), getPosId(), this, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getPosId() {
|
|
||||||
return Constants.AD_SETTING.getSplash().getSlotId(Constants.AD_TENCENT_QQ);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* ----------非常重要----------
|
|
||||||
*
|
|
||||||
* Android6.0以上的权限适配简单示例:
|
|
||||||
*
|
|
||||||
* 如果targetSDKVersion >= 23,那么必须要申请到所需要的权限,再调用广点通SDK,否则广点通SDK不会工作。
|
|
||||||
*
|
|
||||||
* Demo代码里是一个基本的权限申请示例,请开发者根据自己的场景合理地编写这部分代码来实现权限申请。
|
|
||||||
* 注意:下面的`checkSelfPermission`和`requestPermissions`方法都是在Android6.0的SDK中增加的API,如果您的App还没有适配到Android6.0以上,则不需要调用这些方法,直接调用广点通SDK即可。
|
|
||||||
*/
|
|
||||||
@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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 权限都已经有了,那么直接调用SDK
|
|
||||||
if (lackedPermission.size() == 0) {
|
|
||||||
fetchSplashAD(this, container, skipView, getAppID(Constants.AD_TENCENT_QQ), getPosId(), this, 0);
|
|
||||||
} else {
|
|
||||||
// 请求所缺少的权限,在onRequestPermissionsResult中再看是否获得权限,如果获得权限就可以调用SDK,否则不要调用SDK。
|
|
||||||
String[] requestPermissions = new String[lackedPermission.size()];
|
|
||||||
lackedPermission.toArray(requestPermissions);
|
|
||||||
requestPermissions(requestPermissions, 1024);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasAllPermissionsGranted(int[] grantResults) {
|
|
||||||
for (int grantResult : grantResults) {
|
|
||||||
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)) {
|
|
||||||
fetchSplashAD(this, container, skipView, getAppID(Constants.AD_TENCENT_QQ), getPosId(), this, 0);
|
|
||||||
} else {
|
|
||||||
// 如果用户没有授权,那么应该说明意图,引导用户去设置里面授权。
|
|
||||||
Toast.makeText(this, "应用缺少必要的权限!请点击\"权限\",打开所需要的权限。", Toast.LENGTH_LONG).show();
|
|
||||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
||||||
intent.setData(Uri.parse("package:" + getPackageName()));
|
|
||||||
startActivity(intent);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拉取开屏广告,开屏广告的构造方法有3种,详细说明请参考开发者文档。
|
|
||||||
*
|
|
||||||
* @param activity 展示广告的activity
|
|
||||||
* @param adContainer 展示广告的大容器
|
|
||||||
* @param skipContainer 自定义的跳过按钮:传入该view给SDK后,SDK会自动给它绑定点击跳过事件。SkipView的样式可以由开发者自由定制,其尺寸限制请参考activity_splash.xml或者接入文档中的说明。
|
|
||||||
* @param appId 应用ID
|
|
||||||
* @param posId 广告位ID
|
|
||||||
* @param adListener 广告状态监听器
|
|
||||||
* @param fetchDelay 拉取广告的超时时长:取值范围[3000, 5000],设为0表示使用广点通SDK默认的超时时长。
|
|
||||||
*/
|
|
||||||
private void fetchSplashAD(Activity activity, ViewGroup adContainer, View skipContainer,
|
|
||||||
String appId, String posId, SplashADListener adListener, int fetchDelay) {
|
|
||||||
fetchSplashADTime = System.currentTimeMillis();
|
|
||||||
Map<String, String> tags = new HashMap<>();
|
|
||||||
tags.put("tag_s1", "value_s1");
|
|
||||||
tags.put("tag_s2", "value_s2");
|
|
||||||
|
|
||||||
splashAD = new SplashAD(activity, adContainer, skipContainer, appId, posId, adListener,
|
|
||||||
fetchDelay, tags);
|
|
||||||
// 如果不需要传tag,使用如下构造函数
|
|
||||||
// splashAD = new SplashAD(activity, adContainer, skipContainer, appId, posId, adListener, fetchDelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onADPresent() {
|
|
||||||
Log.i("AD_DEMO", "SplashADPresent");
|
|
||||||
splashHolder.setVisibility(View.INVISIBLE); // 广告展示后一定要把预设的开屏图片隐藏起来
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onADClicked() {
|
|
||||||
Log.i("AD_DEMO", "SplashADClicked clickUrl: "
|
|
||||||
+ (splashAD.getExt() != null ? splashAD.getExt().get("clickUrl") : ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 倒计时回调,返回广告还将被展示的剩余时间。
|
|
||||||
* 通过这个接口,开发者可以自行决定是否显示倒计时提示,或者还剩几秒的时候显示倒计时
|
|
||||||
*
|
|
||||||
* @param millisUntilFinished 剩余毫秒数
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onADTick(long millisUntilFinished) {
|
|
||||||
Log.i("AD_DEMO", "SplashADTick " + millisUntilFinished + "ms");
|
|
||||||
skipView.setText(String.format(SKIP_TEXT, Math.round(millisUntilFinished / 1000f)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onADExposure() {
|
|
||||||
Log.i("AD_DEMO", "SplashADExposure");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onADDismissed() {
|
|
||||||
Log.i("AD_DEMO", "SplashADDismissed");
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNoAD(AdError error) {
|
|
||||||
Log.i(
|
|
||||||
"AD_DEMO",
|
|
||||||
String.format("LoadSplashADFail, eCode=%d, errorMsg=%s", error.getErrorCode(),
|
|
||||||
error.getErrorMsg()));
|
|
||||||
/**
|
|
||||||
* 为防止无广告时造成视觉上类似于"闪退"的情况,设定无广告时页面跳转根据需要延迟一定时间,demo
|
|
||||||
* 给出的延时逻辑是从拉取广告开始算开屏最少持续多久,仅供参考,开发者可自定义延时逻辑,如果开发者采用demo
|
|
||||||
* 中给出的延时逻辑,也建议开发者考虑自定义minSplashTimeWhenNoAD的值
|
|
||||||
**/
|
|
||||||
long alreadyDelayMills = System.currentTimeMillis() - fetchSplashADTime;//从拉广告开始到onNoAD已经消耗了多少时间
|
|
||||||
long shouldDelayMills = alreadyDelayMills > minSplashTimeWhenNoAD ? 0 : minSplashTimeWhenNoAD
|
|
||||||
- alreadyDelayMills;//为防止加载广告失败后立刻跳离开屏可能造成的视觉上类似于"闪退"的情况,根据设置的minSplashTimeWhenNoAD
|
|
||||||
// 计算出还需要延时多久
|
|
||||||
handler.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
SplashActivity.this.finish();
|
|
||||||
}
|
|
||||||
}, shouldDelayMills);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置一个变量来控制当前开屏页面是否可以跳转,当开屏广告为普链类广告时,点击会打开一个广告落地页,此时开发者还不能打开自己的App主页。当从广告落地页返回以后,
|
|
||||||
* 才可以跳转到开发者自己的App主页;当开屏广告是App类广告时只会下载App。
|
|
||||||
*/
|
|
||||||
private void next() {
|
|
||||||
if (canJump) {
|
|
||||||
|
|
||||||
this.finish();
|
|
||||||
} else {
|
|
||||||
canJump = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
canJump = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
if (canJump) {
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
canJump = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
handler.removeCallbacksAndMessages(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 开屏页一定要禁止用户对返回按钮的控制,否则将可能导致用户手动退出了App而广告无法正常曝光和计费 */
|
|
||||||
@Override
|
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onKeyDown(keyCode, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -42,4 +42,6 @@ public class ActivityAnounce extends Activity_base {
|
||||||
public void fillData() {
|
public void fillData() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.app.ProgressDialog;
|
||||||
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.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -22,6 +23,8 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -73,6 +76,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import com.qq.e.ads.banner.AbstractBannerADListener;
|
import com.qq.e.ads.banner.AbstractBannerADListener;
|
||||||
import com.qq.e.ads.banner.BannerView;
|
import com.qq.e.ads.banner.BannerView;
|
||||||
|
import com.qq.e.ads.banner2.UnifiedBannerADListener;
|
||||||
|
import com.qq.e.ads.banner2.UnifiedBannerView;
|
||||||
import com.qq.e.ads.cfg.VideoOption;
|
import com.qq.e.ads.cfg.VideoOption;
|
||||||
import com.qq.e.ads.nativ.ADSize;
|
import com.qq.e.ads.nativ.ADSize;
|
||||||
import com.qq.e.ads.nativ.NativeADUnifiedListener;
|
import com.qq.e.ads.nativ.NativeADUnifiedListener;
|
||||||
|
@ -95,7 +100,7 @@ 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 {
|
public abstract class Activity_base extends AppCompatActivity implements NativeExpressAD.NativeExpressADListener,UnifiedBannerADListener {
|
||||||
|
|
||||||
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";
|
||||||
|
@ -453,7 +458,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
Log.d(TAG, String.format("loadBanner:mLastBannerTime %s ,timepassed %s",mLastBannerTime,(new Date().getTime() - mLastBannerTime)/1000));
|
Log.d(TAG, String.format("loadBanner:mLastBannerTime %s ,timepassed %s",mLastBannerTime,(new Date().getTime() - mLastBannerTime)/1000));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
mLastBannerTime =new Date().getTime();
|
||||||
Log.d(TAG, "loadBanner:mLastBannerTime start new banner request,mBannerContainer.getChildCount(): "+mBannerContainer.getChildCount());
|
Log.d(TAG, "loadBanner:mLastBannerTime start new banner request,mBannerContainer.getChildCount(): "+mBannerContainer.getChildCount());
|
||||||
if(Constants.AD_SETTING.getChapterBanner().getSource()== AD_TENCENT_QQ) {
|
if(Constants.AD_SETTING.getChapterBanner().getSource()== AD_TENCENT_QQ) {
|
||||||
getBanner_qq();
|
getBanner_qq();
|
||||||
|
@ -1086,7 +1091,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BannerView bv;
|
/* BannerView bv;
|
||||||
private void getBanner_qq() {
|
private void getBanner_qq() {
|
||||||
|
|
||||||
if(this.bv != null){
|
if(this.bv != null){
|
||||||
|
@ -1098,8 +1103,8 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bv = new BannerView(this, com.qq.e.ads.banner.ADSize.BANNER,
|
this.bv = new BannerView(this, com.qq.e.ads.banner.ADSize.BANNER,
|
||||||
AdSetting.getAppID(Constants.AD_TENCENT_QQ),
|
"1109247602" *//* AdSetting.getAppID(Constants.AD_TENCENT_QQ)*//*,
|
||||||
Constants.AD_SETTING.getChapterBanner().getSlotId(Constants.AD_TENCENT_QQ));
|
"9000263914551986" *//* Constants.AD_SETTING.getChapterBanner().getSlotId(Constants.AD_TENCENT_QQ)*//*);
|
||||||
// 注意:如果开发者的banner不是始终展示在屏幕中的话,请关闭自动刷新,否则将导致曝光率过低。
|
// 注意:如果开发者的banner不是始终展示在屏幕中的话,请关闭自动刷新,否则将导致曝光率过低。
|
||||||
// 并且应该自行处理:当banner广告区域出现在屏幕后,再手动loadAD。
|
// 并且应该自行处理:当banner广告区域出现在屏幕后,再手动loadAD。
|
||||||
// bv.setRefresh(0);
|
// bv.setRefresh(0);
|
||||||
|
@ -1107,24 +1112,85 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNoAD(AdError error) {
|
public void onNoAD(AdError error) {
|
||||||
Log.i(
|
Log.d(
|
||||||
"AD_DEMO",
|
TAG,
|
||||||
String.format("Banner onNoAD,eCode = %d, eMsg = %s", error.getErrorCode(),
|
String.format("loadListAd,eCode = %d, eMsg = %s", error.getErrorCode(),
|
||||||
error.getErrorMsg()));
|
error.getErrorMsg()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onADReceiv() {
|
public void onADReceiv() {
|
||||||
Log.i("AD_DEMO", "ONBannerReceive");
|
Log.d(TAG, "loadListAd ONBannerReceive");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mBannerContainer.addView(bv);
|
mBannerContainer.addView(bv);
|
||||||
this.bv.loadAD();
|
this.bv.loadAD();
|
||||||
|
|
||||||
mLastBannerTime =new Date().getTime();
|
mLastBannerTime =new Date().getTime();
|
||||||
|
}*/
|
||||||
|
UnifiedBannerView bv;
|
||||||
|
//banner2.0
|
||||||
|
private void getBanner_qq() {
|
||||||
|
if(this.bv != null){
|
||||||
|
mBannerContainer.removeView(bv);
|
||||||
|
bv.destroy();
|
||||||
|
}
|
||||||
|
String posId =Constants.AD_SETTING.getChapterBanner().getSlotId(Constants.AD_TENCENT_QQ);//"9000263914551986";
|
||||||
|
|
||||||
|
Map<String, String> tags = new HashMap<>();
|
||||||
|
tags.put("tag_b1", "value_b1");
|
||||||
|
tags.put("tag_b2", "value_b2");
|
||||||
|
this.bv = new UnifiedBannerView(this, AdSetting.getAppID(Constants.AD_TENCENT_QQ) , posId, this, tags);
|
||||||
|
this.bv.setRefresh(0);
|
||||||
|
// 不需要传递tags使用下面构造函数
|
||||||
|
// this.bv = new UnifiedBannerView(this, Constants.APPID, posId, this);
|
||||||
|
mBannerContainer.addView(bv, getUnifiedBannerLayoutParams());
|
||||||
|
bv.loadAD();
|
||||||
|
mLastBannerTime =new Date().getTime();
|
||||||
|
// return this.bv;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onADReceive() {
|
||||||
|
Log.d(TAG, "loadListAd UnifiedBannerView ONBannerReceive");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADExposure() {
|
||||||
|
Log.d(TAG, "loadListAd UnifiedBannerView onADExposure");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADClosed() {
|
||||||
|
Log.d(TAG, "loadListAd UnifiedBannerView onADClosed");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADClicked() {
|
||||||
|
Log.d(TAG, "loadListAd UnifiedBannerView onADClicked");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADLeftApplication() {
|
||||||
|
Log.d(TAG, "loadListAd UnifiedBannerView onADLeftApplication");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADOpenOverlay() {
|
||||||
|
Log.d(TAG, "loadListAd UnifiedBannerView onADOpenOverlay");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onADCloseOverlay() {
|
||||||
|
Log.d(TAG, "loadListAd onADCloseOverlay");
|
||||||
|
}
|
||||||
|
private FrameLayout.LayoutParams getUnifiedBannerLayoutParams() {
|
||||||
|
Point screenSize = new Point();
|
||||||
|
getWindowManager().getDefaultDisplay().getSize(screenSize);
|
||||||
|
return new FrameLayout.LayoutParams(screenSize.x, Math.round(screenSize.x / 6.4F));
|
||||||
|
}
|
||||||
|
|
||||||
|
//原生上图下文1280x720 8020766944969033
|
||||||
private void loadNativeBanner_qq(int adWidth,int adHeight) {
|
private void loadNativeBanner_qq(int adWidth,int adHeight) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -1139,8 +1205,8 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
|
|
||||||
|
|
||||||
nativeExpressAD = new NativeExpressAD(this, getMyADSize(adWidth, adHeight),
|
nativeExpressAD = new NativeExpressAD(this, getMyADSize(adWidth, adHeight),
|
||||||
AdSetting.getAppID(Constants.AD_TENCENT_QQ),
|
AdSetting.getAppID(Constants.AD_TENCENT_QQ) ,
|
||||||
Constants.AD_SETTING.getChapterContentBanner().getSlotId(Constants.AD_TENCENT_QQ), this); // 这里的Context必须为Activity
|
/*原生上图下文1280x720*/ Constants.AD_SETTING.getChapterContentBanner().getSlotId(Constants.AD_TENCENT_QQ) , this); // 这里的Context必须为Activity
|
||||||
/* nativeExpressAD.setVideoOption(new VideoOption.Builder()
|
/* nativeExpressAD.setVideoOption(new VideoOption.Builder()
|
||||||
.setAutoPlayPolicy(VideoOption.AutoPlayPolicy.WIFI) // 设置什么网络环境下可以自动播放视频
|
.setAutoPlayPolicy(VideoOption.AutoPlayPolicy.WIFI) // 设置什么网络环境下可以自动播放视频
|
||||||
.setAutoPlayMuted(true) // 设置自动播放视频时,是否静音
|
.setAutoPlayMuted(true) // 设置自动播放视频时,是否静音
|
||||||
|
@ -1441,5 +1507,12 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
||||||
hideProgress();
|
hideProgress();
|
||||||
// MobclickAgent.onPause(this);
|
// MobclickAgent.onPause(this);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (bv != null) {
|
||||||
|
bv.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -527,8 +527,8 @@ void initTabs(){
|
||||||
private NativeExpressAD mADManager;
|
private NativeExpressAD mADManager;
|
||||||
void loadListAd_qq(BookListAdapter adapter, int adCnt, boolean addFooter) {
|
void loadListAd_qq(BookListAdapter adapter, int adCnt, boolean addFooter) {
|
||||||
ADSize adSize = new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT); // 消息流中用AUTO_HEIGHT
|
ADSize adSize = new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT); // 消息流中用AUTO_HEIGHT
|
||||||
mADManager = new NativeExpressAD(activity, adSize, getAppID(Constants.AD_TENCENT_QQ),
|
mADManager = new NativeExpressAD(activity, adSize, getAppID(Constants.AD_TENCENT_QQ) ,
|
||||||
Constants.AD_SETTING.getInformationFlow().getSlotId(Constants.AD_TENCENT_QQ), this);
|
Constants.AD_SETTING.getInformationFlow().getSlotId(Constants.AD_TENCENT_QQ) , this);
|
||||||
mADManager.setMaxVideoDuration(5);
|
mADManager.setMaxVideoDuration(5);
|
||||||
mADManager.loadAD(adCnt);
|
mADManager.loadAD(adCnt);
|
||||||
qqAdapter =adapter;
|
qqAdapter =adapter;
|
||||||
|
|
|
@ -31,8 +31,10 @@ 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;
|
||||||
|
import com.novelbook.android.db.DownloadTask;
|
||||||
import com.novelbook.android.db.Novel;
|
import com.novelbook.android.db.Novel;
|
||||||
|
|
||||||
|
import com.novelbook.android.db.SiteRule;
|
||||||
import com.novelbook.android.filechooser.FileChooserActivity;
|
import com.novelbook.android.filechooser.FileChooserActivity;
|
||||||
import com.novelbook.android.netsubscribe.BookSubscribe;
|
import com.novelbook.android.netsubscribe.BookSubscribe;
|
||||||
import com.novelbook.android.netutils.HttpMethods;
|
import com.novelbook.android.netutils.HttpMethods;
|
||||||
|
@ -56,6 +58,7 @@ import org.litepal.LitePal;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
|
@ -102,11 +105,23 @@ public class Fragment_Shelf extends BasicFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadNovelsOnShelf() {
|
private void loadNovelsOnShelf() {
|
||||||
|
|
||||||
|
Log.d(TAG, String.format("db count info: chapters %s,novels %s,downtask %s,siterule %s,maxsize %s",
|
||||||
|
LitePal.count(Chapter.class), LitePal.count(Novel.class),LitePal.count(DownloadTask.class),LitePal.count(SiteRule.class)
|
||||||
|
,Fileutil.formatFileSize( LitePal.getDatabase().getMaximumSize())
|
||||||
|
));
|
||||||
|
|
||||||
|
try{
|
||||||
|
throw new Exception("show trace");
|
||||||
|
}catch (Exception e){
|
||||||
|
Log.e(TAG, "loadNovelsOnShelf: ",e);
|
||||||
|
}
|
||||||
|
|
||||||
bookLists = Novel.getNovelsOnShelf();
|
bookLists = Novel.getNovelsOnShelf();
|
||||||
noveIds = "";
|
noveIds = "";
|
||||||
int i=0;
|
int i=0;
|
||||||
for (Novel novel : bookLists) {
|
for (Novel novel : bookLists) {
|
||||||
if (novel.isFinished() || novel.isLocalBook() || novel.isUpdated()) {
|
if (novel.isFinished() || novel.isLocalBook() || (novel.isUpdated() && (new Date().getTime() - novel.getLastVisit() > 1*3600*1000 ))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(i>Constants.MAX_SHELF_CNT){
|
if(i>Constants.MAX_SHELF_CNT){
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.novelbook.android.utils.Constants;
|
||||||
|
|
||||||
public class AdSetting {
|
public class AdSetting {
|
||||||
private boolean showAdsense;
|
private boolean showAdsense;
|
||||||
private String[] appIds={};
|
private String[] appIds={ };
|
||||||
private slot splash = new slot();
|
private slot splash = new slot();
|
||||||
private slot splash2 = new slot();
|
private slot splash2 = new slot();
|
||||||
private slot informationFlow = new slot();
|
private slot informationFlow = new slot();
|
||||||
|
@ -16,8 +16,8 @@ public class AdSetting {
|
||||||
private slot fixBanner = new slot();
|
private slot fixBanner = new slot();
|
||||||
private slot bigBanner = new slot();
|
private slot bigBanner = new slot();
|
||||||
public boolean isShowAdsense() {
|
public boolean isShowAdsense() {
|
||||||
return true;
|
// return true;
|
||||||
// return showAdsense && NetUtil.isNetworkConnected();
|
return showAdsense && NetUtil.isNetworkConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShowAdsense(boolean showAdsense) {
|
public void setShowAdsense(boolean showAdsense) {
|
||||||
|
@ -82,8 +82,8 @@ public class AdSetting {
|
||||||
private int displayPosition;
|
private int displayPosition;
|
||||||
|
|
||||||
public int getDisplayPosition() {
|
public int getDisplayPosition() {
|
||||||
//return 1;
|
// return 2;
|
||||||
return displayPosition;
|
return displayPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDisplayPosition(int displayPosition) {
|
public void setDisplayPosition(int displayPosition) {
|
||||||
|
@ -91,8 +91,8 @@ public class AdSetting {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShow() {
|
public boolean isShow() {
|
||||||
return true;
|
// return true;
|
||||||
// return show && NetUtil.isNetworkConnected();
|
return show && NetUtil.isNetworkConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShow(boolean show) {
|
public void setShow(boolean show) {
|
||||||
|
@ -100,8 +100,8 @@ public class AdSetting {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSource() {
|
public int getSource() {
|
||||||
//return source;
|
return source;
|
||||||
return 1 ;
|
// return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSource(int source) {
|
public void setSource(int source) {
|
||||||
|
|
|
@ -375,11 +375,21 @@ public class BookUtil {
|
||||||
|
|
||||||
mChapters = NovelParseUtil.getChapters(mSite.getMuluUrl(), siteJson,mSite.getDomain(),maxAge,mSiteRule);
|
mChapters = NovelParseUtil.getChapters(mSite.getMuluUrl(), siteJson,mSite.getDomain(),maxAge,mSiteRule);
|
||||||
|
|
||||||
/* if (mChapters != null){
|
if (mChapters != null){
|
||||||
|
/* int i=0;
|
||||||
for (Chapter chapter:mChapters) {
|
for (Chapter chapter:mChapters) {
|
||||||
Log.i(TAG, String.format("prepare book to get chaps readChaptersAsync %s-->%s",chapter.getChapterUrl(), chapter.getChapterName()));
|
i++;
|
||||||
}
|
// Log.i(TAG, String.format("prepare book to get chaps readChaptersAsync %s-->%s",chapter.getChapterUrl(), chapter.getChapterName()));
|
||||||
}*/
|
if(chapter.getChapterName().equals(mNovel.getChapterName())){
|
||||||
|
if(i<mChapters.size()-1){
|
||||||
|
mNovel.setChapterName(mChapters.get(mChapters.size()-1).getChapterName());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
checkLastUpdatedChapter();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
@ -390,6 +400,7 @@ public class BookUtil {
|
||||||
readChaptersAsync();
|
readChaptersAsync();
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
|
|
||||||
mMuluStatus = MuluStatus.isDone;
|
mMuluStatus = MuluStatus.isDone;
|
||||||
handler.sendEmptyMessage(MSG_READCHAPTER_SUCCESS);
|
handler.sendEmptyMessage(MSG_READCHAPTER_SUCCESS);
|
||||||
Log.d(TAG,String.format("prepare book loadChapts----end download %s 目录, 目录数量 %s, cost %s", mNovel.getName() , mChapters.size(), new Date().getTime() -startTime ));
|
Log.d(TAG,String.format("prepare book loadChapts----end download %s 目录, 目录数量 %s, cost %s", mNovel.getName() , mChapters.size(), new Date().getTime() -startTime ));
|
||||||
|
@ -428,6 +439,23 @@ public class BookUtil {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkLastUpdatedChapter() {
|
||||||
|
for (int i=mChapters.size()-1;i>0;i--) {
|
||||||
|
if(mChapters.get(i).getChapterName().equals(mNovel.getChapterName())){
|
||||||
|
if(i<mChapters.size()-1){
|
||||||
|
|
||||||
|
mNovel.setChapterName(mChapters.get(mChapters.size()-1).getChapterName());
|
||||||
|
Log.d(TAG, "prepare book: set novel lastchaptname " + mNovel.getLastReadChapt());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( mChapters.size()> mNovel.getChaptCnt()){
|
||||||
|
mNovel.setChaptCnt(mChapters.size());
|
||||||
|
mNovel.update(mNovel.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setChapterNo(int chapterNo) {
|
public void setChapterNo(int chapterNo) {
|
||||||
this.chapterNo = chapterNo;
|
this.chapterNo = chapterNo;
|
||||||
/*
|
/*
|
||||||
|
@ -973,11 +1001,8 @@ int muluRetryCount =0;
|
||||||
|
|
||||||
mChapters = NovelParseUtil.getChapters(mSite.getDomain(),url, content, siteJson);
|
mChapters = NovelParseUtil.getChapters(mSite.getDomain(),url, content, siteJson);
|
||||||
Log.d(TAG,String.format("mulu on Site %s download status %s",mSite.getDomain(),mMuluStatus));
|
Log.d(TAG,String.format("mulu on Site %s download status %s",mSite.getDomain(),mMuluStatus));
|
||||||
if( mChapters.size()> mNovel.getChaptCnt()){
|
|
||||||
mNovel.setChaptCnt(mChapters.size());
|
|
||||||
mNovel.update(mNovel.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
checkLastUpdatedChapter();
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
// } catch (JSONException | IOException e) {
|
// } catch (JSONException | IOException e) {
|
||||||
Log.e(TAG,String.format("prepare book, mulu on Site %s download status %s",mSite.getDomain(),mMuluStatus),e);
|
Log.e(TAG,String.format("prepare book, mulu on Site %s download status %s",mSite.getDomain(),mMuluStatus),e);
|
||||||
|
|
|
@ -542,7 +542,7 @@ public class PageFactory implements ChangeSource{
|
||||||
|
|
||||||
|
|
||||||
int bannerPagecnt = Constants.AD_SETTING.getChapterBanner().getPageCount4Display();
|
int bannerPagecnt = Constants.AD_SETTING.getChapterBanner().getPageCount4Display();
|
||||||
int nativeBannerPageCnt =4;// Constants.AD_SETTING.getChapterContentBanner().getPageCount4Display();
|
int nativeBannerPageCnt = Constants.AD_SETTING.getChapterContentBanner().getPageCount4Display();
|
||||||
if (Constants.AD_SETTING.getChapterContentBanner().isShow() &&
|
if (Constants.AD_SETTING.getChapterContentBanner().isShow() &&
|
||||||
nativeBannerPageCnt > 0 &&
|
nativeBannerPageCnt > 0 &&
|
||||||
mNavtiveBannerPlusCnt >= nativeBannerPageCnt) {
|
mNavtiveBannerPlusCnt >= nativeBannerPageCnt) {
|
||||||
|
|
Loading…
Reference in New Issue