|
@@ -19,6 +19,8 @@ import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
import android.widget.VideoView;
|
|
import android.widget.VideoView;
|
|
|
import com.bumptech.glide.Glide;
|
|
import com.bumptech.glide.Glide;
|
|
|
|
|
+import com.jasmine.cantaloupe.engine.JasmineEngine;
|
|
|
|
|
+import com.jasmine.cantaloupe.utils.LogUtils2;
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
import com.sheep.gamegroup.greendao.DDProviderHelper;
|
|
import com.sheep.gamegroup.greendao.DDProviderHelper;
|
|
|
import com.sheep.gamegroup.greendao.download.SheepAd;
|
|
import com.sheep.gamegroup.greendao.download.SheepAd;
|
|
@@ -36,17 +38,21 @@ import com.sheep.gamegroup.view.activity.helper.AdHelper;
|
|
|
import com.sheep.jiuyan.samllsheep.BuildConfig;
|
|
import com.sheep.jiuyan.samllsheep.BuildConfig;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
import com.tencent.klevin.KleinManager;
|
|
import com.tencent.klevin.KleinManager;
|
|
|
import com.tencent.klevin.base.callback.KleinResponseCallback;
|
|
import com.tencent.klevin.base.callback.KleinResponseCallback;
|
|
|
|
|
+
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+
|
|
|
import butterknife.BindView;
|
|
import butterknife.BindView;
|
|
|
import butterknife.OnClick;
|
|
import butterknife.OnClick;
|
|
|
import io.reactivex.Observable;
|
|
import io.reactivex.Observable;
|
|
|
import io.reactivex.Observer;
|
|
import io.reactivex.Observer;
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
|
|
+
|
|
|
import static com.sheep.gamegroup.view.activity.helper.AdHelper.*;
|
|
import static com.sheep.gamegroup.view.activity.helper.AdHelper.*;
|
|
|
import static com.tencent.klevin.base.okhttp.ErrorCode.KLSplashAdEvent_AdPlayCompletion;
|
|
import static com.tencent.klevin.base.okhttp.ErrorCode.KLSplashAdEvent_AdPlayCompletion;
|
|
|
import static com.tencent.klevin.base.okhttp.ErrorCode.KLSplashAdEvent_AdShowFinish;
|
|
import static com.tencent.klevin.base.okhttp.ErrorCode.KLSplashAdEvent_AdShowFinish;
|
|
@@ -132,7 +138,7 @@ public class SplashAct extends BaseActivity {
|
|
|
//SDK的广告,展示SDK的广告,并拉取一次广告并保存
|
|
//SDK的广告,展示SDK的广告,并拉取一次广告并保存
|
|
|
initSdkAdvertising(ad.getAd_type());
|
|
initSdkAdvertising(ad.getAd_type());
|
|
|
}
|
|
}
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
sendHandlerMessages(2000);
|
|
sendHandlerMessages(2000);
|
|
|
}
|
|
}
|
|
|
//拉一次广告,不加载,下次打开APP加载上次拉的数据
|
|
//拉一次广告,不加载,下次打开APP加载上次拉的数据
|
|
@@ -157,52 +163,84 @@ public class SplashAct extends BaseActivity {
|
|
|
|
|
|
|
|
//加载游可盈广告
|
|
//加载游可盈广告
|
|
|
private void initYKYAd() {
|
|
private void initYKYAd() {
|
|
|
- int posId; //开屏广告ID
|
|
|
|
|
- if (BuildConfig.FLAVOR.equals("sheep")) {
|
|
|
|
|
- posId = 30112;
|
|
|
|
|
- } else {
|
|
|
|
|
- //posId = 30029;
|
|
|
|
|
- posId = 30112;
|
|
|
|
|
- }
|
|
|
|
|
- String data = "{\"placements\":[{\"pos_id\":" + posId + ",\"ad_count\":1}]}";
|
|
|
|
|
- //"{\"placements\":[{\"pos_id\":" + posId + ",\"ad_count\":1}]}";
|
|
|
|
|
- KleinManager.getInstance().prepareAD(
|
|
|
|
|
- getApplicationContext(),
|
|
|
|
|
- data,
|
|
|
|
|
- 5000,
|
|
|
|
|
- true,
|
|
|
|
|
|
|
+ //游可盈广告初始化
|
|
|
|
|
+ KleinManager.getInstance().initKleinAdSDK(this,
|
|
|
|
|
+ "{\"app_id\":" + Integer.parseInt(ad.getThird_app_id()) + ",\"app_bundle\":\"abc.kfzs.com\",\"app_version\":\"6.3.1\",\"is_debug\":" + BuildConfig.DEBUG + "}",
|
|
|
new KleinResponseCallback() {
|
|
new KleinResponseCallback() {
|
|
|
@Override
|
|
@Override
|
|
|
- public void onSuccess(int i) {
|
|
|
|
|
|
|
+ public void onSuccess(int code) {
|
|
|
if (BuildConfig.DEBUG)
|
|
if (BuildConfig.DEBUG)
|
|
|
- Log.d("!!!!!Success", String.valueOf(i));
|
|
|
|
|
|
|
+ G.showToast("游可赢广告初始化:init onSuccess : " + code);
|
|
|
|
|
+ //code:KLAdEvent_InitSuccess = 800; // 宿主初始化成功
|
|
|
|
|
+ String data = "{\"placements\":[{\"pos_id\":" + ad.getThird_ad_id() + ",\"ad_count\":1}]}";
|
|
|
|
|
+ //"{\"placements\":[{\"pos_id\":" + posId + ",\"ad_count\":1}]}";
|
|
|
|
|
+ KleinManager.getInstance().prepareAD(
|
|
|
|
|
+ getApplicationContext(),
|
|
|
|
|
+ data,
|
|
|
|
|
+ 5000,
|
|
|
|
|
+ true,
|
|
|
|
|
+ new KleinResponseCallback() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onSuccess(int i) {
|
|
|
|
|
+ if (BuildConfig.DEBUG)
|
|
|
|
|
+ Log.d("!!!!!Success", String.valueOf(i));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onFail(int i) {
|
|
|
|
|
+ if (BuildConfig.DEBUG)
|
|
|
|
|
+ Log.d("!!!!!Fail", String.valueOf(i));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onEvent(int i) {
|
|
|
|
|
+ if (BuildConfig.DEBUG)
|
|
|
|
|
+ Log.d("!!!!!Event", String.valueOf(i));
|
|
|
|
|
+ switch (i) {
|
|
|
|
|
+ case KLSplashAdEvent_AdPlayCompletion:
|
|
|
|
|
+ case KLSplashAdEvent_AdShowFinish:
|
|
|
|
|
+ case KLSplashAdEvent_AdSkip:
|
|
|
|
|
+ sendHandlerMessages(0);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void onFail(int i) {
|
|
|
|
|
|
|
+ public void onFail(int code) {
|
|
|
if (BuildConfig.DEBUG)
|
|
if (BuildConfig.DEBUG)
|
|
|
- Log.d("!!!!!Fail", String.valueOf(i));
|
|
|
|
|
|
|
+ G.showToast("游可赢广告初始化:init onFail : " + code);
|
|
|
|
|
+ //code:KLAdEvent_InitError = 801; // 宿主初始化错误
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void onEvent(int i) {
|
|
|
|
|
|
|
+ public void onEvent(int code) {
|
|
|
|
|
+ // 初始化不会回调
|
|
|
if (BuildConfig.DEBUG)
|
|
if (BuildConfig.DEBUG)
|
|
|
- Log.d("!!!!!Event", String.valueOf(i));
|
|
|
|
|
- switch (i) {
|
|
|
|
|
- case KLSplashAdEvent_AdPlayCompletion:
|
|
|
|
|
- case KLSplashAdEvent_AdShowFinish:
|
|
|
|
|
- case KLSplashAdEvent_AdSkip:
|
|
|
|
|
- sendHandlerMessages(0);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ G.showToast("游可赢广告事件:init onSuccess : " + code);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//加载优投广告
|
|
//加载优投广告
|
|
|
private void initYTAd() {
|
|
private void initYTAd() {
|
|
|
|
|
+ JasmineEngine.getInstance(this).init(
|
|
|
|
|
+ ad.getThird_app_id(),
|
|
|
|
|
+ Integer.parseInt(ad.getThird_ad_id()),
|
|
|
|
|
+ new JasmineEngine.InitCallBack() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void initSuccess() {
|
|
|
|
|
+ LogUtils2.info("initSuccess");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void initFailed(String err) {
|
|
|
|
|
+ LogUtils2.info("initFailed:" + err);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//从服务端拉取广告信息
|
|
//从服务端拉取广告信息
|