调整广告,修复bug

This commit is contained in:
mwang 2019-06-14 00:24:34 +08:00
parent a06e45c303
commit 8204477341
33 changed files with 454 additions and 216 deletions

View File

@ -17,8 +17,8 @@ android {
applicationId "com.novelbook.android"
minSdkVersion 19 //target 19 Android 4.4 4.1%
targetSdkVersion 28
versionCode 5
versionName "5.0"
versionCode 6
versionName "6.0"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@ -40,13 +40,7 @@ android {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "String", "MAIN_HOST", '"http://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","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"'*/
// buildConfigField "String", "API_HOST", '""'
// buildConfigField "String", "CHANNEL",'"DEBUG"'
versionNameSuffix "-debug"
minifyEnabled false
zipAlignEnabled false
@ -79,23 +73,25 @@ android {
}
}
//
/*productFlavors {
/* productFlavors {
// googleplay {}
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\\"]}"'
applicationId "com.zhushou.wangshu"
versionName "v1.0"
buildConfigField "String", "MAIN_HOST", '"http://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","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"'
}
qq {
applicationId "com.zhushou.wangshu"
versionName "v1.0"
buildConfigField "String", "MAIN_HOST", '"http://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", '""'
*//* kuan {
}
*//*kuan {
applicationId "com.novelbook.android"
versionName "v-kuan-1.0"
buildConfigField "String", "MAIN_HOST", '"http://xiaoshuofenxiang.com/api/"'
@ -111,14 +107,7 @@ android {
//buildConfigField "String", "API_HOST", '""'
buildConfigField "String", "CHANNEL",'"xiaomi"'
}
qq {
applicationId "com.novelbook.android.qq"
versionName "v-qq-1.0"
buildConfigField "String", "MAIN_HOST", '"http://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", '""'
}
qxs {
applicationId "com.novelbook.android.qxs"
versionName "v-qxs-5.0"

View File

@ -111,16 +111,28 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(!Constants.AD_SETTING.isShowAdsense() ||!Constants.AD_SETTING.getSplash().isShow() ){
boolean isGoToMain= getIntent().getBooleanExtra(EXTR_LUNCHER,true);
if(!Constants.AD_SETTING.isShowAdsense() ||isGoToMain && !Constants.AD_SETTING.getSplash().isShow() ){
goToMainActivity();
return;
}
int rid =R.layout.ad_toutiao_activity_splash;
if(Constants.AD_SETTING.getSplash().getSource() == Constants.AD_TENCENT_QQ ){
int splashSource=Constants.AD_TENCENT_QQ;
if(isGoToMain) {
if (Constants.AD_SETTING.getSplash().getSource() == Constants.AD_TENCENT_QQ) {
rid = R.layout.ad_qq_activity_splash;
}else if(Constants.AD_SETTING.getSplash().getSource() == Constants.AD_TOUTIAO ){
} else if (Constants.AD_SETTING.getSplash().getSource() == Constants.AD_TOUTIAO) {
rid = R.layout.ad_toutiao_activity_splash;
splashSource=Constants.AD_TOUTIAO;
}
}else{
if (Constants.AD_SETTING.getSplash2().getSource() == Constants.AD_TENCENT_QQ) {
rid = R.layout.ad_qq_activity_splash;
} else if (Constants.AD_SETTING.getSplash2().getSource() == Constants.AD_TOUTIAO) {
// rid = R.layout.ad_toutiao_activity_splash;
goToMainActivity();
return;
}
}
setContentView(rid);
@ -142,7 +154,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
);
tvTitle.setText(R.string.app_name);
//加载开屏广告
if(Constants.AD_SETTING.getSplash().getSource() == Constants.AD_TOUTIAO ) {
if(splashSource == Constants.AD_TOUTIAO ) {
mHandler.sendEmptyMessageDelayed(MSG_GO_MAIN, AD_TIME_OUT);
//step2:创建TTAdNative对象
try {
@ -152,7 +164,7 @@ public class SplashActivity extends Activity implements WeakHandler.IHandler, Sp
return;
}
loadSplashAd();
}else if(Constants.AD_SETTING.getSplash().getSource() == Constants.AD_TENCENT_QQ ){
}else if(splashSource == Constants.AD_TENCENT_QQ ){
if (Build.VERSION.SDK_INT >= 23) {
checkAndRequestPermission();
} else {

View File

@ -135,7 +135,7 @@ public class SplashAdManager implements Application.ActivityLifecycleCallbacks,
return false;
}
long in = new Date().getTime() -lastAd;
int interVal =60000;//Constants.AD_SETTING.getSplash2().getInterval4Display()*1000;
int interVal = Constants.AD_SETTING.getSplash2().getInterval4Display()*1000;
Log.d("zzr", "canShowAd: interval is, " +in + ", canshow? "+ (in >interVal));
return in >interVal;
}
@ -146,7 +146,8 @@ public class SplashAdManager implements Application.ActivityLifecycleCallbacks,
public static void plusPage(Activity activity){
pages++;
if(pages >Constants.AD_SETTING.getSplash2().getPageCount4Display()){
showInterAd(activity);
clearPages();
showSplashAd(activity);
}
}

View File

@ -49,7 +49,7 @@ static final String TAG = ActivitySetup.class.getSimpleName();
public void run() {
super.run();
mVersion =CommonUtil.getVersion(ActivitySetup.this);
mCacheSize =FileUtils.getCachedSize();
mCacheSize =FileUtils.getFormatedCachedSize() ;
handler.sendEmptyMessage(1);
}
}.start() ;
@ -66,12 +66,16 @@ static final String TAG = ActivitySetup.class.getSimpleName();
}
@Override
public void fillData() {
tvVersion.setText(mVersion);
tvCache.setText(mCacheSize);
if(mCacheSize.equals("0.00B")){
tvCache.setText(R.string.noCache);
}
}
@ -85,6 +89,11 @@ static final String TAG = ActivitySetup.class.getSimpleName();
startActivity(intent);
break;
case R.id.llCache:
if(mCacheSize.equals("0.00B")){
return;
}
final AlertDialog.Builder normalDialog =
new AlertDialog.Builder(ActivitySetup.this);
@ -98,8 +107,9 @@ static final String TAG = ActivitySetup.class.getSimpleName();
stopService(intent);
FileUtils.clearCache();
LitePal.deleteAll(DownloadTask.class);
tvCache.setText(FileUtils.getCachedSize());
mCacheSize="0.00B";
//tvCache.setText(FileUtils.getFormatedCachedSize());
tvCache.setText(R.string.noCache);
}
});
normalDialog.setNegativeButton("取消",
@ -144,6 +154,7 @@ static final String TAG = ActivitySetup.class.getSimpleName();
}else if(Constants.serverVersion==-1){
handler.sendEmptyMessage(MSG_VERSION_LATEST);
}
handler.sendEmptyMessage(1000);
}

View File

@ -92,7 +92,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native
private static String TAG ="Activity_base";
private ProgressDialog mProgressDialog;
private MyApp application;
MyApp application;
private Activity_base oContext;
protected Gson gson = new Gson();
protected long mLastBannerTime =0;
@ -179,7 +179,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native
if(mBannerContainer==null){
return;
}
if(Constants.AD_SETTING.isShowAdsense()){
if(Constants.AD_SETTING.isShowAdsense() && Constants.AD_SETTING.getBigBanner().isShow() && NetUtil.isNetworkConnected()){
loadNativeBannerAd();
mBannerContainer.setVisibility(View.VISIBLE);
}else{

View File

@ -153,7 +153,7 @@ public class Activity_cache extends Activity_base {
if( mData.size()>0){
tvMsg.setText(String.format("共有%s条下载记录",mData.size()));
}else{
tvMsg.setText("您还没有没有缓存过小说");
tvMsg.setText(R.string.noRecord);
}
}
@ -247,7 +247,7 @@ public class Activity_cache extends Activity_base {
private List<DownloadTask> mDatas = new ArrayList<DownloadTask>();
private OnItemClickLitener mOnItemClickLitener;
private int listItemID;
private String norecord ="还没有下载记录";
// private String norecord ="还没有下载记录";
public CacheAdapter(Context context, List<DownloadTask> mDatas, int listItemID, OnItemClickLitener clickLitener) {
this.context = context;
@ -302,7 +302,7 @@ public class Activity_cache extends Activity_base {
if (hd instanceof EmptyViewHolder) {
EmptyViewHolder holder = ( EmptyViewHolder)hd;
holder.tvEmpty.setVisibility(View.VISIBLE);
holder.tvEmpty.setText(norecord);
holder.tvEmpty.setText(R.string.noRecord);
return;
}
MyViewHolder holder = ( MyViewHolder)hd;

View File

@ -65,11 +65,15 @@ import com.novelbook.android.utils.ImageUtil;
import com.novelbook.android.utils.MyImageLoader;
import com.novelbook.android.utils.OnItemClickListener;
import com.novelbook.android.utils.PageFactory;
import com.qq.e.ads.nativ.ADSize;
import com.qq.e.ads.nativ.NativeADUnifiedListener;
import com.qq.e.ads.nativ.NativeExpressAD;
import com.qq.e.ads.nativ.NativeExpressADView;
import com.qq.e.ads.nativ.NativeUnifiedAD;
import com.qq.e.ads.nativ.NativeUnifiedADData;
import com.qq.e.comm.constants.AdPatternType;
import com.qq.e.comm.util.AdError;
import com.qq.e.comm.util.GDTLogger;
import com.umeng.analytics.MobclickAgent;
import com.youth.banner.loader.ImageLoader;
@ -91,7 +95,7 @@ import static com.novelbook.android.utils.AdUtil.getAppID;
/**
* A simple {@link Fragment} subclass.
*/
public abstract class BasicFragment extends Fragment implements NativeADUnifiedListener {
public abstract class BasicFragment extends Fragment implements /* NativeADUnifiedListener,*/NativeExpressAD.NativeExpressADListener {
private static String TAG = BasicFragment.class.getSimpleName();
protected View rootView;
@ -459,13 +463,14 @@ void initTabs(){
error_try=0;
}
//---------toutiao ad------
//---------banner ad------
public void showBanner( FrameLayout bannerContainer , int adHeight ) {
if(bannerContainer==null){
return;
}
// bannerContainer.setVisibility(View.GONE);
if (!Constants.AD_SETTING.isShowAdsense()) {
if (!Constants.AD_SETTING.isShowAdsense() || !Constants.AD_SETTING.getFixBanner().isShow() || !NetUtil.isNetworkConnected()) {
mBannerContainer.setVisibility(View.GONE);
return;
}
@ -475,7 +480,7 @@ void initTabs(){
}
// qq ad ------------------------------begin
private NativeUnifiedAD mAdManager;
/* private NativeUnifiedAD mAdManager;
private List<NativeUnifiedADData> mAds = new ArrayList<>();
public void loadListAd_qq(BookListAdapter adapter, int adCnt, boolean addFooter) {
if(mAdManager==null) {
@ -488,11 +493,12 @@ void initTabs(){
qqAdapter =adapter;
qqAddFooter=addFooter;
Log.d(TAG, "loadListAd_qq: ad requested");
}
}*/
private boolean qqAddFooter;
private BookListAdapter qqAdapter;
@Override
/* @Override
public void onADLoaded(List<NativeUnifiedADData> ads) {
Log.d(TAG, "loadListAd_qq: ad onADLoaded,qqAddFooter? "+qqAddFooter);
// mIsLoading = false;
@ -506,7 +512,7 @@ void initTabs(){
}else{
qqAdapter.AddHeaderItem(ads);
}
}
}*/
@Override
public void onNoAD(AdError adError) {
Log.d(TAG, "loadListAd_qq: ad onNoAD " );
@ -516,6 +522,88 @@ void initTabs(){
adError.getErrorMsg()));
}
private NativeExpressAD mADManager;
void loadListAd_qq(BookListAdapter adapter, int adCnt, boolean addFooter) {
ADSize adSize = new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT); // 消息流中用AUTO_HEIGHT
mADManager = new NativeExpressAD(activity, adSize, getAppID(Constants.AD_TENCENT_QQ),
Constants.AD_SETTING.getInformationFlow().getSlotId(Constants.AD_TENCENT_QQ), this);
mADManager.setMaxVideoDuration(5);
mADManager.loadAD(adCnt);
qqAdapter =adapter;
qqAddFooter=addFooter;
Log.d(TAG, "loadListAd_qq: ad requested");
}
@Override
public void onADLoaded(List<NativeExpressADView> adList) {
Log.i(TAG, "onADLoaded: " + adList.size());
/* mAdViewList = adList;
for (int i = 0; i < mAdViewList.size(); i++) {
int position = FIRST_AD_POSITION + ITEMS_PER_AD * i;
if (position < mNormalDataList.size()) {
NativeExpressADView view = mAdViewList.get(i);
GDTLogger.i("ad load[" + i + "]: " + getAdInfo(view));
if (view.getBoundData().getAdPatternType() == AdPatternType.NATIVE_VIDEO) {
view.setMediaListener(mediaListener);
}
mAdViewPositionMap.put(view, position); // 把每个广告在列表中位置记录下来
mAdapter.addADViewToPosition(position, mAdViewList.get(i));
}
}
mAdapter.notifyDataSetChanged();*/
if(qqAdapter==null){
return;
}
if(qqAddFooter) {
qqAdapter.AddFooterItem(adList);
}else{
qqAdapter.AddHeaderItem(adList);
}
}
@Override
public void onRenderFail(NativeExpressADView adView) {
Log.i(TAG, "onRenderFail: " + adView.toString());
}
@Override
public void onRenderSuccess(NativeExpressADView adView) {
// Log.i(TAG, "onRenderSuccess: " + adView.toString() + ", adInfo: " + getAdInfo(adView));
}
@Override
public void onADExposure(NativeExpressADView adView) {
Log.i(TAG, "onADExposure: " + adView.toString());
}
@Override
public void onADClicked(NativeExpressADView adView) {
Log.i(TAG, "onADClicked: " + adView.toString());
}
@Override
public void onADClosed(NativeExpressADView adView) {
Log.i(TAG, "onADClosed: " + adView.toString());
/* if (mAdapter != null) {
int removedPosition = mAdViewPositionMap.get(adView);
mAdapter.removeADView(removedPosition, adView);
}*/
}
@Override
public void onADLeftApplication(NativeExpressADView adView) {
Log.i(TAG, "onADLeftApplication: " + adView.toString());
}
@Override
public void onADOpenOverlay(NativeExpressADView adView) {
Log.i(TAG, "onADOpenOverlay: " + adView.toString());
}
@Override
public void onADCloseOverlay(NativeExpressADView adView) {
Log.i(TAG, "onADCloseOverlay");
}
//qq ad end<-------------
/**

View File

@ -453,6 +453,7 @@ public class Fragment_Shelf extends BasicFragment {
@OnClick({R.id.btnSelect, R.id.btnDelete})
void shelfZhengliSubmit(View view) {
if (view.getId() == R.id.btnSelect) {
if (isSelectAll) {
@ -468,7 +469,29 @@ public class Fragment_Shelf extends BasicFragment {
mChkAdapter.notifyDataSetChanged();
} else if (view.getId() == R.id.btnDelete) {
boolean isChecked = false;
for(boolean b :flag){
if(b) {
isChecked = true;
break;
}
}
if(!isChecked){
new AlertDialog.Builder(activity)
.setTitle(this.getString(R.string.app_name))
.setMessage( "您还没有选择要移除的书籍")
.setNegativeButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
return;
}
})
.setCancelable(false).show();
return;
}
new AlertDialog.Builder(activity)
.setTitle(this.getString(R.string.app_name))
.setMessage( "您将从书架移除选中的书籍,是否继续?")
@ -500,15 +523,16 @@ public class Fragment_Shelf extends BasicFragment {
nv.update(nv.getId());
// nv.update(nv.getId()); //not work,,,If you set a default value to a field, the corresponding column won't be updated.
}
bookLists = Novel.getNovelsOnShelf();
flag = new boolean[bookLists.size()];
zhengliShelf();
initData();
// flag = new boolean[bookLists.size()];
// bookLists.remove(i);
}
}
btnSelectAll.setText("全选");
bookLists = Novel.getNovelsOnShelf();
flag = new boolean[bookLists.size()];
zhengliShelf();
initData();
}
})
.setCancelable(false).show();
@ -533,6 +557,27 @@ public class Fragment_Shelf extends BasicFragment {
private void initZhengliDialog() {
if( flag==null || flag.length ==0 ){
flag= new boolean[bookLists.size()];
}
if( flag==null || flag.length ==0 ){
new AlertDialog.Builder(activity)
.setTitle(this.getString(R.string.app_name))
.setMessage( "您书架上还没有书籍可以整理")
.setNegativeButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
return;
}
})
.setCancelable(false).show();
return;
}
zhengliShelf();
llShelfBottom.setVisibility(View.VISIBLE);
Main2Activity main2Activity = (Main2Activity) activity;

View File

@ -192,32 +192,7 @@ public class Fragment_booklist extends BasicFragment {
} else {
mData = new ArrayList<Novel>();
mAdapter = new BookListAdapter(activity, mData, listItem, new OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
if(mData.get(position) instanceof Novel)
showBookDetail((Novel)mData.get(position));
// openBook(mData.get(position),mAdapter);
}
@Override
public void onItemLongClick(View view, int position) {
// initDialog(position);
// mAdapter.removeData(position);
}
@Override
public void onLinearOutClick(View view, int position, int llId) {
Toast.makeText(activity, "book " + position + " clicked",
Toast.LENGTH_SHORT).show();
}
});
mAdapter.setShowFootView(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
mRecyclerView.setAdapter(mAdapter);
initialDataAdapter();
}
}
/* if(mAdapter!=null){
@ -311,6 +286,36 @@ public class Fragment_booklist extends BasicFragment {
}
private void initialDataAdapter() {
mData = new ArrayList<Novel>();
mAdapter = new BookListAdapter(activity, mData, listItem, new OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
if(mData.get(position) instanceof Novel)
showBookDetail((Novel)mData.get(position));
// openBook(mData.get(position),mAdapter);
}
@Override
public void onItemLongClick(View view, int position) {
// initDialog(position);
// mAdapter.removeData(position);
}
@Override
public void onLinearOutClick(View view, int position, int llId) {
Toast.makeText(activity, "book " + position + " clicked",
Toast.LENGTH_SHORT).show();
}
});
mAdapter.setShowFootView(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
mRecyclerView.setAdapter(mAdapter);
}
@Override
public void initViews(){
//mRecyclerView
@ -367,6 +372,7 @@ public class Fragment_booklist extends BasicFragment {
}
void loadHistory(){
initialDataAdapter();
new Thread() {
@Override
public void run() {
@ -374,9 +380,10 @@ public class Fragment_booklist extends BasicFragment {
mMoreData = Novel.getNovelsHistory();
setPageCount(1);
//
handler.sendEmptyMessage(1);
if(mMoreData!=null && mMoreData.size()>2) {
loadListAd(mAdapter, 2, mData.size() > 0);
if(mMoreData!=null && mMoreData.size()>5) {
loadListAd(mAdapter, 1, mData.size() > 0);
}
}
}.start();

View File

@ -60,7 +60,7 @@ import static com.novelbook.android.FileActivity.EXTERNAL_STORAGE_REQ_CODE;
public class Main2Activity extends Activity_base
implements NavigationView.OnNavigationItemSelectedListener{//} , BasicFragment.OnFragmentInteractionListener {
public MyApp app ;
// public MyApp app ;
public static final String TAG =Main2Activity.class.getSimpleName();
// @BindView(R.id.fab)
@ -89,17 +89,18 @@ public class Main2Activity extends Activity_base
public static volatile Activity activityContext = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
NetUtil.getHostPolicy();
super.onCreate(savedInstanceState);
activityContext =this;
//PageFactory.createPageFactory(this);
app =(MyApp) getApplicationContext();
// requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
config =Config.getInstance();
// ButterKnife.bind(this);
initialSexOption();
// checkUpdate(true);
//checkUpdate(true);
CommonUtil.getSearchTabTtitle(this);
DisplayMetrics metric = new DisplayMetrics();
WindowManager wm = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
@ -445,7 +446,7 @@ private int bottomSelectedIndex;
// return super.onKeyUp(keyCode, event);
// return false;
finish();
app.exit();
application.exit();
}
}
try{

View File

@ -101,7 +101,14 @@ public class MyApp extends Application {
if (!oList.contains(activity)) {
oList.add(activity);//把当前Activity添加到集合中
}
currentAct=activity;
}
private static Activity currentAct =null;
public static Activity getCurrentActivity(){
return currentAct;
}
/**

View File

@ -129,8 +129,8 @@ public class ReadActivity extends Activity_base implements AdInterface {
@BindView(R.id.tvUrl)
TextView tvUrl;
// @BindView(R.id.top_banner_container)
// FrameLayout mTopBannerContainer;
@BindView(R.id.top_banner_container)
FrameLayout mTopBannerContainer;
@BindView(R.id.imgLoading)
pl.droidsonroids.gif.GifImageView imgLoading;
@ -1084,6 +1084,10 @@ public class ReadActivity extends Activity_base implements AdInterface {
return tmpFrame;
}
@Override
void initNaviBanner() {
}
public void hideStatusAds(){
/* try{
@ -1131,6 +1135,7 @@ public class ReadActivity extends Activity_base implements AdInterface {
// mBannerContainer.removeAllViews();
// mBannerContainer.setBackgroundResource(R.color.transparent);
hideAdSlot(mBannerContainer);
hideAdSlot(mNative_status_banner_container);
if(height<=0){
return;
}
@ -1138,7 +1143,7 @@ public class ReadActivity extends Activity_base implements AdInterface {
if( adY >390*Constants.ONE_DP_SIZE){
return;
}
hideAdSlot(mTopBannerContainer);
if(mBannerContainer.getChildCount()>0) {
mBannerContainer.removeAllViews();
Log.d(TAG, "loadBannerAd: hideAdSlot()");
@ -1163,21 +1168,26 @@ public class ReadActivity extends Activity_base implements AdInterface {
// mTopBannerContainer.setVisibility(View.INVISIBLE);//翻页引起抖动
//mTopBannerContainer.removeAllViews();
// Log.d(TAG, String.format("loadBannerAd:showTopBanner width %s, height %s ,adY %s ",Constants.SCREEN_WIDTH_PIX-50,adHeight,adY));
tmpFrame =mBannerContainer;
tmpFrame =mTopBannerContainer;
// hideAdSlot(mBannerContainer);
hideAdSlot(mBannerContainer);
hideAdSlot(mNative_status_banner_container);
if(adHeight<=0){
hideAdSlot(mTopBannerContainer);
return;
}
int topMargin = adY >200*Constants.ONE_DP_SIZE ? adY -15*Constants.ONE_DP_SIZE :adY -5*Constants.ONE_DP_SIZE;
Log.d(TAG, String.format("loadBannerAd:showTopBanner width %s, height %s ,adY %s ",Constants.SCREEN_WIDTH_PIX-50,adHeight,adY));
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mBannerContainer.getLayoutParams();
loadBanner(mBannerContainer, Constants.SCREEN_WIDTH_PIX-50,adHeight);
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mTopBannerContainer.getLayoutParams();
loadBanner(mTopBannerContainer, Constants.SCREEN_WIDTH_PIX-50,adHeight);
// loadNativeBannerAd(mTopBannerContainer,BuildConfig.AD_SLOT_TOUTIAO_BANNER_NATIVE_ID, 304,200);
params.setMargins(10*Constants.ONE_DP_SIZE, topMargin, 10*Constants.ONE_DP_SIZE, 0 );
params.width =-1;
params.height = (int) getResources().getDimension(R.dimen.topBannerHeight);
mBannerContainer.setLayoutParams(params);
showAdSlot(mBannerContainer);
mTopBannerContainer.setLayoutParams(params);
showAdSlot(mTopBannerContainer);
}

View File

@ -37,6 +37,7 @@ import com.novelbook.android.utils.CommonUtil;
import com.novelbook.android.utils.ImageUtil;
import com.novelbook.android.utils.MyImageLoader;
import com.novelbook.android.utils.OnItemClickListener;
import com.qq.e.ads.nativ.NativeExpressADView;
import java.util.ArrayList;
import java.util.List;
@ -60,7 +61,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
private static final int ITEM_VIEW_TYPE_SMALL_PIC_AD = 6;
private static final int ITEM_VIEW_TYPE_LARGE_PIC_AD = 7;
private static final int ITEM_VIEW_TYPE_VIDEO = 8;
private static final int ITEM_VIEW_TYPE_QQ_NATIVE_EXPRESS = 9;
// private MyImageLoader loader = new MyImageLoader();
@ -162,9 +163,12 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
return ITEM_VIEW_TYPE_VIDEO;
}
return ITEM_VIEW_TYPE_SMALL_PIC_AD;
}else if(mDatas.get(position) instanceof NativeExpressADView ){
return ITEM_VIEW_TYPE_QQ_NATIVE_EXPRESS;
}
}else if ( position == mDatas.size()) {
}
else if ( position == mDatas.size()) {
//最后一个item设置为footerView
if(!showFootView){
return NO_FOOTER;
@ -201,6 +205,10 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
return new GroupAdViewHolder(mInflater.inflate(R.layout.listitem_ad_group_pic, parent, false));
case ITEM_VIEW_TYPE_VIDEO:
return new VideoAdViewHolder(mInflater.inflate(R.layout.listitem_ad_large_video, parent, false));
case ITEM_VIEW_TYPE_QQ_NATIVE_EXPRESS:
return new QQ_ExpressViewHolder(mInflater.inflate(R.layout.listitem_ad_qq_item_express, parent, false));
default:
return new MyViewHolder( mInflater.inflate(listItemID, parent, false));
}
@ -254,8 +262,27 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
EmptyViewHolder holder = (EmptyViewHolder)hd;
holder.tvEmpty.setVisibility(View.VISIBLE);
holder.tvEmpty.setText(norecord);
}else if (hd instanceof QQ_ExpressViewHolder) {
QQ_ExpressViewHolder holder = (QQ_ExpressViewHolder)hd;
// holder.title.setVisibility(View.VISIBLE);
final NativeExpressADView adView = (NativeExpressADView) mDatas.get(position);
// mAdViewPositionMap.put(adView, position); // 广告在列表中的位置是可以被更新的
if (holder.container.getChildCount() > 0
&& holder.container.getChildAt(0) == adView) {
return;
}
if (holder.container.getChildCount() > 0) {
holder.container.removeAllViews();
}
if (adView.getParent() != null) {
((ViewGroup) adView.getParent()).removeView(adView);
}
holder.container.addView(adView);
adView.render(); // 调用render方法后sdk才会开始展示广告
}
else if (hd instanceof MyViewHolder && mDatas.get(position) instanceof Novel) {
@ -623,6 +650,19 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
super(itemView);
}
}
class QQ_ExpressViewHolder extends RecyclerView.ViewHolder {
// public TextView title;
public ViewGroup container;
public QQ_ExpressViewHolder(View view) {
super(view);
// title = (TextView) view.findViewById(R.id.title);
container = (ViewGroup) view.findViewById(R.id.express_ad_container);
}
}
private void bindData(final AdViewHolder adViewHolder, TTFeedAd ad) {
//可以被点击的view, 也可以把convertView放进来意味item可被点击
List<View> clickViewList = new ArrayList<>();

View File

@ -1,6 +1,9 @@
package com.novelbook.android.bean;
import com.novelbook.android.netutils.NetUtil;
public class AdSetting {
private boolean showAdsense;
private String[] appIds={};
private slot splash = new slot();
private slot splash2 = new slot();
@ -9,10 +12,10 @@ public class AdSetting {
private slot chapterContentBanner = new slot();
private slot chapterEndBanner = new slot();
private slot pop = new slot();
private boolean showAdsense;
private slot fixBanner = new slot();
private slot bigBanner = new slot();
public boolean isShowAdsense() {
return true;//showAdsense;
return showAdsense && NetUtil.isNetworkConnected();
}
public void setShowAdsense(boolean showAdsense) {
@ -51,8 +54,15 @@ public class AdSetting {
return pop;
}
public slot getFixBanner() {
return fixBanner;
}
public class slot{
public slot getBigBanner() {
return bigBanner;
}
public class slot{
private boolean show;
private int source;
private int interval4Display;
@ -71,7 +81,7 @@ public class slot{
}
public boolean isShow() {
return show;
return show && NetUtil.isNetworkConnected();
}
public void setShow(boolean show) {
@ -79,8 +89,8 @@ public class slot{
}
public int getSource() {
// return source;
return 1;
return source;
// return 1;
}
public void setSource(int source) {

View File

@ -7,6 +7,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.drawable.Drawable;
import android.graphics.pdf.PdfDocument;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
@ -28,10 +29,12 @@ import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.novelbook.android.MyApp;
import com.novelbook.android.R;
import com.novelbook.android.ReadActivity;
import com.novelbook.android.db.Novel;
import com.novelbook.android.utils.FileUtils;
import com.novelbook.android.utils.PageFactory;
import org.litepal.LitePal;
@ -644,12 +647,16 @@ public class DirectoryFragment extends Fragment implements View.OnClickListener
for (Novel book : bookLists){
if (book.getNovelPath().equals(bookList.getNovelPath())){
isSave = true;
bookList =book;
break;
}
}
if (!isSave){
bookList.save();
}
// PageFactory.getInstance(MyApp.applicationContext).prepareBook(bookList);
ReadActivity.openBook(bookList, getActivity());
}
}).show();

View File

@ -107,7 +107,7 @@ public class FileChooserActivity extends AppCompatActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.file, menu);
// getMenuInflater().inflate(R.menu.file, menu);
return true;
}

View File

@ -222,7 +222,7 @@ public class HttpMethods {
});
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
//设置 Debug Log 模式
okHttpBuilder.addInterceptor(loggingInterceptor);
// okHttpBuilder.addInterceptor(new RetryInterceptor());

View File

@ -1,6 +1,7 @@
package com.novelbook.android.netutils;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@ -12,6 +13,7 @@ import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.novelbook.android.AD.toutiao.TTAdManagerHolder;
import com.novelbook.android.BookActivity;
import com.novelbook.android.BuildConfig;
import com.novelbook.android.Main2Activity;
import com.novelbook.android.MyApp;
import com.novelbook.android.bean.AdSetting;
@ -317,10 +319,13 @@ public class NetUtil {
String systemVersion = CommonUtil.getSystemVersion();
String deviceBrand = CommonUtil.getDeviceBrand();
String packagenm = CommonUtil.getPackageName(context);
userAgent = "Android/" + versionName + "/"+packagenm+"/" + deviceBrand + "/" + systemModel + "/" + systemVersion;
String channel =CommonUtil.getChannel(context);// BuildConfig.CHANNEL;
userAgent = "Android/" +channel +"/"+ versionName + "/"+packagenm+"/" + deviceBrand + "/" + systemModel + "/" + systemVersion;
return userAgent;
}
public static void getHostPolicy(){
if(isRequestHosts){
return;
@ -432,7 +437,11 @@ public class NetUtil {
}
public static void checkUpdate(boolean isSilence){
UpdateManager manager = new UpdateManager(Main2Activity.activityContext);
Activity currentActivity = MyApp.getCurrentActivity();
if(currentActivity==null){
return;
}
UpdateManager manager = new UpdateManager(currentActivity);
if(isSilence)
manager.checkUpdateSilence();
else

View File

@ -62,6 +62,11 @@ public class RetryInterceptor implements Interceptor {
boolean isMainApi =path.equals("/api/g/");
if(oldUrl.indexOf("xiaoshuofenxiang.com") == -1 || !path.startsWith("/api/") || NetUtil.getHost(isMainApi)==null){
// rh = null;
if(oldUrl.indexOf("xiaoshuofenxiang.com")!=-1) {
Request.Builder requestBuilder = request.newBuilder();
requestBuilder.removeHeader("User-Agent").addHeader("User-Agent", HttpMethods.LOCALUSERAGENT);
request =requestBuilder.build();
}
Response response = doRequest(chain, request);
if(response!=null)
@ -137,7 +142,7 @@ public class RetryInterceptor implements Interceptor {
response = doRequest(chain, newRequest);
Log.d(TAG, String.format("HttpMethods intercept: %s, response is null? %s",newRequest.url(), response == null));
Log.d(TAG, String.format("HttpMethods intercept: %s, response is null? %s, ua %s",newRequest.url(), response == null,newRequest.header("User-Agent")));
/* int i=0;
while((response==null || !response.isSuccessful() )&& i<5){
@ -217,7 +222,7 @@ public class RetryInterceptor implements Interceptor {
private Response doRequest(Chain chain, Request request) throws IOException {
Response response = null;
Log.d(TAG, String.format("HttpMethods ua: %s, ua %s",request.url(), request.header("User-Agent")));
try {
response = chain.proceed(request);
} catch (Exception e) {

View File

@ -331,8 +331,8 @@ public class UpdateManager {
builder.setTitle(R.string.soft_update_title);
}
String upgradeDetails=mHashMap.get("details");
String forceRefresh =isForceRefresh? "本地版本过低,请升级新版本\n":"";
builder.setMessage( forceRefresh +mContext.getPackageName() + "\n当前版本"+getVersionCode(mContext) +"\n"
String forceRefresh =isForceRefresh? "本地版本过低,请升级新版本":"";
builder.setMessage( forceRefresh +/*mContext.getPackageName() +*/ "\n当前版本"+getVersionCode(mContext) +"\n"
+"最新版本:"+ serviceCode +"\n"
+ mContext.getString(R.string.soft_update_info) + upgradeDetails );
builder.setPositiveButton(R.string.soft_update_updatebtn, new OnClickListener()
@ -500,5 +500,6 @@ public class UpdateManager {
mContext.startActivity(i);
exit(-1);
}
}

View File

@ -168,9 +168,9 @@ public class BookUtil {
mChapters = LitePal.where("novelId=?", mNovel.getId() + "").find(Chapter.class);
for (Chapter c : mChapters) {
/* for (Chapter c : mChapters) {
Log.d(TAG, String.format("bookchapter :%s,fileName :%s, chapter Size %s", c.getChapterName(), c.getChapterPath(), c.getLength()));
}
}*/
chaptCache = new HashMap<Integer, Cache>();
if (mChapters.isEmpty()) { //1. 首次打开 本地导入的书

View File

@ -505,7 +505,7 @@ public class CommonUtil {
String date1 = format1.format(new Date(System.currentTimeMillis()));
return date1;// 2012-10-03 23:41:31
}
private String getChannel(Context context) {
public static String getChannel(Context context) {
try {
PackageManager pm = context.getPackageManager();
ApplicationInfo appInfo = pm.getApplicationInfo(getPackageName(context), PackageManager.GET_META_DATA);

View File

@ -122,10 +122,14 @@ public class FileUtils {
public static long getCacheSize(int noveId) {
return Fileutil.getDirSize(getNovelDir(noveId));
}
public static String getCachedSize(){
public static String getFormatedCachedSize(){
File f = new File(BookUtil.chapterPath);
return Fileutil.formatFileSize(Fileutil.getDirSize(f));
}
public static long getCachedSize2(){
File f = new File(BookUtil.chapterPath);
return Fileutil.getDirSize(f) ;
}
public static void clearCache(){
File f = new File(BookUtil.chapterPath);
Fileutil.deleteDir(f);

View File

@ -35,7 +35,7 @@ public class HistoryCache {
Gson gson = new Gson();
List<String> retList = (List)gson.fromJson(history, (new TypeToken<List<String>>() {
}).getType());
if(retList.size()>9){
if(retList!=null && retList.size()>9){
return retList.subList(0,9);
}
return retList;

View File

@ -500,10 +500,10 @@ public class PageFactory implements ChangeSource{
page.setFirstPage(pageNo==1);
page.setPageNo(pageNo);
if(Constants.AD_SETTING.getChapterEndBanner().isShow() && length >=chars.length ){
/* if(Constants.AD_SETTING.getChapterEndBanner().isShow() && length >=chars.length ){
if(page.getLines().size()< mLineCount/2)
page.setBannerHeight(0);
}
}*/
chaptPages.add(page);
// Log.d(TAG, String.format("prepare book build page %s ready for chapter %s,cost %s",pageNo, chaptId,new Date().getTime()-starttime1));
@ -525,8 +525,8 @@ public class PageFactory implements ChangeSource{
// Constants.AD_CHAPT_TOP_BANNER_PER_PAGE_COUNT = 1;
int bannerPagecnt =-20;// Constants.AD_SETTING.getChapterBanner().getPageCount4Display();
int nativeBannerPageCnt =20;// Constants.AD_SETTING.getChapterContentBanner().getPageCount4Display();
int bannerPagecnt = Constants.AD_SETTING.getChapterBanner().getPageCount4Display();
int nativeBannerPageCnt = Constants.AD_SETTING.getChapterContentBanner().getPageCount4Display();
if (Constants.AD_SETTING.getChapterContentBanner().isShow() &&
nativeBannerPageCnt > 0 &&
mNavtiveBannerPlusCnt >= nativeBannerPageCnt) {
@ -547,15 +547,19 @@ public class PageFactory implements ChangeSource{
Log.d(TAG, String.format("getNextChapterPage: pageNo %s, adLines %s,adLine %s, nativeBannerHeight %s",
pageNo, adLines, adLine, trPage.getNativeBannerHeight()));
}
} else if (Constants.AD_SETTING.getChapterBanner().isShow()) {
}
if(trPage.getNativeBannerHeight()==0)
if (Constants.AD_SETTING.getChapterBanner().isShow()) {
if (bannerPagecnt <=0 || mSmallBannerPlusCnt < bannerPagecnt) {
mSmallBannerPlusCnt++;
trPage.setBannerHeight((int) mBannerTopHeight);
} else {
mSmallBannerMinusCnt--;
if (mSmallBannerMinusCnt <= 0) {
if (mSmallBannerMinusCnt < 0) {
mSmallBannerMinusCnt = bannerPagecnt;
}
if (mSmallBannerMinusCnt == 0) {
mSmallBannerPlusCnt = 0;
}
}
@ -921,11 +925,11 @@ private void hideSysUI(){
float adY =targetRect.top +250;
if(showAd)
while(!showingStatusAd || new Date().getTime() - showStatusAdTime > 2000) {
while(!showingStatusAd /*|| new Date().getTime() - showStatusAdTime > 2000*/) {
showingStatusAd =true;
showStatusAdTime = new Date().getTime();
showStatusAd((int) adHeight, (int) adY);
Log.d(TAG, "loadBannerAd: AD is requested, mStatus:" +mStatus);
// showStatusAd((int) adHeight, (int) adY);
// Log.d(TAG, "loadBannerAd: draw status, AD is requested, mStatus:" +mStatus);
}
if (mStatus==Status.OPENING ) {
@ -1086,7 +1090,9 @@ private void hideSysUI(){
mAdY=(int)marginHeight;
mAdType =AdTpye.BANNER;
// mAd.showTopBanner(trPage.getTopBannerHeight(),(int)(marginHeight));
if(trPage.getBannerHeight()==0) {
mAd.showNativeBannerInLines(0,0);//hide ad container
}
// mAd.showNativeBannerInLines(0,0);
// }
@ -1163,13 +1169,19 @@ private void hideSysUI(){
mAdY=(int) (mHeight - statusMarginBottom - trPage.getBannerHeight());
mAdHeight = trPage.getBannerHeight();
mAdType =AdTpye.BANNER;
}else {
}else if(trPage.getPageNo()>1 && trPage.isLastPage() && Constants.AD_SETTING.getChapterEndBanner().isShow()) {
mAdY=(int)adY;
mAdHeight = (int) adHeight;
mAdType = AdTpye.CHAPTEREND;
}
if(trPage.getBannerHeight()==0 || mAdType !=AdTpye.BANNER){
mAd.showTopBanner(0, 0);//清除所有广告
}
// showAd((int) adHeight, (int) adY);
Log.d(TAG, String.format("loadBannerAd: AD is requested, adtype %s, adHeight %s",mAdType,adHeight));
Log.d(TAG, String.format("loadBannerAd: AD is requested, adtype %s, adHeight %s, ady %s",mAdType,adHeight,adY));
}
// Log.d(TAG,String.format("ad + statusMarginBottom %s ",200+ statusMarginBottom));
// Log.d(TAG,String.format("adHeight %s, adY %s",adHeight,adY));
@ -1259,26 +1271,31 @@ private void hideSysUI(){
}
public void showAd(){
if(mStatus == Status.LASTPAGE){
if(mStatus == Status.LASTPAGE || mAd==null){
return;
}
Log.d(TAG, String.format("loadBannerAd showAd: mAdType %s",mAdType));
Log.d(TAG, String.format("loadBannerAd showAd: mAdType %s, pageNo %s",mAdType, currentPage.getPageNo()));
if(mAdType ==AdTpye.BANNER){
mAd.showTopBanner(mAdHeight,mAdY);
}else if(mAdType == AdTpye.NATIVEINLINES){
// mAd.showNativeBannerInLines(0,0);
mAd.showNativeBannerInLines(mAdHeight,mAdY);
}else if(mAdType == AdTpye.CHAPTEREND){
// mAd.showNativeBannerInLines(0,0);
mAd.showNativeBannerInLines(mAdHeight,mAdY);
}else{
mAd.showNativeBannerInLines(0,0);
}
}
private void showStatusAd(int adHeight,int adY) {
boolean showAd = showingStatusAd || getCurrentPage()==null || getCurrentPage().getPageNo() > 1;
boolean showAd = showingStatusAd /*|| getCurrentPage()==null || getCurrentPage().getPageNo() > 1*/;
//Log.d(TAG, String.format("loadBannerAd showStatusAd: mAdType %s",mAdType));
// boolean showAd =true;
if (showAd && mAd != null) {
mAd.showStatusAd(adHeight, adY);
// mAd.showStatusAd(adHeight, adY);
}
@ -1526,6 +1543,7 @@ private void hideSysUI(){
// currentPage = getPageForBegin(begin);
if (mBookPageWidget != null) {
currentPage(true);
showAd();
}
// Log.d(TAG, String.format("prepare book set PageFactory.mStatus %s .",PageFactory.Status.FINISH ) );
// PageFactory.mStatus = PageFactory.Status.FINISH;
@ -1969,6 +1987,9 @@ private void hideSysUI(){
currentPage = getPageForBegin(position);
currentPage(true);
hideSysUI();
if(position>0){
showAd();
}
}
public void retryChapt(int chapNum){
@ -1998,6 +2019,7 @@ private void hideSysUI(){
currentChaptPages = loadCurrentChapt(currentChapter );
currentPage = getPageForBegin(currentPage.getBegin());
currentPage(true);
showAd();
}
//改变字体大小
@ -2010,6 +2032,7 @@ private void hideSysUI(){
currentChaptPages = loadCurrentChapt(currentChapter );
currentPage = getPageForBegin(currentPage.getBegin());
currentPage(true);
showAd();
}
//改变字体

View File

@ -207,12 +207,7 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
<FrameLayout
android:layout_marginTop="1dp"
android:layout_marginBottom="1dp"
style="@style/frmBannerContainer"
android:layout_height="@dimen/nativeBannerHeight"
android:id="@+id/banner_container"/>
<!--
@ -291,7 +286,12 @@
android:nestedScrollingEnabled="false"
android:paddingBottom="2dp"
/>
<FrameLayout
android:layout_marginTop="1dp"
android:layout_marginBottom="1dp"
style="@style/frmBannerContainer"
android:layout_height="@dimen/nativeBannerHeight"
android:id="@+id/banner_container"/>
</LinearLayout>
<LinearLayout style="@style/llGraySplit" />
<LinearLayout

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/express_ad_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"/>
</RelativeLayout>

View File

@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
android:background="@color/white"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="match_parent"
@ -12,6 +12,7 @@
android:orientation="horizontal">
<Button
android:id="@+id/btn_choose_all"
style="@style/setting_dialog_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
@ -20,6 +21,7 @@
android:gravity="center"/>
<Button
android:id="@+id/btn_delete"
style="@style/setting_dialog_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
@ -30,6 +32,7 @@
<Button
android:id="@+id/btn_add_file"
style="@style/setting_dialog_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"

View File

@ -75,7 +75,7 @@
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="160dp"
android:layout_marginBottom="230dp"
android:text="@string/refresh"
android:visibility="gone" />
<!-- <LinearLayout
@ -99,13 +99,15 @@
style="@style/frmBannerContainer"
android:layout_height="@dimen/nativeBannerHeight"
android:visibility="visible"
/> <FrameLayout
/> -->
<FrameLayout
android:id="@+id/top_banner_container"
style="@style/frmBannerContainer"
android:layout_height="@dimen/topBannerHeight"
android:visibility="visible"
/>-->
/>
<FrameLayout
android:id="@+id/banner_container"
style="@style/frmBannerContainer"

View File

@ -53,7 +53,7 @@
<dimen name="_20dp">20dp</dimen>
<dimen name="nativeBannerHeight">280dp</dimen>
<dimen name="one_dp">1dp</dimen>
<dimen name="topBannerHeight">60dp</dimen>
<dimen name="topBannerHeight">55dp</dimen>
<!-- Default screen margins, per the Android Design guidelines. -->

View File

@ -1,5 +1,5 @@
<resources>
<string name="app_name">网书助手</string>
<string name="app_name">网书助手(测试)</string>
<string name="title_home">书架</string>
<string name="title_dashboard">书城</string>
<string name="title_notifications">排行榜</string>
@ -114,7 +114,7 @@
<string name="readseting">设置</string>
<string name="aboutContent">如风小说阅读是专注于提供更舒适的阅读体验,主打本地阅读,操作方式简单易上手,目前支持txt格式。</string>
<string name="noRecord">没有数据</string>
<string name="noRecord">还没有记录</string>
<string name="title_Activity_ChgSource">换源</string>
<string name="_00_00">00.00%</string>
<string name="cached">已缓存</string>
@ -143,48 +143,7 @@
<string name="ad_title">[推广]</string>
<string name="gdtslogan">gdtslogan</string>
<string name="click_to_skip">点击跳过</string>
<string name="noCache">没有缓存</string>
<string-array name="voicer_cloud_entries">
<item>小燕—女青、中英、普通话</item>
<item>小艾—女青、中英、普通话、支持情感</item>
<item>小宇—男青、中英、普通话</item>
<item>凯瑟琳—女青、英</item>
<item>亨利—男青、英</item>
<item>玛丽—女青、英</item>
<item>小研—女青、中英、普通话</item>
<item>小琪—女青、中英、普通话</item>
<item>小峰—男青、中英、普通话</item>
<item>小梅—女青、中英、粤语</item>
<item>小莉—女青、中英、台湾普通话</item>
<item>小蓉—女青、中、四川话</item>
<item>小芸—女青、中、东北话</item>
<item>小坤—男青、中、河南话</item>
<item>小强—男青、中、湖南话</item>
<item>小莹—女青、中、陕西话</item>
<item>小新—男童、中、普通话</item>
<item>楠楠—女童、中、普通话</item>
<item>老孙—男老、中、普通话</item>
</string-array>
<string-array name="voicer_cloud_values">
<item>xiaoyan</item>
<item>aisxa</item>
<item>xiaoyu</item>
<item>catherine</item>
<item>henry</item>
<item>vimary</item>
<item>vixy</item>
<item>xiaoqi</item>
<item>vixf</item>
<item>xiaomei</item>
<item>xiaolin</item>
<item>xiaorong</item>
<item>xiaoqian</item>
<item>xiaokun</item>
<item>xiaoqiang</item>
<item>vixying</item>
<item>xiaoxin</item>
<item>nannan</item>
<item>vils</item>
</string-array>
</resources>

View File

@ -1,17 +0,0 @@
package com.deiniu.zhuike;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@ -104,14 +104,19 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/legacy_multidex_aapt_derived_proguard_rules" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/legacy_multidex_main_dex_list" />
<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_manifests" />
<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/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/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/rs" />
<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/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />