调整广告

This commit is contained in:
mwang 2019-06-04 00:13:32 +08:00
parent 577a1acf4a
commit f823f19565
20 changed files with 397 additions and 70 deletions

View File

@ -31,7 +31,7 @@ android {
multiDexEnabled true //65535 multiDexEnabled true //65535
manifestPlaceholders = [UMENG_CHANNEL_CALUE: "umeng"] //uMeng manifestPlaceholders = [UMENG_CHANNEL_CALUE: "umeng"] //uMeng
// flavorDimensions "default" //debug时注销 flavorDimensions "default" //debug时注销
} }
buildTypes { buildTypes {
debug { debug {
@ -44,6 +44,7 @@ android {
buildConfigField "String","AD_SLOT_TOUTIAO_SPLASH_ID",'"819267134"' buildConfigField "String","AD_SLOT_TOUTIAO_SPLASH_ID",'"819267134"'
buildConfigField "String","AD_SLOT_TOUTIAO_BANNER_ID",'"919267016"' buildConfigField "String","AD_SLOT_TOUTIAO_BANNER_ID",'"919267016"'
buildConfigField "String","AD_SLOT_TOUTIAO_BANNER_NATIVE_ID",'"919267816"' buildConfigField "String","AD_SLOT_TOUTIAO_BANNER_NATIVE_ID",'"919267816"'
buildConfigField "String","AD_SLOT_TOUTIAO_INTERACTION_ID",'"919267451"'
// buildConfigField "String", "API_HOST", '""' // buildConfigField "String", "API_HOST", '""'
versionNameSuffix "-debug" versionNameSuffix "-debug"
minifyEnabled false minifyEnabled false
@ -62,7 +63,7 @@ android {
shrinkResources true shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
/* 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,9 +78,23 @@ android {
} }
} }
// //
/* productFlavors { /*productFlavors {
// googleplay {} // googleplay {}
kuan { ali {
applicationId "com.novelbook.android"
versionName "v-qxs-1.0"
buildConfigField "String", "MAIN_HOST", '"http://chqxs.xiaoshuofenxiang.com/api/"'
buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/qxs.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
buildConfigField "String","AD_TOUTIAO_APP_ID",'"5019267"'
buildConfigField "String","AD_SLOT_TOUTIAO_FEEDAD_ID",'"919267464"'
buildConfigField "String","AD_SLOT_TOUTIAO_SPLASH_ID",'"819267134"'
buildConfigField "String","AD_SLOT_TOUTIAO_BANNER_ID",'"919267016"'
buildConfigField "String","AD_SLOT_TOUTIAO_BANNER_NATIVE_ID",'"919267816"'
buildConfigField "String","AD_SLOT_TOUTIAO_INTERACTION_ID",'"919267451"'
}
*//* kuan {
applicationId "com.novelbook.android" applicationId "com.novelbook.android"
versionName "v-kuan-1.0" versionName "v-kuan-1.0"
buildConfigField "String", "MAIN_HOST", '"http://xiaoshuofenxiang.com/api/"' buildConfigField "String", "MAIN_HOST", '"http://xiaoshuofenxiang.com/api/"'
@ -131,7 +146,7 @@ android {
buildConfigField "String", "MAIN_HOST", '"http://chg.xiaoshuofenxiang.com/api/"' 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", '"{\\"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", '""' // buildConfigField "String", "API_HOST", '""'
} }*//*
// //
productFlavors.all { flavor -> productFlavors.all { flavor ->
flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name] flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]

View File

@ -63,7 +63,7 @@ public class SplashAdManager implements Application.ActivityLifecycleCallbacks,
if (mIsBackground) { if (mIsBackground) {
mIsBackground = false; mIsBackground = false;
showAd(activity); // showAd(activity);
Log.d("zzr", "从广告页回到前台"); Log.d("zzr", "从广告页回到前台");
} }
@ -108,7 +108,9 @@ public class SplashAdManager implements Application.ActivityLifecycleCallbacks,
public void onLowMemory() { public void onLowMemory() {
} }
static void showInterAd(Activity activity){
}
static void showAd(Activity activity){ static void showAd(Activity activity){
if(canShowAd()) { if(canShowAd()) {
lastAd = new Date().getTime(); lastAd = new Date().getTime();
@ -129,7 +131,7 @@ public class SplashAdManager implements Application.ActivityLifecycleCallbacks,
public static void plusPage(Activity activity){ public static void plusPage(Activity activity){
pages++; pages++;
if(pages >Constants.AD_SPLASH_PAGES){ if(pages >Constants.AD_SPLASH_PAGES){
showAd(activity); showInterAd(activity);
} }
} }

View File

@ -49,11 +49,20 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if(!Constants.SHOWAD){
goToMainActivity();
return;
}
setContentView(R.layout.ad_toutiao_activity_splash); setContentView(R.layout.ad_toutiao_activity_splash);
ButterKnife.bind(this); ButterKnife.bind(this);
mSplashContainer = (FrameLayout) findViewById(R.id.splash_container); mSplashContainer = (FrameLayout) findViewById(R.id.splash_container);
//step2:创建TTAdNative对象 //step2:创建TTAdNative对象
mTTAdNative = TTAdManagerHolder.get().createAdNative(this); try {
mTTAdNative = TTAdManagerHolder.get().createAdNative(this);
}catch (Exception e){
goToMainActivity();
return;
}
//在合适的时机申请权限如read_phone_state,防止获取不了imei时候下载类广告没有填充的问题 //在合适的时机申请权限如read_phone_state,防止获取不了imei时候下载类广告没有填充的问题
//在开屏时候申请不太合适因为该页面倒计时结束或者请求超时会跳转在该页面申请权限体验不好 //在开屏时候申请不太合适因为该页面倒计时结束或者请求超时会跳转在该页面申请权限体验不好
// TTAdManagerHolder.getInstance(this).requestPermissionIfNecessary(this); // TTAdManagerHolder.getInstance(this).requestPermissionIfNecessary(this);
@ -173,11 +182,12 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler {
* 跳转到主页面 * 跳转到主页面
*/ */
private void goToMainActivity() { private void goToMainActivity() {
if( !getIntent().hasExtra(EXTR_LUNCHER)){
Intent intent = new Intent(SplashActivity.this, Main2Activity.class); Intent intent = new Intent(SplashActivity.this, Main2Activity.class);
startActivity(intent); startActivity(intent);
if(mSplashContainer!=null) {
mSplashContainer.removeAllViews();
} }
mSplashContainer.removeAllViews();
SplashAdManager.clearPages(); SplashAdManager.clearPages();
this.finish(); this.finish();
} }

View File

@ -25,7 +25,9 @@ public class TTAdManagerHolder {
} }
public static void init(Context context) { public static void init(Context context) {
doInit(context); if( Constants.SHOWAD) {
doInit(context);
}
} }
//step1:接入网盟广告sdk的初始化操作详情见接入文档和穿山甲平台说明 //step1:接入网盟广告sdk的初始化操作详情见接入文档和穿山甲平台说明

View File

@ -33,6 +33,7 @@ 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.TTInteractionAd;
import com.bytedance.sdk.openadsdk.TTNativeAd; import com.bytedance.sdk.openadsdk.TTNativeAd;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.novelbook.android.AD.toutiao.TTAdManagerHolder; import com.novelbook.android.AD.toutiao.TTAdManagerHolder;
@ -44,6 +45,7 @@ import com.novelbook.android.netutils.NetUtil;
import com.novelbook.android.upgrade.UpdateManager; import com.novelbook.android.upgrade.UpdateManager;
import com.novelbook.android.utils.CommonUtil; import com.novelbook.android.utils.CommonUtil;
import com.novelbook.android.utils.Constants;
import com.novelbook.android.utils.ImageUtil; import com.novelbook.android.utils.ImageUtil;
import com.novelbook.android.utils.OnItemClickListener; import com.novelbook.android.utils.OnItemClickListener;
@ -331,16 +333,32 @@ public abstract class Activity_base extends AppCompatActivity {
Button mCreativeButton; Button mCreativeButton;
TTAdNative mTTAdNative; TTAdNative mTTAdNative;
void initAD_TouTiao(){ void initAD_TouTiao(){
mTTAdNative = TTAdManagerHolder.get().createAdNative(this); if(Constants.SHOWAD)
//step3:(可选强烈建议在合适的时机调用):申请部分权限如read_phone_state,防止获取不了imei时候下载类广告没有填充的问题 try {
TTAdManagerHolder.get().requestPermissionIfNecessary(this); mTTAdNative = TTAdManagerHolder.get().createAdNative(this);
this.mAQuery = new AQuery2(this); //step3:(可选强烈建议在合适的时机调用):申请部分权限如read_phone_state,防止获取不了imei时候下载类广告没有填充的问题
TTAdManagerHolder.get().requestPermissionIfNecessary(this);
this.mAQuery = new AQuery2(this);
}catch (Exception er){
Log.e(TAG, "initAD_TouTiao: ", er);
}
} }
//----toutiao ad ----
TTAdNative getTTAdNative(){
if(mTTAdNative== null){
if(Constants.SHOWAD){
TTAdManagerHolder.init(MyApp.applicationContext);
initAD_TouTiao();
}
}
return mTTAdNative;
}
//----toutiao ad ----
boolean mShowAd =false;
public void loadBannerAd(FrameLayout bannerContainer, String codeId, int width, int height) { public void loadBannerAd(FrameLayout bannerContainer, String codeId, int width, int height) {
//step4:创建广告请求参数AdSlot,具体参数含义参考文档 //step4:创建广告请求参数AdSlot,具体参数含义参考文档
if(!Constants.SHOWAD || getTTAdNative()==null ){return;}
/* if(height >390){ /* if(height >390){
width =(int)(height*1.78); width =(int)(height*1.78);
@ -351,9 +369,9 @@ public abstract class Activity_base extends AppCompatActivity {
}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;
Log.d(TAG, String.format("loadBannerAd:finial width %s, height %s ",width,height)); Log.d(TAG, String.format("loadBannerAd:finial width %s, height %s ",width,height));
AdSlot adSlot = new AdSlot.Builder() AdSlot adSlot = new AdSlot.Builder()
.setCodeId(codeId) //广告位id .setCodeId(codeId) //广告位id
@ -361,18 +379,19 @@ public abstract class Activity_base extends AppCompatActivity {
.setImageAcceptedSize(width, height) .setImageAcceptedSize(width, height)
.build(); .build();
//step5:请求广告对请求回调的广告作渲染处理 //step5:请求广告对请求回调的广告作渲染处理
mTTAdNative.loadBannerAd(adSlot, new TTAdNative.BannerAdListener() { getTTAdNative().loadBannerAd(adSlot, new TTAdNative.BannerAdListener() {
@Override @Override
public void onError(int code, String message) { public void onError(int code, String message) {
// TToast.show(oContext, "load error : " + code + ", " + message); // TToast.show(oContext, "load error : " + code + ", " + message);
Log.e(TAG, String.format("loadBannerAd:code %s, message %s ", code,message)); Log.e(TAG, String.format("loadBannerAd:code %s, message %s ", code,message));
bannerContainer.removeAllViews(); bannerContainer.removeAllViews();
// bannerContainer.setVisibility(View.GONE);
} }
@Override @Override
public void onBannerAdLoad(final TTBannerAd ad) { public void onBannerAdLoad(final TTBannerAd ad) {
if (ad == null) { if (ad == null ) {
return; return;
} }
View bannerView = ad.getBannerView(); View bannerView = ad.getBannerView();
@ -383,6 +402,9 @@ public abstract class Activity_base extends AppCompatActivity {
ad.setSlideIntervalTime(30 * 1000); ad.setSlideIntervalTime(30 * 1000);
bannerContainer.removeAllViews(); bannerContainer.removeAllViews();
bannerContainer.addView(bannerView); bannerContainer.addView(bannerView);
// bannerContainer.setVisibility(View.VISIBLE);
Log.d(TAG, "loadBannerAd: set banner VISIBLE");
// mTTAdNative.loadBannerAd(adSlot,null);
//设置广告互动监听回调 //设置广告互动监听回调
ad.setBannerInteractionListener(new TTBannerAd.AdInteractionListener() { ad.setBannerInteractionListener(new TTBannerAd.AdInteractionListener() {
@Override @Override
@ -476,6 +498,10 @@ public abstract class Activity_base extends AppCompatActivity {
//-------------native toutiao ad //-------------native toutiao ad
void loadNativeBannerAd(FrameLayout bannerContainer,String codeId) { void loadNativeBannerAd(FrameLayout bannerContainer,String codeId) {
//step4:创建广告请求参数AdSlot,注意其中的setNativeAdtype方法具体参数含义参考文档 //step4:创建广告请求参数AdSlot,注意其中的setNativeAdtype方法具体参数含义参考文档
if(!Constants.SHOWAD || getTTAdNative()==null ){
return;
}
if(bannerContainer==null) return; if(bannerContainer==null) return;
final AdSlot adSlot = new AdSlot.Builder() final AdSlot adSlot = new AdSlot.Builder()
.setCodeId(codeId) .setCodeId(codeId)
@ -486,7 +512,7 @@ public abstract class Activity_base extends AppCompatActivity {
.build(); .build();
//step5:请求广告对请求回调的广告作渲染处理 //step5:请求广告对请求回调的广告作渲染处理
mTTAdNative.loadNativeAd(adSlot, new TTAdNative.NativeAdListener() { getTTAdNative().loadNativeAd(adSlot, new TTAdNative.NativeAdListener() {
@Override @Override
public void onError(int code, String message) { public void onError(int code, String message) {
// TToast.show(oContext, "load error : " + code + ", " + message); // TToast.show(oContext, "load error : " + code + ", " + message);
@ -495,7 +521,7 @@ public abstract class Activity_base extends AppCompatActivity {
@Override @Override
public void onNativeAdLoad(List<TTNativeAd> ads) { public void onNativeAdLoad(List<TTNativeAd> ads) {
if (ads.get(0) == null) { 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);
@ -508,8 +534,11 @@ public abstract class Activity_base extends AppCompatActivity {
} }
bannerContainer.removeAllViews(); bannerContainer.removeAllViews();
bannerContainer.addView(bannerView); bannerContainer.addView(bannerView);
// bannerContainer.setVisibility(View.VISIBLE);
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);
} }
}); });
} }
@ -668,5 +697,89 @@ public abstract class Activity_base extends AppCompatActivity {
public TTAdNative getAdNative(){ public TTAdNative getAdNative(){
return mTTAdNative; return mTTAdNative;
} }
void loadInteractionAd(String codeId) {
//step4:创建插屏广告请求参数AdSlot,具体参数含义参考文档
if(getAdNative()==null){
return;
}
AdSlot adSlot = new AdSlot.Builder()
.setCodeId(codeId)
.setSupportDeepLink(true)
.setImageAcceptedSize(600, 600) //根据广告平台选择的尺寸传入同比例尺寸
.build();
//step5:请求广告调用插屏广告异步请求接口
getAdNative().loadInteractionAd(adSlot, new TTAdNative.InteractionAdListener() {
@Override
public void onError(int code, String message) {
Log.e(TAG, String.format("loadInteractionAd onError: code %s ,message %s",code,message) );
}
@Override
public void onInteractionAdLoad(TTInteractionAd ttInteractionAd) {
// TToast.show(getApplicationContext(), "type: " + ttInteractionAd.getInteractionType());
ttInteractionAd.setAdInteractionListener(new TTInteractionAd.AdInteractionListener() {
@Override
public void onAdClicked() {
Log.d(TAG, "被点击");
// TToast.show(mContext, "广告被点击");
}
@Override
public void onAdShow() {
Log.d(TAG, "被展示");
// TToast.show(mContext, "广告被展示");
}
@Override
public void onAdDismiss() {
Log.d(TAG, "插屏广告消失");
// TToast.show(mContext, "广告消失");
}
});
//如果是下载类型的广告可以注册下载状态回调监听
if (ttInteractionAd.getInteractionType() == TTAdConstant.INTERACTION_TYPE_DOWNLOAD) {
ttInteractionAd.setDownloadListener(new TTAppDownloadListener() {
@Override
public void onIdle() {
Log.d(TAG, "点击开始下载");
// TToast.show(mContext, "点击开始下载");
}
@Override
public void onDownloadActive(long totalBytes, long currBytes, String fileName, String appName) {
Log.d(TAG, "下载中");
// TToast.show(mContext, "下载中");
}
@Override
public void onDownloadPaused(long totalBytes, long currBytes, String fileName, String appName) {
Log.d(TAG, "下载暂停");
// TToast.show(mContext, "下载暂停");
}
@Override
public void onDownloadFailed(long totalBytes, long currBytes, String fileName, String appName) {
Log.d(TAG, "下载失败");
// TToast.show(mContext, "下载失败");
}
@Override
public void onDownloadFinished(long totalBytes, String fileName, String appName) {
Log.d(TAG, "下载完成");
// TToast.show(mContext, "下载完成");
}
@Override
public void onInstalled(String fileName, String appName) {
Log.d(TAG, "安装完成");
// TToast.show(mContext, "安装完成");
}
});
}
//弹出插屏广告
ttInteractionAd.showInteractionAd(oContext);
}
});
}
} }

View File

@ -160,7 +160,13 @@ public class BookActivity extends Activity_base {
tvTonglei.setVisibility(View.GONE); tvTonglei.setVisibility(View.GONE);
tvAuthorMore.setText( ""); tvAuthorMore.setText( "");
initiDownloadReceiver(); initiDownloadReceiver();
loadNativeBannerAd(mBannerContainer,BuildConfig.AD_SLOT_TOUTIAO_BANNER_NATIVE_ID); mShowAd =Constants.SHOWAD;
if(Constants.SHOWAD){
loadNativeBannerAd(mBannerContainer,BuildConfig.AD_SLOT_TOUTIAO_BANNER_NATIVE_ID);
mBannerContainer.setVisibility(View.VISIBLE);
}else{
mBannerContainer.setVisibility(View.GONE);
}
} }
@Override @Override

View File

@ -141,7 +141,7 @@ public abstract class BasicFragment extends Fragment {
initData(); initData();
initViews(); initViews();
initSwipeRefreshLayout(); initSwipeRefreshLayout();
showBanner(mBannerContainer,185); showBanner(mBannerContainer,260);
return view; return view;
// Inflate the layout for this fragment // Inflate the layout for this fragment
@ -458,7 +458,7 @@ void initTabs(){
return; return;
} }
((Main2Activity) activity).loadBannerAd(bannerContainer, BuildConfig.AD_SLOT_TOUTIAO_BANNER_ID, Constants.SCREEN_WIDTH_PIX, adHeight); ((Main2Activity) activity).loadBannerAd(bannerContainer, BuildConfig.AD_SLOT_TOUTIAO_BANNER_ID,600, adHeight);
mBannerContainer.setVisibility(View.VISIBLE); mBannerContainer.setVisibility(View.VISIBLE);
} }

View File

@ -444,7 +444,7 @@ private int bottomSelectedIndex;
// return super.onKeyUp(keyCode, event); // return super.onKeyUp(keyCode, event);
// return false; // return false;
// finish(); finish();
app.exit(); app.exit();
} }
} }

View File

@ -3,6 +3,7 @@ package com.novelbook.android;
import android.app.Activity; import android.app.Activity;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import android.provider.SyncStateContract;
import android.util.Log; import android.util.Log;
import com.bytedance.sdk.openadsdk.TTAdConfig; import com.bytedance.sdk.openadsdk.TTAdConfig;
@ -45,8 +46,10 @@ public class MyApp extends Application {
initAD(); initAD();
} }
private void initialConstants(){ private void initialConstants(){
Config.createConfig(this); Config confg= Config.createConfig(this);
Constants.SEX = Config.getInstance().getSexOption(); Constants.SEX = confg.getSexOption();
Constants.SHOWAD =confg.isShowAd();
Constants.PRE_LOAD_CHAPT =confg.isPreLoadChapter();
} }
private void initUmengApi(){ private void initUmengApi(){
UMConfigure.init(applicationContext,UMConfigure.DEVICE_TYPE_PHONE,null); UMConfigure.init(applicationContext,UMConfigure.DEVICE_TYPE_PHONE,null);
@ -62,9 +65,10 @@ public class MyApp extends Application {
public boolean exit() { public boolean exit() {
removeALLActivity_();
System.exit(-1); System.exit(-1);
removeALLActivity_();
return true; return true;
} }
/** /**

View File

@ -13,6 +13,7 @@ import android.graphics.Typeface;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout; import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
@ -128,6 +129,10 @@ public class ReadActivity extends Activity_base implements AdInterface {
@BindView(R.id.imgLoading) @BindView(R.id.imgLoading)
pl.droidsonroids.gif.GifImageView imgLoading; pl.droidsonroids.gif.GifImageView imgLoading;
@BindView(R.id.native_banner_container )
FrameLayout mNative_banner_container;
private Config config; private Config config;
private WindowManager.LayoutParams lp; private WindowManager.LayoutParams lp;
private Novel book; private Novel book;
@ -873,6 +878,13 @@ public class ReadActivity extends Activity_base implements AdInterface {
@Override @Override
public void showLoading(boolean isShow) { public void showLoading(boolean isShow) {
/* if(!isShow){
try {
throw new Exception("why not show");
} catch (Exception e) {
Log.e(TAG, "showLoading: ",e );
}
}*/
imgLoading.setVisibility(isShow?View.VISIBLE:View.GONE); imgLoading.setVisibility(isShow?View.VISIBLE:View.GONE);
} }
@ -1000,8 +1012,9 @@ public class ReadActivity extends Activity_base implements AdInterface {
@Override @Override
public void showAd(boolean showAd ,int adHeight,int adY) { public void showAd(boolean showAd ,int adHeight,int adY) {
hideSystemUI(); hideSystemUI(); mShowAd =showAd;
mBannerContainer.setVisibility(View.GONE); mBannerContainer.setVisibility(View.GONE);
mNative_banner_container.setVisibility(View.GONE);
if(!Constants.SHOWAD){ if(!Constants.SHOWAD){
return; return;
} }
@ -1018,17 +1031,21 @@ public class ReadActivity extends Activity_base implements AdInterface {
// Log.d(TAG, String.format("loadBannerAd:width %s, height %s ,adY %s",Constants.SCREEN_WIDTH_PIX-50,adHeight,adY)); // Log.d(TAG, String.format("loadBannerAd:width %s, height %s ,adY %s",Constants.SCREEN_WIDTH_PIX-50,adHeight,adY));
if(adHeight>500 && adY <500){ if(adHeight>500 && adY <500){
loadNativeBannerAd(mBannerContainer,BuildConfig.AD_SLOT_TOUTIAO_BANNER_NATIVE_ID); loadNativeBannerAd(mNative_banner_container,BuildConfig.AD_SLOT_TOUTIAO_BANNER_NATIVE_ID);
params.setMargins(20, adY-30, 20, 50); params.setMargins(20, adY-30, 20, 150);
mNative_banner_container.setLayoutParams(params);
mNative_banner_container.setVisibility(View.VISIBLE);
}else }else
{ {
loadBannerAd(mBannerContainer,BuildConfig.AD_SLOT_TOUTIAO_BANNER_ID, Constants.SCREEN_WIDTH_PIX-50,adHeight); loadBannerAd(mBannerContainer,BuildConfig.AD_SLOT_TOUTIAO_BANNER_ID, Constants.SCREEN_WIDTH_PIX-50,adHeight);
params.setMargins(20, adY-10, 20, 15); params.setMargins(20, adY-10, 20, 15);
mBannerContainer.setLayoutParams(params);
mBannerContainer.setVisibility(View.VISIBLE);
} }
mBannerContainer.setLayoutParams(params);
mBannerContainer.setVisibility(View.VISIBLE);
} }
} }

View File

@ -470,6 +470,9 @@ 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) ){
return;
}
int p = mDatas.size()>3?3:0; int p = mDatas.size()>3?3:0;
mDatas.addAll(p, items); mDatas.addAll(p, items);
notifyDataSetChanged(); notifyDataSetChanged();

View File

@ -10,6 +10,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.BookActivity; import com.novelbook.android.BookActivity;
import com.novelbook.android.Main2Activity; import com.novelbook.android.Main2Activity;
import com.novelbook.android.MyApp; import com.novelbook.android.MyApp;
@ -371,6 +372,9 @@ public class NetUtil {
Constants.AD_SPLASH_INVTERVAL =(long) 1000 * ads.getInt("splashInterval"); Constants.AD_SPLASH_INVTERVAL =(long) 1000 * ads.getInt("splashInterval");
Constants.AD_SPLASH_PAGES = ads.getInt("splashPageCount"); Constants.AD_SPLASH_PAGES = ads.getInt("splashPageCount");
Log.d(TAG, String.format("initHostConstants: Constants.AD_SPLASH_INVTERVAL %s,AD_SPLASH_PAGES %s",Constants.AD_SPLASH_INVTERVAL,Constants.AD_SPLASH_PAGES )); Log.d(TAG, String.format("initHostConstants: Constants.AD_SPLASH_INVTERVAL %s,AD_SPLASH_PAGES %s",Constants.AD_SPLASH_INVTERVAL,Constants.AD_SPLASH_PAGES ));
// try { // try {
Constants.version = CommonUtil.getVersionCode(MyApp.applicationContext); Constants.version = CommonUtil.getVersionCode(MyApp.applicationContext);
@ -382,6 +386,21 @@ public class NetUtil {
// }catch (Exception er){ // }catch (Exception er){
// Log.e(TAG, "initHostConstants: update error ",er ); // Log.e(TAG, "initHostConstants: update error ",er );
// } // }
if( ads.getBoolean("showAdsense")){
if(!Constants.SHOWAD ){
Constants.SHOWAD = ads.getBoolean("showAdsense");
TTAdManagerHolder.init(MyApp.applicationContext);
}
}
Constants.SHOWAD = ads.getBoolean("showAdsense");
Constants.PRE_LOAD_CHAPT= false;//jsonObject.getBoolean("preLoadChapter");
Config.getInstance().setShowAd(Constants.SHOWAD);
Config.getInstance().setPreLoadChapter(Constants.PRE_LOAD_CHAPT);
Log.d(TAG, String.format("initHostConstants: Constants.AD_SPLASH_INVTERVAL %s,AD_SPLASH_PAGES %s, Constants.SHOWAD %s,Constants.AD_PRE_LOAD_CHAPT %s "
,Constants.AD_SPLASH_INVTERVAL,Constants.AD_SPLASH_PAGES, Constants.SHOWAD, Constants.PRE_LOAD_CHAPT ));
} }
public static void checkUpdate(boolean isSilence){ public static void checkUpdate(boolean isSilence){

View File

@ -1601,7 +1601,7 @@ int muluRetryCount =0;
return error.toCharArray(); return error.toCharArray();
} }
if( Constants.AD_PRE_LOAD_CHAPT) { if( Constants.PRE_LOAD_CHAPT) {
if (mChapters.size() > index && NetUtil.isNetworkConnected()) { if (mChapters.size() > index && NetUtil.isNetworkConnected()) {

View File

@ -40,7 +40,9 @@ public class Config {
public final static int PAGE_MODE_COVER = 1; public final static int PAGE_MODE_COVER = 1;
public final static int PAGE_MODE_SLIDE = 2; public final static int PAGE_MODE_SLIDE = 2;
public final static int PAGE_MODE_NONE = 3; public final static int PAGE_MODE_NONE = 3;
public final static boolean SHOW_AD = false;
public final static String SHOW_AD_KEY = "showAd";
private static final String PRE_LOAD_CHAPT_KEY ="preloadchapt" ;
private Context mContext; private Context mContext;
private static Config config; private static Config config;
private SharedPreferences sp; private SharedPreferences sp;
@ -210,5 +212,16 @@ public class Config {
sp.edit().putString(KEY_ROOT_URL,baseUrl).commit(); sp.edit().putString(KEY_ROOT_URL,baseUrl).commit();
} }
public Boolean isShowAd(){
return sp.getBoolean(SHOW_AD_KEY,true);
}
public void setShowAd(boolean isShowAd){
sp.edit().putBoolean(SHOW_AD_KEY,isShowAd).commit();
}
public Boolean isPreLoadChapter(){
return sp.getBoolean(PRE_LOAD_CHAPT_KEY,false);
}
public void setPreLoadChapter(boolean isPreloadChapt){
sp.edit().putBoolean(PRE_LOAD_CHAPT_KEY,isPreloadChapt).commit();
}
} }

View File

@ -13,8 +13,8 @@ public class Constants {
public static final int MAXAGE_MAX =60*60*24*28; //28 ; public static final int MAXAGE_MAX =60*60*24*28; //28 ;
public static final int MAXAGE_MULU = 60*60*24*7*2; //2周;; public static final int MAXAGE_MULU = 60*60*24*7*2; //2周;;
public static final String VERSION_ADDRESS ="version.xml"; public static final String VERSION_ADDRESS ="version.xml";
public static final boolean SHOWAD =true ; public static boolean SHOWAD =false ;
public static boolean AD_PRE_LOAD_CHAPT = false; public static boolean PRE_LOAD_CHAPT = false;
public static long AD_SPLASH_INVTERVAL = 5*60*1000;//间隔5分钟 public static long AD_SPLASH_INVTERVAL = 5*60*1000;//间隔5分钟
public static int AD_SPLASH_PAGES = 15; public static int AD_SPLASH_PAGES = 15;
public static int SCREEN_HEIGHT_PIX =1920 ; public static int SCREEN_HEIGHT_PIX =1920 ;

View File

@ -186,6 +186,8 @@ public class PageFactory implements ChangeSource{
private final int MSG_NEXTPAGE=2; private final int MSG_NEXTPAGE=2;
private final int MSG_HIDEPROGRESS=3; private final int MSG_HIDEPROGRESS=3;
private final int MSG_NEXTPAGE_FAIL=4; private final int MSG_NEXTPAGE_FAIL=4;
private final int MSG_HID_AD=5;
private final int MSG_SHOW_LOADING=5;
public AdInterface getmAd() { public AdInterface getmAd() {
return mAd; return mAd;
} }
@ -233,8 +235,31 @@ public class PageFactory implements ChangeSource{
if(mAd!=null) { if(mAd!=null) {
mAd.showRefresh(View.GONE); mAd.showRefresh(View.GONE);
// mAd.hideProgressbar(); // mAd.hideProgressbar();
mAd.showLoading(false);
mAd.showLoading(false);
Log.d(TAG, "showloading: case MSG_HIDEPROGRESS: false" );
} }
}else if (msg.what == MSG_HID_AD) {
/* Log.d(TAG, "loadBannerAd: set banner gone 0, showingStatusAd " +showingStatusAd);
if(showingStatusAd) {
if (mAd != null) {
mAd.showAd(false, 0, 0);
Log.d(TAG, "loadBannerAd: set banner gone 1");
}
showingStatusAd = false;
Log.d(TAG, "loadBannerAd: set banner gone 2");
}*/
}else if (msg.what == MSG_SHOW_LOADING) {
if(mAd!=null) {
mAd.showLoading(true);
Log.d(TAG, "showloading: case MSG_SHOW_LOADING: true" );
}
} }
} }
Map<Integer,Integer> fileRetryCnt = new HashMap<Integer,Integer>(); Map<Integer,Integer> fileRetryCnt = new HashMap<Integer,Integer>();
@ -327,7 +352,7 @@ public class PageFactory implements ChangeSource{
@Override @Override
public void run() { public void run() {
Log.d(TAG, String.format("prepare book to download chapter %s ,thread.name %s",chid,Thread.currentThread().getName() ) ); Log.d(TAG, String.format("prepare book to download chapter %s ,thread.name %s",chid,Thread.currentThread().getName() ) );
mBookUtil.chaptChars(chid); //TODO: 读取到上一章block后,file还是不存在的现在就死循环了 fixed mBookUtil.chaptChars(chid);
super.run(); super.run();
}}.start(); }}.start();
@ -392,7 +417,7 @@ public class PageFactory implements ChangeSource{
void preReadChaptCache(final int chaptId){ void preReadChaptCache(final int chaptId){
if(!Constants.AD_PRE_LOAD_CHAPT){ if(!Constants.PRE_LOAD_CHAPT){
return; return;
} }
if(chaptMap==null) { if(chaptMap==null) {
@ -552,6 +577,7 @@ public class PageFactory implements ChangeSource{
case SERVERERROR:return true; case SERVERERROR:return true;
case CHANGESOURCE:return false; case CHANGESOURCE:return false;
case NETWORKFAILE:return true; case NETWORKFAILE:return true;
case LASTPAGE:return true;
} }
return false; return false;
} }
@ -583,7 +609,8 @@ public class PageFactory implements ChangeSource{
NETWORKFAILE, NETWORKFAILE,
SERVERERROR, SERVERERROR,
CHANGESOURCE , CHANGESOURCE ,
LOCALFAIL; LOCALFAIL,
LASTPAGE;
} }
private void hideSysUI(){ private void hideSysUI(){
if(mAd!=null){ if(mAd!=null){
@ -722,20 +749,24 @@ private void hideSysUI(){
hideSysUI(); hideSysUI();
mAd.showRefresh(View.VISIBLE); mAd.showRefresh(View.VISIBLE);
mAd.hideProgressbar(); mAd.hideProgressbar();
mAd.showLoading(false); // mAd.showLoading(false);
String status = ""; String status = "";
boolean showAd =true;
switch (mStatus){ switch (mStatus){
case OPENING: case OPENING:
status = "正在拼命加载" + loadingTxt; status = "正在拼命加载" + loadingTxt;
mAd.showRefresh(View.GONE); mAd.showRefresh(View.GONE);
// mAd.showProgressbar(false,status); // mAd.showProgressbar(false,status);
mAd.showLoading(true); mAd.showLoading(true);
Log.d(TAG, "showloading: case OPENING: true" );
//handler.sendEmptyMessage(MSG_SHOW_LOADING);
// showProgressDialog(); // showProgressDialog();
break; break;
case FAIL: case FAIL:
status = "读取错误,请稍后重试"; status = "读取错误,请稍后重试";
mAd.showRefresh(View.VISIBLE); mAd.showRefresh(View.VISIBLE);
mAd.showReadSetting(); mAd.showReadSetting();
mAd.showLoading(false);
try { try {
throw new Exception("error on reading"); throw new Exception("error on reading");
} catch (Exception e) { } catch (Exception e) {
@ -744,25 +775,43 @@ private void hideSysUI(){
} }
break; break;
case NETWORKFAILE: case NETWORKFAILE:
mAd.showLoading(false);
Log.d(TAG, "showloading: case NETWORKFAILE: false" );
showAd =false;
status = "请开启网络"; status = "请开启网络";
break; break;
case SERVERERROR: case SERVERERROR:
mAd.showLoading(false);
Log.d(TAG, "showloading: case SERVERERROR: false" );
status = "服务器故障"; status = "服务器故障";
break; break;
case FINISH: case FINISH:
mAd.showLoading(false);
Log.d(TAG, "showloading: case FINISH: false" );
status = "加载成功"; status = "加载成功";
mAd.showRefresh(View.GONE); mAd.showRefresh(View.GONE);
mAd.hideProgressbar(); mAd.hideProgressbar();
showAd =false;
break; break;
case CHANGESOURCE: case CHANGESOURCE:
mAd.showLoading(true);
Log.d(TAG, "showloading: case CHANGESOURCE: true" );
status = statusChangeSource; status = statusChangeSource;
mAd.showRefresh(View.GONE); mAd.showRefresh(View.GONE);
break; break;
case LOCALFAIL: case LOCALFAIL:
mAd.showLoading(false);
Log.d(TAG, "showloading: case LOCALFAIL: false" );
status = "本地缓存加载错误"; status = "本地缓存加载错误";
mAd.showRefresh(View.GONE); mAd.showRefresh(View.GONE);
break; break;
case LASTPAGE:
status = "看完了,没有了";
mAd.showRefresh(View.GONE);
mAd.showLoading(false);
Log.d(TAG, "showloading: case LASTPAGE: false" );
break;
} }
Canvas c = new Canvas(bitmap); Canvas c = new Canvas(bitmap);
@ -787,7 +836,7 @@ private void hideSysUI(){
StaticLayout myStaticLayout = new StaticLayout(status, tp, c.getWidth(), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false); StaticLayout myStaticLayout = new StaticLayout(status, tp, c.getWidth(), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
myStaticLayout.draw(c);*/ myStaticLayout.draw(c);*/
mBookPageWidget.postInvalidate();
// hideSysUI(); // hideSysUI();
/* float adHeight = mHeight - baseline -marginHeight-statusMarginBottom-30; /* float adHeight = mHeight - baseline -marginHeight-statusMarginBottom-30;
float adY =targetRect.top +10;*/ float adY =targetRect.top +10;*/
@ -795,15 +844,52 @@ private void hideSysUI(){
float adHeight = baseline -100; float adHeight = baseline -100;
float adY =targetRect.top +250; float adY =targetRect.top +250;
if(showAd)
while(!showingStatusAd || new Date().getTime() - showStatusAdTime > 2000) { while(!showingStatusAd || new Date().getTime() - showStatusAdTime > 2000) {
showingStatusAd =true; showingStatusAd =true;
showStatusAdTime = new Date().getTime(); showStatusAdTime = new Date().getTime();
showAd((int) adHeight, (int) adY); showAd((int) adHeight, (int) adY);
Log.d(TAG, "loadBannerAd: AD is requested"); Log.d(TAG, "loadBannerAd: AD is requested, mStatus:" +mStatus);
} }
if (mStatus==Status.OPENING ) {
String url = mBookUtil.getChapter(currentChapter).getChapterUrl();
if(!TextUtils.isEmpty(url)) {
if(url.length()>100)
url =url.substring(0,100);
waitPaint.setTextSize(mContext.getResources().getDimension(R.dimen.reading_medu_text_size));// 字体大小
waitPaint.setColor(getTextColor());
waitPaint.setTextAlign(Paint.Align.CENTER);
targetRect = new Rect(0, 0, mWidth, mHeight);
fontMetrics = waitPaint.getFontMetricsInt();
baseline = baseline +150;
// 下面这行是实现水平居中drawText对应改为传入targetRect.centerX()
waitPaint.setTextAlign(Paint.Align.CENTER);
c.drawText("转向第三方网站 " + getSite().getName() , targetRect.centerX(), baseline, waitPaint);
baseline+=40;
c.drawText(url , targetRect.centerX(), baseline, waitPaint);
String chaptName= mBookUtil.getChapter(currentChapter).getChapterName();
if(!TextUtils.isEmpty(chaptName)) {
if(chaptName.length()>100)
chaptName =chaptName.substring(0,100);
chaptName ="正为您搜索加载 " +chaptName +" ...";
baseline = 80;
// 下面这行是实现水平居中drawText对应改为传入targetRect.centerX()
waitPaint.setTextAlign(Paint.Align.CENTER);
c.drawText(chaptName, targetRect.centerX(), baseline, waitPaint);
}
}
}
mBookPageWidget.postInvalidate();
} }
@ -813,9 +899,19 @@ private void hideSysUI(){
public void onDraw(Bitmap bitmap,List<String> m_lines,Boolean updateChapter,Boolean showAd) { public void onDraw(Bitmap bitmap,List<String> m_lines,Boolean updateChapter,Boolean showAd) {
hideSysUI(); hideSysUI();
// mAd.showRefresh(View.GONE); // mAd.showRefresh(View.GONE);
if(m_lines.size()==0){ if(m_lines.size()==0 ){
return; return;
} }
/* Log.d(TAG, "showloading: ondraw showAd: " +showAd );
try{
throw new Exception("showloading: ondraw mStatus: " +mStatus );
}catch (Exception e){
Log.e(TAG, "showloading: ", e);
}*/
if(showAd && mAd!=null){
handler.sendEmptyMessage(MSG_HID_AD);
handler.sendEmptyMessage(MSG_HIDEPROGRESS);
}
mStatus =Status.FINISH; mStatus =Status.FINISH;
// Log.d(TAG, String.format(" prepare book onDraw chapter %s, getChapters().size() %s ",currentChapter ,getChapters().size() ) ); // Log.d(TAG, String.format(" prepare book onDraw chapter %s, getChapters().size() %s ",currentChapter ,getChapters().size() ) );
if (getChapters().size() > 0 && updateChapter) { if (getChapters().size() > 0 && updateChapter) {
@ -825,11 +921,10 @@ private void hideSysUI(){
} }
// Log.d(TAG, String.format(" prepare book onDraw chapter _____________ %s ",currentChapter ) ); // Log.d(TAG, String.format(" prepare book onDraw chapter _____________ %s ",currentChapter ) );
showingStatusAd =false;
if(mAd!=null){
handler.sendEmptyMessage(MSG_HIDEPROGRESS);
}
//更新数据库进度 //更新数据库进度
if ( mStatus ==Status.FINISH && currentPage != null && getNovel() != null) { if ( mStatus ==Status.FINISH && currentPage != null && getNovel() != null) {
@ -1048,14 +1143,21 @@ private void hideSysUI(){
if(mBookPageWidget==null){ if(mBookPageWidget==null){
return; return;
} }
Log.d(TAG, " prePage() onDraw: mBookPageWidget.getCurPage() "); if(mStatus ==Status.LASTPAGE) {
onDraw(mBookPageWidget.getCurPage(),currentPage.getLines(),true,false); onDraw(mBookPageWidget.getCurPage(),currentPage.getLines(),true,false);
currentPage = getPrePage(); if(mBookPageWidget==null){
if(mBookPageWidget==null){ return;
return; }
Log.d(TAG, " prePage() onDraw: mBookPageWidget.getNextPage() ");
onDraw(mBookPageWidget.getNextPage(),currentPage.getLines(),true,true);
}else{
if(mBookPageWidget==null){
return;
}
Log.d(TAG, " prePage() onDraw: mBookPageWidget.getNextPage() ");
currentPage = getPrePage();
onDraw(mBookPageWidget.getNextPage(),currentPage.getLines(),true,true);
} }
Log.d(TAG, " prePage() onDraw: mBookPageWidget.getNextPage() ");
onDraw(mBookPageWidget.getNextPage(),currentPage.getLines(),true,true);
} }
@ -1114,8 +1216,11 @@ private void hideSysUI(){
} }
m_islastPage =currentChapter == mBookUtil.getChapters().size();// ||mBookUtil.getChapters().size()==0; m_islastPage =currentChapter == mBookUtil.getChapters().size();// ||mBookUtil.getChapters().size()==0;
if ( m_islastPage){ if ( m_islastPage){
Toast.makeText(mContext, "已经是最后一页了", Toast.LENGTH_SHORT).show();
currentPage(false); Toast.makeText(mContext, "已经是最后一页了", Toast.LENGTH_SHORT).show();
mStatus = Status.LASTPAGE;
drawStatus();
// currentPage(false);
return; return;
} else { } else {
@ -1173,7 +1278,9 @@ private void hideSysUI(){
} }
}else{ }else{
Log.d(TAG, "prepare book: has been prepared, return.... " + book.getName()); Log.d(TAG, "prepare book: has been prepared, return.... " + book.getName());
return; if(mBookUtil!=null) {
return;
}
} }
} }
@ -1198,7 +1305,7 @@ private void hideSysUI(){
if(book.isLocalBook()){ //离线书籍重新初始化加载mBookUtil if(book.isLocalBook()){ //离线书籍重新初始化加载mBookUtil
mBookUtil = new BookUtil(); mBookUtil = new BookUtil();
mBookUtil.setNovel(book); mBookUtil.setNovel(book);
}else if(getNovle()==null){ }else if(mBookUtil ==null || getNovle()==null){
Log.d(TAG, "prepare book: preparing in openBook method" + book.getName()); Log.d(TAG, "prepare book: preparing in openBook method" + book.getName());
prepareBook(book); prepareBook(book);
} }

View File

@ -45,8 +45,8 @@
/> />
<pl.droidsonroids.gif.GifImageView <pl.droidsonroids.gif.GifImageView
android:id="@+id/imgLoading" android:id="@+id/imgLoading"
android:layout_width="35dp" android:layout_width="30dp"
android:layout_height="35dp" android:layout_height="30dp"
android:src="@mipmap/loading" android:src="@mipmap/loading"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:layout_gravity="center_horizontal|bottom" android:layout_gravity="center_horizontal|bottom"
@ -76,10 +76,17 @@
</LinearLayout>--> </LinearLayout>-->
<FrameLayout
style="@style/frmBannerContainer"
android:layout_height="wrap_content"
android:id="@+id/banner_container"
android:visibility="gone"
/>
<FrameLayout <FrameLayout
style="@style/frmBannerContainer" style="@style/frmBannerContainer"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/banner_container" android:id="@+id/native_banner_container"
android:visibility="gone"
/> />
</FrameLayout> </FrameLayout>

View File

@ -25,6 +25,8 @@
<dimen name="reading_default_text_size">20sp</dimen> <dimen name="reading_default_text_size">20sp</dimen>
<!-- 书本字体最小大小 --> <!-- 书本字体最小大小 -->
<dimen name="reading_min_text_size">10sp</dimen> <dimen name="reading_min_text_size">10sp</dimen>
<!-- 书本字体中大小 -->
<dimen name="reading_medu_text_size">12sp</dimen>
<!-- 书本字体最大大小 --> <!-- 书本字体最大大小 -->
<dimen name="reading_max_text_size">30sp</dimen> <dimen name="reading_max_text_size">30sp</dimen>
<!-- 设置行高 --> <!-- 设置行高 -->

View File

@ -451,10 +451,11 @@
</style> </style>
<style name="frmBannerContainer"> <style name="frmBannerContainer">
<item name="android:layout_width">match_parent</item> <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">50dp</item> <item name="android:layout_height">50dp</item>
<item name="android:layout_centerInParent">true</item> <item name="android:layout_centerInParent">true</item>
<item name="android:background">@color/mintcream</item> <item name="android:background">@color/mintcream</item>
<item name="android:visibility">gone</item>
</style> </style>

View File

@ -104,14 +104,19 @@
<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/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/manifest-checker" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged-not-compiled-resources" />
<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_manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
<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/proguard-files" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard-rules" />
<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/res_stripped" />
<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/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" />
@ -121,6 +126,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
<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" />