From 103469ea19dbd48622e54eb001fd882577375690 Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Sun, 9 May 2021 12:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=E3=80=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/caches/build_file_checksums.ser | Bin 537 -> 537 bytes app/release/output-metadata.json | 18 ---- app/src/main/assets/updatelog.fy | 9 ++ .../xyz/fycz/myreader/application/App.java | 9 +- .../myreader/ui/activity/SplashActivity.java | 80 ++++++++++-------- .../myreader/ui/dialog/MyAlertDialog.java | 3 +- .../xyz/fycz/myreader/util/utils/AdUtils.java | 7 +- .../main/res/layout/activity_ad_setting.xml | 16 ++++ app/src/main/res/layout/activity_splash.xml | 42 ++++++--- app/src/main/res/values/strings.xml | 1 + app/version_code.properties | 4 +- 11 files changed, 119 insertions(+), 70 deletions(-) delete mode 100644 app/release/output-metadata.json diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 8711bc69ed9a1e8b2c38d98db5f7aee6adcc949e..7d5178e7750f9e8a6522cb39f8c64020e5610b45 100644 GIT binary patch delta 14 WcmbQqGLvP(Oy=uL|8AU9%Lo83R0gX6 delta 14 WcmbQqGLvP(Oy>Q{hc?csWdr~!c?H%0 diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json deleted file mode 100644 index 63fbbd0..0000000 --- a/app/release/output-metadata.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "version": 2, - "artifactType": { - "type": "APK", - "kind": "Directory" - }, - "applicationId": "xyz.fycz.myreader", - "variantName": "processReleaseResources", - "elements": [ - { - "type": "SINGLE", - "filters": [], - "versionCode": 194, - "versionName": "1.9.4", - "outputFile": "风月读书v1.9.4.apk" - } - ] -} \ No newline at end of file diff --git a/app/src/main/assets/updatelog.fy b/app/src/main/assets/updatelog.fy index 5391ac6..ee16fb7 100644 --- a/app/src/main/assets/updatelog.fy +++ b/app/src/main/assets/updatelog.fy @@ -1,3 +1,12 @@ +2021.05.09 +风月读书v1.9.5 +更新内容: +1、优化开屏广告体验 +2、开屏右下角无广告新增跳过按钮,防止点击跳过时误触广告,广告加载时间过久也可直接跳过 +3、修复概率性启动闪退bug +4、修复书源:九桃小说 +5、新增备用更新通道 + 2021.04.25 风月读书v1.9.4 更新内容: diff --git a/app/src/main/java/xyz/fycz/myreader/application/App.java b/app/src/main/java/xyz/fycz/myreader/application/App.java index 6fe974b..48ed0f7 100644 --- a/app/src/main/java/xyz/fycz/myreader/application/App.java +++ b/app/src/main/java/xyz/fycz/myreader/application/App.java @@ -311,10 +311,13 @@ public class App extends Application { Document doc = Jsoup.parse(html); String content = doc.getElementsByClass("ql-editor").text(); if (StringHelper.isEmpty(content)) { - if (isManualCheck || NetworkUtils.isNetWorkAvailable()) { - ToastUtils.showError("检查更新失败!"); + content = OkHttpUtils.getUpdateInfo(); + if (StringHelper.isEmpty(content)) { + if (isManualCheck || NetworkUtils.isNetWorkAvailable()) { + ToastUtils.showError("检查更新失败!"); + } + return; } - return; } String[] contents = content.split(";"); int newestVersion = 0; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java index fd9f650..4bcc397 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java @@ -59,11 +59,12 @@ public class SplashActivity extends BaseActivity { private int adTimes; private PermissionsChecker mPermissionsChecker; - private Thread myThread = new Thread() {//创建子线程 + //创建子线程 + private Thread start = new Thread() { @Override public void run() { try { - sleep(WAIT_INTERVAL);//使程序休眠 + Thread.sleep(WAIT_INTERVAL);//使程序休眠 Intent it = new Intent(SplashActivity.this, MainActivity.class);//启动MainActivity it.putExtra("startFromSplash", true); startActivity(it); @@ -74,24 +75,23 @@ public class SplashActivity extends BaseActivity { } }; - private Thread countTime = new Thread(){ + private Thread countTime = new Thread() { @Override public void run() { - for (int i = 0; i < 8; i++) { + for (int i = 0; i < 5; i++) { + int time = 5 - i; + App.runOnUiThread(() -> binding.tvSkip.setText(getString(R.string.skip_ad, time))); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } - if (!App.isDestroy(SplashActivity.this)){ - WAIT_INTERVAL = 0; - startNormal(); - } + WAIT_INTERVAL = 0; + startNormal(); } }; - @Override protected void bindView() { binding = ActivitySplashBinding.inflate(getLayoutInflater()); @@ -131,13 +131,21 @@ public class SplashActivity extends BaseActivity { adTimes = spu.getInt("curAdTimes", 3); String[] splashAdCounts = splashAdCount.split(":"); String today = DateHelper.getYearMonthDay1(); - if (today.equals(splashAdCounts[0])){ + if (today.equals(splashAdCounts[0])) { todayAdCount = Integer.parseInt(splashAdCounts[1]); - }else { + } else { todayAdCount = 0; } } + @Override + protected void initClick() { + binding.tvSkip.setOnClickListener(v -> { + WAIT_INTERVAL = 0; + startNormal(); + }); + } + @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) { @@ -147,7 +155,7 @@ public class SplashActivity extends BaseActivity { } private void start() { - if (adTimes >= 0 && todayAdCount >= adTimes){ + if (adTimes >= 0 && todayAdCount >= adTimes) { startNoAd(); } else { AdUtils.checkHasAd() @@ -173,7 +181,7 @@ public class SplashActivity extends BaseActivity { } } - private void startNoAd(){ + private void startNoAd() { Animation inAni = AnimationUtils.loadAnimation(SplashActivity.this, R.anim.fade_in); binding.ivSplash.setVisibility(View.VISIBLE); binding.ivSplash.startAnimation(inAni); @@ -184,18 +192,26 @@ public class SplashActivity extends BaseActivity { } private void startNormal() { - if (BookGroupService.getInstance().curGroupIsPrivate()) { - App.runOnUiThread(() -> { - MyAlertDialog.showPrivateVerifyDia(SplashActivity.this, needGoTo -> { - myThread.start(); - }, () -> { - SharedPreUtils.getInstance().putString(SplashActivity.this.getString(R.string.curBookGroupId), ""); - SharedPreUtils.getInstance().putString(SplashActivity.this.getString(R.string.curBookGroupName), ""); - myThread.start(); + if (!App.isDestroy(this)) { + if (BookGroupService.getInstance().curGroupIsPrivate()) { + App.runOnUiThread(() -> { + MyAlertDialog.showPrivateVerifyDia(SplashActivity.this, needGoTo -> { + if (!start.isAlive()) { + start.start(); + } + }, () -> { + SharedPreUtils.getInstance().putString(SplashActivity.this.getString(R.string.curBookGroupId), ""); + SharedPreUtils.getInstance().putString(SplashActivity.this.getString(R.string.curBookGroupName), ""); + if (!start.isAlive()) { + start.start(); + } + }); }); - }); - } else { - myThread.start(); + } else { + if (!start.isAlive()) { + start.start(); + } + } } } @@ -206,7 +222,7 @@ public class SplashActivity extends BaseActivity { @Override public void show() { Log.d(TAG, "广告展示成功"); - AdUtils.adRecord("splash","adShow"); + AdUtils.adRecord("splash", "adShow"); countTodayAd(); countTime.start(); } @@ -215,15 +231,14 @@ public class SplashActivity extends BaseActivity { @Override public void click() { Log.d(TAG, "广告被点击"); - AdUtils.adRecord("splash","adClick"); + AdUtils.adRecord("splash", "adClick"); } // 展示出错时可读取 msg 中的错误信息 @Override public void error(String msg) { WAIT_INTERVAL = 1500; - if (!App.isDestroy(SplashActivity.this)) - startNormal(); + startNormal(); Log.e(TAG, msg); //ToastUtils.showError(msg); } @@ -232,16 +247,15 @@ public class SplashActivity extends BaseActivity { @Override public void finishCountdown() { Log.d(TAG, "倒计时结束或用户主动点击跳过按钮"); - AdUtils.adRecord("splash","adFinishCount"); - if (!App.isDestroy(SplashActivity.this)) - startNormal(); + WAIT_INTERVAL = 0; + AdUtils.adRecord("splash", "adFinishCount"); + startNormal(); } }); } catch (Exception e) { e.printStackTrace(); WAIT_INTERVAL = 1500; - if (!App.isDestroy(SplashActivity.this)) - startNormal(); + startNormal(); } } diff --git a/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java b/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java index c8c0aaa..5060ea6 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java @@ -153,7 +153,8 @@ public class MyAlertDialog { onCancel.cancel(); } }); - fd.show(activity.getSupportFragmentManager(), "fingerprint"); + if (!App.isDestroy(activity)) + fd.show(activity.getSupportFragmentManager(), "fingerprint"); } else { showPrivatePwdInputDia(activity, onVerify, onCancel); } diff --git a/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java b/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java index 235fb6b..b3da89e 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java +++ b/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java @@ -2,6 +2,7 @@ package xyz.fycz.myreader.util.utils; import android.util.Log; + import com.weaction.ddsdk.base.DdSdkHelper; import org.json.JSONArray; @@ -58,7 +59,7 @@ public class AdUtils { public static void adRecord(String type, String name) { Single.create((SingleOnSubscribe) emitter -> { MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); - String body = "adType=" + type + "&type=" + name + UserService.makeSignalParam(); + String body = "adType=" + type + "&type=" + name + UserService.makeSignalParam(); RequestBody requestBody = RequestBody.create(mediaType, body); OkHttpUtils.getHtml(URLCONST.AD_URL, requestBody, "UTF-8"); emitter.onSuccess(true); @@ -121,8 +122,8 @@ public class AdUtils { return adTimes < 0 || todayAdCount < adTimes || bookDetailAd; } - public static void initAd(){ - if (!hasInitAd){ + public static void initAd() { + if (!hasInitAd) { hasInitAd = true; DdSdkHelper.init("1234", "216", "51716a16fbdf50905704b6575b1b3b60", "142364", "35ce0efe5f3cc960b116db227498e238", diff --git a/app/src/main/res/layout/activity_ad_setting.xml b/app/src/main/res/layout/activity_ad_setting.xml index 44fe663..56d87c0 100644 --- a/app/src/main/res/layout/activity_ad_setting.xml +++ b/app/src/main/res/layout/activity_ad_setting.xml @@ -129,6 +129,22 @@ android:clickable="false" android:longClickable="false" /> + + + + + - + + android:visibility="gone" + app:srcCompat="@drawable/start" /> + + + android:layout_weight="1" /> + + + + app:srcCompat="@mipmap/ic_launcher" /> + + android:textSize="@dimen/text_medium_size" /> + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ffe9627..e064642 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -477,6 +477,7 @@ 书名 选择本地图片 编辑书籍 + 跳过 | %ds 跟随系统 diff --git a/app/version_code.properties b/app/version_code.properties index d515c1c..72a623d 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Mon May 03 14:54:05 CST 2021 -VERSION_CODE=194 +#Sun May 09 12:34:16 CST 2021 +VERSION_CODE=195