Commit 54c779ea authored by maxiaoliang's avatar maxiaoliang

11

parent 9cd6b5c6
......@@ -61,6 +61,7 @@ import com.zxhl.cms.widget.ChatDialogUtils;
import com.zxhl.cms.widget.LoadingDialog;
import com.zxhl.main.page.fragment.ConstellationMachFragment;
import com.zxhl.main.page.fragment.HomeFragment;
import com.zxhl.main.page.fragment.MessageFragment;
import com.zxhl.main.page.fragment.PopularFragment;
import com.zxhl.main.page.view.NavigationBottomView;
import com.zxhl.uc.page.fragment.UserCenterFragment;
......@@ -116,7 +117,6 @@ public class MainActivity extends BaseActivity implements NavigationBottomView.N
if (showCheckPermissions()) {
checkLocation();
}
Log.d("MXL","init");
mLoading = LoadingDialog.getLoadingDialog(
this,
getString(com.zxhl.cms.R.string.wait_ing),
......@@ -166,7 +166,7 @@ public class MainActivity extends BaseActivity implements NavigationBottomView.N
private void initFragment() {
fragments.add(new HomeFragment());
fragments.add(new ConstellationMachFragment());
fragments.add(new ChatFragment());
fragments.add(new MessageFragment());
fragments.add(new UserCenterFragment());
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
......
......@@ -8,7 +8,8 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="68dp"
android:background="@color/white">
android:background="@color/white"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
......@@ -26,7 +27,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
android:padding="10dp"
android:visibility="gone">
<LinearLayout
android:id="@+id/id_ll_guest"
......
......@@ -299,6 +299,8 @@ public class NetConfig {
public static final String HOME_STAR_LIGHT_BLACKLIST = "app/v1/hk/game/star/blacklist";//我的 - 黑名单列表
public static final String HOME_STAR_BLACK= "app/v1/hk/game/star/black";//拉黑/取消拉黑
public static final String HOME_STAR_CONSTELLATION_PAIRING= "app/v1/hk/game/star/constellationPairing";//星座配对头像列表
public static final String HOME_STAR_CONSTELLATION_RESLUT= "app/v1/hk/game/star/constellationPairing";//星座配对 - 结果获取
public static final String HOME_STAR_MY_LIKE_LIST= "app/v1/hk/game/star/myLikeList";//我的 - 我喜欢列表
}
......
......@@ -140,11 +140,17 @@ interface IHomeApi {
@Query("size") size: Int
): Observable<Response<List<FollowEntity>>>
@GET(NetConfig.StarLight.HOME_STAR_LIGHT_LIKEMYLIST)
// @GET(NetConfig.StarLight.HOME_STAR_LIGHT_LIKEMYLIST)
// fun getMyLikeList(
// @Query("page") page: Int,
// @Query("size") size: Int,
// @Query("free") free: Int,
// ): Observable<Response<List<FollowEntity>>>
@GET(NetConfig.StarLight.HOME_STAR_MY_LIKE_LIST)
fun getMyLikeList(
@Query("page") page: Int,
@Query("size") size: Int,
@Query("free") free: Int,
@Query("size") size: Int
): Observable<Response<List<FollowEntity>>>
@GET(NetConfig.StarLight.HOME_STAR_LIGHT_MESSAGE_LIST)
......@@ -295,5 +301,8 @@ interface IHomeApi {
): Observable<Response<Any>>
@GET(NetConfig.StarLight.HOME_STAR_CONSTELLATION_PAIRING)
fun getConstellation(): Observable<Response<Any>>
fun getConstellation(@Query("date") date: String?): Observable<Response<ConstellationEntity>>
@POST(NetConfig.StarLight.HOME_STAR_CONSTELLATION_RESLUT)
fun getStarMachReslut(): Observable<Response<StarMachEntity>>
}
\ No newline at end of file
package com.zxhl.cms.net.model.chat
class ConstellationEntity {
var videoPrice: String? = ""
var list: List<ConstellationList>? = null
}
class ConstellationList {
var headImage: String? = ""
var nickname: String? = ""
var uid: String? = ""
}
package com.zxhl.cms.net.model.chat
class StarMachEntity {
var headImage: String? = ""
var nickname: String? = ""
var uid: String? = ""
var sex: String = ""
var video: String? = ""
var matchingDegree: Int = 0
var nationalFlag: String? = ""
var age: String? = ""
var videoPrice: String? = ""
}
\ No newline at end of file
......@@ -231,6 +231,9 @@ interface RounterApi {
@RounterUri(Constant.scheme + "://updateintrodution")
fun getIntentUpdateIntrodution(@RounterParam("description") str: String): Intent
@RounterUri(Constant.scheme + "://constellreslut")
fun getIntentConstellReslut(): Intent
@RounterUri(Constant.scheme + "://coin_store")
fun getIntentCoinStore(): Intent
......
......@@ -250,6 +250,15 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
public static void ConstellResultJump() {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentConstellReslut();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
AppContext.get().startActivity(intent);
} catch (Exception e) {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
public static void UserInfoJump() {
try {
......
......@@ -57,4 +57,5 @@ dependencies {
implementation 'com.zhy:percent-support-extends:1.0.1'
implementation 'com.cncoderx.wheelview:library:1.2.5'
implementation 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
implementation 'com.android.support:percent:25.2.0'
}
......@@ -53,15 +53,15 @@
android:scheme="hwxg" />
</intent-filter>
</activity>
<activity android:name="com.zxhl.main.page.activity.MyLikesActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="mylikes"
android:scheme="hwxg" />
</intent-filter>
</activity>
<!-- <activity android:name="com.zxhl.main.page.activity.MyLikesActivity">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.VIEW" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- <data-->
<!-- android:host="mylikes"-->
<!-- android:scheme="hwxg" />-->
<!-- </intent-filter>-->
<!-- </activity>-->
<activity android:name="com.zxhl.main.page.activity.UserDetailActivity">
<intent-filter>
......@@ -164,6 +164,16 @@
android:scheme="hwxg" />
</intent-filter>
</activity>
<activity android:name="com.zxhl.main.page.activity.ConstellReslutActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="constellreslut"
android:scheme="hwxg" />
</intent-filter>
</activity>
<activity android:name="com.zxhl.main.page.activity.WinterBoxActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
......
package com.zxhl.main.page.activity
import android.text.TextUtils
import android.view.View
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.bumptech.glide.request.RequestOptions
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.net.SettingPreference
import com.zxhl.cms.net.model.chat.ConstellationEntity
import com.zxhl.cms.net.model.chat.StarMachEntity
import com.zxhl.main.R
import com.zxhl.main.page.contract.StarMachContract
import com.zxhl.main.page.presenter.StarMachPresenter
import kotlinx.android.synthetic.main.activity_layout_constell_reslut.*
class ConstellReslutActivity : BaseActivity(), StarMachContract.View {
private var mPresenter: StarMachPresenter? = null
override fun init() {
mPresenter = StarMachPresenter(this)
mPresenter?.getStarMachReslut()
id_img_close?.setOnClickListener {
finish()
}
}
override fun before() {
super.before()
setStatusBarBackground(AppContext.get().resources.getColor(R.color.transparent))
}
override fun onClick(v: View?) {
}
override fun layoutID(): Int {
return R.layout.activity_layout_constell_reslut
}
override fun setReslut(result: StarMachEntity?) {
if (result != null) {
id_tv_user_nick_name?.text = result.nickname
id_tv_matchingdegree?.text = "${result.matchingDegree}"
setStar(result.matchingDegree)
id_tv_age?.text="${result.age}"
id_tv_price?.text="${result.videoPrice}/min"
if (TextUtils.equals(result.sex, "2")) {
id_ll_sex_bg.setBackgroundResource(R.drawable.shape_girl_bg)
} else {
id_ll_sex_bg.setBackgroundResource(R.drawable.shape_boy_bg)
}
id_img_guoqi?.setLoadImageUrl(result.nationalFlag,false)
if (!TextUtils.isEmpty(result.headImage)) {
Glide.with(AppContext.get()).load(result.headImage)
.apply(RequestOptions.bitmapTransform(CircleCrop()))
.into(id_img_user_head)
}
val user = SettingPreference.getUserInfoData()
if (!TextUtils.isEmpty(user.headImage)) {
Glide.with(this).load(user.headImage)
.apply(RequestOptions.bitmapTransform(CircleCrop()))
.into(id_img_my_head)
}
}
}
fun setStar(machDegree: Int) {
when (machDegree) {
0 -> {
id_img_one_star.setImageResource(R.drawable.icon_xing_default)
id_img_two_star.setImageResource(R.drawable.icon_xing_default)
id_img_three_star.setImageResource(R.drawable.icon_xing_default)
id_img_four_star.setImageResource(R.drawable.icon_xing_default)
id_img_five_star.setImageResource(R.drawable.icon_xing_default)
}
20 -> {
id_img_one_star.setImageResource(R.drawable.icon_xing_liang)
id_img_two_star.setImageResource(R.drawable.icon_xing_default)
id_img_three_star.setImageResource(R.drawable.icon_xing_default)
id_img_four_star.setImageResource(R.drawable.icon_xing_default)
id_img_five_star.setImageResource(R.drawable.icon_xing_default)
}
40 -> {
id_img_one_star.setImageResource(R.drawable.icon_xing_liang)
id_img_two_star.setImageResource(R.drawable.icon_xing_liang)
id_img_three_star.setImageResource(R.drawable.icon_xing_default)
id_img_four_star.setImageResource(R.drawable.icon_xing_default)
id_img_five_star.setImageResource(R.drawable.icon_xing_default)
}
60 -> {
id_img_one_star.setImageResource(R.drawable.icon_xing_liang)
id_img_two_star.setImageResource(R.drawable.icon_xing_liang)
id_img_three_star.setImageResource(R.drawable.icon_xing_liang)
id_img_four_star.setImageResource(R.drawable.icon_xing_default)
id_img_five_star.setImageResource(R.drawable.icon_xing_default)
}
80 -> {
id_img_one_star.setImageResource(R.drawable.icon_xing_liang)
id_img_two_star.setImageResource(R.drawable.icon_xing_liang)
id_img_three_star.setImageResource(R.drawable.icon_xing_liang)
id_img_four_star.setImageResource(R.drawable.icon_xing_liang)
id_img_five_star.setImageResource(R.drawable.icon_xing_default)
}
100 -> {
id_img_one_star.setImageResource(R.drawable.icon_xing_liang)
id_img_two_star.setImageResource(R.drawable.icon_xing_liang)
id_img_three_star.setImageResource(R.drawable.icon_xing_liang)
id_img_four_star.setImageResource(R.drawable.icon_xing_liang)
id_img_five_star.setImageResource(R.drawable.icon_xing_liang)
}
}
}
}
\ No newline at end of file
......@@ -42,6 +42,24 @@ class SplashActivity : BaseActivity(), SplashContract.View {
}
EventUtils.onEvent("app_start")
if (SettingPreference.getFirstApp()) {
// if (TextUtils.equals(
// Utils.getChannel(this),
// "toutiao"
// ) || TextUtils.equals(Utils.getChannel(this), "toutiao_h5")
// ) {
//
// mPresenter = SplashPresenter(this@SplashActivity, this@SplashActivity)
// initListener()
// } else {
// CenterDialog.showPrivacyProtocol(this, object : View.OnClickListener {
// override fun onClick(p0: View?) {
// SettingPreference.setFirstApp()
// mPresenter = SplashPresenter(this@SplashActivity, this@SplashActivity)
// initListener()
// }
// })
//
// }
CenterDialog.showPrivacyProtocol(this, object : View.OnClickListener {
override fun onClick(p0: View?) {
SettingPreference.setFirstApp()
......@@ -84,9 +102,14 @@ class SplashActivity : BaseActivity(), SplashContract.View {
if (user == null && TextUtils.isEmpty(token)) {
JumpUtils.loginBeforeJump()
} else {
JumpUtils.activityJump(
RounterBus.getRounter(RounterApi::class.java).getIntentActivityMain()
)
// if (TextUtils.equals(SettingPreference.getUserHasData(), "0")) {
// JumpUtils.SettingInfoJump()
// } else {
// JumpUtils.activityJump(
// RounterBus.getRounter(RounterApi::class.java).getIntentActivityMain()
// )
// }
JumpUtils.activityJump(RounterBus.getRounter(RounterApi::class.java).getIntentActivityMain())
}
finish()
}
......
......@@ -644,7 +644,7 @@ class UserInfoActivity : BaseActivity(), EditUserInfoContract.View, ChooseDateCa
R.id.id_img_add -> {
EventUtils.onEvent("UploadAlbumImage", "相册上传图")
PictureSelector.create(this)
.openGallery(PictureConfig.TYPE_ALL)
.openGallery(PictureConfig.TYPE_IMAGE)
.imageSpanCount(4)// 每行显示个数 int
.maxSelectNum(getSize())
.selectionMode(PictureConfig.SINGLE)// 多选 or 单选 PictureConfig.MULTIPLE or PictureConfig.SINGLE
......
......@@ -23,15 +23,12 @@ import com.zxhl.main.R
class LikesAdpater : BaseRecyclerAdapter<FollowEntity, LikesAdpater.ViewHolder> {
private var mContext: Context? = null
private val listener: OnRecycleItemClickListener<FollowEntity>
private var free: Int = 0
constructor(
content: Context?,
listener: OnRecycleItemClickListener<FollowEntity>,
free: Int
listener: OnRecycleItemClickListener<FollowEntity>
) : super() {
this.listener = listener
mContext = content
this.free=free
}
override fun onCreateViewHolder(holder: ViewGroup, p1: Int): ViewHolder {
......@@ -44,78 +41,17 @@ class LikesAdpater : BaseRecyclerAdapter<FollowEntity, LikesAdpater.ViewHolder>
val data = mList[position]
holder.id_tv_name.text = data.nickname
//
holder.id_tv_like_time.text=data.dateStr + " 喜欢了你"
if(data.chatStatus==0){
holder.id_tv_chat.text = "打招呼"
holder.id_tv_chat.setTextColor(AppContext.get().resources.getColor(R.color.white))
holder.id_tv_chat.setBackgroundResource(R.drawable.shape_aa60ff_r3)
}else{
holder.id_tv_chat.text = "继续聊天"
holder.id_tv_chat.setBackgroundResource(R.drawable.shape_aa60ff_storke_r5)
holder.id_tv_chat.setTextColor(AppContext.get().resources.getColor(R.color.color_aa60ff))
}
if (free == 2) {
holder.id_tv_name.visibility = View.INVISIBLE
holder.id_tv_chat.visibility = View.INVISIBLE
holder.id_img_mohu_tv.visibility = View.VISIBLE
if (!TextUtils.isEmpty(data.headImage)) {
Glide.with(AppContext.get()).load(data.headImage)
// .apply(RequestOptions.bitmapTransform(CircleCrop()))
.apply(RequestOptions.bitmapTransform(BlurTransformation(25)))
.into(holder.id_img_likes_head)
} else {
holder.id_img_likes_head.setImageResource(R.drawable.icon_user_photo_default)
}
if (data.nickname.isNotEmpty()) {
when (data.nickname.length) {
1 -> {
holder.id_img_mohu_tv.setImageResource(R.drawable.font_mohu_1)
}
2 -> {
holder.id_img_mohu_tv.setImageResource(R.drawable.font_mohu_2)
}
3 -> {
holder.id_img_mohu_tv.setImageResource(R.drawable.font_mohu_3)
}
4 -> {
holder.id_img_mohu_tv.setImageResource(R.drawable.font_mohu_4)
}
5 -> {
holder.id_img_mohu_tv.setImageResource(R.drawable.font_mohu_5)
}
6 -> {
holder.id_img_mohu_tv.setImageResource(R.drawable.font_mohu_6)
}
7 -> {
holder.id_img_mohu_tv.setImageResource(R.drawable.font_mohu_7)
}
8 -> {
holder.id_img_mohu_tv.setImageResource(R.drawable.font_mohu_8)
}
9 -> {
holder.id_img_mohu_tv.setImageResource(R.drawable.font_mohu_9)
}
10 -> {
holder.id_img_mohu_tv.setImageResource(R.drawable.font_mohu_10)
}
else ->
holder.id_img_mohu_tv.setImageResource(R.drawable.font_mohu_10)
}
}
} else {
holder.id_tv_name.visibility = View.VISIBLE
holder.id_tv_chat.visibility = View.VISIBLE
holder.id_img_mohu_tv.visibility = View.GONE
if (!TextUtils.isEmpty(data.headImage)) {
Glide.with(AppContext.get()).load(data.headImage)
.apply(RequestOptions.bitmapTransform(CircleCrop()))
// .apply(RequestOptions.bitmapTransform(BlurTransformation(25)))
.into(holder.id_img_likes_head)
} else {
holder.id_img_likes_head.setImageResource(com.ym.chat.R.drawable.icon_user_photo_default)
}
}
// holder.id_tv_like_time.text=data.dateStr + " 喜欢了你"
// if(data.chatStatus==0){
// holder.id_tv_chat.text = "打招呼"
// holder.id_tv_chat.setTextColor(AppContext.get().resources.getColor(R.color.white))
// holder.id_tv_chat.setBackgroundResource(R.drawable.shape_aa60ff_r3)
// }else{
// holder.id_tv_chat.text = "继续聊天"
// holder.id_tv_chat.setBackgroundResource(R.drawable.shape_aa60ff_storke_r5)
// holder.id_tv_chat.setTextColor(AppContext.get().resources.getColor(R.color.color_aa60ff))
// }
//
}
......@@ -123,18 +59,27 @@ class LikesAdpater : BaseRecyclerAdapter<FollowEntity, LikesAdpater.ViewHolder>
var id_tv_name: TextView
var id_tv_like_time: TextView
var id_tv_chat: TextView
var id_img_mohu_tv: ImageView
var id_tv_price: TextView
var id_img_guoqi: ImageView
var id_img_xiaoxi: ImageView
var id_img_shipin: ImageView
var id_img_likes_head: CircleImageView
constructor(itemView: View) : super(itemView) {
id_img_likes_head = itemView.findViewById(R.id.id_img_likes_head)
id_img_mohu_tv = itemView.findViewById(R.id.id_img_mohu)
id_img_guoqi = itemView.findViewById(R.id.id_img_guoqi)
id_img_xiaoxi = itemView.findViewById(R.id.id_img_xiaoxi)
id_img_shipin = itemView.findViewById(R.id.id_img_shipin)
id_tv_name = itemView.findViewById(R.id.id_tv_name)
id_tv_like_time = itemView.findViewById(R.id.id_tv_like_time)
id_tv_chat = itemView.findViewById(R.id.id_tv_chat)
id_tv_chat?.setOnClickListener {
id_tv_price = itemView.findViewById(R.id.id_tv_price)
id_img_xiaoxi?.setOnClickListener {
val pos = adapterPosition
if (pos >= 0 && pos < mList.size) {
listener.onItemClick(it,pos,mList[pos])
}
}
id_img_shipin?.setOnClickListener {
val pos = adapterPosition
if (pos >= 0 && pos < mList.size) {
listener.onItemClick(it,pos,mList[pos])
......
package com.zxhl.main.page.contract
import com.zxhl.cms.net.model.chat.ConstellationEntity
class ConstellationContract {
interface View {
fun setReslut(result:ConstellationEntity?)
}
interface Presenter {
fun getConstellationPairing(date:String)
}
}
\ No newline at end of file
......@@ -5,12 +5,12 @@ import com.zxhl.cms.net.model.chat.FollowEntity
class MyLikesContract {
interface View {
fun setData(boolean: Boolean, reslut: List<FollowEntity>?,result: ChatMessageChargeOrNotEntity?)
fun setData(boolean: Boolean, reslut: List<FollowEntity>?)
fun setEmptyView()
}
interface Presenter {
fun getLikesList(ifRefresh: Boolean,free:Int,result: ChatMessageChargeOrNotEntity?)
fun getLikesList(ifRefresh: Boolean)
}
}
\ No newline at end of file
package com.zxhl.main.page.contract
import com.zxhl.cms.net.model.chat.StarMachEntity
class StarMachContract {
interface View {
fun setReslut(result: StarMachEntity?)
}
interface Presenter {
fun getStarMachReslut()
}
}
\ No newline at end of file
package com.zxhl.main.page.fragment
import android.text.TextUtils
import android.view.View
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.bumptech.glide.request.RequestOptions
import com.zxhl.cms.common.base.BaseFragment
import com.zxhl.cms.net.model.chat.ConstellationEntity
import com.zxhl.cms.utils.JumpUtils
import com.zxhl.cms.utils.NoDoubleClickListener
import com.zxhl.main.R
import com.zxhl.main.page.contract.ConstellationContract
import com.zxhl.main.page.presenter.ConstellationPresenter
import kotlinx.android.synthetic.main.fragment_layout_constellation_match.*
class ConstellationMachFragment:BaseFragment() {
class ConstellationMachFragment : BaseFragment(), ConstellationContract.View {
private var mPresenter: ConstellationPresenter? = null
private var mListImgView: MutableList<ImageView> = ArrayList()
override fun layoutID(): Int {
return R.layout.fragment_layout_constellation_match
}
override fun init(view: View?) {
mPresenter = ConstellationPresenter(this)
mListImgView.add(id_img_shuiping)
mListImgView.add(id_img_shuangyu)
mListImgView.add(id_img_mojie)
mListImgView.add(id_img_juxie)
mListImgView.add(id_img_shuangzi)
mListImgView.add(id_img_jinniu)
mListImgView.add(id_img_shizi)
mListImgView.add(id_img_chunv)
mListImgView.add(id_img_tianping)
mListImgView.add(id_img_tianxie)
mListImgView.add(id_img_sheshou)
mListImgView.add(id_img_baiyang)
id_tv_start_mach?.setOnClickListener(object :NoDoubleClickListener(){
override fun onNoDoubleClick(v: View?) {
JumpUtils.ConstellResultJump()
}
})
}
override fun lazyLoad() {
super.lazyLoad()
if (isInitial && isVisible) {
mPresenter?.getConstellationPairing("0727")
}
}
override fun setReslut(result: ConstellationEntity?) {
if (!result?.list.isNullOrEmpty()) {
for (i in 0 until (result?.list!!.size )) {
// if(!TextUtils.isEmpty(result.list!![i].headImage)){
// mListImgView[i].visibility=View.VISIBLE
// }else{
// mListImgView[i].visibility=View.GONE
// }
if (i < mListImgView.size) {
Glide.with(this).load(result.list!![i].headImage)
.apply(RequestOptions.bitmapTransform(CircleCrop()))
.into(mListImgView[i])
}
}
}
}
}
\ No newline at end of file
package com.zxhl.main.page.fragment
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.zxhl.cms.common.base.BaseFragment
import com.zxhl.cms.net.model.chat.ChatStausEvent
import com.zxhl.cms.net.model.chat.FollowEntity
import com.zxhl.cms.utils.*
import com.zxhl.main.R
import com.zxhl.main.page.adapter.LikesAdpater
import com.zxhl.main.page.contract.MyLikesContract
import com.zxhl.main.page.presenter.MyLikesPresenter
import kotlinx.android.synthetic.main.activity_layout_my_likes.*
import kotlinx.android.synthetic.main.layout_empty_view.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
class LikeFragment : BaseFragment(), MyLikesContract.View,
OnRecycleItemClickListener<FollowEntity> {
private var mPresenter: MyLikesPresenter? = null
private var mAdapter: LikesAdpater? = null
override fun layoutID(): Int {
return R.layout.fragment_layout_like
}
override fun init(view: View?) {
mPresenter = MyLikesPresenter(this)
initAdapter()
}
var mylikeEntity:FollowEntity?=null
override fun onItemClick(view: View?, position: Int, data: FollowEntity?) {
mylikeEntity=data
JumpUtils.startC2CChatActivity(mylikeEntity?.chatStatus!!,data?.uid, data?.nickname)
}
override fun onResume() {
super.onResume()
mPresenter?.getLikesList(true)
}
fun initAdapter() {
mAdapter = LikesAdpater(mActivity, this)
id_rl_likes?.layoutManager = LinearLayoutManager(mActivity)
id_rl_likes?.adapter = mAdapter
id_rl_likes.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (Utils.isSlideToBottom(recyclerView)) {
if ((mAdapter?.list?.size ?: 0) >= 20) {
mPresenter?.getLikesList(false)
}
}
}
})
id_refresh_layout.setColorSchemeColors(resources.getColor(com.zxhl.cms.R.color.color_aa60ff))
id_refresh_layout?.setOnRefreshListener {
mPresenter?.getLikesList(true)
}
}
override fun setData(isRefresh: Boolean, reslut: List<FollowEntity>?) {
id_ll_empty?.visibility = View.GONE
if (isRefresh) {
mAdapter?.clear()
}
id_refresh_layout?.isRefreshing = false
val start = mAdapter?.getItemCount() ?: 0
mAdapter?.appendToList(reslut)
if (isRefresh) {
mAdapter?.notifyDataSetChanged()
} else {
val end = mAdapter?.getItemCount() ?: 0
mAdapter?.notifyItemRangeChanged(start, end)
}
}
override fun setEmptyView() {
id_refresh_layout?.isRefreshing = false
id_ll_empty?.visibility = View.VISIBLE
id_tv_empty_text.text = "暂时没有人喜欢你,快去找用户喜欢你吧~"
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEvent(chatStausEvent: ChatStausEvent){
mylikeEntity?.chatStatus=chatStausEvent.chatstatus?.toInt()
mAdapter?.notifyDataSetChanged()
//chatStaus=chatStausEvent.chatstatus?.toInt()
}
override fun onDestroy() {
super.onDestroy()
EventBus.getDefault().unregister(this)
}
companion object {
fun newInstance() = LikeFragment()
}
}
\ No newline at end of file
package com.zxhl.main.page.fragment
import android.view.View
import androidx.fragment.app.Fragment
import com.flyco.tablayout.listener.CustomTabEntity
import com.ym.chat.fragment.ChatFragment
import com.zxhl.main.R
import com.zxhl.main.page.view.BaseViewPagerFragment
import com.zxhl.main.page.view.TabEntity
class MessageFragment: BaseViewPagerFragment() {
override val createTitles = ArrayList<CustomTabEntity>().apply {
add(TabEntity("Message"))
add(TabEntity("Like"))
}
override val createFragments: Array<Fragment> = arrayOf(
ChatFragment(),
LikeFragment.newInstance()
)
override fun layoutID(): Int {
return R.layout.fragment_layout_message
}
override fun init(view: View?) {
viewPager?.currentItem = 0
}
override fun lazyLoad() {
super.lazyLoad()
if (isVisible && isInitial) {
createFragments[viewPager?.currentItem ?: 0].userVisibleHint = true
}
}
override fun onDestroy() {
super.onDestroy()
}
}
\ No newline at end of file
package com.zxhl.main.page.presenter
import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.chat.ConstellationEntity
import com.zxhl.main.page.contract.ConstellationContract
class ConstellationPresenter:ConstellationContract.Presenter {
private val mView: ConstellationContract.View
constructor(mView: ConstellationContract.View) {
this.mView = mView
}
override fun getConstellationPairing(date:String) {
ApiClient.homeApi.getConstellation(date).compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<ConstellationEntity>() {
override fun onSuccess(result:ConstellationEntity?) {
mView.setReslut(result)
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
}
})
}
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ class MyLikesPresenter : MyLikesContract.Presenter {
private var page = 1
private val size = 20
private var isMore = false
override fun getLikesList(ifRefresh: Boolean,free:Int,result2: ChatMessageChargeOrNotEntity?) {
override fun getLikesList(ifRefresh: Boolean) {
if (ifRefresh) {
page = 1
isMore = false
......@@ -27,7 +27,7 @@ class MyLikesPresenter : MyLikesContract.Presenter {
return
}
isMore = true
ApiClient.homeApi.getMyLikeList(page, size,free)
ApiClient.homeApi.getMyLikeList(page, size)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<List<FollowEntity>>() {
override fun onSuccess(result: List<FollowEntity>?) {
......@@ -39,7 +39,7 @@ class MyLikesPresenter : MyLikesContract.Presenter {
} else {
isMore = true
}
mView.setData(ifRefresh, result,result2)
mView.setData(ifRefresh, result)
}else{
if(page==1){
mView.setEmptyView()
......
package com.zxhl.main.page.presenter
import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.chat.ConstellationEntity
import com.zxhl.cms.net.model.chat.StarMachEntity
import com.zxhl.main.page.contract.StarMachContract
class StarMachPresenter : StarMachContract.Presenter {
private val mView: StarMachContract.View
constructor(mView: StarMachContract.View) {
this.mView = mView
}
override fun getStarMachReslut() {
ApiClient.homeApi.getStarMachReslut()
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<StarMachEntity>() {
override fun onSuccess(result: StarMachEntity?) {
mView.setReslut(result)
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
}
})
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ff824fff" />
<corners android:radius="7dp" />
</shape>
\ No newline at end of file
......@@ -173,6 +173,7 @@
android:textSize="18sp" />
<TextView
android:id="@+id/id_tv_start_mach"
android:layout_width="280dp"
android:layout_height="45dp"
android:layout_gravity="center_horizontal"
......@@ -184,3 +185,4 @@
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/id_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/id_rl_title">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/id_rl_likes"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<include layout="@layout/layout_empty_view"/>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:background="@color/white"
android:orientation="vertical">
<com.flyco.tablayout.CommonTabLayout
android:id="@+id/id_fragment_home_tab"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="24dp"
app:tl_iconVisible="true"
app:tl_iconGravity="RIGHT"
app:tl_iconMargin="5dp"
app:tl_indicator_bounce_enable="false"
app:tl_indicator_color="@color/transparent"
app:tl_indicator_width="10dp"
app:tl_tab_space_equal="true"
app:tl_textBold="BOTH"
app:tl_textSelectColor="@color/color_824fff"
app:tl_textUnselectColor="@color/color_666666"
app:tl_textsize="18sp" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="#EDEDED"/>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
......@@ -2,48 +2,80 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_20">
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@color/white">
<com.zxhl.cms.widget.CircleImageView
android:id="@+id/id_img_likes_head"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginRight="@dimen/dp_10" />
android:layout_marginTop="10dp"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="10dp" />
<TextView
android:id="@+id/id_tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginBottom="@dimen/dp_3"
android:layout_marginTop="13dp"
android:layout_marginBottom="10dp"
android:layout_toRightOf="@+id/id_img_likes_head"
android:text="Mike"
android:textColor="@color/color_333333"
android:textSize="15sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/id_img_mohu"
android:layout_width="wrap_content"
android:layout_height="22dp"
android:layout_toRightOf="@+id/id_img_likes_head"
android:layout_marginTop="3dp"
android:layout_marginBottom="@dimen/dp_3" />
<TextView
android:id="@+id/id_tv_like_time"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/id_tv_name"
android:layout_toRightOf="@+id/id_img_likes_head"
android:textColor="@color/color_666666"
android:textSize="@dimen/sp_13" />
android:gravity="center_vertical">
<TextView
android:id="@+id/id_tv_chat"
android:layout_width="72dp"
android:layout_height="@dimen/dp_27"
<ImageView
android:id="@+id/id_img_guoqi"
android:layout_width="20dp"
android:layout_height="14dp"
android:layout_marginRight="5dp" />
<TextView
android:id="@+id/id_tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/icon_xingbi_wode_2"
android:drawablePadding="4dp"
android:text="60/min"
android:textColor="#FA6240"
android:textSize="11sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/dp_11"
android:background="@drawable/shape_aa60ff_r3"
android:gravity="center"
android:textColor="#999999" />
android:layout_centerVertical="true">
<ImageView
android:id="@+id/id_img_xiaoxi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:src="@drawable/icon_xiaoxi" />
<ImageView
android:id="@+id/id_img_shipin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_likes_video" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="@+id/id_img_likes_head"
android:layout_toRightOf="@+id/id_img_likes_head"
android:background="#EDEDED" />
</RelativeLayout>
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