Commit 71b1d6aa authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parent a79934a8
...@@ -346,6 +346,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR ...@@ -346,6 +346,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
return return
} else { } else {
ll_lucky.visibility = View.VISIBLE ll_lucky.visibility = View.VISIBLE
context?.let { GlideUtils.loadRoundImageViewGif(it,R.drawable.ic_nine,iv_lucky_gif) }
} }
val complete = data.complete val complete = data.complete
......
...@@ -159,15 +159,15 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -159,15 +159,15 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
line_my_contactus.visibility = View.GONE line_my_contactus.visibility = View.GONE
} }
// 2-登录 // 2-是否有手机号
if (userManager.userIsLogin()) { if (!TextUtils.isEmpty(userManager.mobile)) {
tv_my_account.text = "用户ID:" + consumer.idcode tv_my_account.text = "手机号:" + consumer.mobile.substring(0,3)+"****"+consumer.mobile.substring(consumer.mobile.length-4)
iv_my_bind.visibility = View.GONE iv_my_bind.visibility = View.GONE
} else { } else {
// 未登录
tv_my_account.text = "绑定手机号" tv_my_account.text = "绑定手机号"
iv_my_bind.visibility = View.VISIBLE iv_my_bind.visibility = View.VISIBLE
} }
tv_my_id.text = "用户ID:"+consumer.idcode
// 3-vip // 3-vip
if (consumer.expireTime > 0) { if (consumer.expireTime > 0) {
......
package com.mints.helivideo.ui.widgets.luckymonkeypanel; package com.mints.helivideo.ui.widgets.luckymonkeypanel;
import android.content.Context; import android.content.Context;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
...@@ -24,6 +25,8 @@ public class PanelItemView extends FrameLayout implements ItemView { ...@@ -24,6 +25,8 @@ public class PanelItemView extends FrameLayout implements ItemView {
private ImageView iv_panel_item_pic; private ImageView iv_panel_item_pic;
private Drawable drawable; private Drawable drawable;
private Drawable drawable2; private Drawable drawable2;
private Context context;
public PanelItemView(Context context) { public PanelItemView(Context context) {
this(context, null); this(context, null);
...@@ -35,6 +38,8 @@ public class PanelItemView extends FrameLayout implements ItemView { ...@@ -35,6 +38,8 @@ public class PanelItemView extends FrameLayout implements ItemView {
public PanelItemView(Context context, AttributeSet attrs, int defStyleAttr) { public PanelItemView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
this.context=context;
inflate(context, R.layout.view_panel_item, this); inflate(context, R.layout.view_panel_item, this);
overlay = findViewById(R.id.overlay); overlay = findViewById(R.id.overlay);
iv_panel_item_pic = findViewById(R.id.iv_panel_item_pic); iv_panel_item_pic = findViewById(R.id.iv_panel_item_pic);
...@@ -48,18 +53,39 @@ public class PanelItemView extends FrameLayout implements ItemView { ...@@ -48,18 +53,39 @@ public class PanelItemView extends FrameLayout implements ItemView {
case "o": case "o":
// 一年 // 一年
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_year); 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; break;
case "f": case "f":
// 终身 // 终身
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_all); 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; break;
case "m": case "m":
// 手机 // 手机
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_mobile); iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_mobile);
tv_panel_item_text.setTextColor(ContextCompat.getColor(
context,
R.color.apk_uninstalled
));
tv_panel_item_text.setTypeface(null, Typeface.BOLD);
break; break;
default: default:
// 支付 // 支付
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_vip); 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; break;
} }
tv_panel_item_text.setText(text); tv_panel_item_text.setText(text);
......
package com.mints.helivideo.ui.widgets.luckymonkeypanel; package com.mints.helivideo.ui.widgets.luckymonkeypanel;
import android.content.Context; import android.content.Context;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
...@@ -24,6 +25,7 @@ public class PanelItemView2 extends FrameLayout implements ItemView { ...@@ -24,6 +25,7 @@ public class PanelItemView2 extends FrameLayout implements ItemView {
private ImageView iv_panel_item_pic; private ImageView iv_panel_item_pic;
private Drawable drawable; private Drawable drawable;
private Drawable drawable2; private Drawable drawable2;
private Context context;
public PanelItemView2(Context context) { public PanelItemView2(Context context) {
this(context, null); this(context, null);
...@@ -35,6 +37,7 @@ public class PanelItemView2 extends FrameLayout implements ItemView { ...@@ -35,6 +37,7 @@ public class PanelItemView2 extends FrameLayout implements ItemView {
public PanelItemView2(Context context, AttributeSet attrs, int defStyleAttr) { public PanelItemView2(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
this.context=context;
inflate(context, R.layout.view_panel_item2, this); inflate(context, R.layout.view_panel_item2, this);
overlay = findViewById(R.id.overlay); overlay = findViewById(R.id.overlay);
iv_panel_item_pic = findViewById(R.id.iv_panel_item_pic); iv_panel_item_pic = findViewById(R.id.iv_panel_item_pic);
...@@ -48,18 +51,39 @@ public class PanelItemView2 extends FrameLayout implements ItemView { ...@@ -48,18 +51,39 @@ public class PanelItemView2 extends FrameLayout implements ItemView {
case "o": case "o":
// 一年 // 一年
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_year); 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; break;
case "f": case "f":
// 终身 // 终身
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_all); 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; break;
case "m": case "m":
// 手机 // 手机
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_mobile); iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_mobile);
tv_panel_item_text.setTextColor(ContextCompat.getColor(
context,
R.color.apk_uninstalled
));
tv_panel_item_text.setTypeface(null, Typeface.BOLD);
break; break;
default: default:
// 支付 // 支付
iv_panel_item_pic.setImageResource(R.mipmap.ic_nine_vip); 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; break;
} }
tv_panel_item_text.setText(text); tv_panel_item_text.setText(text);
......
...@@ -38,8 +38,13 @@ import com.mints.helivideo.ui.widgets.VipCountDialog ...@@ -38,8 +38,13 @@ import com.mints.helivideo.ui.widgets.VipCountDialog
import com.mints.helivideo.utils.AppPreferencesManager import com.mints.helivideo.utils.AppPreferencesManager
import com.mints.helivideo.utils.SpanUtils import com.mints.helivideo.utils.SpanUtils
import com.mints.helivideo.utils.UIUtils import com.mints.helivideo.utils.UIUtils
import com.mints.library.utils.GlideUtils
import com.mints.library.utils.nodoubleclick.AntiShake 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.*
import kotlinx.android.synthetic.main.drama_activity_api_detail.iv_lucky_gif
import kotlinx.android.synthetic.main.drama_activity_api_detail.ll_lucky
import kotlinx.android.synthetic.main.drama_activity_api_detail.tv_lucky_status
import kotlinx.android.synthetic.main.fragment_main.*
/** /**
* @author Assen * @author Assen
...@@ -714,6 +719,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -714,6 +719,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
// 超过免费剧 // 超过免费剧
if (position >= mVedioBean!!.freeIndex) { if (position >= mVedioBean!!.freeIndex) {
ll_lucky.visibility = View.VISIBLE ll_lucky.visibility = View.VISIBLE
context?.let { GlideUtils.loadRoundImageViewGif(it,R.drawable.ic_nine,iv_lucky_gif) }
} else { } else {
ll_lucky.visibility = View.GONE ll_lucky.visibility = View.GONE
} }
......
...@@ -27,8 +27,13 @@ import com.mints.helivideo.ui.widgets.VipCountDialog ...@@ -27,8 +27,13 @@ import com.mints.helivideo.ui.widgets.VipCountDialog
import com.mints.helivideo.utils.AppPreferencesManager import com.mints.helivideo.utils.AppPreferencesManager
import com.mints.helivideo.utils.SpanUtils import com.mints.helivideo.utils.SpanUtils
import com.mints.helivideo.video.tx.adapter.TxVideoAdapter import com.mints.helivideo.video.tx.adapter.TxVideoAdapter
import com.mints.library.utils.GlideUtils
import com.mints.library.utils.nodoubleclick.AntiShake import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_tx_video.* import kotlinx.android.synthetic.main.activity_tx_video.*
import kotlinx.android.synthetic.main.activity_tx_video.iv_lucky_gif
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.fragment_main.*
class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
VideoEpisodeAdapter.OnEpisodeClickListener, TxVideoAdapter.OnCustomChildClickListener { VideoEpisodeAdapter.OnEpisodeClickListener, TxVideoAdapter.OnCustomChildClickListener {
...@@ -389,6 +394,8 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -389,6 +394,8 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
if (isLuckyShow || localLucky) { if (isLuckyShow || localLucky) {
ll_lucky.visibility = View.VISIBLE ll_lucky.visibility = View.VISIBLE
context?.let { GlideUtils.loadRoundImageViewGif(it,R.drawable.ic_nine,iv_lucky_gif) }
} else { } else {
ll_lucky.visibility = View.GONE ll_lucky.visibility = View.GONE
} }
......
...@@ -64,6 +64,16 @@ object GlideUtils { ...@@ -64,6 +64,16 @@ object GlideUtils {
}) })
} }
//加载Gif*****
fun loadRoundImageViewGif(mContext: Context, drawable: Int, imageView: ImageView) {
val options = RequestOptions()
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.DATA)
Glide.with(mContext)
.load(drawable)
.apply(options)
.into(imageView)
}
//默认加载 //默认加载
fun loadImageViewNoAnim(mContext: Context?, path: Any?, mImageView: ImageView?) { fun loadImageViewNoAnim(mContext: Context?, path: Any?, mImageView: ImageView?) {
......
...@@ -72,9 +72,9 @@ ...@@ -72,9 +72,9 @@
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/iv_lucky_gif"
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="70dp" android:layout_height="70dp" />
android:src="@mipmap/ic_get_mobile" />
<TextView <TextView
android:id="@+id/tv_lucky_status" android:id="@+id/tv_lucky_status"
......
...@@ -71,9 +71,9 @@ ...@@ -71,9 +71,9 @@
app:layout_constraintRight_toRightOf="parent"> app:layout_constraintRight_toRightOf="parent">
<ImageView <ImageView
android:id="@+id/iv_lucky_gif"
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="70dp" android:layout_height="70dp"/>
android:src="@mipmap/ic_get_mobile" />
<TextView <TextView
android:id="@+id/tv_lucky_status" android:id="@+id/tv_lucky_status"
......
...@@ -257,6 +257,7 @@ ...@@ -257,6 +257,7 @@
app:layout_constraintEnd_toEndOf="parent"> app:layout_constraintEnd_toEndOf="parent">
<ImageView <ImageView
android:id="@+id/iv_lucky_gif"
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="70dp" android:layout_height="70dp"
android:src="@mipmap/ic_get_mobile" /> android:src="@mipmap/ic_get_mobile" />
......
...@@ -34,25 +34,48 @@ ...@@ -34,25 +34,48 @@
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:src="@mipmap/ic_my_avat" /> android:src="@mipmap/ic_my_avat" />
<TextView <LinearLayout
android:id="@+id/tv_my_account"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:text="绑定手机号"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/iv_my_bind"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:orientation="vertical">
android:layout_marginLeft="10dp"
android:src="@mipmap/ic_my_bind"></ImageView>
<TextView
android:id="@+id/tv_my_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:text="用户ID:"
android:textColor="@color/black_text"
android:textSize="16sp" />
<LinearLayout
android:layout_marginTop="6dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_my_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:text="绑定手机号"
android:textColor="#000000"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/iv_my_bind"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:src="@mipmap/ic_my_bind"></ImageView>
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
...@@ -70,10 +93,10 @@ ...@@ -70,10 +93,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:visibility="gone"
android:background="@mipmap/bg_my_vip" android:background="@mipmap/bg_my_vip"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="24dp"> android:paddingLeft="24dp"
android:visibility="gone">
<TextView <TextView
android:id="@+id/tv_my_vip" android:id="@+id/tv_my_vip"
...@@ -108,11 +131,11 @@ ...@@ -108,11 +131,11 @@
<RelativeLayout <RelativeLayout
android:id="@+id/rl_lucky" android:id="@+id/rl_lucky"
android:visibility="gone"
android:layout_width="300dp" android:layout_width="300dp"
android:layout_height="300dp" android:layout_height="300dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"> android:visibility="gone">
<com.mints.helivideo.ui.widgets.luckymonkeypanel.LuckyMonkeyPanelView <com.mints.helivideo.ui.widgets.luckymonkeypanel.LuckyMonkeyPanelView
android:id="@+id/lucky_panel" android:id="@+id/lucky_panel"
...@@ -141,10 +164,10 @@ ...@@ -141,10 +164,10 @@
</RelativeLayout> </RelativeLayout>
<LinearLayout <LinearLayout
android:layout_marginTop="10dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="14dp" android:layout_marginStart="14dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="14dp" android:layout_marginEnd="14dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:background="@drawable/shape_bg_mobile" android:background="@drawable/shape_bg_mobile"
...@@ -212,14 +235,14 @@ ...@@ -212,14 +235,14 @@
android:background="@color/my_color_gray" /> android:background="@color/my_color_gray" />
<LinearLayout <LinearLayout
android:visibility="gone"
android:id="@+id/ll_my_payrecord" android:id="@+id/ll_my_payrecord"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="20dp" android:paddingStart="20dp"
android:paddingEnd="15dp"> android:paddingEnd="15dp"
android:visibility="gone">
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
...@@ -276,14 +299,14 @@ ...@@ -276,14 +299,14 @@
android:background="@color/my_color_gray" /> android:background="@color/my_color_gray" />
<LinearLayout <LinearLayout
android:visibility="gone"
android:id="@+id/ll_contactus" android:id="@+id/ll_contactus"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="20dp" android:paddingStart="20dp"
android:paddingEnd="15dp"> android:paddingEnd="15dp"
android:visibility="gone">
<TextView <TextView
android:id="@+id/tv_contact" android:id="@+id/tv_contact"
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<color name="my_color_gray">#E6E6E6</color> <color name="my_color_gray">#E6E6E6</color>
<color name="color_FDFDFD">#FDFDFD</color> <color name="color_FDFDFD">#FDFDFD</color>
<color name="color_A24240">#A24240</color>
<color name="color_F61F03">#FD563B</color> <color name="color_F61F03">#FD563B</color>
......
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