Commit f5cfa99c authored by jyx's avatar jyx

我的页面添加继续观看弹窗

parent 7b882a5f
......@@ -109,7 +109,7 @@ class DrawExpressManager {
UIUtils.getScreenWidth(activity),
UIUtils.getScreenHeight(activity)
)
.setAdCount(1)//请求广告数量为1到3条 (优先采用平台配置的数量)
.setAdCount(3)//请求广告数量为1到3条 (优先采用平台配置的数量)
.build()
adNativeLoader.loadDrawFeedAd(adslot, object : TTAdNative.DrawFeedAdListener {
......
......@@ -100,7 +100,7 @@ class ExpressManager {
* 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
*/
.setImageAcceptedSize(UIUtils.getAdWidth(MintsApplication.getContext()).toInt(), 0)
.setAdCount(1)//请求广告数量为1到3条 (优先采用平台配置的数量)
.setAdCount(3)//请求广告数量为1到3条 (优先采用平台配置的数量)
.build()
adNativeLoader.loadFeedAd(adslot, object : TTAdNative.FeedAdListener {
......@@ -194,7 +194,20 @@ class ExpressManager {
private fun showExpressView(it: TTFeedAd) {
it.setExpressRenderListener(object : MediationExpressRenderListener {
override fun onRenderSuccess(p0: View?, p1: Float, p2: Float, p3: Boolean) {
mExpressAdCallback?.renderSuccess(frameLayout)
mExpressAdCallback?.let {
if (it.renderSuccess(frameLayout)) {
LogUtil.d(
TAG,
"gromore信息流 onRenderSuccess -> showAd->$isShowAd \n adcode->$adcode ecpm->$ecpm"
)
isLoadSuccess = 0
isShowAd = true
adShowTime = System.currentTimeMillis()
}
}
mExpressAdCallback = null
Log.i(TAG, "onRenderSuccess")
it.setDislikeCallback(ForegroundOrBackground.getTopActivity(),
object : TTAdDislike.DislikeInteractionCallback {
......
package com.mints.helivideo.ui.fragment
import android.app.Dialog
import android.os.Bundle
import android.os.Handler
import android.os.Looper
......@@ -7,7 +8,6 @@ import android.text.TextUtils
import android.view.View
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.mints.helivideo.BuildConfig
import com.mints.helivideo.R
import com.mints.helivideo.ad.AdManager
import com.mints.helivideo.ad.AdStatusListener
......@@ -22,18 +22,15 @@ import com.mints.helivideo.mvp.presenters.MyPresenter
import com.mints.helivideo.mvp.views.MyView
import com.mints.helivideo.ui.activitys.*
import com.mints.helivideo.ui.fragment.base.LazyLoadBaseFragment
import com.mints.helivideo.ui.widgets.DialogListener
import com.mints.helivideo.ui.widgets.NineContinueDialog
import com.mints.helivideo.utils.AppPreferencesManager
import com.mints.helivideo.utils.SpanUtils
import com.mints.helivideo.utils.TimeRender
import com.mints.helivideo.utils.ToastUtil
import com.mints.helivideo.utils.rxutil.CommonRxTask
import com.mints.helivideo.utils.rxutil.RxjavaUtil
import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_nine.*
import kotlinx.android.synthetic.main.fragment_main_my.*
import kotlinx.android.synthetic.main.fragment_main_my.btn_action
import kotlinx.android.synthetic.main.fragment_main_my.lucky_panel
import kotlinx.android.synthetic.main.fragment_main_my.tv_nine_count
/**
* 描述:我
......@@ -126,27 +123,9 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
readyGo(OrderRecordActivity::class.java)
}
R.id.btn_action -> {
if (luckyIndexMap.size == 0) {
showToast("界面初始异常,请重新进入")
return
}
if (nineShowBean != null) {
if (nineShowBean!!.complete != nineShowBean!!.need) {
val luckyFirst =
AppPreferencesManager.get().getBoolean(Constant.LUCKY_MY_FIRST, false)
if (!luckyFirst) {
AppPreferencesManager.get().put(Constant.LUCKY_MY_FIRST, true)
val bundle = Bundle()
bundle.putInt(NineKnowActivity.COMPLETE, nineShowBean!!.complete)
bundle.putInt(NineKnowActivity.NEED, nineShowBean!!.need)
readyGo(NineKnowActivity::class.java, bundle)
return
}
}
}
// clickTurn()
readyGo(NinePayActivity::class.java)
luckyAward()
}
}
}
......@@ -217,6 +196,8 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
//----9宫格逻辑--开始--//
override fun unlockSuc() {
myPresenter.showTurn()
showContinueDialog()
}
override fun getTurnIphoneMsgSuc(data: NineListBean) {
......@@ -313,7 +294,7 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
}
fun startNine(data: NineListBean.NineBean) {
private fun startNine(data: NineListBean.NineBean) {
if (data.pid == null) {
showToast("抽奖产品未配置")
return
......@@ -354,6 +335,44 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
return 1
}
// 点击九宫格按钮
private fun clickTurn() {
if (luckyIndexMap.size == 0) {
showToast("界面初始异常,请重新进入")
return
}
if (nineShowBean != null) {
if (nineShowBean!!.complete != nineShowBean!!.need) {
val luckyFirst =
AppPreferencesManager.get().getBoolean(Constant.LUCKY_MY_FIRST, false)
if (!luckyFirst) {
AppPreferencesManager.get().put(Constant.LUCKY_MY_FIRST, true)
val bundle = Bundle()
bundle.putInt(NineKnowActivity.COMPLETE, nineShowBean!!.complete)
bundle.putInt(NineKnowActivity.NEED, nineShowBean!!.need)
readyGo(NineKnowActivity::class.java, bundle)
return
}
}
}
luckyAward()
}
// 继续观看逻辑
private fun showContinueDialog() {
nineShowBean?.let {
NineContinueDialog(requireActivity(), it.need - it.complete, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
dialog?.dismiss()
clickTurn()
}
}).show()
}
}
//----9宫格逻辑--结束--//
}
\ No newline at end of file
package com.mints.helivideo.ui.widgets
import android.app.Activity
import android.app.Dialog
import android.view.Gravity
import android.view.KeyEvent
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import com.mints.helivideo.R
class NineContinueDialog(
activity: Activity,
watchCount: Int,
listener: DialogListener
) :
Dialog(activity, R.style.dialog) {
private val lp: WindowManager.LayoutParams
init {
setContentView(R.layout.dialog_nine_continue)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.windowAnimations = R.style.DialogAnimFade
window!!.attributes = lp
// 设置外部不可关闭
setCancelable(false)
setCanceledOnTouchOutside(false)
setOnKeyListener { dialogInterface, i, keyEvent ->
i == KeyEvent.KEYCODE_BACK
}
val tv_nine_text = findViewById<TextView>(R.id.tv_nine_text)
val tv_nine_next = findViewById<TextView>(R.id.tv_nine_next)
val tv_nine_close = findViewById<ImageView>(R.id.tv_nine_close)
tv_nine_text.text = String.format("再看%d集即可抽奖", watchCount)
listener.setDialog(this)
tv_nine_next.setOnClickListener(listener)
tv_nine_close.setOnClickListener { dismiss() }
}
}
\ No newline at end of file
......@@ -288,6 +288,6 @@ public class UIUtils {
}
public static float getAdWidth(Context context) {
return getScreenWidth(context) - dp2px(30);
return getScreenWidth(context) - dp2px(60);
}
}
......@@ -120,8 +120,8 @@ public class SuperShortVideoView extends RelativeLayout {
onPageSelectedMethod(position);
if (mCurrentPosition == mAdapter.getData().size() - 1) {
mAdapter.notifyItemChanged(mCurrentPosition);
if (isLuckPosition(position)) {
mAdapter.notifyItemChanged(position);
}
break;
case RecyclerView.SCROLL_STATE_DRAGGING://拖动
......
......@@ -20,7 +20,6 @@ import com.mints.helivideo.manager.UserManager
import com.mints.helivideo.mvp.model.*
import com.mints.helivideo.utils.UIUtils
import com.mints.helivideo.video.tx.TXVideoBaseView
import kotlinx.android.synthetic.main.drama_activity_api_detail.*
class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewHolder>() {
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="250dp"
android:layout_height="170dp"
android:layout_centerInParent="true"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@mipmap/bg_vip_count" />
<ImageView
android:id="@+id/tv_nine_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:src="@mipmap/ic_close" />
<TextView
android:id="@+id/tv_nine_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
android:gravity="center"
android:textColor="@color/black"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_nine_next"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_below="@id/tv_nine_text"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="24dp"
android:layout_marginBottom="18dp"
android:background="@mipmap/bg_vip_count_btn"
android:gravity="center"
android:text="继续观看"
android:textColor="#6C4D22"
android:textSize="14sp" />
</RelativeLayout>
</RelativeLayout>
......@@ -3,83 +3,97 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/fm"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:background="@mipmap/bg_vip_count"
android:orientation="vertical">
android:layout_centerInParent="true">
<TextView
android:id="@+id/text_count"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_gravity="right"
android:layout_margin="12dp"
android:background="@drawable/shape_vedio"
android:gravity="center"
android:text="3"
android:textColor="#969798"
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:scaleType="fitXY"
android:src="@mipmap/bg_vip_count" />
<LinearLayout
android:layout_width="wrap_content"
android:id="@+id/fm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp"
android:orientation="horizontal">
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:orientation="vertical">
<TextView
android:id="@+id/tv_dialog_vip_count_left"
android:id="@+id/text_count"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_gravity="right"
android:layout_margin="12dp"
android:background="@drawable/shape_vedio"
android:gravity="center"
android:text="3"
android:textColor="#969798"
android:textSize="16sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1分钱"
android:textColor="#E8541D"
android:textSize="22sp"
android:textStyle="bold" />
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_dialog_vip_count_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1分钱"
android:textColor="#E8541D"
android:textSize="22sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_dialog_vip_count_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 签约会员"
android:textColor="#2B272D"
android:textSize="22sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/tv_dialog_vip_count_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 签约会员"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="解锁全部剧集"
android:textColor="#2B272D"
android:textSize="22sp"
android:textStyle="bold" />
</LinearLayout>
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="解锁全部剧集"
android:textColor="#2B272D"
android:textSize="16sp" />
<TextView
android:layout_width="200dp"
android:layout_height="44dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="26dp"
android:layout_marginBottom="18dp"
android:background="@mipmap/bg_vip_count_btn"
android:gravity="center"
android:text="解锁"
android:textColor="#6C4D22"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="200dp"
android:layout_height="44dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="26dp"
android:layout_marginBottom="18dp"
android:background="@mipmap/bg_vip_count_btn"
android:gravity="center"
android:text="解锁"
android:textColor="#6C4D22"
android:textSize="18sp"
android:textStyle="bold" />
<FrameLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/shape_bg_write" />
</LinearLayout>
<FrameLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/shape_bg_write" />
</LinearLayout>
</FrameLayout>
</RelativeLayout>
......@@ -178,13 +178,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:background="@drawable/shape_bg_write"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
<com.mints.helivideo.ui.widgets.RoundRectLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -205,23 +205,24 @@
android:id="@+id/tv_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="试看已结束" />
<Button
android:id="@+id/unlock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_width="230dp"
android:layout_height="40dp"
android:layout_marginBottom="10dp"
android:background="@mipmap/bg_detail_top"
android:paddingStart="30dp"
android:text="看广告解锁1集"
android:textColor="@color/white" />
<Button
android:id="@+id/vip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="230dp"
android:layout_height="40dp"
android:layout_marginBottom="10dp"
android:background="@mipmap/bg_detail_bottom"
android:textColor="@color/white"
......
......@@ -11,7 +11,7 @@
android:layout_height="match_parent"
android:scaleType="center" />
<FrameLayout
<com.mints.helivideo.ui.widgets.RoundRectLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000">
......@@ -20,8 +20,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:background="@drawable/shape_bg_write"
android:gravity="center"
android:orientation="vertical">
......@@ -47,29 +47,31 @@
android:id="@+id/tv_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="试看已结束" />
<Button
android:id="@+id/unlock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_width="230dp"
android:layout_height="40dp"
android:layout_marginBottom="10dp"
android:background="@mipmap/bg_detail_top"
android:paddingStart="30dp"
android:text="看广告解锁1集"
android:textColor="@color/white" />
<Button
android:id="@+id/vip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="230dp"
android:layout_height="40dp"
android:layout_marginBottom="10dp"
android:background="@mipmap/bg_detail_bottom"
android:textColor="@color/white"
android:visibility="gone" />
</LinearLayout>
</FrameLayout>
</com.mints.helivideo.ui.widgets.RoundRectLayout>
</FrameLayout>
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