修复bug、优化体验

pull/5/head
fengyuecanzhu 4 years ago
parent 6d770fa296
commit 103469ea19
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 18
      app/release/output-metadata.json
  3. 9
      app/src/main/assets/updatelog.fy
  4. 9
      app/src/main/java/xyz/fycz/myreader/application/App.java
  5. 80
      app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java
  6. 3
      app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java
  7. 7
      app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java
  8. 16
      app/src/main/res/layout/activity_ad_setting.xml
  9. 42
      app/src/main/res/layout/activity_splash.xml
  10. 1
      app/src/main/res/values/strings.xml
  11. 4
      app/version_code.properties

@ -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"
}
]
}

@ -1,3 +1,12 @@
2021.05.09
风月读书v1.9.5
更新内容:
1、优化开屏广告体验
2、开屏右下角无广告新增跳过按钮,防止点击跳过时误触广告,广告加载时间过久也可直接跳过
3、修复概率性启动闪退bug
4、修复书源:九桃小说
5、新增备用更新通道
2021.04.25
风月读书v1.9.4
更新内容:

@ -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;

@ -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();
}
}

@ -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);
}

@ -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<Boolean>) 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",

@ -129,6 +129,22 @@
android:clickable="false"
android:longClickable="false" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerInParent="true"
android:text="@string/book_detail_ad"
android:textColor="@color/textPrimary" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout

@ -1,49 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_splash"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
app:srcCompat="@drawable/start"/>
android:visibility="gone"
app:srcCompat="@drawable/start" />
<LinearLayout
android:id="@+id/ll_ad"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
android:layout_weight="1" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="8">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:srcCompat="@mipmap/ic_launcher"/>
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:layout_marginStart="5dp"
android:gravity="center"
android:text="@string/app_name"
android:textColor="@color/textPrimary"
android:textSize="@dimen/text_medium_size"
android:text="@string/app_name"/>
android:textSize="@dimen/text_medium_size" />
</LinearLayout>
<TextView
android:id="@+id/tv_skip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="15dp"
android:background="@drawable/setting_btn_bg"
android:gravity="center"
android:paddingVertical="5dp"
android:paddingHorizontal="8dp"
android:text="跳过"
android:textColor="@color/textSecondary"
android:textSize="@dimen/text_normal_size" />
</RelativeLayout>
</LinearLayout>

@ -477,6 +477,7 @@
<string name="book_name">书名</string>
<string name="select_local_pic">选择本地图片</string>
<string name="menu_edit">编辑书籍</string>
<string name="skip_ad">跳过 | %ds</string>
<string-array name="reset_screen_time">
<item>跟随系统</item>

@ -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

Loading…
Cancel
Save