Commit d6a4b4fe authored by mengcuiguang's avatar mengcuiguang

引入创神报错,引入kotlin

parent cc443e5e
......@@ -10,8 +10,8 @@ android {
applicationId "com.mints.highgold"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 9
versionName "1.0.8"
versionCode 10
versionName "1.0.9"
flavorDimensions "default"
// dex突破65535的限制
......@@ -210,7 +210,6 @@ dependencies {
implementation files('libs/sun.misc.BASE64Decoder.jar')
// 三方接入
// 穿山甲广告
implementation(name: 'open_ad_sdk', ext: 'aar')
......@@ -290,16 +289,14 @@ dependencies {
exclude group: 'com.google.code.gson'
}
// 珊瑚广告
implementation(name:'adapt-1.3.3', ext:'aar')
implementation(name:'commonbase-1.0.2', ext:'aar')
implementation(name:'discovery-2.0.12', ext:'aar')
implementation(name:'shanhuAD-1.0.14', ext:'aar')
implementation(name: 'adapt-1.3.3', ext: 'aar')
implementation(name: 'commonbase-1.0.2', ext: 'aar')
implementation(name: 'discovery-2.0.12', ext: 'aar')
implementation(name: 'shanhuAD-1.0.14', ext: 'aar')
// 创神广告
// implementation(name: 'ad_library_v2.0', ext: 'aar')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// implementation 'com.jaredrummler:android-processes:1.1.1'
}
......@@ -40,7 +40,8 @@
android:theme="@style/CustomAppTheme"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".ui.activitys.Aboutas2Activity"></activity>
<activity android:name=".ui.activitys.CsVedioActivity"></activity>
<activity android:name=".ui.activitys.Aboutas2Activity" />
<uses-library
android:name="org.apache.http.legacy"
......@@ -205,8 +206,9 @@
</service> <!-- 定位需要的服务 -->
<service android:name="com.amap.api.location.APSService" /> <!-- 自有下载 -->
<provider
tools:replace="android:authorities"
android:name="android.support.v4.content.FileProvider"
android:authorities="com.mints.highgold.fileprovider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
......@@ -257,7 +259,7 @@
android:configChanges="keyboard|orientation"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar"></activity>
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name="com.mintegral.msdk.reward.player.MTGRewardVideoActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
......
package com.mints.highgold.ad
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import com.mints.highgold.common.Constant
import com.mints.highgold.ui.activitys.CsVedioActivity
/**
* 创神视频
*/
class ChuangshenVedioAdManager private constructor(activity: Activity) {
private var chuangshenVedioAdListener: ChuangshenVedioAdListener? = null
var activity: Activity? = null
private fun init(activity: Activity) {
this.activity = activity
}
fun loadChuangshenAd(downloadCoin: Int, curCoin: Int, carrierType: String?, extraId: String?) {
if (activity == null) {
return
}
chuangshenVedioAdListener?.chuangshenVedioAdSuccess()
val bundle = Bundle()
bundle.putString(Constant.TRY_VEDIO_COIN, curCoin.toString())
bundle.putString(Constant.TRY_TASK_H5DOWNLOADCOIN, downloadCoin.toString())
bundle.putString(Constant.TRY_CARRIER, carrierType)
bundle.putString(Constant.MAIN_EXTRA_ID, extraId)
readyGo(CsVedioActivity::class.java,bundle)
}
fun setChuangshenVedioAdListener(chuangshenVedioAdListener: ChuangshenVedioAdListener?) {
this.chuangshenVedioAdListener = chuangshenVedioAdListener
}
interface ChuangshenVedioAdListener {
fun chuangshenVedioAdSuccess()
}
companion object {
private var _inst: ChuangshenVedioAdManager? = null
fun getInstance(activity: Activity): ChuangshenVedioAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = ChuangshenVedioAdManager(activity)
_inst
}
}
}
init {
init(activity)
}
fun readyGo(clazz: Class<*>?, bundle: Bundle) {
val intent = Intent(activity, clazz)
intent.putExtras(bundle)
activity?.startActivity(intent)
}
}
\ No newline at end of file
......@@ -35,6 +35,7 @@ public class VedioAdingManager {
private MintegralVedioAdManager mintegralVedioAdManager;
private HytechVedioAdManager hytechVedioAdManager;
private ShanhuVedioAdManager shanhuVedioAdManager;
private ChuangshenVedioAdManager chuangshenVedioAdManager;
private int ylhWeight;
private int csjFullWeight;
......@@ -42,6 +43,7 @@ public class VedioAdingManager {
private int hytechVedioWeight;
private int mintegralWeight;
private int shanhuWeight;
private int chuangshenWeight;
private ArrayList<WeightBean> weightList;
private Activity activity;
......@@ -74,6 +76,7 @@ public class VedioAdingManager {
hytechVedioAdManager = HytechVedioAdManager.getInstance(activity);
mintegralVedioAdManager = MintegralVedioAdManager.getInstance(activity);
shanhuVedioAdManager = ShanhuVedioAdManager.getInstance(activity);
chuangshenVedioAdManager = ChuangshenVedioAdManager.Companion.getInstance(activity);
weightList = new ArrayList<>();
}
......@@ -87,6 +90,7 @@ public class VedioAdingManager {
this.hytechVedioWeight = hytechVedioWeight;
this.mintegralWeight = mintegralWeight;
this.shanhuWeight = shanhuWeight;
this.chuangshenWeight = chuangshenWeight;
}
/**
......@@ -183,6 +187,11 @@ public class VedioAdingManager {
weight = weight + csjFullWeight;
LogUtil.d(TAG, "权重值:csjFullWeight:" + csjFullWeight);
}
if (AppConfig.chuangshenVedioAdCount > 0) {
weightList.add(new WeightBean(chuangshenWeight, Constant.CHUANGSHEN_VEDIO_AD));
weight = weight + chuangshenWeight;
LogUtil.d(TAG, "权重值:chuangshenWeight:" + chuangshenWeight);
}
// 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) {
......@@ -525,6 +534,33 @@ public class VedioAdingManager {
isVedioAdDownload = true;
}
});
}else if (TextUtils.equals(vedioAdType, Constant.CHUANGSHEN_VEDIO_AD)) {
// 创神激励视频
if (chuangshenVedioAdManager == null) {
if (activity == null) {
if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerError(Constant.SHANHU_VEDIO_AD);
}
return;
}
chuangshenVedioAdManager = ChuangshenVedioAdManager.Companion.getInstance(activity);
}
// 重置监听
chuangshenVedioAdManager.setChuangshenVedioAdListener(null);
chuangshenVedioAdManager.loadChuangshenAd(bean.getDownloadCoin(), bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
chuangshenVedioAdManager.setChuangshenVedioAdListener(new ChuangshenVedioAdManager.ChuangshenVedioAdListener() {
@Override
public void chuangshenVedioAdSuccess() {
AppConfig.chuangshenVedioAdCount--;
AppConfig.preAdType = Constant.CHUANGSHEN_VEDIO_AD;
AppConfig.preAdTime = Calendar.getInstance().getTimeInMillis();
if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerSuccess(Constant.CHUANGSHEN_VEDIO_AD);
}
}
});
}
} catch (Exception e) {
e.printStackTrace();
......
......@@ -67,6 +67,14 @@ public class AppConfig {
* hytechVedio 剩余广告播放数
*/
public static int hytechVedioAdCount = 0;
/**
* 创神 剩余广告播放数
*/
public static int chuangshenVedioAdCount = 0;
/**
* 多盟 剩余广告播放数
*/
public static int duomentVedioAdCount = 0;
/**
* 一览视频 时间间隔 单位-秒
......
......@@ -125,6 +125,8 @@ public interface Constant {
String HYTECH_VEDIO_AD = "HYTECH_VEDIO_AD";
String MINTEGRAL_VEDIO_AD = "MINTEGRAL_VEDIO_AD";
String SHANHU_VEDIO_AD = "SHANHU_VEDIO_AD";
String CHUANGSHEN_VEDIO_AD = "CHUANGSHEN_VEDIO_AD";
String DUOMENT_VEDIO_AD = "DUOMENT_VEDIO_AD";
// 载体
String CARRIER_DRINK = "DRINK";//喝水
......@@ -190,6 +192,8 @@ public interface Constant {
String AD_SOURCE_MINTEGRAL = "MINTEGRAL";
String AD_SOURCE_HYTECH = "HYTECH";//东方网
String AD_SOURCE_SHANHU = "CORAL";//珊瑚
String AD_SOURCE_CHUANGSHEN = "CHUANGSHEN";//创神
String AD_SOURCE_DUOMENT = "DUOMENT";//多盟
// 页面
int PAGE_ONE = 1;
......
package com.mints.highgold.mvp.model
import java.io.Serializable
data class MyTestBean(val tid: Int = 0, val name: String = "") : Serializable
\ No newline at end of file
package com.mints.highgold.mvp.presenters
import android.text.TextUtils
import com.mints.highgold.common.Constant
import com.mints.highgold.manager.AppHttpManager
import com.mints.highgold.mvp.model.BaseResponse
import com.mints.highgold.mvp.views.CsVedioView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import rx.Observable
class CsVedioPresenter : BasePresenter<CsVedioView>() {
/**
* 提交任务
*/
fun reportAddCoinMsg(tryCarrier: String, vo: HashMap<String, Any>) {
val observable: Observable<BaseResponse<Any>>
observable = if (TextUtils.equals(tryCarrier, Constant.CARRIER_DAILY_DOWNLOAD) || TextUtils.equals(tryCarrier, Constant.CARRIER_DAILY_VIDEO)) {
// 每日任务
loanService.reportTaskMsgV1(vo)
} else {
// 挑战
loanService.reportAddCoinMsg(vo)
}
AppHttpManager.getInstance(loanApplication)
.call(observable,
object : BaseSubscriber<BaseResponse<Any?>?>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
}
fun onNext(baseResponse: BaseResponse<Any?>) {
if (isLinkView) return
}
})
}
/**
* 下载接口
*/
fun reportDownloadTask(tryCarrier: String?, vo: java.util.HashMap<String?, Any?>?) {
val observable: Observable<BaseResponse<Any>>
observable = if (TextUtils.equals(tryCarrier, Constant.CARRIER_DAILY_DOWNLOAD) || TextUtils.equals(tryCarrier, Constant.CARRIER_DAILY_VIDEO)) {
// 每日任务
loanService.reportTaskMsgV1(vo)
} else {
// 挑战
loanService.reportAddCoinMsg(vo)
}
AppHttpManager.getInstance(loanApplication)
.call(observable,
object : BaseSubscriber<BaseResponse<Any?>?>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
}
fun onNext(baseResponse: BaseResponse<Any?>) {
if (isLinkView) return
val code = baseResponse.status
when (code) {
200 -> view.reportDownloadTask()
}
}
})
}
}
\ No newline at end of file
package com.mints.highgold.mvp.views
interface CsVedioView : BaseView {
fun reportDownloadTask()
}
\ No newline at end of file
......@@ -485,32 +485,32 @@ public interface LoanService {
builder.interceptors().add(okHttpInterceptor);
Retrofit retrofit;
// if (BuildConfig.DEBUG) {
// SPUtil spUtil = SPUtil.getInstance(context);
// if (TextUtils.isEmpty(spUtil.getString(Constant.LOCAL_IP))) {
// spUtil.putString(Constant.LOCAL_IP, "http://39.97.65.143:9082/api-p1/");
// }
// retrofit = new Retrofit.Builder()
// .client(builder.build())
// .baseUrl(spUtil.getString(Constant.LOCAL_IP))
// .addConverterFactory(GsonConverterFactory.create())
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .build();
// } else {
// retrofit = new Retrofit.Builder()
// .client(builder.build())
// .baseUrl(BuildConfig.MainIp)
// .addConverterFactory(GsonConverterFactory.create())
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .build();
// }
if (BuildConfig.DEBUG) {
SPUtil spUtil = SPUtil.getInstance(context);
if (TextUtils.isEmpty(spUtil.getString(Constant.LOCAL_IP))) {
spUtil.putString(Constant.LOCAL_IP, "http://39.97.65.143:9082/api-p1/");
}
retrofit = new Retrofit.Builder()
.client(builder.build())
.baseUrl(spUtil.getString(Constant.LOCAL_IP))
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build();
} else {
retrofit = new Retrofit.Builder()
.client(builder.build())
.baseUrl(BuildConfig.MainIp)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build();
}
// retrofit = new Retrofit.Builder()
// .client(builder.build())
// .baseUrl(BuildConfig.MainIp)
// .addConverterFactory(GsonConverterFactory.create())
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .build();
return retrofit.create(LoanService.class);
......
package com.mints.highgold.ui.activitys
import android.os.Bundle
import com.mints.highgold.R
import com.mints.highgold.common.Constant
import com.mints.highgold.mvp.presenters.CsVedioPresenter
import com.mints.highgold.mvp.views.CsVedioView
import com.mints.highgold.ui.activitys.base.BaseActivity
import com.mints.highgold.utils.LogUtil
/**
* 描述:创神视频
* 作者:孟崔广
* 时间:2020/5/25 14:43
* 邮箱:mengcga@163.com
*/
class CsVedioActivity : BaseActivity()
, CsVedioView {
private val TAG = CsVedioActivity::class.java.simpleName
private var csVedioPresenter: CsVedioPresenter? = null
private var vedioCoin: String? = null
private var vedioDownloadCoin: String? = null
private var tryCarrier: String? = null
private var extraId: String? = null
override fun getContentViewLayoutID() = R.layout.activity_cs_vedio
override fun isApplyKitKatTranslucency() = false
override fun getBundleExtras(extras: Bundle?) {
vedioCoin = extras!!.getString(Constant.TRY_VEDIO_COIN)
vedioDownloadCoin = extras.getString(Constant.TRY_TASK_H5DOWNLOADCOIN)
tryCarrier = extras.getString(Constant.TRY_CARRIER)
extraId = extras.getString(Constant.MAIN_EXTRA_ID)
LogUtil.d(TAG, "vedioCoin=${vedioCoin} vedioDownloadCoin=${vedioDownloadCoin} tryCarrier=${tryCarrier} extraId=${extraId} ")
}
override fun initViewsAndEvents() {
csVedioPresenter = CsVedioPresenter()
csVedioPresenter?.attachView(this)
}
override fun onDestroy() {
super.onDestroy()
csVedioPresenter?.detachView()
}
override fun reportDownloadTask() {
}
}
......@@ -27,6 +27,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mints.highgold.BuildConfig;
import com.mints.highgold.R;
import com.mints.highgold.ad.ChuangshenVedioAdManager;
import com.mints.highgold.ad.ShanhuVedioAdManager;
import com.mints.highgold.ad.VedioAdingManager;
import com.mints.highgold.ad.inscreenvedio.MintegralInscreenVedioAdManager;
......@@ -359,7 +360,8 @@ public class MainFragment extends BaseFragment
switch (view.getId()) {
case R.id.tv_fragment_main_whatgold:// 如何赚金币
readyGo(WhatGoldActivity.class);
// ShanhuVedioAdManager.getInstance(getActivity()).loadShanhuAd(0,0,"","");
// ChuangshenVedioAdManager.Companion.getInstance(getActivity()).loadChuangshenAd(10,20,"main","abc");
break;
case R.id.rl_fragment_main_redbox:// 红包
readyGo(RedboxActivity.class);
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.activitys.CsVedioActivity">
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
......@@ -21,75 +21,4 @@
name="gdt_sdk_download_path2"
path="com_qq_e_download" />
<!-- &lt;!&ndash; 愉悦推 &ndash;&gt;-->
<!-- <root-path-->
<!-- name="root"-->
<!-- path="" />-->
<!-- <external-path-->
<!-- name="external_storage_download"-->
<!-- path="Download" />-->
<!-- <files-path-->
<!-- name="my_images"-->
<!-- path="images/" />-->
<!-- <external-path-->
<!-- name="office"-->
<!-- path="." />-->
<!-- <external-path-->
<!-- name="external_storage_root"-->
<!-- path="." />-->
<!-- <external-path-->
<!-- name="download"-->
<!-- path="." />-->
<!-- <external-path-->
<!-- name="files_root"-->
<!-- path="mimoDownload" />-->
<!-- <external-path-->
<!-- name="youthkd_down"-->
<!-- path="youthkd" />-->
<!-- <external-path-->
<!-- name="beta_external_path"-->
<!-- path="Download/" />-->
<!-- <external-path-->
<!-- name="beta_external_files_path"-->
<!-- path="Android/data/" />-->
<!-- <external-path-->
<!-- name="my_images"-->
<!-- path="Download/" />-->
<!-- <external-path-->
<!-- name="gdt_sdk_download_path"-->
<!-- path="GDTDOWNLOAD" />-->
<!-- <external-path-->
<!-- name="external_files"-->
<!-- path="Download" />-->
<!-- <external-files-path-->
<!-- name="external_files_path"-->
<!-- path="Download" />-->
<!-- <external-files-path-->
<!-- name="bdpath"-->
<!-- path="bddownload/" />-->
<!-- <external-path-->
<!-- name="bdpathsd"-->
<!-- path="bddownload/" />-->
<!-- <root-path-->
<!-- name="download"-->
<!-- path="" />-->
<!-- <files-path-->
<!-- name="51xianwan"-->
<!-- path="downloads" />-->
<!-- <files-path-->
<!-- name="downloads"-->
<!-- path="downloads" />-->
<!-- &lt;!&ndash;这个下载路径不可以修改&ndash;&gt;-->
<!-- <external-path-->
<!-- name="IFly_AD_Download_Path"-->
<!-- path="IFlyAdDownload" />-->
<!-- &lt;!&ndash;这个下载路径不可以修改&ndash;&gt;-->
<!-- <external-cache-path-->
<!-- name="cache"-->
<!-- path="." />-->
</paths>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment