Commit 2112529e authored by jyx's avatar jyx

优化页面样式

parent b31d5d0e
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
......
......@@ -8,7 +8,6 @@ import android.os.Bundle
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
......@@ -44,6 +43,8 @@ class MainActivity : BaseActivity(), View.OnClickListener {
var tabIvRecommend: TextView? = null
var tabIvMy: TextView? = null
private var mShowBlack = false
// 底部标签切换的Fragment
private var mainFragment: Fragment? = null
private var recommendFragment: Fragment? = null
......@@ -205,7 +206,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
tabIvLoan!!.isSelected = true
tabIvRecommend!!.isSelected = false
tabIvMy!!.isSelected = false
ll_bottom_tab.background= ContextCompat.getDrawable(context, R.color.white)
changeBottomTabColor(false)
}
/**
......@@ -220,8 +221,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
tabIvLoan!!.isSelected = false
tabIvRecommend!!.isSelected = true
tabIvMy!!.isSelected = false
ll_bottom_tab.background= ContextCompat.getDrawable(context, R.color.black)
changeBottomTabColor(mShowBlack)
}
/**
......@@ -236,7 +236,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
tabIvLoan!!.isSelected = false
tabIvRecommend!!.isSelected = false
tabIvMy!!.isSelected = true
ll_bottom_tab.background= ContextCompat.getDrawable(context, R.color.white)
changeBottomTabColor(false)
}
......@@ -298,4 +298,29 @@ class MainActivity : BaseActivity(), View.OnClickListener {
ll_edit.visibility = View.GONE
}
}
fun showBlack(showBlack: Boolean) {
this.mShowBlack = showBlack
changeBottomTabColor(showBlack)
}
private fun changeBottomTabColor(showBlack: Boolean) {
if (showBlack) {
tabIvRecommend?.setTextColor(
ContextCompat.getColorStateList(
context,
R.color.item_text_sel2
)
)
ll_bottom_tab.background = ContextCompat.getDrawable(context, R.color.black)
} else {
tabIvRecommend?.setTextColor(
ContextCompat.getColorStateList(
context,
R.color.item_text_sel
)
)
ll_bottom_tab.background = ContextCompat.getDrawable(context, R.color.white)
}
}
}
\ No newline at end of file
......@@ -17,7 +17,6 @@ class RecommendPageAdapter(private val fragments: List<Fragment>, fragment: Frag
private val ids = arrayListOf(fid1, fid2)
private val createID = hashSetOf<Long>()
override fun getItemId(position: Int): Long {
return position.toLong()
}
......
......@@ -110,21 +110,21 @@ class MyFragment : BaseFragment(), MyView, View.OnClickListener {
override fun onClick(v: View?) {
when (v?.id) {
R.id.ll_my_vip, R.id.fl_my_vip, R.id.iv_my_hint -> {
// if (!userManager.vipFlag) {
// readyGo(VipActivity::class.java)
// }
AdManager.instance.showAd(requireActivity(), "", object : AdStatusListener {
override fun adSuccess() {
}
override fun adFail() {
}
override fun adClose() {
}
if (!userManager.vipFlag) {
readyGo(VipActivity::class.java)
}
})
// AdManager.instance.showAd(requireActivity(), "", object : AdStatusListener {
// override fun adSuccess() {
// }
//
// override fun adFail() {
// }
//
// override fun adClose() {
// }
//
// })
}
R.id.iv_my_set -> {
val idList = mutableListOf<Long>()
......
......@@ -22,8 +22,6 @@ import kotlinx.android.synthetic.main.fragment_recommend.*
*/
class RecommendFragment : BaseFragment(), View.OnClickListener {
private var isEdit = false
private var mSelectTabIndex = -1
private val tabsData = mutableListOf<String>()
private val fragments = mutableListOf<Fragment>()
......@@ -53,11 +51,17 @@ class RecommendFragment : BaseFragment(), View.OnClickListener {
tab.id = position
tab.customView = getTabView(position)
}.attach()
tab_recommend.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) {
mSelectTabIndex = tab!!.id
updateTab(tab, true, mSelectTabIndex)
if (mSelectTabIndex == 0) {
changeBottomTabColor(false)
iv_edit.visibility = View.VISIBLE
} else {
changeBottomTabColor(true)
iv_edit.visibility = View.GONE
}
}
override fun onTabUnselected(tab: TabLayout.Tab?) {
......@@ -67,7 +71,10 @@ class RecommendFragment : BaseFragment(), View.OnClickListener {
override fun onTabReselected(tab: TabLayout.Tab?) {
}
})
vp2_recommend.offscreenPageLimit = 2
// 默认选中第二个
tab_recommend.getTabAt(1)?.select()
vp2_recommend.setCurrentItem(1, false)
vp2_recommend.offscreenPageLimit = 1
}
private fun getTabView(position: Int): View {
......@@ -116,8 +123,10 @@ class RecommendFragment : BaseFragment(), View.OnClickListener {
}
}
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_TWO) {
}
}
......@@ -154,6 +163,10 @@ class RecommendFragment : BaseFragment(), View.OnClickListener {
(fragments[0] as FollowVideoFragment).getAdapter().setEditStyle(isEdit)
}
private fun changeBottomTabColor(showBlack: Boolean) {
(requireActivity() as MainActivity).showBlack(showBlack)
}
fun fullChoice() {
(fragments[0] as FollowVideoFragment).getAdapter().fullChoice()
}
......@@ -162,4 +175,16 @@ class RecommendFragment : BaseFragment(), View.OnClickListener {
}
override fun onHiddenChanged(hidden: Boolean) {
super.onHiddenChanged(hidden)
// 传递生命周期
if (hidden) {
fragments[1].onPause()
onPause()
} else {
fragments[1].onResume()
onResume()
}
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import androidx.recyclerview.widget.RecyclerView
import cn.jzvd.Jzvd
import com.mints.wisdomclean.R
import com.mints.wisdomclean.ui.fragment.base.BaseFragment
import com.mints.wisdomclean.utils.LogUtil
import com.mints.wisdomclean.video.*
import kotlinx.android.synthetic.main.fragment_watch_video.*
......
......@@ -5,12 +5,14 @@ import android.content.Context
import android.util.Log
import android.view.View
import android.widget.Button
import android.widget.ImageView
import android.widget.LinearLayout
import com.bytedance.sdk.dp.*
import com.mints.wisdomclean.MintsApplication
import com.mints.wisdomclean.R
import com.mints.wisdomclean.ad.AdManager
import com.mints.wisdomclean.ad.AdStatusListener
import com.mints.wisdomclean.ui.activitys.VipActivity
import com.mints.wisdomclean.ui.activitys.base.BaseActivity
import com.mints.wisdomclean.ui.adapter.VideoEpisodeAdapter
import com.mints.wisdomclean.ui.widgets.DialogListener
......@@ -63,7 +65,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
private var blockView: View? = null
private var unlockBtn: Button? = null
private var leaveBtn: Button? = null
private var leaveBtn: ImageView? = null
private var vipBtn: Button? = null
private var lastIndex = 1
......@@ -94,6 +97,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
blockView?.isClickable = true
unlockBtn = findViewById(R.id.unlock)
leaveBtn = findViewById(R.id.leave)
vipBtn = findViewById(R.id.vip)
blockView?.visibility = View.GONE
......@@ -135,6 +139,9 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
leaveBtn?.setOnClickListener {
finish()
}
vipBtn?.setOnClickListener {
readyGo(VipActivity::class.java)
}
}
isInited = true
......
......@@ -2,8 +2,13 @@ package com.mints.wisdomclean.video
import android.app.Activity
import android.util.Log
import android.view.View
import cn.jzvd.Jzvd
import cn.jzvd.JzvdStd
import com.airbnb.lottie.LottieAnimationView
import com.airbnb.lottie.LottieComposition
import com.airbnb.lottie.LottieCompositionFactory
import com.airbnb.lottie.LottieDrawable
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
......@@ -18,6 +23,7 @@ import com.mints.wisdomclean.R
*/
class RecommendVideoAdapter(var activity: Activity) :
BaseQuickAdapter<VideoBean, BaseViewHolder>(R.layout.item_video_recommend) {
override fun convert(holder: BaseViewHolder, item: VideoBean) {
//用户名
holder.setText(R.id.username_tv, item.user_name)
......@@ -27,6 +33,16 @@ class RecommendVideoAdapter(var activity: Activity) :
Glide.with(activity).load(item.video_image)
.into(holder.getView<JzvdStdTikTok>(R.id.jz_video).posterImageView)
var isPlay = false
holder.getView<View>(R.id.ll_collect).setOnClickListener {
isPlay = !isPlay
if (isPlay) {
playCollectAnim(holder.getView(R.id.iv_collect))
} else {
playCancelCollectAnim(holder.getView(R.id.iv_collect))
}
}
//声明 代理服务缓存
val proxy = MintsApplication.StaticParams.getProxy()
//这个缓存下一个
......@@ -61,6 +77,30 @@ class RecommendVideoAdapter(var activity: Activity) :
this.onVideoCompletion = onVideoCompletion
}
private fun playCollectAnim(view: LottieAnimationView) {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
lottieDrawable.loop(false)
lottieDrawable.playAnimation()
}
view.setImageDrawable(lottieDrawable)
}
private fun playCancelCollectAnim(view: LottieAnimationView) {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_cancel_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
lottieDrawable.loop(false)
lottieDrawable.playAnimation()
}
view.setImageDrawable(lottieDrawable)
}
}
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="1117"
android:viewportHeight="1024">
<path
android:pathData="M802.85,0C706.75,0 617.38,47.54 558.55,125.92 499.74,47.51 410.41,0 314.24,0 140.97,0 0,151.96 0,338.73c0,111.43 50.49,189.6 91.07,252.4 117.95,182.46 414.53,409.48 427.1,419.03 12.1,9.22 26.25,13.84 40.34,13.84 14.15,0 28.3,-4.62 40.37,-13.84 12.6,-9.56 309.19,-236.61 427.1,-419.03C1066.57,528.32 1117.09,450.16 1117.09,338.73 1117.09,151.92 976.12,0 802.85,0z"
android:fillColor="#fff"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FFF"
android:pathData="M512.05,50.98C229.2,50.98 0,238.98 0,470.93c0,212.42 192.48,387.52 442.02,415.65 -10.72,15.2 -24.93,34.37 -35.73,45.18a24.11,24.11 0,0 0,-7.58 4.83,20.56 20.56,0 0,0 -6.11,14.21c-0.1,3.62 0.99,6.91 2.5,9.92 0.61,10 9.5,17.81 44.93,7.3 59.62,-17.7 95.76,-25.44 182.22,-56.02 60.32,-21.33 114.13,-53.34 155.42,-82.56C925.17,755.7 1024,622.96 1024,470.93 1024,238.98 794.8,50.98 512.05,50.98zM256.02,533.98c-35.33,0 -64.02,-28.24 -64.02,-63.06 0,-34.75 28.7,-62.98 64.02,-62.98 35.31,0 64.03,28.22 64.03,62.98 0.02,34.82 -28.72,63.06 -64.03,63.06zM512.05,533.98c-35.42,0 -64.03,-28.24 -64.03,-63.06 0,-34.75 28.61,-62.98 64.03,-62.98 35.31,0 63.9,28.22 63.9,62.98 0,34.82 -28.59,63.06 -63.9,63.06zM767.98,533.98c-35.33,0 -63.92,-28.24 -63.92,-63.06 0,-34.75 28.59,-62.98 63.92,-62.98 35.41,0 64.02,28.22 64.02,62.98 0,34.82 -28.61,63.06 -64.02,63.06z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#fff"
android:pathData="M50.56,993.33l-44.69,3.96 89.59,-3.96c0,-293.18 208.49,-410.87 404.05,-426.17v248.83l522.06,-406.28L499.53,3.64v217.13c-135.78,8.92 -246.56,59.46 -329.68,150.44C-25.3,584.82 2.05,955.19 5.83,996.76l44.74,-3.44z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/ic_cb_selected" android:state_checked="true" />
<item android:drawable="@mipmap/ic_cb_selected" android:state_selected="true" />
<item android:drawable="@mipmap/ic_cb_selected" android:state_pressed="true" />
<item android:drawable="@mipmap/ic_cb_unselected" android:state_checked="false" />
</selector>
\ No newline at end of file
......@@ -41,7 +41,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="剧场"
android:textColor="@drawable/item_text_sel"
android:textColor="@color/item_text_sel"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
......@@ -59,7 +59,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="推荐"
android:textColor="@drawable/item_text_sel2"
android:textColor="@color/item_text_sel2"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
......@@ -77,7 +77,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我的"
android:textColor="@drawable/item_text_sel"
android:textColor="@color/item_text_sel"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
......
......@@ -68,27 +68,52 @@
</LinearLayout>
<LinearLayout
<FrameLayout
android:id="@+id/block_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000"
android:gravity="center"
android:orientation="vertical">
android:background="#99000000">
<Button
android:id="@+id/unlock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="解锁" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="试看已结束"
android:textColor="@color/white"
android:textSize="16sp" />
<Button
android:id="@+id/unlock"
android:layout_width="280dp"
android:layout_height="40dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_red"
android:text="看广告解锁1集"
android:textColor="@color/white" />
<Button
<Button
android:id="@+id/vip"
android:layout_width="280dp"
android:layout_height="40dp"
android:background="@drawable/shape_green"
android:text="开通会员" />
</LinearLayout>
<ImageView
android:id="@+id/leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="离开" />
android:layout_marginTop="20dp"
android:src="@mipmap/ic_arrow_back" />
</FrameLayout>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
......@@ -37,20 +37,23 @@
<ImageView
android:id="@+id/iv_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="10dp"
android:src="@mipmap/ic_arrow_back" />
android:src="@mipmap/ic_edit" />
<ImageView
<TextView
android:id="@+id/iv_edit_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="10dp"
android:gravity="center_vertical"
android:src="@mipmap/ic_close"
android:visibility="gone" />
android:text="退出"
android:visibility="gone"
app:drawableEndCompat="@mipmap/ic_close_small" />
</FrameLayout>
......
......@@ -55,13 +55,14 @@
<CheckBox
android:id="@+id/cb"
style="@style/Widget.AppCompat.CompoundButton.RadioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="end"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:visibility="visible" />
android:background="@null"
android:button="@null"
android:drawableEnd="@drawable/selector_cb"
android:paddingEnd="6dp"
android:paddingBottom="140dp" />
</FrameLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="2dp"
......@@ -23,11 +24,13 @@
android:textColor="@color/black"
android:textSize="16sp" />
<ImageView
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/item_iv_play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="start|bottom"
android:src="@mipmap/iv_playing" />
app:lottie_autoPlay="true"
app:lottie_fileName="playing.json"
app:lottie_loop="true" />
</FrameLayout>
\ No newline at end of file
......@@ -62,13 +62,12 @@
app:layout_constraintBottom_toTopOf="@id/ll"
app:layout_constraintRight_toRightOf="parent">
<ImageView
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/zan_iv"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginTop="10dp"
android:scaleType="fitXY"
android:src="@drawable/ic_aixin" />
android:src="@mipmap/home_collect_img_0" />
<TextView
android:id="@+id/zan_num_tv"
......
......@@ -102,16 +102,15 @@
app:layout_constraintBottom_toTopOf="@id/ll"
app:layout_constraintRight_toRightOf="parent">
<ImageView
android:id="@+id/zan_iv"
android:layout_width="35dp"
android:layout_height="35dp"
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/iv_collect"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginTop="10dp"
android:scaleType="fitXY"
android:src="@drawable/ic_aixin" />
android:src="@mipmap/home_collect_img_0" />
<TextView
android:id="@+id/zan_num_tv"
android:id="@+id/tv_collect_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
......
......@@ -81,6 +81,10 @@
<item name="android:button">@drawable/checkbox_style</item>
</style>
<style name="FollowCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/selector_cb</item>
</style>
<!--Big File Detail Alert Dialog-->
......
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