pull/21/head
fengyuecanzhu 3 years ago
parent 4e88a92fdc
commit f45ad507c4
  1. 5
      .idea/jarRepositories.xml
  2. 4
      .idea/misc.xml
  3. 32
      app/build.gradle
  4. BIN
      app/libs/ddsdk-release.aar
  5. 5
      app/src/main/AndroidManifest.xml
  6. 2
      app/src/main/java/xyz/fycz/myreader/application/App.java
  7. 36
      app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
  8. 98
      app/src/main/java/xyz/fycz/myreader/ui/activity/DonateActivity.java
  9. 23
      app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java
  10. 27
      app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java
  11. 98
      app/src/main/res/layout/activity_donate.xml
  12. 1
      build.gradle

@ -26,5 +26,10 @@
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://artifact.bytedance.com/repository/pangle" />
</remote-repository>
</component>
</project>

@ -16,8 +16,9 @@
<entry key="..\:/android/FYReader/app/src/main/res/drawable/selector_btn_add.xml" value="0.17777777777777778" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_about.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_auth_email.xml" value="0.1897644927536232" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_book_detail.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_crash.xml" value="0.264" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_donate.xml" value="0.536" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_donate.xml" value="0.32698961937716264" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_feedback.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_file_picker.xml" value="0.2318840579710145" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_group_manager.xml" value="0.12132725430597771" />
@ -49,6 +50,7 @@
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_search_word2.xml" value="0.1947463768115942" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_search_word_1.xml" value="0.1947463768115942" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/layout_about_content.xml" value="0.176" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/layout_book_detail_content.xml" value="0.17889492753623187" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/layout_book_detail_header.xml" value="0.536" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/listview_search_book_item.xml" value="0.22010869565217392" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/search_book_item.xml" value="0.1947463768115942" />

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

Binary file not shown.

@ -3,6 +3,11 @@
xmlns:tools="http://schemas.android.com/tools"
package="xyz.fycz.myreader">
<!--必要权限,解决安全风险漏洞,发送和注册广播事件需要调用带有传递权限的接口-->
<permission android:name="${applicationId}.openadsdk.permission.TT_PANGOLIN"
android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.openadsdk.permission.TT_PANGOLIN" />
<!-- ********************************permission************************************ -->
<!-- 读取手机状态和身份 -->
<!-- <uses-permission android:name="android.permission.READ_PHONE_STATE"/>-->

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

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

@ -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<Boolean>() {
AdUtils.checkHasAd().subscribe(new MySingleObserver<Boolean>() {
@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");
}
});
});
}

@ -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<Boolean>() {
@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();
}*/
}
}

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

@ -104,6 +104,104 @@
android:textColor="@color/textAssist" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_ad_support"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:gravity="center"
android:text="@string/ad_support"
android:textColor="@color/textPrimary" />
<TextView
android:layout_width="wrap_content"
android:layout_height="15dp"
android:gravity="center"
android:text="@string/ad_support_tip"
android:textColor="@color/textSecondary"
android:textSize="@dimen/text_minimum_size" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:background="@color/colorForeground"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerInParent="true"
android:text="@string/flow_ad_tip"
android:textColor="@color/textSecondary" />
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_inter_ad"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@drawable/selector_common_bg"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingTop="8dp"
android:paddingRight="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/inter_ad"
android:textColor="@color/textSecondary"
android:textSize="@dimen/text_normal_size" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:text="@string/donate_tip"
android:textColor="@color/textAssist" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_rewarded_video"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@drawable/selector_common_bg"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingTop="8dp"
android:paddingRight="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rewarded_video"
android:textColor="@color/textSecondary"
android:textSize="@dimen/text_normal_size" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:text="@string/donate_tip"
android:textColor="@color/textAssist" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="10dp" />

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

Loading…
Cancel
Save