Commit b96018f9 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 393453bc
......@@ -136,10 +136,11 @@
<activity
android:name=".ui.activitys.NineActivity"
android:exported="false"
android:screenOrientation="portrait" />
android:theme="@style/TransparentTheme" />
<activity
android:name=".ui.activitys.NinePayActivity"
android:exported="false"
android:theme="@style/TransparentTheme" />
<activity
......
......@@ -22,11 +22,14 @@ object Constant {
const val MINTS_PKG_NAME = "com.mints.helivideo"
const val ACTION_EXIT_APP = "package.exit"
const val LUCKY_FLAG = "LUCKY_FLAG"
const val LUCKY_COMPLETE = "LUCKY_COMPLETE"
const val LUCKY_NEED = "LUCKY_NEED"
const val CARRIERTYPE_CSJ_VEDIO = "1"
const val CARRIERTYPE_TX_VEDIO = "1"
const val CARRIERTYPE_NINE = "2"
const val CARRIERTYPE_NINE3 = "3"
/**
* app应用首页 0-主页 1-中间 2-我
......
......@@ -67,7 +67,7 @@ class HomePresenter : BasePresenter<HomeView>() {
when (code) {
200 -> {
view.topTabsSuc(baseResponse.data)
showTurn()
// showTurn()
}
else -> {
view.showToast(message)
......@@ -94,8 +94,12 @@ class HomePresenter : BasePresenter<HomeView>() {
200 -> {
val data = baseResponse.data
if (data != null) {
AppPreferencesManager.get()
.put(Constant.LUCKY_FLAG, data.isShow)
// AppPreferencesManager.get()
// .put(Constant.LUCKY_FLAG, data.isShow)
// AppPreferencesManager.get()
// .put(Constant.LUCKY_COMPLETE, data.complete)
// AppPreferencesManager.get()
// .put(Constant.LUCKY_NEED, data.need)
}
}
}
......
......@@ -82,7 +82,7 @@ class MyPresenter : BasePresenter<MyView>() {
val code = baseResponse.status
when (code) {
200 -> {
showTurn(false)
showTurn()
getMyInfo()
}
}
......@@ -129,7 +129,7 @@ class MyPresenter : BasePresenter<MyView>() {
})
}
fun showTurn(isClick:Boolean) {
fun showTurn() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.showTurn(),
object : BaseSubscriber<BaseResponse<NineShowBean>>() {
......@@ -146,7 +146,7 @@ class MyPresenter : BasePresenter<MyView>() {
val message = baseResponse.message
when (code) {
200 -> view.showTurnSuc(isClick,baseResponse.data)
200 -> view.showTurnSuc(baseResponse.data)
else -> {
view.showToast(message)
}
......
......@@ -46,7 +46,7 @@ class NinePresenter : BasePresenter<NineView>() {
}
fun showTurn(isClick:Boolean) {
fun showTurn() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.showTurn(),
object : BaseSubscriber<BaseResponse<NineShowBean>>() {
......@@ -63,7 +63,7 @@ class NinePresenter : BasePresenter<NineView>() {
val message = baseResponse.message
when (code) {
200 -> view.showTurnSuc(isClick,baseResponse.data)
200 -> view.showTurnSuc(baseResponse.data)
else -> {
view.showToast(message)
}
......
......@@ -171,4 +171,37 @@ class VideoPresenter : BasePresenter<VideoView>() {
}
fun showTurn() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.showTurn(),
object : BaseSubscriber<BaseResponse<NineShowBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<NineShowBean>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.showTurnSuc(baseResponse.data)
else -> {
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ import com.mints.helivideo.mvp.model.UserBean
interface MyView : BaseView {
fun getUserSuc(data:UserBean)
fun showTurnSuc(isClick: Boolean, data: NineShowBean)
fun showTurnSuc(data: NineShowBean)
fun getTurnIphoneMsgSuc(data: NineListBean)
fun toTurnSuc(data: NineListBean.NineBean)
fun unlockSuc()
......
......@@ -7,6 +7,6 @@ import com.mints.helivideo.mvp.model.NineShowBean
interface NineView : BaseView {
fun getTurnIphoneMsgSuc(data: NineListBean)
fun toTurnSuc(data: NineListBean.NineBean)
fun showTurnSuc(isClick: Boolean, data: NineShowBean)
fun showTurnSuc(data: NineShowBean)
fun unlockSuc()
}
\ No newline at end of file
......@@ -16,4 +16,7 @@ interface VideoView : BaseView {
fun unlockSuc(indexList: IndexList)
fun unlockFail()
fun showTurnSuc(data: NineShowBean)
}
\ No newline at end of file
......@@ -33,11 +33,17 @@ class NineActivity : BaseActivity(), View.OnClickListener, NineView {
private val ninePresenter by lazy { NinePresenter() }
private var yoyo: YoYo.YoYoString? = null
val luckyIndexMap: MutableMap<Int, String> = HashMap()
private var nineShowBean: NineShowBean? = null
var carrierType = Constant.CARRIERTYPE_NINE
override fun getContentViewLayoutID() = R.layout.activity_nine
override fun isApplyKitKatTranslucency() = false
override fun toggleOverridePendingTransition() = true
override fun getOverridePendingTransitionMode() = TransitionMode.SCALE
override fun initViewsAndEvents() {
ninePresenter.attachView(this)
ninePresenter.getTurnIphoneMsg()
......@@ -52,7 +58,7 @@ class NineActivity : BaseActivity(), View.OnClickListener, NineView {
override fun onResume() {
super.onResume()
ninePresenter.showTurn(false)
ninePresenter.showTurn()
}
override fun onDestroy() {
......@@ -68,6 +74,11 @@ class NineActivity : BaseActivity(), View.OnClickListener, NineView {
iv_nine_back.setOnClickListener(this)
}
override fun finish() {
super.finish()
overridePendingTransition(0, R.anim.scale_out)
}
override fun onClick(v: View) {
if (AntiShake.check(v.id)) return
......@@ -87,11 +98,11 @@ class NineActivity : BaseActivity(), View.OnClickListener, NineView {
}
override fun unlockSuc() {
ninePresenter.showTurn(true)
ninePresenter.showTurn()
}
override fun getTurnIphoneMsgSuc(data: NineListBean) {
lucky_panel.setImgArray(data.list)
lucky_panel2.setImgArray(data.list)
initLuckyIndexForPid(data.list)
if (TextUtils.isEmpty(data.rule)) {
......@@ -117,11 +128,14 @@ class NineActivity : BaseActivity(), View.OnClickListener, NineView {
}, 500)
}
override fun showTurnSuc(isClick: Boolean, data: NineShowBean) {
AppPreferencesManager.get()
.put(Constant.LUCKY_FLAG, data.isShow)
if (isClick && data.complete >= data.need) {
override fun showTurnSuc(data: NineShowBean) {
nineShowBean = data
if (TextUtils.equals(
carrierType,
Constant.CARRIERTYPE_NINE3
) && data.complete >= data.need
) {
carrierType = Constant.CARRIERTYPE_NINE
ninePresenter.toTurn()
}
// 展示 5/20
......@@ -129,7 +143,11 @@ class NineActivity : BaseActivity(), View.OnClickListener, NineView {
}
private fun luckyAward() {
val carrierType = Constant.CARRIERTYPE_NINE
if (nineShowBean != null) {
if (nineShowBean!!.complete >= nineShowBean!!.need) {
carrierType = Constant.CARRIERTYPE_NINE3
}
}
AdManager.instance.showAd(this, carrierType,
object : AdStatusListener {
var canFail = false
......@@ -169,8 +187,13 @@ class NineActivity : BaseActivity(), View.OnClickListener, NineView {
}
fun startNine(data: NineListBean.NineBean) {
if (!lucky_panel.isGameRunning) {
lucky_panel.startGame()
if (data.pid == null) {
showToast("产品未配置")
return
}
if (!lucky_panel2.isGameRunning) {
lucky_panel2.startGame()
RxjavaUtil.executeRxTask(object : CommonRxTask<String>("") {
override fun doInIOThread() {
......@@ -183,7 +206,7 @@ class NineActivity : BaseActivity(), View.OnClickListener, NineView {
}
val index = getLuckyIndex(data.pid)
lucky_panel.tryToStop(index)
lucky_panel2.tryToStop(index)
Handler(Looper.getMainLooper()).postDelayed({
val bundle = Bundle()
......
......@@ -159,6 +159,8 @@ class NinePayActivity : BaseActivity(), View.OnClickListener, NinePayView {
activity.clickTab3Layout()
}
}, 500)
}else{
finish()
}
}
......
......@@ -7,7 +7,7 @@ import android.text.TextUtils
import android.view.View
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.mints.library.utils.nodoubleclick.AntiShake
import com.mints.helivideo.BuildConfig
import com.mints.helivideo.R
import com.mints.helivideo.ad.AdManager
import com.mints.helivideo.ad.AdStatusListener
......@@ -22,11 +22,11 @@ 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.utils.AppPreferencesManager
import com.mints.helivideo.utils.SpanUtils
import com.mints.helivideo.utils.TimeRender
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
......@@ -46,6 +46,8 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
val luckyIndexMap: MutableMap<Int, String> = HashMap()
private var yoyo: YoYo.YoYoString? = null
private var isInitLuckyData = false
private var nineShowBean: NineShowBean? = null
var carrierType = Constant.CARRIERTYPE_NINE
override fun getContentViewLayoutID() = R.layout.fragment_main_my
......@@ -84,7 +86,7 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
if (AntiShake.check(ll_my_record?.id)) return
if (!TextUtils.isEmpty(userManager?.userID)) {
myPresenter.showTurn(false)
myPresenter.showTurn()
myPresenter.getMyInfo()
} else {
myPresenter.userLogin()
......@@ -128,6 +130,19 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
}
luckyAward()
// if (nineShowBean != null) {
// if (nineShowBean!!.complete >= nineShowBean!!.need) {
// carrierType = Constant.CARRIERTYPE_NINE3
// }
// }
// val vo = java.util.HashMap<String, Any>()
// vo["adcode"] = "1"
// vo["ecpm"] = "1"
// vo["adSource"] = "1"
// vo["carrierType"] = carrierType
// vo["adid"] = BuildConfig.GROMORE_VIDEO_CODE
// myPresenter.unlock(vo)
}
}
}
......@@ -197,7 +212,7 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
//----9宫格逻辑--开始--//
override fun unlockSuc() {
myPresenter.showTurn(true)
myPresenter.showTurn()
}
override fun getTurnIphoneMsgSuc(data: NineListBean) {
......@@ -219,10 +234,8 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
}, 500)
}
override fun showTurnSuc(isClick: Boolean, data: NineShowBean) {
AppPreferencesManager.get()
.put(Constant.LUCKY_FLAG, data.isShow)
override fun showTurnSuc(data: NineShowBean) {
nineShowBean = data
if (data.isShow) {
// 加载一次转盘数据
if (!isInitLuckyData) {
......@@ -235,7 +248,12 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
}
rl_lucky.visibility = View.VISIBLE
if (isClick && data.complete >= data.need) {
if (TextUtils.equals(
carrierType,
Constant.CARRIERTYPE_NINE3
) && data.complete >= data.need
) {
carrierType = Constant.CARRIERTYPE_NINE
myPresenter.toTurn()
}
tv_nine_count.text = "${data.complete}/${data.need}次"
......@@ -245,7 +263,11 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
}
private fun luckyAward() {
val carrierType = Constant.CARRIERTYPE_NINE
if (nineShowBean != null) {
if (nineShowBean!!.complete >= nineShowBean!!.need) {
carrierType = Constant.CARRIERTYPE_NINE3
}
}
AdManager.instance.showAd(requireActivity(), carrierType,
object : AdStatusListener {
var canFail = false
......@@ -285,6 +307,11 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
}
fun startNine(data: NineListBean.NineBean) {
if (data.pid == null) {
showToast("抽奖产品未配置")
return
}
if (!lucky_panel.isGameRunning) {
lucky_panel.startGame()
......@@ -302,7 +329,7 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
bundle.putString(NinePayActivity.PID, data.pid)
bundle.putString(NinePayActivity.TITLE, data.title)
readyGo(NinePayActivity::class.java, bundle)
}, 500)
}, 1000)
}
})
}
......@@ -317,7 +344,7 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
}
}
return 0
return 1
}
//----9宫格逻辑--结束--//
......
package com.mints.helivideo.ui.widgets.luckymonkeypanel;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.mints.helivideo.R;
import com.mints.helivideo.mvp.model.NineListBean;
import java.util.List;
public class LuckyMonkeyPanelView2 extends FrameLayout {
private ImageView bg_1;
private ImageView bg_2;
private PanelItemView2 itemView1, itemView2, itemView3,
itemView4, itemView6,
itemView7, itemView8, itemView9;
private ItemView[] itemViewArr = new ItemView[8];
private int currentIndex = 0;
private int currentTotal = 0;
private int stayIndex = 0;
private boolean isMarqueeRunning = false;
private boolean isGameRunning = false;
private boolean isTryToStop = false;
private static final int DEFAULT_SPEED = 150;
private static final int MIN_SPEED = 50;
private int currentSpeed = DEFAULT_SPEED;
public LuckyMonkeyPanelView2(Context context) {
this(context, null);
}
public LuckyMonkeyPanelView2(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public LuckyMonkeyPanelView2(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
inflate(context, R.layout.view_lucky_mokey_panel2, this);
setupView();
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
startMarquee();
}
@Override
protected void onDetachedFromWindow() {
stopMarquee();
super.onDetachedFromWindow();
}
private void setupView() {
bg_1 = (ImageView) findViewById(R.id.bg_1);
bg_2 = (ImageView) findViewById(R.id.bg_2);
itemView1 = (PanelItemView2) findViewById(R.id.item1);
itemView2 = (PanelItemView2) findViewById(R.id.item2);
itemView3 = (PanelItemView2) findViewById(R.id.item3);
itemView4 = (PanelItemView2) findViewById(R.id.item4);
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());
itemViewArr[0] = itemView4;
itemViewArr[1] = itemView1;
itemViewArr[2] = itemView2;
itemViewArr[3] = itemView3;
itemViewArr[4] = itemView6;
itemViewArr[5] = itemView9;
itemViewArr[6] = itemView8;
itemViewArr[7] = itemView7;
}
}
private void stopMarquee() {
isMarqueeRunning = false;
isGameRunning = false;
isTryToStop = false;
}
private void startMarquee() {
isMarqueeRunning = true;
new Thread(new Runnable() {
@Override
public void run() {
while (isMarqueeRunning) {
try {
Thread.sleep(250);
} catch (InterruptedException e) {
e.printStackTrace();
}
post(new Runnable() {
@Override
public void run() {
if (bg_1 != null && bg_2 != null) {
if (VISIBLE == bg_1.getVisibility()) {
bg_1.setVisibility(GONE);
bg_2.setVisibility(VISIBLE);
} else {
bg_1.setVisibility(VISIBLE);
bg_2.setVisibility(GONE);
}
}
}
});
}
}
}).start();
}
private long getInterruptTime() {
currentTotal++;
if (isTryToStop) {
currentSpeed += 10;
if (currentSpeed > DEFAULT_SPEED) {
currentSpeed = DEFAULT_SPEED;
}
} else {
if (currentTotal / itemViewArr.length > 0) {
currentSpeed -= 10;
}
if (currentSpeed < MIN_SPEED) {
currentSpeed = MIN_SPEED;
}
}
return currentSpeed;
}
public boolean isGameRunning() {
return isGameRunning;
}
public void startGame() {
isGameRunning = true;
isTryToStop = false;
currentSpeed = DEFAULT_SPEED;
new Thread(new Runnable() {
@Override
public void run() {
while (isGameRunning) {
try {
Thread.sleep(getInterruptTime());
} catch (InterruptedException e) {
e.printStackTrace();
}
post(new Runnable() {
@Override
public void run() {
int preIndex = currentIndex;
currentIndex++;
if (currentIndex >= itemViewArr.length) {
currentIndex = 0;
}
itemViewArr[preIndex].setFocus(false);
itemViewArr[currentIndex].setFocus(true);
if (isTryToStop && currentSpeed == DEFAULT_SPEED && stayIndex == currentIndex) {
isGameRunning = false;
}
}
});
}
}
}).start();
}
public void tryToStop(int position) {
stayIndex = position;
isTryToStop = true;
}
}
package com.mints.helivideo.ui.widgets.luckymonkeypanel;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.mints.helivideo.R;
/**
* Created by jeanboy on 2017/4/20.
*/
public class PanelItemView2 extends FrameLayout implements ItemView {
private View overlay;
private TextView tv_panel_item_text;
private ImageView iv_panel_item_pic;
public PanelItemView2(Context context) {
this(context, null);
}
public PanelItemView2(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public PanelItemView2(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
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_text = findViewById(R.id.tv_panel_item_text);
}
public void setStyle(String type, String text) {
if (TextUtils.equals(type, "p")) {
// 支付
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_vip);
} else {
// 手机
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_mobile);
}
tv_panel_item_text.setText(text);
}
@Override
public void setFocus(boolean isFocused) {
if (overlay != null) {
overlay.setVisibility(isFocused ? INVISIBLE : VISIBLE);
}
}
}
......@@ -33,9 +33,11 @@ import com.mints.helivideo.ui.widgets.DialogListener
import com.mints.helivideo.ui.widgets.VideoEpisodeDialog
import com.mints.helivideo.ui.widgets.VipCountDialog
import com.mints.helivideo.utils.AppPreferencesManager
import com.mints.helivideo.utils.SpanUtils
import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.drama_activity_api_detail.*
import kotlinx.android.synthetic.main.drama_activity_api_detail.ll_lucky
import kotlinx.android.synthetic.main.fragment_main_my.*
import kotlinx.android.synthetic.main.fragment_tx_video.*
/**
......@@ -233,14 +235,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
override fun onResume() {
super.onResume()
if (AppPreferencesManager.get()
.getBoolean(Constant.LUCKY_FLAG, false)) {
// 匹配
ll_lucky.visibility = View.VISIBLE
} else {
// 未匹配
ll_lucky.visibility = View.GONE
}
videoPresenter.showTurn()
if (mVipFlag != UserManager.getInstance().vipFlag && UserManager.getInstance().vipFlag) {
// 重置状态
......@@ -596,6 +592,33 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
}
override fun showTurnSuc(data: NineShowBean) {
if (data.isShow) {
val complete = data.complete
val need = data.need
if (complete >= need) {
tv_lucky_status.text = SpanUtils()
.append("可领取")
.setForegroundColor(resources.getColor(R.color.apk_uninstalled))
.create()
} else {
tv_lucky_status.text = SpanUtils()
.append(complete.toString())
.setForegroundColor(resources.getColor(R.color.red))
.append("/")
.append(need.toString())
.create()
}
// 匹配
ll_lucky.visibility = View.VISIBLE
} else {
// 未匹配
ll_lucky.visibility = View.GONE
}
}
private fun playCollectAnim(view: LottieAnimationView) {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_collect.json")
......
......@@ -389,5 +389,9 @@ class DramaTabFragment : BaseFragment(), VideoView {
override fun unlockFail() {
}
override fun showTurnSuc(data: NineShowBean) {
}
}
\ No newline at end of file
......@@ -27,9 +27,15 @@ import com.mints.helivideo.ui.adapter.VideoEpisodeAdapter
import com.mints.helivideo.ui.widgets.DialogListener
import com.mints.helivideo.ui.widgets.VideoEpisodeDialog
import com.mints.helivideo.ui.widgets.VipCountDialog
import com.mints.helivideo.utils.SpanUtils
import com.mints.helivideo.video.tx.adapter.TxVideoAdapter
import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_tx_video.*
import kotlinx.android.synthetic.main.activity_tx_video.episode_tv
import kotlinx.android.synthetic.main.activity_tx_video.fm_bottom
import kotlinx.android.synthetic.main.activity_tx_video.ll_lucky
import kotlinx.android.synthetic.main.activity_tx_video.tv_lucky_status
import kotlinx.android.synthetic.main.drama_activity_api_detail.*
class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
VideoEpisodeAdapter.OnEpisodeClickListener, TxVideoAdapter.OnCustomChildClickListener {
......@@ -76,6 +82,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override fun onResume() {
super.onResume()
super_short_video_view.resume()
videoPresenter.showTurn()
if (mVipFlag != UserManager.getInstance().vipFlag && UserManager.getInstance().vipFlag) {
// 重置状态
......@@ -118,6 +125,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
fm_bottom.setOnClickListener(this)
close_iv.setOnClickListener(this)
ll_lucky.setOnClickListener(this)
}
......@@ -131,7 +139,9 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
R.id.fm_bottom -> {
showEpisodeDialog()
}
R.id.ll_lucky -> {
readyGo(NineActivity::class.java)
}
else -> {}
}
}
......@@ -199,6 +209,33 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override fun unlockFail() {
}
override fun showTurnSuc(data: NineShowBean) {
if (data.isShow) {
val complete = data.complete
val need = data.need
if (complete >= need) {
tv_lucky_status.text = SpanUtils()
.append("可领取")
.setForegroundColor(resources.getColor(R.color.apk_uninstalled))
.create()
} else {
tv_lucky_status.text = SpanUtils()
.append(complete.toString())
.setForegroundColor(resources.getColor(R.color.red))
.append("/")
.append(need.toString())
.create()
}
// 匹配
ll_lucky.visibility = View.VISIBLE
} else {
// 未匹配
ll_lucky.visibility = View.GONE
}
}
override fun onEpisodeClick(position: Int) {
dialog?.dismiss()
if (position >= mVedioBean!!.unlockIndex) {
......@@ -238,9 +275,6 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
}
}
R.id.ll_lucky2 -> {
readyGo(NineActivity::class.java)
}
R.id.leave -> {
// 返回
finish()
......
......@@ -55,9 +55,6 @@ class TxVideoFragment : BaseFragment(), RecommendView {
true
)
}
ll_lucky.setOnClickListener {
readyGo(NineActivity::class.java)
}
recommend_view.setOnCustomChildClickListener(object :
TxRecommendVideoAdapter.OnCustomChildClickListener {
override fun onCustomChildClick(view: View, position: Int) {
......@@ -99,15 +96,6 @@ class TxVideoFragment : BaseFragment(), RecommendView {
super.onResume()
if (AppConfig.fragmentClickFlag != Constant.FRAGMENT_CLICK_TWO) return
if (AppPreferencesManager.get()
.getBoolean(Constant.LUCKY_FLAG, false)) {
// 匹配
ll_lucky.visibility = View.VISIBLE
} else {
// 未匹配
ll_lucky.visibility = View.GONE
}
recommend_view.resume()
}
......
......@@ -80,19 +80,6 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
}
}
val llLucky = holder.getView<View>(R.id.ll_lucky2)
if (AppPreferencesManager.get()
.getBoolean(Constant.LUCKY_FLAG, false)) {
// 匹配
llLucky.visibility = View.VISIBLE
llLucky.setOnClickListener {
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
}
} else {
// 未匹配
llLucky.visibility = View.GONE
}
if (vedioBean?.collect == 0) {
// 未收藏
setCollectImage(holder.getView(R.id.zan_iv))
......
......@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#20000000" />
<solid android:color="#30000000" />
<corners android:radius="10dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#99000000" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="15dip" />
</shape>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#99B70A06" />
<solid android:color="#50000000" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="5dip" />
......
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout 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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/bg_nine"
android:background="#90000000"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_nine_back"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:padding="10dp"
android:src="@mipmap/ic_arrow_white" />
android:layout_centerInParent="true"
android:orientation="vertical">
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->
<!-- <RelativeLayout-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="@drawable/shape_bg_nine">-->
<!-- <com.sunfusheng.marqueeview.MarqueeView-->
<!-- android:id="@+id/marqueeView"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerVertical="true"-->
<!-- app:mvAnimDuration="1000"-->
<!-- app:mvInterval="3000"-->
<!-- app:mvSingleLine="true"-->
<!-- app:mvTextColor="@color/white"-->
<!-- app:mvTextSize="8sp" />-->
<!-- </RelativeLayout>-->
<!-- <ImageView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:visibility="gone"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:src="@mipmap/ic_nine_good"></ImageView>-->
<!-- </RelativeLayout>-->
<RelativeLayout
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp">
android:layout_height="wrap_content"
android:background="@drawable/shape_bg_nine">
<com.sunfusheng.marqueeview.MarqueeView
android:id="@+id/marqueeView"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
app:mvAnimDuration="1000"
app:mvInterval="3000"
app:mvSingleLine="true"
app:mvTextColor="@color/white"
app:mvTextSize="10sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="220dp"
android:layout_height="220dp"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal">
<com.mints.helivideo.ui.widgets.luckymonkeypanel.LuckyMonkeyPanelView
android:id="@+id/lucky_panel"
<com.mints.helivideo.ui.widgets.luckymonkeypanel.LuckyMonkeyPanelView2
android:id="@+id/lucky_panel2"
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_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:background="@mipmap/ic_luckly_btn">
android:background="@mipmap/ic_lucky_vedio">
<TextView
android:visibility="gone"
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:layout_marginBottom="6dp"
android:textColor="@color/white"
android:textSize="10dp"></TextView>
android:textSize="8dp"></TextView>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:background="@drawable/shape_bg_nine">
<com.sunfusheng.marqueeview.MarqueeView
android:id="@+id/marqueeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="40dp"
app:mvAnimDuration="1000"
app:mvInterval="3000"
app:mvSingleLine="true"
app:mvTextColor="@color/white"
app:mvTextSize="14sp" />
</RelativeLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:src="@mipmap/ic_nine_good"></ImageView>
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_nine_rule"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:layout_marginTop="4dp"
android:background="@drawable/shape_bg_nine"
android:orientation="vertical"
android:visibility="gone">
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:src="@mipmap/ic_nine_rule"></ImageView>
<TextView
android:id="@+id/tv_nine_rule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:layout_marginTop="10dp"
android:layout_margin="6dp"
android:textColor="#FFC1C3"
android:textSize="14sp"></TextView>
android:textSize="10sp"></TextView>
</LinearLayout>
<ImageView
android:id="@+id/iv_nine_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="10dp"
android:src="@mipmap/ic_quit_yuan" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
......@@ -60,4 +60,32 @@
</FrameLayout>
<LinearLayout
android:id="@+id/ll_lucky"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="11dp"
android:visibility="gone"
android:layout_gravity="bottom|right"
android:layout_marginBottom="220dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="50dp"
android:src="@mipmap/ic_get_mobile" />
<TextView
android:id="@+id/tv_lucky_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:background="@drawable/shape_bg_black2"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:text="0/5"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>
\ No newline at end of file
......@@ -14,7 +14,7 @@
<View
android:id="@+id/view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
......@@ -37,11 +37,11 @@
android:ellipsize="end"
android:gravity="center"
android:maxEms="9"
android:textStyle="bold"
android:maxLines="1"
android:text="-"
android:textColor="#fff"
android:textSize="16sp" />
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/info_tv"
......@@ -59,11 +59,11 @@
<LinearLayout
android:id="@+id/ll_lucky"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="11dp"
android:layout_marginBottom="220dp"
android:visibility="gone"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
......@@ -74,6 +74,17 @@
android:layout_height="50dp"
android:src="@mipmap/ic_get_mobile" />
<TextView
android:id="@+id/tv_lucky_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:background="@drawable/shape_bg_black2"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:text="0/5"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
......@@ -81,9 +92,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginBottom="110dp"
android:gravity="center"
android:orientation="vertical"
android:layout_marginBottom="110dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent">
......@@ -98,8 +109,8 @@
android:id="@+id/zan_num_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="6dp"
android:gravity="center"
android:text="-"
android:textColor="#fff"
android:textSize="14sp" />
......@@ -188,11 +199,11 @@
<Button
android:id="@+id/vip"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/bg_detail_bottom"
android:textColor="@color/white" />
android:textColor="@color/white"
android:visibility="gone" />
</LinearLayout>
......
......@@ -9,22 +9,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:visibility="gone"
android:id="@+id/ll_lucky"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="11dp"
android:layout_marginBottom="190dp"
android:gravity="center"
android:layout_gravity="bottom|right"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="50dp"
android:src="@mipmap/ic_get_mobile" />
</LinearLayout>
</FrameLayout>
\ No newline at end of file
......@@ -48,24 +48,6 @@
app:layout_constraintLeft_toLeftOf="parent" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_lucky2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="11dp"
android:layout_marginBottom="190dp"
android:gravity="center"
android:visibility="gone"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent">
<ImageView
android:layout_width="60dp"
android:layout_height="50dp"
android:src="@mipmap/ic_get_mobile" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_collect"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="220dp"
android:layout_height="220dp"
android:background="@drawable/bg_lucky_monkey_panel">
<ImageView
android:id="@+id/bg_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bubble0" />
<ImageView
android:id="@+id/bg_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bubble1"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:padding="5dp"
android:background="@drawable/bg_lucky_monkey_panel_nei"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.mints.helivideo.ui.widgets.luckymonkeypanel.PanelItemView2
android:id="@+id/item1"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@mipmap/ic_nine_item_bg" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<com.mints.helivideo.ui.widgets.luckymonkeypanel.PanelItemView2
android:id="@+id/item2"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@mipmap/ic_nine_item_bg" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<com.mints.helivideo.ui.widgets.luckymonkeypanel.PanelItemView2
android:id="@+id/item3"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@mipmap/ic_nine_item_bg" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.mints.helivideo.ui.widgets.luckymonkeypanel.PanelItemView2
android:id="@+id/item4"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@mipmap/ic_nine_item_bg" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<View
android:layout_width="50dp"
android:layout_height="50dp" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<com.mints.helivideo.ui.widgets.luckymonkeypanel.PanelItemView2
android:id="@+id/item6"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@mipmap/ic_nine_item_bg" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.mints.helivideo.ui.widgets.luckymonkeypanel.PanelItemView2
android:id="@+id/item7"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@mipmap/ic_nine_item_bg" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<com.mints.helivideo.ui.widgets.luckymonkeypanel.PanelItemView2
android:id="@+id/item8"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@mipmap/ic_nine_item_bg" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<com.mints.helivideo.ui.widgets.luckymonkeypanel.PanelItemView2
android:id="@+id/item9"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@mipmap/ic_nine_item_bg" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/item_bg"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_panel_item_pic"
android:layout_width="25dp"
android:layout_height="25dp"></ImageView>
<TextView
android:id="@+id/tv_panel_item_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:gravity="center_horizontal"
android:textColor="#A24240"
android:textSize="7sp"></TextView>
</LinearLayout>
<View
android:id="@+id/overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_lucky_monkey_item_overlay" />
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
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