Commit a7321bc1 authored by mengcuiguang's avatar mengcuiguang

Merge branch 'dev_ad' of http://39.97.65.143:81/android/android_goodmoney into dev_ad

parents 63caef16 ae828bf1
...@@ -230,6 +230,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis ...@@ -230,6 +230,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
cdvvYilanTime.layoutParams = params cdvvYilanTime.layoutParams = params
cdvvYilanTime.setOnClickListener(this) cdvvYilanTime.setOnClickListener(this)
rl_fragment_main_redbox.setOnClickListener(this) rl_fragment_main_redbox.setOnClickListener(this)
rl_fragment_main_redbox.isClickable = false
} }
private fun initChannelFragment() { private fun initChannelFragment() {
...@@ -303,7 +304,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis ...@@ -303,7 +304,7 @@ class HorizonChannelFragment : BaseFragment(), HorizChannelView, View.OnClickLis
mRedBoxTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener { mRedBoxTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) { override fun onTick(millisUntilFinished: Long) {
if (!requireActivity().isFinishing) { if (!requireActivity().isFinishing) {
tv_fragment_main_redbox.text = TimeRender.ms2HMS(millisUntilFinished.toInt()) tv_fragment_main_redbox.text = TimeRender.ms2MS(millisUntilFinished.toInt())
} }
} }
......
...@@ -4,7 +4,9 @@ import android.os.Bundle ...@@ -4,7 +4,9 @@ import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.text.TextUtils import android.text.TextUtils
import android.view.Gravity
import android.view.View import android.view.View
import android.widget.FrameLayout
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.fragment.app.FragmentTransaction import androidx.fragment.app.FragmentTransaction
import com.daimajia.androidanimations.library.Techniques import com.daimajia.androidanimations.library.Techniques
...@@ -358,8 +360,14 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -358,8 +360,14 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
val params = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT) val params = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)
params.setMargins(0, 0, 0, BubbleUtils.dp2px(270)) params.setMargins(0, 0, 0, BubbleUtils.dp2px(270))
cdvvYilanTime.layoutParams = params cdvvYilanTime.layoutParams = params
val paramsRedBox = FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT)
paramsRedBox.setMargins(0, BubbleUtils.dp2px(60), 0, 0)
paramsRedBox.gravity = Gravity.END
rl_fragment_main_redbox.layoutParams = paramsRedBox
cdvvYilanTime.setOnClickListener(this) cdvvYilanTime.setOnClickListener(this)
rl_fragment_main_redbox.setOnClickListener(this) rl_fragment_main_redbox.setOnClickListener(this)
rl_fragment_main_redbox.isClickable = false
// 广告回调 // 广告回调
YLUIConfig.getInstance().registerAdListener(object : YLAdListener { YLUIConfig.getInstance().registerAdListener(object : YLAdListener {
...@@ -598,7 +606,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener { ...@@ -598,7 +606,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
mRedBoxTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener { mRedBoxTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) { override fun onTick(millisUntilFinished: Long) {
if (!requireActivity().isFinishing) { if (!requireActivity().isFinishing) {
tv_fragment_main_redbox.text = TimeRender.ms2HMS(millisUntilFinished.toInt()) tv_fragment_main_redbox.text = TimeRender.ms2MS(millisUntilFinished.toInt())
} }
} }
......
...@@ -248,4 +248,32 @@ public class TimeRender { ...@@ -248,4 +248,32 @@ public class TimeRender {
HMStime = hourStr + ":" + mintStr + ":" + sedStr; HMStime = hourStr + ":" + mintStr + ":" + sedStr;
return HMStime; return HMStime;
} }
/**
* 时间格式化
*
* @param _ms
* @return
*/
public static String ms2MS(int _ms) {
String HMStime;
_ms /= 1000;
int hour = _ms / 3600;
int mint = (_ms % 3600) / 60 + hour * 60;
int sed = _ms % 60;
// String hourStr = String.valueOf(hour);
// if (hour < 10) {
// hourStr = "0" + hourStr;
// }
String mintStr = String.valueOf(mint);
if (mint < 10) {
mintStr = "0" + mintStr;
}
String sedStr = String.valueOf(sed);
if (sed < 10) {
sedStr = "0" + sedStr;
}
HMStime = mintStr + ":" + sedStr;
return HMStime;
}
} }
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_fragment_main_redbox" android:id="@+id/rl_fragment_main_redbox"
android:layout_width="75dp" android:layout_width="50dp"
android:layout_height="75dp" android:layout_height="50dp"
android:layout_gravity="end" android:layout_gravity="end"
android:layout_marginTop="100dp" android:layout_marginTop="100dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="12dp" android:layout_height="12dp"
android:layout_gravity="center|bottom" android:layout_gravity="center|bottom"
android:layout_marginBottom="10dp" android:layout_marginBottom="8dp"
android:background="@drawable/shape_redbox_red" android:background="@drawable/shape_redbox_red"
android:gravity="center" android:gravity="center"
android:paddingStart="2dp" android:paddingStart="2dp"
android:paddingEnd="2dp" android:paddingEnd="2dp"
android:text="可拆开" android:text="可拆开"
android:textColor="@color/color_F28335" android:textColor="@color/color_F28335"
android:textSize="6sp" /> android:textSize="8sp" />
</FrameLayout> </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