Commit 6dc96409 authored by mengcuiguang's avatar mengcuiguang

添加百度广告

parent 517c8dcb
......@@ -159,11 +159,14 @@
android:exported="false"
android:hardwareAccelerated="true"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.NineActivity"
android:exported="false"
android:theme="@style/TransparentTheme" />
<activity
android:name=".ui.activitys.SongAwardActivity"
android:exported="false"
android:screenOrientation="portrait" />
android:theme="@style/TransparentTheme" />
<activity
android:name=".ui.activitys.HintActivity"
android:launchMode="singleTask"
......@@ -219,5 +222,33 @@
android:authorities="${applicationId}.TTMultiProvider"
android:exported="false" />
<!-- Pangle end================== -->
<!-- baidu start================== -->
<!-- 声明打开落地页的Activity(不建议修改主题配置)-->
<activity
android:name="com.baidu.mobads.sdk.api.AppActivity"
android:configChanges="screenSize|keyboard|keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar" />
<!-- 声明打开显示激励视频/全屏视频的Activity-->
<activity
android:name="com.baidu.mobads.sdk.api.MobRewardVideoActivity"
android:configChanges="screenSize|orientation|keyboardHidden"
android:launchMode="singleTask"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- 如果targetSdkVersion设置值>=24,则强烈建议添加以下provider,否则会影响app变现 -->
<!-- android:authorities="${packageName}.bd.provider" authorities中${packageName}部分必须替换成app自己的包名 -->
<!-- 原来的FileProvider在新版本中改为BdFileProvider,继承自v4的FileProvider,需要在应用内引用support-v4包 -->
<provider
android:name="com.baidu.mobads.sdk.api.BdFileProvider"
android:authorities="${applicationId}.bd.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/bd_file_paths" />
</provider>
<!-- baidu end================== -->
</application>
</manifest>
\ No newline at end of file
......@@ -63,6 +63,7 @@ public class HalfScreenManagerNoPre {
adNativeLoader.loadFullScreenVideoAd(adSlot, new TTAdNative.FullScreenVideoAdListener() {
@Override
public void onError(int i, String s) {
LogUtil.d(TAG, "gromore预加载 插全屏广告实时加载-半屏--> 4、onError ");
if (adStatusListener != null) {
adStatusListener.adFail();
......
......@@ -29,6 +29,8 @@ object Constant {
const val CARRIERTYPE_REWARD_COIN = "REWARD_COIN" //红包提现页
const val CARRIERTYPE_REWARD_DI = "REWARD_DI" //元宝提现页
const val CARRIERTYPE_ONLY_SHOW = "ONLY_SHOW" //白嫖
const val CARRIERTYPE_SING_OVER = "ONLY_SHOW" //猜歌进度完成
const val CARRIERTYPE_SONG_CLICK = "REWARD_GUESS_SONG_CLICK" //不看视频点击答题 的入参
......
......@@ -7,5 +7,7 @@ data class MusicBean(
val nextIsAd: Boolean, //接下来是不是要看广告了
val openCash: Boolean, //还能不能提现,不能提现就不展示提现入口了
val turnNeedCount: Int, //提现需要的次数
val unitId: String,
val cash: String,
val userMsg: UserMsgBean? = null
)
\ No newline at end of file
......@@ -12,11 +12,16 @@ import com.duben.dayplaylet.R
import com.duben.dayplaylet.ad.AdManager
import com.duben.dayplaylet.ad.AdStatusListener
import com.duben.dayplaylet.ad.NoPreAdManager
import com.duben.dayplaylet.ad.half.HalfScreenManagerNoPre
import com.duben.dayplaylet.common.AppConfig
import com.duben.dayplaylet.common.Constant
import com.duben.dayplaylet.manager.TrackManager
import com.duben.dayplaylet.mvp.model.NineListBean
import com.duben.dayplaylet.mvp.model.NineShowBean
import com.duben.dayplaylet.ui.activitys.base.BaseActivity
import com.duben.dayplaylet.ui.widgets.DialogListener
import com.duben.dayplaylet.ui.widgets.WithDrawSucDialog
import com.duben.dayplaylet.utils.ConsumerToastUtil
import com.duben.dayplaylet.utils.SplitArrayUtils
import com.duben.dayplaylet.utils.rxutil.CommonRxTask
import com.duben.dayplaylet.utils.rxutil.RxjavaUtil
......@@ -29,11 +34,14 @@ import kotlinx.android.synthetic.main.activity_nine.*
*/
class NineActivity : BaseActivity(), View.OnClickListener {
companion object {
const val DRAW_ID = "DRAW_ID"
const val CASH = "CASH"
}
private var yoyo: YoYo.YoYoString? = null
val luckyIndexMap: MutableMap<Int, String> = HashMap()
private var nineShowBean: NineShowBean? = null
var isAdShow = false
private var mWithDrawSucDialog: WithDrawSucDialog? = null
var drawId = ""
var cash = ""
override fun getContentViewLayoutID() = R.layout.activity_nine
......@@ -41,33 +49,23 @@ class NineActivity : BaseActivity(), View.OnClickListener {
override fun toggleOverridePendingTransition() = true
override fun getOverridePendingTransitionMode() = TransitionMode.SCALE
override fun getOverridePendingTransitionMode() = TransitionMode.FADE
override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras)
extras?.let {
cash = it.getString(CASH, "")
drawId = it.getString(DRAW_ID, "")
}
}
override fun initViewsAndEvents() {
initListener()
btn_action?.postDelayed({
yoyo = YoYo.with(Techniques.Pulse).duration(1000).repeat(-1).playOn(btn_action)
}, 200)
}
override fun onResume() {
super.onResume()
}
override fun onDestroy() {
super.onDestroy()
yoyo?.stop()
yoyo = null
}
private fun initListener() {
btn_action.setOnClickListener(this)
rl_lucky.setOnClickListener(this)
iv_nine_next.setOnClickListener(this)
iv_nine_back.setOnClickListener(this)
}
......@@ -83,62 +81,106 @@ class NineActivity : BaseActivity(), View.OnClickListener {
R.id.iv_nine_back -> {
finish()
}
// R.id.btn_action, R.id.rl_lucky -> {
// if (luckyIndexMap.size == 0) {
// showToast("界面初始异常,请重新进入")
// return
// }
//
// if (isAdShow) {
// luckyAward()
// } else {
// if (nineShowBean != null) {
// if (nineShowBean!!.complete >= nineShowBean!!.need) {
// luckyAward()
// } else {
// val bundle = Bundle()
// bundle.putInt(NineKnowActivity.COMPLETE, nineShowBean!!.complete)
// bundle.putInt(NineKnowActivity.NEED, nineShowBean!!.need)
// readyGoThenKill(NineKnowActivity::class.java, bundle)
// }
// }
// }
// }
}
}
// fun startNine(data: NineListBean.NineBean) {
// if (data.pid == null) {
// showToast("产品未配置")
// return
// }
//
// if (!lucky_panel2.isGameRunning) {
// lucky_panel2.startGame()
//
// RxjavaUtil.executeRxTask(object : CommonRxTask<String>("") {
// override fun doInIOThread() {
// Thread.sleep(3000)
// }
//
// override fun doInUIThread() {
// if (this@NineActivity.isFinishing) {
// return
// }
//
// val index = getLuckyIndex(data.pid)
// lucky_panel2.tryToStop(index)
//
// Handler(Looper.getMainLooper()).postDelayed({
// val bundle = Bundle()
// bundle.putString(NinePayActivity.PID, data.pid)
// bundle.putString(NinePayActivity.TITLE, data.title)
// bundle.putString(NinePayActivity.TYPE, data.type)
// readyGoThenKill(NinePayActivity::class.java, bundle)
// }, 1500)
// }
// })
// }
// }
R.id.iv_nine_next -> {
// showAd(Constant.CARRIERTYPE_SING_OVER)
adCloseNext("")
}
}
}
private fun showAd(carrierType: String) {
AdManager.instance.showAd(this@NineActivity, carrierType,
object : AdStatusListener {
var canFail = false
override fun adSuccess() {
canFail = true
}
override fun adFail() {
if (canFail) return
showLoading("正在获取视频", false)
NoPreAdManager.loadVideoAd(
this@NineActivity,
carrierType, object : AdStatusListener {
override fun adFail() {
hideLoading()
showToast("广告太火爆了,请稍候再试")
}
override fun adSuccess() {
hideLoading()
}
override fun adClose(vo: HashMap<String, Any>?) {
hideLoading()
adCloseNext(carrierType)
}
})
}
override fun adClose(vo: HashMap<String, Any>?) {
adCloseNext(carrierType)
}
})
}
/**
* 点击关闭广告
*/
private fun adCloseNext(carrierType: String) {
Handler(Looper.getMainLooper()).postDelayed({
startNine()
}, 500)
}
fun startNine() {
if (!lucky_panel2.isGameRunning) {
lucky_panel2.startGame()
RxjavaUtil.executeRxTask(object : CommonRxTask<String>("") {
override fun doInIOThread() {
Thread.sleep(3000)
}
override fun doInUIThread() {
if (this@NineActivity.isFinishing) {
return
}
lucky_panel2.tryToStop(5)
Handler(Looper.getMainLooper()).postDelayed({
showWithdrawSucDialog()
}, 2000)
}
})
}
}
private fun showWithdrawSucDialog() {
TrackManager.getInstance().addCashoutReq(drawId)
mWithDrawSucDialog =
WithDrawSucDialog(context, 10, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
dialog?.dismiss()
when (v?.id) {
R.id.btn -> {
HalfScreenManagerNoPre.getInstance().showAd(this@NineActivity, null)
finish()
}
R.id.ib_close -> {
HalfScreenManagerNoPre.getInstance().showAd(this@NineActivity, null)
finish()
}
else -> {}
}
}
})
mWithDrawSucDialog?.show()
}
}
\ No newline at end of file
......@@ -113,6 +113,7 @@ class SongAwardActivity : BaseActivity(), View.OnClickListener {
}
override fun loadFail() {
ExpressManager.instance.preLoadAd()
}
})
......
......@@ -245,6 +245,7 @@ class TaskAwardActivity : BaseActivity(), View.OnClickListener {
}
override fun loadFail() {
ExpressManager.instance.preLoadAd()
}
})
......
......@@ -37,6 +37,7 @@ import com.duben.dayplaylet.manager.DPHolder
import com.duben.dayplaylet.mvp.model.MusicBean
import com.duben.dayplaylet.mvp.presenters.MusicPresenter
import com.duben.dayplaylet.mvp.views.MusicView
import com.duben.dayplaylet.ui.activitys.NineActivity
import com.duben.dayplaylet.ui.activitys.SongAwardActivity
import com.duben.dayplaylet.ui.fragment.base.LazyLoadBaseFragment
import com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
......@@ -84,7 +85,15 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
musicPresenter.attachView(this)
rl_open_cash.setOnClickListener {
showRewardAnim(10, 10)
mMusicBean?.let {
// if(it.completeCount>=it.turnNeedCount){
val bundle = Bundle()
bundle.putString(NineActivity.DRAW_ID, it.unitId)
bundle.putString(NineActivity.CASH, it.cash)
readyGo(NineActivity::class.java, bundle)
// }
}
}
}
......
......@@ -86,6 +86,7 @@ class VideoLockDialog(
}
override fun loadFail() {
ExpressManager.instance.preLoadAd()
}
})
......
......@@ -90,6 +90,7 @@ class WithDrawSucDialog(
}
override fun loadFail() {
ExpressManager.instance.preLoadAd()
}
})
......
......@@ -16,10 +16,10 @@ public class LuckyMonkeyPanelView2 extends FrameLayout {
private ImageView bg_2;
private PanelItemView2 itemView1, itemView2, itemView3,
itemView4, itemView6,
itemView5, itemView4, itemView6,
itemView7, itemView8, itemView9;
private ItemView[] itemViewArr = new ItemView[8];
private ItemView[] itemViewArr = new ItemView[9];
private int currentIndex = 0;
private int currentTotal = 0;
private int stayIndex = 0;
......@@ -44,12 +44,14 @@ public class LuckyMonkeyPanelView2 extends FrameLayout {
super(context, attrs, defStyleAttr);
inflate(context, R.layout.view_lucky_mokey_panel2, this);
setupView();
setImgArray();
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
startMarquee();
}
@Override
......@@ -65,24 +67,23 @@ public class LuckyMonkeyPanelView2 extends FrameLayout {
itemView2 = (PanelItemView2) findViewById(R.id.item2);
itemView3 = (PanelItemView2) findViewById(R.id.item3);
itemView4 = (PanelItemView2) findViewById(R.id.item4);
itemView5 = (PanelItemView2) findViewById(R.id.item5);
itemView6 = (PanelItemView2) findViewById(R.id.item6);
itemView7 = (PanelItemView2) findViewById(R.id.item7);
itemView8 = (PanelItemView2) findViewById(R.id.item8);
itemView9 = (PanelItemView2) findViewById(R.id.item9);
}
public void setImgArray(List<NineListBean.NineBean> list) {
// 0金币 1huawei手机 2提现券 3金币 4红包 5提现券 6金币 7phone
if (list != null && list.size() >= 8) {
itemView1.setStyle(list.get(0).getType(), list.get(0).getTitle());
itemView2.setStyle(list.get(1).getType(), list.get(1).getTitle());
itemView3.setStyle(list.get(2).getType(), list.get(2).getTitle());
itemView6.setStyle(list.get(3).getType(), list.get(3).getTitle());
itemView9.setStyle(list.get(4).getType(), list.get(4).getTitle());
itemView8.setStyle(list.get(5).getType(), list.get(5).getTitle());
itemView7.setStyle(list.get(6).getType(), list.get(6).getTitle());
itemView4.setStyle(list.get(7).getType(), list.get(7).getTitle());
public void setImgArray() {
itemView1.setStyle("¥5", "提现");
itemView2.setStyle("很遗憾", "下次再来");
itemView3.setStyle("¥8", "提现");
itemView6.setStyle("¥10", "提现");
itemView9.setStyle("¥3", "提现");
itemView8.setStyle("¥???", "提现");
itemView7.setStyle("¥50", "提现");
itemView4.setStyle("¥???", "提现");
itemView5.setStyle("¥99", "提现");
itemViewArr[0] = itemView4;
itemViewArr[1] = itemView1;
......@@ -92,7 +93,7 @@ public class LuckyMonkeyPanelView2 extends FrameLayout {
itemViewArr[5] = itemView9;
itemViewArr[6] = itemView8;
itemViewArr[7] = itemView7;
}
itemViewArr[8] = itemView5;
}
......
......@@ -22,7 +22,7 @@ public class PanelItemView2 extends FrameLayout implements ItemView {
private View overlay;
private TextView tv_panel_item_text;
private ImageView iv_panel_item_pic;
private TextView tv_panel_item_cash;
private Drawable drawable;
private Drawable drawable2;
private Context context;
......@@ -40,52 +40,14 @@ public class PanelItemView2 extends FrameLayout implements ItemView {
this.context=context;
inflate(context, R.layout.view_panel_item2, this);
overlay = findViewById(R.id.overlay);
iv_panel_item_pic = findViewById(R.id.iv_panel_item_pic);
tv_panel_item_cash = findViewById(R.id.tv_panel_item_cash);
tv_panel_item_text = findViewById(R.id.tv_panel_item_text);
drawable = ContextCompat.getDrawable(getContext(), R.drawable.bg_lucky_monkey_item_overlay);
drawable2 = ContextCompat.getDrawable(getContext(), R.drawable.bg_lucky_monkey_item_overlay2);
}
public void setStyle(String type, String text) {
switch (type) {
case "o":
// 一年
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_year);
tv_panel_item_text.setTextColor(ContextCompat.getColor(
context,
R.color.color_A24240
));
tv_panel_item_text.setTypeface(null, Typeface.NORMAL);
break;
case "f":
// 终身
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_all);
tv_panel_item_text.setTextColor(ContextCompat.getColor(
context,
R.color.color_A24240
));
tv_panel_item_text.setTypeface(null, Typeface.NORMAL);
break;
case "m":
// 手机
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_mobile);
tv_panel_item_text.setTextColor(ContextCompat.getColor(
context,
R.color.color_fea54c
));
tv_panel_item_text.setTypeface(null, Typeface.BOLD);
break;
default:
// 支付
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_vip);
tv_panel_item_text.setTextColor(ContextCompat.getColor(
context,
R.color.color_A24240
));
tv_panel_item_text.setTypeface(null, Typeface.NORMAL);
break;
}
public void setStyle(String cash, String text) {
tv_panel_item_cash.setText(cash);
tv_panel_item_text.setText(text);
}
......
......@@ -13,6 +13,12 @@
android:layout_centerInParent="true"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_nine_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@mipmap/ic_draw_quit" />
<RelativeLayout
android:id="@+id/rl_lucky"
......@@ -26,36 +32,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<RelativeLayout
android:id="@+id/btn_action"
android:layout_width="82dp"
android:layout_height="82dp"
android:layout_centerInParent="true"
android:background="@mipmap/ic_launcher_main">
<TextView
android:id="@+id/tv_nine_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:text="-/-"
android:textColor="@color/white"
android:textSize="10dp"></TextView>
</RelativeLayout>
</RelativeLayout>
<ImageView
android:id="@+id/iv_nine_back"
android:layout_width="44dp"
android:layout_height="44dp"
android:id="@+id/iv_nine_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="4dp"
android:src="@mipmap/ic_quit_yuan" />
android:layout_marginTop="20dp"
android:src="@mipmap/bg_draw_btn"></ImageView>
</LinearLayout>
</RelativeLayout>
......@@ -46,7 +46,7 @@
android:layout_alignBottom="@id/iv_open_cash"
android:layout_centerHorizontal="true"
android:layout_marginBottom="21dp"
android:text="3/5"
android:text="0/0"
android:textColor="@color/red"
android:textSize="12sp" />
......
......@@ -23,9 +23,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="14dp"
android:padding="5dp"
android:background="@drawable/bg_lucky_monkey_panel_nei"
android:orientation="vertical">
android:orientation="vertical"
android:padding="5dp">
<LinearLayout
android:layout_width="match_parent"
......@@ -83,9 +83,11 @@
android:layout_weight="1" />
<View
<com.duben.dayplaylet.ui.widgets.luckymonkeypanel.PanelItemView2
android:id="@+id/item5"
android:layout_width="88dp"
android:layout_height="88dp" />
android:layout_height="88dp"
android:background="@mipmap/ic_nine_item_bg" />
<View
......
......@@ -14,20 +14,27 @@
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_panel_item_pic"
android:layout_width="36dp"
android:layout_height="36dp"></ImageView>
<TextView
android:id="@+id/tv_panel_item_cash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="123"
android:textColor="@color/tv_message_recente_money"
android:textSize="20sp"
android:textStyle="bold"></TextView>
<TextView
android:id="@+id/tv_panel_item_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="4dp"
android:layout_marginRight="4dp"
android:gravity="center_horizontal"
android:textColor="#A24240"
android:textSize="11sp"></TextView>
android:text="123"
android:textColor="@color/tv_message_recente_money"
android:textSize="12sp"></TextView>
</LinearLayout>
......
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