diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index eb2873e..ffbbbfb 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -26,5 +26,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 5dbbcff..96e6124 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -16,8 +16,9 @@
+
-
+
@@ -49,6 +50,7 @@
+
diff --git a/app/build.gradle b/app/build.gradle
index 1a5492d..c2bf5f4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -146,9 +146,12 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
+ // androidx
implementation 'androidx.core:core-ktx:1.6.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
+ implementation 'androidx.appcompat:appcompat:1.3.1'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
//anko
def anko_version = '0.10.8'
@@ -177,12 +180,6 @@ dependencies {
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.2'
- implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'
-
- implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
-
- implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
-
implementation 'com.google.android.material:material:1.4.0'
//Scroller
@@ -248,6 +245,29 @@ dependencies {
//apache
implementation('org.apache.commons:commons-text:1.9')
+
+ //DDSDK
+ implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
+ implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
+ implementation 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.8'
+ implementation 'com.lzy.net:okgo:3.0.4'
+ implementation 'com.pangle.cn:ads-sdk-pro:4.2.5.2'
+ implementation('com.facebook.fresco:fresco:0.12.0') {
+ exclude module: 'support-v4'
+ exclude group: 'com.android.support'
+ }
+ implementation('com.facebook.fresco:animated-gif:0.12.0') {
+ exclude module: 'support-v4'
+ exclude group: 'com.android.support'
+ }
+ implementation('com.facebook.fresco:animated-webp:0.12.0') {
+ exclude module: 'support-v4'
+ exclude group: 'com.android.support'
+ }
+ implementation('com.facebook.fresco:webpsupport:0.12.0') {
+ exclude module: 'support-v4'
+ exclude group: 'com.android.support'
+ }
}
greendao {
diff --git a/app/libs/ddsdk-release.aar b/app/libs/ddsdk-release.aar
new file mode 100644
index 0000000..05b32b5
Binary files /dev/null and b/app/libs/ddsdk-release.aar differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f111285..e75f044 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,6 +3,11 @@
xmlns:tools="http://schemas.android.com/tools"
package="xyz.fycz.myreader">
+
+
+
+
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 c033b7c..192f21e 100644
--- a/app/src/main/java/xyz/fycz/myreader/application/App.java
+++ b/app/src/main/java/xyz/fycz/myreader/application/App.java
@@ -58,6 +58,7 @@ import xyz.fycz.myreader.util.help.SSLSocketClient;
import xyz.fycz.myreader.util.SharedPreUtils;
import xyz.fycz.myreader.util.help.StringHelper;
import xyz.fycz.myreader.util.ToastUtils;
+import xyz.fycz.myreader.util.utils.AdUtils;
import xyz.fycz.myreader.util.utils.FileUtils;
import xyz.fycz.myreader.util.utils.NetworkUtils;
import xyz.fycz.myreader.util.utils.OkHttpUtils;
@@ -99,6 +100,7 @@ public class App extends Application {
initNightTheme();
// LLog.init(APPCONST.LOG_DIR);
initDialogX();
+ AdUtils.initAd();
}
diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
index 173e0cf..7e860c6 100644
--- a/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
+++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
@@ -8,6 +8,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -19,6 +20,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.request.RequestOptions;
+import com.weaction.ddsdk.ad.DdSdkFlowAd;
import org.jetbrains.annotations.NotNull;
@@ -55,6 +57,7 @@ import xyz.fycz.myreader.ui.dialog.LoadingDialog;
import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog;
import xyz.fycz.myreader.util.ToastUtils;
import xyz.fycz.myreader.util.help.StringHelper;
+import xyz.fycz.myreader.util.utils.AdUtils;
import xyz.fycz.myreader.util.utils.BlurTransformation;
import xyz.fycz.myreader.util.utils.NetworkUtils;
import xyz.fycz.myreader.util.utils.RxUtils;
@@ -254,8 +257,41 @@ public class BookDetailedActivity extends BaseActivity {
}
mSourceDialog.setABooks(aBooks);
mSourceDialog.setSourceIndex(sourceIndex);
+
+ //initAd();
}
+ private void initAd() {
+ AdUtils.checkHasAd().subscribe(new MySingleObserver() {
+ @Override
+ public void onSuccess(@NonNull Boolean aBoolean) {
+ if (aBoolean) {
+ new DdSdkFlowAd().getFlowViews(BookDetailedActivity.this, 1, new DdSdkFlowAd.FlowCallback() {
+ // 信息流广告拉取完毕后返回的 views
+ @Override
+ public void getFlowView(View view) {
+ binding.ic.getRoot().addView(view, 2);
+ }
+
+ // 信息流广告展示后调用
+ @Override
+ public void show() {
+ AdUtils.adRecord("flow", "adShow");
+ Log.d(TAG, "信息流广告展示成功");
+ }
+
+ // 广告拉取失败调用
+ @Override
+ public void error(String msg) {
+ Log.d(TAG, "广告拉取失败\n" + msg);
+ }
+ });
+ }
+ }
+ });
+ }
+
+
@Override
protected void initClick() {
super.initClick();
diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/DonateActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/DonateActivity.java
index d4d06ac..11da225 100644
--- a/app/src/main/java/xyz/fycz/myreader/ui/activity/DonateActivity.java
+++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/DonateActivity.java
@@ -2,10 +2,17 @@ package xyz.fycz.myreader.ui.activity;
import android.content.Intent;
import android.net.Uri;
+import android.util.Log;
import android.view.View;
import androidx.appcompat.widget.Toolbar;
+import com.weaction.ddsdk.ad.DdSdkFlowAd;
+import com.weaction.ddsdk.ad.DdSdkInterAd;
+import com.weaction.ddsdk.ad.DdSdkRewardAd;
+
+import java.util.List;
+
import io.reactivex.annotations.NonNull;
import xyz.fycz.myreader.R;
import xyz.fycz.myreader.application.App;
@@ -42,17 +49,40 @@ public class DonateActivity extends BaseActivity {
@Override
protected void initWidget() {
- /*AdUtils.checkHasAd().subscribe(new MySingleObserver() {
+ AdUtils.checkHasAd().subscribe(new MySingleObserver() {
@Override
public void onSuccess(@NonNull Boolean aBoolean) {
if (aBoolean) {
- AdUtils.initAd();
+ //AdUtils.initAd();
initAd();
}
}
- });*/
+ });
}
+ private void initAd() {
+ binding.llAdSupport.setVisibility(View.VISIBLE);
+ new DdSdkFlowAd().getFlowViews(DonateActivity.this, 4, new DdSdkFlowAd.FlowCallback() {
+ // 信息流广告拉取完毕后返回的 views
+ @Override
+ public void getFlowView(View view) {
+ binding.llAdSupport.addView(view, 2);
+ }
+
+ // 信息流广告展示后调用
+ @Override
+ public void show() {
+ AdUtils.adRecord("flow","adShow");
+ Log.d(TAG, "信息流广告展示成功");
+ }
+
+ // 广告拉取失败调用
+ @Override
+ public void error(String msg) {
+ Log.d(TAG, "广告拉取失败\n" + msg);
+ }
+ });
+ }
@Override
protected void initClick() {
@@ -62,6 +92,68 @@ public class DonateActivity extends BaseActivity {
binding.rlThanks.setOnClickListener(v ->
MyAlertDialog.showFullWebViewDia(this, URLCONST.THANKS_URL,
false, null));
+
+ binding.llRewardedVideo.setOnClickListener(v -> {
+ DdSdkRewardAd.show(this, new DdSdkRewardAd.DdSdkRewardCallback() {
+ @Override
+ public void show() {
+ Log.i(TAG, "激励视频展示成功");
+ AdUtils.adRecord("rewardVideo","adShow");
+ }
+
+ @Override
+ public void click() {
+ Log.i(TAG, "激励视频被点击");
+ AdUtils.adRecord("rewardVideo","adClick");
+ }
+
+ @Override
+ public void error(String msg) {
+ }
+
+ @Override
+ public void skip() {
+ Log.i(TAG, "激励视频被跳过");
+ AdUtils.adRecord("rewardVideo","adSkip");
+ }
+
+ @Override
+ public void reward() {
+ Log.i(TAG, "激励视频计时完成");
+ AdUtils.adRecord("rewardVideo","adFinishCount");
+ }
+ });
+ });
+
+ binding.llInterAd.setOnClickListener(v -> {
+ /*
+ * 参数 1 activity
+ * 参数 2 marginDp (float),插屏默认 margin 全屏幕的 24dp,此处允许开发者手动调节 margin 大小,单位为 dp,允许范围为 0dp (全屏) ~ 48dp,请开发者按需填写
+ */
+ DdSdkInterAd.show(this, 48f, new DdSdkInterAd.Callback() {
+ @Override
+ public void show() {
+ Log.i(TAG, "插屏广告展示成功");
+ AdUtils.adRecord("inter","adShow");
+ }
+
+ @Override
+ public void click() {
+ Log.i(TAG, "插屏广告");
+ AdUtils.adRecord("inter","adClick");
+ }
+
+ @Override
+ public void error(String msg) {
+ }
+
+ @Override
+ public void close() {
+ Log.i(TAG, "插屏广告被关闭");
+ AdUtils.adRecord("inter","adClose");
+ }
+ });
+ });
}
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 b951724..e85def3 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
@@ -8,11 +8,14 @@ import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
+import androidx.annotation.NonNull;
+
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.signature.ObjectKey;
import com.gyf.immersionbar.ImmersionBar;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.XXPermissions;
+import com.weaction.ddsdk.ad.DdSdkSplashAd;
import java.io.File;
import java.io.FileOutputStream;
@@ -22,6 +25,7 @@ import java.util.List;
import xyz.fycz.myreader.R;
import xyz.fycz.myreader.application.App;
import xyz.fycz.myreader.base.BaseActivity;
+import xyz.fycz.myreader.base.observer.MySingleObserver;
import xyz.fycz.myreader.common.APPCONST;
import xyz.fycz.myreader.databinding.ActivitySplashBinding;
import xyz.fycz.myreader.greendao.service.BookGroupService;
@@ -30,6 +34,7 @@ import xyz.fycz.myreader.util.IOUtils;
import xyz.fycz.myreader.util.SharedPreUtils;
import xyz.fycz.myreader.util.ToastUtils;
import xyz.fycz.myreader.util.help.DateHelper;
+import xyz.fycz.myreader.util.utils.AdUtils;
import xyz.fycz.myreader.util.utils.ImageLoader;
import xyz.fycz.myreader.util.utils.MD5Utils;
import xyz.fycz.myreader.util.utils.OkHttpUtils;
@@ -146,19 +151,19 @@ public class SplashActivity extends BaseActivity {
}
private void start() {
- startNoAd();
+ //startNoAd();
/*if (adTimes >= 0 && todayAdCount >= adTimes) {
startNoAd();
- } else {
- App.getHandler().postDelayed(() -> {
+ } else {*/
+ /*App.getHandler().postDelayed(() -> {
binding.tvSkip.setVisibility(View.VISIBLE);
- }, 2000);
+ }, 2000);*/
AdUtils.checkHasAd()
.subscribe(new MySingleObserver() {
@Override
public void onSuccess(@NonNull Boolean aBoolean) {
if (aBoolean) {
- AdUtils.initAd();
+ //AdUtils.initAd();
startWithAd();
binding.ivSplash.setVisibility(View.GONE);
binding.llAd.setVisibility(View.VISIBLE);
@@ -173,7 +178,7 @@ public class SplashActivity extends BaseActivity {
startNoAd();
}
});
- }*/
+ //}
}
private void startNoAd() {
@@ -208,7 +213,7 @@ public class SplashActivity extends BaseActivity {
}
private void startWithAd() {
- /*try {
+ try {
new DdSdkSplashAd().show(binding.flAd, this, new DdSdkSplashAd.CountdownCallback() {
// 展示成功
@Override
@@ -216,7 +221,7 @@ public class SplashActivity extends BaseActivity {
Log.d(TAG, "广告展示成功");
AdUtils.adRecord("splash", "adShow");
countTodayAd();
- countTime.start();
+ //countTime.start();
}
// 广告被点击
@@ -248,7 +253,7 @@ public class SplashActivity extends BaseActivity {
e.printStackTrace();
WAIT_INTERVAL = 1500;
startNormal();
- }*/
+ }
}
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 06d2905..837d784 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,9 @@ package xyz.fycz.myreader.util.utils;
import android.util.Log;
+import com.weaction.ddsdk.base.DdSdkHelper;
+import com.weaction.ddsdk.bean.DDSDK;
+
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -11,6 +14,7 @@ import io.reactivex.SingleOnSubscribe;
import io.reactivex.annotations.NonNull;
import okhttp3.MediaType;
import okhttp3.RequestBody;
+import xyz.fycz.myreader.application.App;
import xyz.fycz.myreader.base.observer.MySingleObserver;
import xyz.fycz.myreader.common.URLCONST;
import xyz.fycz.myreader.model.user.UserService;
@@ -118,8 +122,27 @@ public class AdUtils {
}
public static void initAd() {
- if (!hasInitAd) {
+ /*if (!hasInitAd) {
hasInitAd = true;
- }
+ DdSdkHelper.init(new DDSDK.Builder()
+ .setUserId("1234")
+ .setAppId("216")
+ .setAppKey("51716a16fbdf50905704b6575b1b3b60")
+ .setCsjAppId("5273043")
+ .setApp(App.getApplication())
+ .setShowLog(App.isDebug())
+ .create()
+ );
+ }*/
+ DdSdkHelper.init(new DDSDK.Builder()
+ .setUserId("1234")
+ .setAppId("216")
+ .setAppKey("51716a16fbdf50905704b6575b1b3b60")
+ .setCsjAppId("5273043")
+ .setApp(App.getApplication())
+ .setShowLog(App.isDebug())
+ .setCustomRequestPermission(true)
+ .create()
+ );
}
}
diff --git a/app/src/main/res/layout/activity_donate.xml b/app/src/main/res/layout/activity_donate.xml
index 97bb426..e1d2d60 100644
--- a/app/src/main/res/layout/activity_donate.xml
+++ b/app/src/main/res/layout/activity_donate.xml
@@ -104,6 +104,104 @@
android:textColor="@color/textAssist" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
index 19a4229..4166b49 100644
--- a/build.gradle
+++ b/build.gradle
@@ -27,6 +27,7 @@ allprojects {
google()
jcenter()
maven { url "https://jitpack.io" }
+ maven { url 'https://artifact.bytedance.com/repository/pangle'}
}
/*gradle.projectsEvaluated {
tasks.withType(JavaCompile) {