Commit 0902a058 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 916b59c3
......@@ -115,10 +115,6 @@
android:name=".ui.activitys.WebActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.GuideActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.FeedbackActivity"
android:exported="false"
......
......@@ -40,7 +40,7 @@ object Constant {
const val FRAGMENT_CLICK_THREE = 2
const val FRAGMENT_CLICK_FOUR = 3
// 0-开屏,1-信息流,2-激励视频,3-插屏/新插屏 半屏,4-全屏,5-banner,6-DRAW信息流
// 0-开屏,1-信息流,2-激励视频,3-插屏/新插屏 半屏,4-全屏,5-banner
const val GRO_MORE_ADTYPE0 = "0"
const val GRO_MORE_ADTYPE1 = "1"
const val GRO_MORE_ADTYPE2 = "2"
......@@ -54,5 +54,4 @@ object Constant {
var INCOME_URL = "http://mints-web.mints-id.com/agreements/dayplaylet/sysm.html"//收益说明
var REGISTER_URL = "http://mints-web.mints-id.com/agreements/dayplaylet/yhxy.html"//注册协议
var PRIVACY_URL = "http://mints-web.mints-id.com/agreements/dayplaylet/syzc.html"//隐私协议
var MEMBERS_URL = "https://mints-web.mints-id.com/agreements/dayplaylet/gmxy.html"//会员付费服务协议
}
\ No newline at end of file
package com.duben.dayplaylet.ui.activitys
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.KeyEvent
import android.view.View
import com.duben.dayplaylet.R
......@@ -8,6 +10,8 @@ import com.duben.dayplaylet.ad.AdManager
import com.duben.dayplaylet.ad.AdStatusListener
import com.duben.dayplaylet.ad.NoPreAdManager
import com.duben.dayplaylet.ui.activitys.base.BaseActivity
import com.duben.dayplaylet.utils.BubbleUtils
import com.duben.dayplaylet.utils.SpanUtils
import com.duben.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_draw_progress.*
import kotlinx.android.synthetic.main.activity_task_award.iv_award_quit
......@@ -21,6 +25,7 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener {
private var progress = 0
private var max = 0
private var tempAdProgress = 0
override fun getContentViewLayoutID() = R.layout.activity_draw_progress
......@@ -39,31 +44,28 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener {
}
override fun initViewsAndEvents() {
// tv_award_hint.text = SpanUtils()
// .append("金元宝")
// .setForegroundColor(context.resources.getColor(R.color.red))
// .append("可以")
// .setForegroundColor(context.resources.getColor(R.color.title_bg))
// .append("无门槛")
// .setForegroundColor(context.resources.getColor(R.color.red))
// .append("提现哦~")
// .setForegroundColor(context.resources.getColor(R.color.title_bg))
// .create()
tv_draw_progress_count.text = SpanUtils()
.append(progress.toString())
.setFontSize(BubbleUtils.sp2px(30))
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D))
.append("/${max}")
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D))
.create()
tv_draw_progress_title.text = SpanUtils()
.append("还有任务")
.setForegroundColor(context.resources.getColor(R.color.black))
.append("未完成")
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D))
.create()
pb_draw_progress.progress = progress
pb_draw_progress.max = max
initListener()
}
private fun initListener() {
iv_award_quit.setOnClickListener(this)
iv_draw_progress_ad.setOnClickListener(this)
}
override fun onResume() {
super.onResume()
if (!this@DrawProgressActivity.isFinishing) {
}
tv_draw_progress_ad.setOnClickListener(this)
}
override fun finish() {
......@@ -74,10 +76,6 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener {
overridePendingTransition(0, R.anim.scale_out)
}
override fun onDestroy() {
super.onDestroy()
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
return if (keyCode == KeyEvent.KEYCODE_BACK) {
true
......@@ -94,7 +92,7 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener {
R.id.iv_award_quit -> {
finish()
}
R.id.iv_draw_progress_ad -> {
R.id.tv_draw_progress_ad -> {
showAd("")
}
}
......@@ -141,5 +139,20 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener {
* 点击关闭广告
*/
private fun adCloseNext(carrierType: String) {
tempAdProgress = tempAdProgress + 1
Handler(Looper.getMainLooper()).postDelayed({
val showProgress = progress + tempAdProgress
pb_draw_progress.progress = showProgress
pb_draw_progress.max = max
tv_draw_progress_count.text = SpanUtils()
.append(showProgress.toString())
.setFontSize(BubbleUtils.sp2px(30))
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D))
.append("/${max}")
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D))
.create()
}, 300)
}
}
\ No newline at end of file
package com.duben.dayplaylet.ui.activitys
import android.os.Bundle
import android.text.TextUtils
import android.view.KeyEvent
import androidx.viewpager.widget.ViewPager
import com.duben.dayplaylet.R
import com.duben.dayplaylet.manager.UserManager
import com.duben.dayplaylet.ui.activitys.base.BaseActivity
import com.duben.dayplaylet.ui.adapter.VPAdapter
import kotlinx.android.synthetic.main.activity_guide.*
/**
* 欢迎页
*/
class GuideActivity : BaseActivity() {
var count = 0
var layouts = intArrayOf(
R.layout.item_guide1,
R.layout.item_guide2,
R.layout.item_guide3
)
override fun getContentViewLayoutID(): Int {
return R.layout.activity_guide
}
override fun initViewsAndEvents() {
initView()
}
override fun isApplyKitKatTranslucency(): Boolean {
return false
}
override fun onDestroy() {
super.onDestroy()
vp_guide_viewpager.setOnPageChangeListener(null)
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
return if (keyCode == KeyEvent.KEYCODE_BACK) {
true
} else super.onKeyDown(
keyCode,
event
)
}
private fun initView() {
pageIndicatorView.count = 4
val viewPagerAdapter = VPAdapter(this, layouts)
vp_guide_viewpager.adapter = viewPagerAdapter
vp_guide_viewpager.setOnPageChangeListener(mOnPagerChangeListener)
btn_guide_start.setOnClickListener {
vp_guide_viewpager.currentItem = ++count
if (count == layouts.size) {
if (TextUtils.isEmpty(UserManager.getInstance().userID)) {
readyGoThenKill(MainActivity::class.java)
} else {
}
//带点渐变动画
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
}
}
}
private val mOnPagerChangeListener: ViewPager.OnPageChangeListener =
object : ViewPager.OnPageChangeListener {
override fun onPageSelected(position: Int) {
pageIndicatorView.selection = position
count = position
}
override fun onPageScrolled(
position: Int,
positionOffset: Float,
positionOffsetPixels: Int
) {
}
override fun onPageScrollStateChanged(arg0: Int) {}
}
}
\ No newline at end of file
......@@ -30,14 +30,12 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
private val userManager by lazy { UserManager.getInstance() }
override fun initViewsAndEvents() {
initLayout()
}
override fun getContentViewLayoutID() = R.layout.activity_settings
override fun onResume() {
super.onResume()
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
initLayout()
}
......@@ -67,18 +65,18 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
item_invitedCode.findViewById<TextView>(R.id.tv_right).text =
userManager.codeId
item_phone.findViewById<TextView>(R.id.tv_title).text = "手机号"
val phone = ContextCompat.getDrawable(this, R.mipmap.icon_settings_tel)
phone?.setBounds(0, 0, 56, 56)
item_phone.findViewById<TextView>(R.id.tv_title)
.setCompoundDrawables(phone, null, null, null)
item_phone.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE
item_phone.findViewById<ImageView>(R.id.iv_right).visibility = View.GONE
if (!TextUtils.isEmpty(userManager.mobile)) {
item_phone.findViewById<TextView>(R.id.tv_right).text = userManager.mobile
} else {
item_phone.findViewById<TextView>(R.id.tv_right).text = "未绑定"
}
// item_phone.findViewById<TextView>(R.id.tv_title).text = "手机号"
// val phone = ContextCompat.getDrawable(this, R.mipmap.icon_settings_tel)
// phone?.setBounds(0, 0, 56, 56)
// item_phone.findViewById<TextView>(R.id.tv_title)
// .setCompoundDrawables(phone, null, null, null)
// item_phone.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE
// item_phone.findViewById<ImageView>(R.id.iv_right).visibility = View.GONE
// if (!TextUtils.isEmpty(userManager.mobile)) {
// item_phone.findViewById<TextView>(R.id.tv_right).text = userManager.mobile
// } else {
// item_phone.findViewById<TextView>(R.id.tv_right).text = "未绑定"
// }
item_cleanCache.findViewById<TextView>(R.id.tv_title).text = "清理缓存"
val cleanCache = ContextCompat.getDrawable(this, R.mipmap.icon_settings_clean)
......@@ -131,9 +129,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
item_back.findViewById<ImageView>(R.id.iv_right).visibility = View.VISIBLE
}
override fun getContentViewLayoutID() = R.layout.activity_settings
override fun isApplyKitKatTranslucency() = false
override fun onClick(v: View?) {
if (AntiShake.check(v?.id)) return
......
......@@ -24,6 +24,7 @@ class WatchRecordAdapter :
GlideUtils.loadImageViewNoAnim2(context, item.coverImage, holder.getView(R.id.image_iv))
holder.getView<TextView>(R.id.title_tv).text = item.title
holder.getView<TextView>(R.id.info_tv).text = "观看至第${item.seeIndex}集"
holder.getView<TextView>(R.id.info_tv_max).text = "共${item.vedioTotal}集"
if (item.collect == 0) {
// 未收藏
......
......@@ -168,7 +168,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
Constant.CARRIERTYPE_REWARD_FIRST -> {
Handler(Looper.getMainLooper()).postDelayed({
ConsumerToastUtil.showAwardText(requireContext(), userInfo?.rewardCoin ?: 0, 0)
Handler(Looper.getMainLooper()).postDelayed({
addAnimation(iv_main_tempanim, iv_cash, R.mipmap.ic_redpkg)
Handler(Looper.getMainLooper()).postDelayed({
......
......@@ -100,22 +100,6 @@ class CustomDialogAgreement @JvmOverloads constructor(
* @param s
*/
fun setContent(s: String) {
SpanUtils.with(dialog_tv_content)
.append("为了更好的保护您的合法权益,请您阅读并同意以下协议")
.append("《${s}》").setClickSpan(object : ClickableSpan() {
override fun onClick(widget: View) {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, s)
bundle.putString(WebActivity.WEB_URL, Constant.MEMBERS_URL)
readyGo(context,WebActivity::class.java, bundle)
}
override fun updateDrawState(ds: TextPaint) {
ds.color = ContextCompat.getColor(context, R.color.main_mints)
ds.isUnderlineText = false
}
})
.create()
}
/**
......
......@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#feeddc" />
<solid android:color="#FEF9F5" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="10dip" />
......
......@@ -7,92 +7,134 @@
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/bg_task"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="130dp"
android:layout_marginRight="20dp"
android:background="@drawable/shape_bg_task"
android:padding="10dp">
<ImageView
android:id="@+id/iv_task_icon"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="50dp"
android:layout_marginRight="30dp"
android:background="@drawable/shape_banner_write"
android:orientation="vertical">
<TextView
android:id="@+id/tv_draw_progress_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_yuanbao_my"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
android:gravity="center"
android:text=""
android:textColor="@color/red"
android:textSize="20sp"
android:textStyle="bold"></TextView>
<TextView
android:id="@+id/tv_task_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:text="今天观看激励视频"
android:textColor="@color/black_text"
android:textSize="15sp"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@id/iv_task_icon"
app:layout_constraintTop_toTopOf="parent" />
<ProgressBar
android:id="@+id/pb_draw_progress"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="130dp"
android:layout_height="10dp"
android:layout_marginStart="@dimen/dp_10"
android:progressDrawable="@drawable/progressbar_versus_changevedio_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_task_icon"
app:layout_constraintTop_toBottomOf="@id/tv_task_title" />
android:gravity="center"
android:text="完成任务后即可提现"
android:textColor="#767474"
android:textSize="14sp"
android:textStyle="bold"></TextView>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:background="@drawable/shape_bg_task"
android:padding="10dp">
<ImageView
android:id="@+id/iv_task_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_draw_left"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_task_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginTop="10dp"
android:text="今天观看激励视频"
android:textColor="@color/black_text"
android:textSize="15sp"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@id/iv_task_icon"
app:layout_constraintTop_toTopOf="parent" />
<ProgressBar
android:id="@+id/pb_draw_progress"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="130dp"
android:layout_height="10dp"
android:layout_marginStart="@dimen/dp_10"
android:progressDrawable="@drawable/progressbar_versus_changevedio_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_task_icon"
app:layout_constraintTop_toBottomOf="@id/tv_task_title" />
<TextView
android:id="@+id/tv_draw_progress_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0/10"
android:textColor="@color/color_F44E0D"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_draw_progress_ad"
android:layout_width="210dp"
android:layout_height="60dp"
android:layout_gravity="center_horizontal"
android:background="@mipmap/bg_draw_btn"
android:gravity="center"
android:paddingBottom="4dp"
android:text="去完成"
android:textColor="@color/white"
android:textSize="16sp"></TextView>
<TextView
android:id="@+id/tv_draw_progress_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9/10"
android:textColor="@color/red"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="进度将在今日24时清零,请尽快完成任务"
android:textColor="#E35821"
android:textSize="13sp"></TextView>
</LinearLayout>
<ImageView
android:id="@+id/iv_draw_progress_ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:src="@mipmap/bg_task_award_next"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="进度将在今日24时清零,请尽快完成任务"
android:textColor="@color/red"
android:textSize="13sp"></TextView>
</LinearLayout>
android:layout_width="160dp"
android:layout_height="140dp"
android:layout_gravity="right"
android:src="@mipmap/bg_draw_top" />
</FrameLayout>
<ImageView
android:id="@+id/iv_award_quit"
......
......@@ -22,6 +22,7 @@
<include
android:id="@+id/item_phone"
android:visibility="gone"
layout="@layout/item_settings" />
<include
......
......@@ -82,7 +82,7 @@
android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:src="@mipmap/ic_quit_yuan"
android:src="@mipmap/ic_top"
android:visibility="invisible"></ImageView>
</FrameLayout>
......@@ -133,7 +133,7 @@
android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:src="@mipmap/ic_quit_yuan"
android:src="@mipmap/ic_top"
android:visibility="invisible"></ImageView>
</FrameLayout>
</LinearLayout>
......
......@@ -65,10 +65,10 @@
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="18dp"
android:visibility="gone"
android:layout_marginRight="16dp"
android:background="@drawable/shape_bg_write"
android:orientation="vertical"
android:visibility="gone">
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
......@@ -78,8 +78,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="4dp"
android:text="最近观看"
android:textColor="@color/black"
android:textSize="16sp"
......@@ -91,23 +91,23 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="6dp"
android:layout_marginTop="12dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_marginBottom="4dp"
android:text="查看更多"
android:textColor="@color/gray"
android:textSize="12sp"
android:textStyle="bold" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_main_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="8dp"
android:overScrollMode="never" />
</LinearLayout>
......
......@@ -11,8 +11,8 @@
<ImageView
android:id="@+id/ivTopItem"
android:layout_width="90dp"
android:layout_height="120dp"
android:layout_width="84dp"
android:layout_height="110dp"
android:scaleType="fitXY" />
<LinearLayout
......@@ -26,7 +26,7 @@
android:id="@+id/tvTopItemTitle"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginTop="8dp"
android:lines="2"
android:text="我去平行时空"
android:textColor="@color/black"
......
......@@ -24,23 +24,34 @@
<TextView
android:id="@+id/title_tv"
android:maxLines="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="重回80年代"
android:textColor="@color/black" />
<TextView
android:id="@+id/info_tv_max"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="重回80年代"
android:textColor="@color/gray"
android:textSize="12sp" />
<TextView
android:id="@+id/info_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:maxWidth="140dp"
android:maxLines="2"
android:text="重回80年代"
android:textColor="@color/gray"
android:textColor="@color/red"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
......
......@@ -15,6 +15,7 @@
<color name="title_bg">#2B3238</color>
<color name="btn_enabled">#F1F2F8</color>
<color name="black_text">#333333</color>
<color name="color_F44E0D">#F44E0D</color>
<color name="tv_message_recente_money">#FF5E5E</color>
<color name="product_net_text">#121B32</color>
<color name="order_color">#63677E</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