Commit 179518ae authored by jyx's avatar jyx

代码优化

parent e286f970
...@@ -186,7 +186,7 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener { ...@@ -186,7 +186,7 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
} }
override fun updateDrawState(ds: TextPaint) { override fun updateDrawState(ds: TextPaint) {
ds.color = ContextCompat.getColor(mContext, R.color.color_FF9837) ds.color = ContextCompat.getColor(mContext, R.color.tv_message_recente_money)
ds.isUnderlineText = false ds.isUnderlineText = false
} }
}) })
...@@ -200,7 +200,7 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener { ...@@ -200,7 +200,7 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
} }
override fun updateDrawState(ds: TextPaint) { override fun updateDrawState(ds: TextPaint) {
ds.color = ContextCompat.getColor(mContext, R.color.color_FF9837) ds.color = ContextCompat.getColor(mContext, R.color.tv_message_recente_money)
ds.isUnderlineText = false ds.isUnderlineText = false
} }
}) })
...@@ -251,7 +251,8 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener { ...@@ -251,7 +251,8 @@ class MobileLoginActivity : BaseActivity(), LoginView, View.OnClickListener {
when (v?.id) { when (v?.id) {
R.id.dialog_btn_left -> { R.id.dialog_btn_left -> {
readyGo(MainActivity::class.java) readyGo(MainActivity::class.java)
val activity = ActivityPageManager.getInstance().getActivity(MainActivity::class.java) val activity =
ActivityPageManager.getInstance().getActivity(MainActivity::class.java)
if (activity != null && activity is MainActivity) { if (activity != null && activity is MainActivity) {
activity.clickTab3Layout() activity.clickTab3Layout()
} }
......
...@@ -6,6 +6,7 @@ import android.content.Intent ...@@ -6,6 +6,7 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper
import android.text.TextUtils import android.text.TextUtils
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
...@@ -194,7 +195,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener { ...@@ -194,7 +195,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
this, this,
SpanUtils() SpanUtils()
.append("确认注销账户?") .append("确认注销账户?")
.setForegroundColor(ContextCompat.getColor(this, R.color.color_FF9837)) .setForegroundColor(ContextCompat.getColor(this, R.color.tv_message_recente_money))
.create(), .create(),
"提示", "提示",
"确定", "确定",
...@@ -204,7 +205,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener { ...@@ -204,7 +205,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
ToastUtil.show(this@SettingsActivity, "注销账户申请已发起!") ToastUtil.show(this@SettingsActivity, "注销账户申请已发起!")
Handler().postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
finish() finish()
}, 200) }, 200)
......
...@@ -26,7 +26,7 @@ class FollowVideoFragment : BaseFragment(), FollowView { ...@@ -26,7 +26,7 @@ class FollowVideoFragment : BaseFragment(), FollowView {
private val followPresenter by lazy { FollowPresenter() } private val followPresenter by lazy { FollowPresenter() }
private val datas = arrayListOf<VedioBean>() private val datas = arrayListOf<VedioBean>()
lateinit var followAdapter: FollowAdapter private var followAdapter: FollowAdapter? = null
companion object { companion object {
fun newInstance(): Fragment { fun newInstance(): Fragment {
...@@ -59,9 +59,9 @@ class FollowVideoFragment : BaseFragment(), FollowView { ...@@ -59,9 +59,9 @@ class FollowVideoFragment : BaseFragment(), FollowView {
} }
rv_follow.layoutManager = GridLayoutManager(requireContext(), 3) rv_follow.layoutManager = GridLayoutManager(requireContext(), 3)
followAdapter = FollowAdapter(requireActivity()) followAdapter = FollowAdapter(requireActivity())
followAdapter.setEmptyView(emptyView) followAdapter?.setEmptyView(emptyView)
followAdapter.setNewInstance(datas) followAdapter?.setNewInstance(datas)
followAdapter.setOnItemClickListener { adapter, view, position -> followAdapter?.setOnItemClickListener { adapter, view, position ->
LocalVedioManager.startVedioDetailActivityForType( LocalVedioManager.startVedioDetailActivityForType(
requireActivity(), requireActivity(),
datas[position] datas[position]
...@@ -70,7 +70,7 @@ class FollowVideoFragment : BaseFragment(), FollowView { ...@@ -70,7 +70,7 @@ class FollowVideoFragment : BaseFragment(), FollowView {
rv_follow.adapter = followAdapter rv_follow.adapter = followAdapter
} }
fun getAdapter(): FollowAdapter { fun getAdapter(): FollowAdapter? {
return followAdapter return followAdapter
} }
...@@ -91,11 +91,11 @@ class FollowVideoFragment : BaseFragment(), FollowView { ...@@ -91,11 +91,11 @@ class FollowVideoFragment : BaseFragment(), FollowView {
datas.clear() datas.clear()
if (bannerList.list.isNotEmpty()) { if (bannerList.list.isNotEmpty()) {
datas.addAll(bannerList.list) datas.addAll(bannerList.list)
followAdapter.setNewInstance(datas) followAdapter?.setNewInstance(datas)
} }
showEditView(true) showEditView(true)
followAdapter.setEditStyle(false) followAdapter?.setEditStyle(false)
followAdapter.notifyDataSetChanged() followAdapter?.notifyDataSetChanged()
} }
override fun getCollectListFail() { override fun getCollectListFail() {
...@@ -112,13 +112,15 @@ class FollowVideoFragment : BaseFragment(), FollowView { ...@@ -112,13 +112,15 @@ class FollowVideoFragment : BaseFragment(), FollowView {
} }
fun delete() { fun delete() {
followAdapter?.let {
val strArr = arrayListOf<String>() val strArr = arrayListOf<String>()
for (datum in followAdapter.data) { for (datum in it.data) {
if (datum.isChecked) { if (datum.isChecked) {
strArr.add("" + datum.vedioId) strArr.add("" + datum.vedioId)
} }
} }
followPresenter.cancelCollect(strArr) followPresenter.cancelCollect(strArr)
} }
}
} }
\ No newline at end of file
...@@ -42,10 +42,11 @@ class RecommendFragment : BaseFragment(), View.OnClickListener { ...@@ -42,10 +42,11 @@ class RecommendFragment : BaseFragment(), View.OnClickListener {
private fun initVp2() { private fun initVp2() {
mCurrentNewFlag = UserManager.getInstance().newFlag mCurrentNewFlag = UserManager.getInstance().newFlag
fragments.clear()
tabsData.add("追剧") tabsData.add("追剧")
tabsData.add("推荐") tabsData.add("推荐")
fragments.clear()
if (mCurrentNewFlag) { if (mCurrentNewFlag) {
fragments.add(FollowVideoFragment.newInstance()) fragments.add(FollowVideoFragment.newInstance())
fragments.add(WatchVideoFragment.newInstance()) fragments.add(WatchVideoFragment.newInstance())
...@@ -145,18 +146,8 @@ class RecommendFragment : BaseFragment(), View.OnClickListener { ...@@ -145,18 +146,8 @@ class RecommendFragment : BaseFragment(), View.OnClickListener {
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_TWO) { if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_TWO) {
if (mCurrentNewFlag != UserManager.getInstance().newFlag) { if (mCurrentNewFlag != UserManager.getInstance().newFlag) {
mCurrentNewFlag = UserManager.getInstance().newFlag mCurrentNewFlag = UserManager.getInstance().newFlag
if (mCurrentNewFlag) { // 重置状态
// 匹配用户自有 initVp2()
fragments.clear()
fragments.add(FollowVideoFragment.newInstance())
fragments.add(WatchVideoFragment.newInstance())
} else {
// 未匹配用户展示穿山甲
fragments.clear()
fragments.add(FollowVideoFragment.newInstance())
fragments.add(DramaTabFragment())
}
vpAdapter?.notifyDataSetChanged()
} }
} }
} }
...@@ -190,7 +181,7 @@ class RecommendFragment : BaseFragment(), View.OnClickListener { ...@@ -190,7 +181,7 @@ class RecommendFragment : BaseFragment(), View.OnClickListener {
tv_edit_text.visibility = View.GONE tv_edit_text.visibility = View.GONE
} }
(requireActivity() as MainActivity).showEdit(isEdit) (requireActivity() as MainActivity).showEdit(isEdit)
(fragments[0] as FollowVideoFragment).getAdapter().setEditStyle(isEdit) (fragments[0] as FollowVideoFragment).getAdapter()?.setEditStyle(isEdit)
} }
private fun changeBottomTabColor(showBlack: Boolean) { private fun changeBottomTabColor(showBlack: Boolean) {
...@@ -209,7 +200,7 @@ class RecommendFragment : BaseFragment(), View.OnClickListener { ...@@ -209,7 +200,7 @@ class RecommendFragment : BaseFragment(), View.OnClickListener {
} }
fun fullChoice() { fun fullChoice() {
(fragments[0] as FollowVideoFragment).getAdapter().fullChoice() (fragments[0] as FollowVideoFragment).getAdapter()?.fullChoice()
} }
fun changeTab(index: Int) { fun changeTab(index: Int) {
......
...@@ -74,7 +74,7 @@ public class StickHeaderDecoration extends RecyclerView.ItemDecoration { ...@@ -74,7 +74,7 @@ public class StickHeaderDecoration extends RecyclerView.ItemDecoration {
mTextPaint.getTextBounds(adapter.getGroupName(position), 0, adapter.getGroupName(position).length(), mTextRect); mTextPaint.getTextBounds(adapter.getGroupName(position), 0, adapter.getGroupName(position).length(), mTextRect);
c.drawText(adapter.getGroupName(position), left + mTextPaddingLeft, (view.getTop() - mItemHeaderHeight) + mItemHeaderHeight / 2 + mTextRect.height() / 2, mTextPaint); c.drawText(adapter.getGroupName(position), left + mTextPaddingLeft, (view.getTop() - mItemHeaderHeight) + mItemHeaderHeight / 2 + mTextRect.height() / 2, mTextPaint);
} else { } else {
c.drawRect(left, view.getTop() - 1, right, view.getTop(), mLinePaint); // c.drawRect(left, view.getTop() - 1, right, view.getTop(), mLinePaint);
} }
} }
} }
......
...@@ -63,7 +63,7 @@ class VideoEpisodeDialog( ...@@ -63,7 +63,7 @@ class VideoEpisodeDialog(
findViewById<TextView>(R.id.title_tv).text = vedioBean?.title findViewById<TextView>(R.id.title_tv).text = vedioBean?.title
findViewById<TextView>(R.id.label_tv).text = findViewById<TextView>(R.id.label_tv).text =
if (vedioBean?.completeStatus == 0) "已完结" else "未完结" if (vedioBean?.completeStatus == 0) "已完结" else "更新中"
initVp() initVp()
} }
......
...@@ -31,7 +31,6 @@ import com.mints.wisdomclean.ui.adapter.VideoEpisodeAdapter ...@@ -31,7 +31,6 @@ import com.mints.wisdomclean.ui.adapter.VideoEpisodeAdapter
import com.mints.wisdomclean.ui.widgets.DialogListener import com.mints.wisdomclean.ui.widgets.DialogListener
import com.mints.wisdomclean.ui.widgets.VideoEpisodeDialog import com.mints.wisdomclean.ui.widgets.VideoEpisodeDialog
import com.mints.wisdomclean.ui.widgets.VipCountDialog import com.mints.wisdomclean.ui.widgets.VipCountDialog
import com.mints.wisdomclean.utils.LogUtil
import kotlinx.android.synthetic.main.drama_activity_api_detail.* import kotlinx.android.synthetic.main.drama_activity_api_detail.*
import org.json.JSONObject import org.json.JSONObject
...@@ -133,12 +132,15 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -133,12 +132,15 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
drama = outerDrama drama = outerDrama
drama?.let { drama?.let {
LogUtil.d("BBBBB -> " + mVedioBean!!.seeIndex)
it.index = mVedioBean!!.seeIndex it.index = mVedioBean!!.seeIndex
mInitUnlockIndex = mVedioBean!!.unlockIndex mInitUnlockIndex = mVedioBean!!.unlockIndex
mUnlockIndexMap[it.id] = mInitUnlockIndex mUnlockIndexMap[it.id] = mInitUnlockIndex
title_tv.text = it.title title_tv.text = it.title
if (mVedioBean!!.completeStatus == 0) {
episode_tv.text = String.format("共%d集 已完结", it.total) episode_tv.text = String.format("共%d集 已完结", it.total)
} else {
episode_tv.text = String.format("共%d集 更新中", it.total)
}
info_tv.text = String.format("第%d集", it.index + 1) info_tv.text = String.format("第%d集", it.index + 1)
unlock.text = String.format("看广告解锁%d集", lockSet) unlock.text = String.format("看广告解锁%d集", lockSet)
if (mVedioBean!!.collect == 0) { if (mVedioBean!!.collect == 0) {
...@@ -285,7 +287,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -285,7 +287,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
} }
mVedioBean!!.seeIndex = position + 1 mVedioBean!!.seeIndex = position + 1
LogUtil.d("AAAAA -> " + mVedioBean!!.seeIndex + " - " + position)
LocalVedioManager.commitVedio(mVedioBean!!) LocalVedioManager.commitVedio(mVedioBean!!)
showVipCountDialog(position) showVipCountDialog(position)
...@@ -409,7 +410,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -409,7 +410,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
hasUnlockList.add(widget.currentDramaIndex + lockSet) hasUnlockList.add(widget.currentDramaIndex + lockSet)
mHasUnlockIndexMap[drama.id] = hasUnlockList mHasUnlockIndexMap[drama.id] = hasUnlockList
} }
mUnlockIndexMap[drama.id] = mUnlockIndexMap[drama.id]!! + lockSet mUnlockIndexMap[drama.id] =
mUnlockIndexMap[drama.id]!! + lockSet
blockView?.visibility = View.GONE blockView?.visibility = View.GONE
callback?.onDramaRewardArrived() // 解锁当前集 callback?.onDramaRewardArrived() // 解锁当前集
......
...@@ -91,7 +91,7 @@ class VideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -91,7 +91,7 @@ class VideoActivity : BaseActivity(), View.OnClickListener, VideoView,
fun initView() { fun initView() {
mVedioBean?.let { mVedioBean?.let {
episode_tv.text = episode_tv.text =
"共" + it.vedioTotal + "集" + if (it.completeStatus == 0) "已完结" else "更新中" + " >" "共" + it.vedioTotal + "集" + if (it.completeStatus == 0) "已完结" else "更新中"
} }
fm_bottom.setOnClickListener(this) fm_bottom.setOnClickListener(this)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="345dp" android:height="44dp"> <item android:width="345dp" android:height="44dp">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<solid android:color="#fffeb63d" /> <solid android:color="@color/tv_message_recente_money" />
<corners android:radius="50dp" /> <corners android:radius="50dp" />
</shape> </shape>
</item> </item>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="345dp" android:height="44dp"> <item android:width="345dp" android:height="44dp">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#fffeb63d" /> <stroke android:width="1dp" android:color="@color/tv_message_recente_money" />
<solid android:color="#ffffff" /> <solid android:color="#ffffff" />
<corners android:radius="50dp" /> <corners android:radius="50dp" />
</shape> </shape>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@android:color/white" android:drawable="@drawable/btn_index_submit" android:state_checked="true"></item> <item android:color="@android:color/white" android:drawable="@drawable/btn_index_submit" android:state_checked="true"></item>
<item android:color="#FEB63D" android:drawable="@drawable/btn_index_submit_unchecked" android:state_checked="false"></item> <item android:color="@color/tv_message_recente_money" android:drawable="@drawable/btn_index_submit_unchecked" android:state_checked="false"></item>
</selector> </selector>
\ No newline at end of file
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
android:layout_marginRight="2dp" android:layout_marginRight="2dp"
android:padding="5dp" android:padding="5dp"
android:text="@string/register_name" android:text="@string/register_name"
android:textColor="@color/color_FF9837" android:textColor="@color/tv_message_recente_money"
android:textSize="14sp" /> android:textSize="14sp" />
<View <View
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
android:layout_marginLeft="2dp" android:layout_marginLeft="2dp"
android:padding="5dp" android:padding="5dp"
android:text="隐私政策" android:text="隐私政策"
android:textColor="@color/color_FF9837" android:textColor="@color/tv_message_recente_money"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:gravity="center" android:gravity="center"
android:text="获取验证码" android:text="获取验证码"
android:textColor="@color/color_FF9837" android:textColor="@color/tv_message_recente_money"
android:textSize="12sp" /> android:textSize="12sp" />
</RelativeLayout> </RelativeLayout>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_weight="1" android:layout_weight="1"
android:text="共100集 已完结 >" android:text="共100集 已完结"
android:textColor="@color/white" /> android:textColor="@color/white" />
<ImageView <ImageView
......
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="20dp" android:paddingStart="20dp"
android:paddingEnd="20dp"> android:paddingEnd="15dp">
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="20dp" android:paddingStart="20dp"
android:paddingEnd="20dp"> android:paddingEnd="15dp">
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="20dp" android:paddingStart="20dp"
android:paddingEnd="20dp"> android:paddingEnd="15dp">
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="20dp" android:paddingStart="20dp"
android:paddingEnd="20dp"> android:paddingEnd="15dp">
<TextView <TextView
android:id="@+id/tv_contact" android:id="@+id/tv_contact"
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="20dp" android:paddingStart="20dp"
android:paddingEnd="20dp"> android:paddingEnd="15dp">
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
......
...@@ -34,5 +34,6 @@ ...@@ -34,5 +34,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:background="#E6E6E6" /> android:background="#E6E6E6"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>
\ 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