Commit 908d8119 authored by 王雪伟's avatar 王雪伟

[提交人]:王雪伟

[提交简述] :加入充值页和详情页
[实现方案] :
parent 36c98d7e
...@@ -85,7 +85,9 @@ class VipPayActivity : BaseActivity(), VipPayContract.View, ...@@ -85,7 +85,9 @@ class VipPayActivity : BaseActivity(), VipPayContract.View,
JumpUtils.paymentPageJump(Constant.Key.PAY_TYPE_VIP,"1","vip","9.9") JumpUtils.paymentPageJump(Constant.Key.PAY_TYPE_VIP,"1","vip","9.9")
} }
id_img_back -> { id_img_back -> {
finish() CenterDialog.showPayExitDialog(this) {
finish()
}
} }
} }
} }
......
...@@ -206,9 +206,12 @@ interface RounterApi { ...@@ -206,9 +206,12 @@ interface RounterApi {
@RounterUri(Constant.scheme + "://userdetail") @RounterUri(Constant.scheme + "://userdetail")
fun getIntentActivityUserDetail( fun getIntentActivityUserDetail(
@RounterParam("userId") userId: String, @RounterParam("detailfree") detailfree: String @RounterParam("userId") userId: String, @RounterParam("detailfree") detailfree: String
) ): Intent
: Intent @RounterUri(Constant.scheme + "://userdetail_hw")
fun getIntentActivityUserDetailsHw(
@RounterParam("userId") userId: String, @RounterParam("detailfree") detailfree: String
): Intent
@RounterUri(Constant.scheme + "://video_result") @RounterUri(Constant.scheme + "://video_result")
fun getIntentActivityVideoResult(@RounterParam("url") str: String): Intent fun getIntentActivityVideoResult(@RounterParam("url") str: String): Intent
......
...@@ -104,8 +104,19 @@ public class JumpUtils { ...@@ -104,8 +104,19 @@ public class JumpUtils {
} }
public static void UserDetailJump(String userId, String detailfree) { public static void UserDetailJump(String userId, String detailfree) {
UserDetailsHwJump(userId, detailfree);
// try {
// Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityUserDetail(userId, detailfree);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// AppContext.get().startActivity(intent);
// } catch (Exception e) {
// Utils.showToast(AppContext.get(), "This version is not supported, please update the version!");
// }
}
public static void UserDetailsHwJump(String userId, String detailfree) {
try { try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityUserDetail(userId, detailfree); Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityUserDetailsHw(userId, detailfree);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
AppContext.get().startActivity(intent); AppContext.get().startActivity(intent);
} catch (Exception e) { } catch (Exception e) {
...@@ -212,6 +223,7 @@ public class JumpUtils { ...@@ -212,6 +223,7 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "This version is not supported, please update the version!"); Utils.showToast(AppContext.get(), "This version is not supported, please update the version!");
} }
} }
public static void BlockListJump() { public static void BlockListJump() {
try { try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentBlockList(); Intent intent = RounterBus.getRounter(RounterApi.class).getIntentBlockList();
...@@ -221,6 +233,7 @@ public class JumpUtils { ...@@ -221,6 +233,7 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!"); Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
} }
} }
public static void UpdateNickNameJump() { public static void UpdateNickNameJump() {
try { try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentUpdateNickName(); Intent intent = RounterBus.getRounter(RounterApi.class).getIntentUpdateNickName();
...@@ -230,6 +243,7 @@ public class JumpUtils { ...@@ -230,6 +243,7 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!"); Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
} }
} }
public static void UpdateIntrodutionJump() { public static void UpdateIntrodutionJump() {
try { try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentUpdateIntrodution(); Intent intent = RounterBus.getRounter(RounterApi.class).getIntentUpdateIntrodution();
......
package com.zxhl.cms.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
/**
* @author (wangXuewei)
* @datetime 2022-04-15 17:16 GMT+8
* @detail :
*/
public class FlowLayout extends ViewGroup {
public FlowLayout(Context context) {
this(context, null);
}
public FlowLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public FlowLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
private List<List<View>> mLineViews = new ArrayList<List<View>>();
private List<Integer> mLineHeight = new ArrayList<Integer>();
/**
* 测量所有子View大小,确定ViewGroup的宽高
*
* @param widthMeasureSpec
* @param heightMeasureSpec
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
//由于onMeasure会执行多次,避免重复的计算控件个数和高度,这里需要进行清空操作
mLineViews.clear();
mLineHeight.clear();
//获取测量的模式和尺寸大小
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec)-getPaddingLeft()-getPaddingRight();
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec)+getPaddingTop()+getPaddingBottom();
//记录ViewGroup真实的测量宽高
int viewGroupWidth = 0-getPaddingLeft()-getPaddingRight();
int viewGroupHeight = getPaddingTop()+getPaddingBottom();
if (widthMode == MeasureSpec.EXACTLY && heightMode == MeasureSpec.EXACTLY) {
viewGroupWidth = widthSize;
viewGroupHeight = heightSize;
} else {
//当前所占的宽高
int currentLineWidth = 0;
int currentLineHeight = 0;
//用来存储每一行上的子View
List<View> lineView = new ArrayList<View>();
int childViewsCount = getChildCount();
for (int i = 0; i < childViewsCount; i++) {
View childView = getChildAt(i);
//对子View进行测量
measureChild(childView, widthMeasureSpec, heightMeasureSpec);
MarginLayoutParams marginLayoutParams = (MarginLayoutParams) childView.getLayoutParams();
int childViewWidth = childView.getMeasuredWidth() + marginLayoutParams.leftMargin + marginLayoutParams.rightMargin;
int childViewHeight = childView.getMeasuredHeight() + marginLayoutParams.topMargin + marginLayoutParams.bottomMargin;
if (currentLineWidth + childViewWidth > widthSize) {
//当前行宽+子View+左右外边距>ViewGroup的宽度,换行
viewGroupWidth = Math.max(currentLineWidth, widthSize);
viewGroupHeight += currentLineHeight;
//添加行高
mLineHeight.add(currentLineHeight);
//添加行对象
mLineViews.add(lineView);
//new新的一行
lineView = new ArrayList<View>();
//添加行对象里的子View
lineView.add(childView);
currentLineWidth = childViewWidth;
} else {
//当前行宽+子View+左右外边距<=ViewGroup的宽度,不换行
currentLineWidth += childViewWidth;
currentLineHeight = Math.max(currentLineHeight, childViewHeight);
//添加行对象里的子View
lineView.add(childView);
}
if (i == childViewsCount - 1) {
//最后一个子View的时候
//添加行对象
mLineViews.add(lineView);
viewGroupWidth = Math.max(childViewWidth, viewGroupWidth);
viewGroupHeight += childViewHeight;
//添加行高
mLineHeight.add(currentLineHeight);
}
}
}
setMeasuredDimension(viewGroupWidth, viewGroupHeight);
}
/**
* 设置ViewGroup里子View的具体位置
*
* @param changed
* @param l
* @param t
* @param r
* @param b
*/
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int left = getPaddingLeft();
int top = getPaddingTop();
//一共有几行
int lines = mLineViews.size();
for (int i = 0; i < lines; i++) {
//每行行高
int lineHeight = mLineHeight.get(i);
//行内有几个子View
List<View> viewList = mLineViews.get(i);
int views = viewList.size();
for (int j = 0; j < views; j++) {
View view = viewList.get(j);
MarginLayoutParams marginLayoutParams = (MarginLayoutParams) view.getLayoutParams();
int vl = left + marginLayoutParams.leftMargin;
int vt = top + marginLayoutParams.topMargin;
int vr = vl + view.getMeasuredWidth();
int vb = vt + view.getMeasuredHeight();
view.layout(vl, vt, vr, vb);
left += view.getMeasuredWidth() + marginLayoutParams.leftMargin + marginLayoutParams.rightMargin;
}
left = getPaddingLeft();
top += lineHeight;
}
}
/**
* 指定ViewGroup的LayoutParams
*
* @param attrs
* @return
*/
@Override
public LayoutParams generateLayoutParams(AttributeSet attrs) {
return new MarginLayoutParams(getContext(), attrs);
}
}
...@@ -72,6 +72,16 @@ ...@@ -72,6 +72,16 @@
android:scheme="hwxg" /> android:scheme="hwxg" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.zxhl.main.page.activity.UserDetailsActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="userdetail_hw"
android:scheme="hwxg" />
</intent-filter>
</activity>
<activity android:name="com.zxhl.main.page.activity.UserInfoActivity"> <activity android:name="com.zxhl.main.page.activity.UserInfoActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
......
package com.zxhl.main.page.activity
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.net.model.box.HomeListEntity
import com.zxhl.cms.utils.OnRecycleItemClickListener
import com.zxhl.main.R
import com.zxhl.main.page.adapter.UserPhotosAdapter
import com.zxhl.main.page.contract.UserDetailsContract
import com.zxhl.main.page.presenter.UserDetailsPresenter
import kotlinx.android.synthetic.main.activity_layout_user_details_hw.*
/**
* @author (wangXuewei)
* @datetime 2022-04-15 10:48 GMT+8
* @detail :海外新版用户详情
*/
class UserDetailsActivity : BaseActivity(), UserDetailsContract.View,
OnRecycleItemClickListener<String> {
private var userId: String? = ""
private var detailfree: String? = ""
private var mPhotoAdapter: UserPhotosAdapter? = null;
private var mPresenter: UserDetailsPresenter? = null
override fun before() {
super.before()
setStatusBarBackground(AppContext.get().resources.getColor(R.color.transparent))
}
override fun init() {
userId = intent?.data?.getQueryParameter("userId") ?: ""
detailfree = intent?.data?.getQueryParameter("detailfree") ?: ""
mPhotoAdapter = UserPhotosAdapter(this, this)
mPresenter = UserDetailsPresenter(this)
id_rcl_user_details_photo_list.layoutManager =
LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
id_rcl_user_details_photo_list.adapter = mPhotoAdapter
id_img_btn_back.setOnClickListener(this)
id_img_btn_report.setOnClickListener(this)
id_img_user_details_sms.setOnClickListener(this)
id_ll_user_details_call_video.setOnClickListener(this)
mPresenter?.getUserDetails(userId, detailfree)
}
override fun onClick(v: View?) {
when (v) {
id_img_btn_back -> {
finish()
}
id_img_btn_report -> {
showToast("report")
}
id_img_user_details_sms -> {
showToast("sms")
}
id_ll_user_details_call_video -> {
showToast("call video")
}
}
}
override fun layoutID(): Int {
return R.layout.activity_layout_user_details_hw
}
override fun setUserDetails(result: HomeListEntity) {
//Name
id_tv_user_details_name.text = result.nickname
mPhotoAdapter?.clear()
mPhotoAdapter?.appendToList(result.picturesList)
//
if (!result.picturesList.isNullOrEmpty()) {
onItemClick(id_img_user_details_photo, 0, result.picturesList!![0])
}
}
override fun followCallBack(boolean: Boolean) {
}
override fun onItemClick(view: View?, position: Int, data: String?) {
mPhotoAdapter?.setSelectPhoto(position)
id_img_user_details_photo.setLoadImageUrl(data, true)
}
}
\ No newline at end of file
package com.zxhl.main.page.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.RelativeLayout
import androidx.recyclerview.widget.RecyclerView
import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.utils.OnRecycleItemClickListener
import com.zxhl.cms.widget.RecycleImageView
import com.zxhl.main.R
import kotlinx.android.synthetic.main.activity_layout_user_details_hw.*
/**
* @author (wangXuewei)
* @datetime 2022-04-15 18:10 GMT+8
* @detail :
*/
class UserPhotosAdapter : BaseRecyclerAdapter<String, RecyclerView.ViewHolder> {
private var mPosition: Int = 0
private var mContext: Context? = null
private val listener: OnRecycleItemClickListener<String>
constructor(
content: Context?,
listener: OnRecycleItemClickListener<String>
) : super() {
this.listener = listener
mContext = content
}
fun setSelectPhoto(pos: Int) {
mPosition = pos;
notifyDataSetChanged()
}
override fun onCreateViewHolder(holder: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return ViewHolder(
LayoutInflater.from(holder.context)
.inflate(R.layout.item_layout_user_photo, holder, false)
)
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is ViewHolder) {
val data = mList[position]
holder.item_photo.setLoadImageUrl(data, R.drawable.pano_sdk_bad_request_error,5)
if (mPosition == position) {
holder.item_view.background = mContext?.getDrawable(R.drawable.shape_ffffff_r5)
} else {
holder.item_view.background = null
}
holder.item_view.setOnClickListener {
listener.onItemClick(it, position, data)
}
}
}
inner class ViewHolder : RecyclerView.ViewHolder {
val item_view: RelativeLayout;
val item_photo: RecycleImageView;
constructor(itemView: View) : super(itemView) {
item_view = itemView.findViewById(R.id.id_rl_item_user_photo_view)
item_photo = itemView.findViewById(R.id.id_img_item_user_photo)
}
}
}
\ No newline at end of file
package com.zxhl.main.page.contract
import com.zxhl.cms.net.model.box.HomeListEntity
import com.zxhl.cms.net.model.chat.DistanceEntity
class UserDetailsContract {
interface View {
fun setUserDetails(result: HomeListEntity)
fun followCallBack(boolean: Boolean)
}
interface Presenter {
fun getUserDetails(id: String?,free: String?)
fun followUser(uid: String?)
}
}
\ No newline at end of file
...@@ -97,33 +97,36 @@ class SplashPresenter : SplashContract.Presenter { ...@@ -97,33 +97,36 @@ class SplashPresenter : SplashContract.Presenter {
val user = SettingPreference.getUserInfoData() val user = SettingPreference.getUserInfoData()
val token =SettingPreference.getUserToken() val token =SettingPreference.getUserToken()
if (user == null&&TextUtils.isEmpty(token)) { if (user == null&&TextUtils.isEmpty(token)) {
getAds() //getAds()
mView.jumpMainPage()
} else { } else {
UserDataUtils.updateUserInfo(null) UserDataUtils.updateUserInfo { _, _ ->
getAds() //getAds()
mView.jumpMainPage()
}
} }
} }
private fun deviceLogin() { // private fun deviceLogin() {
ApiClient.userInfoAPi.deviceLogin().compose(RxSchedulers.observableIO2Main()) // ApiClient.userInfoAPi.deviceLogin().compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<UserInfo>() { // .subscribe(object : BaseObserver<UserInfo>() {
override fun onSuccess(result: UserInfo) { // override fun onSuccess(result: UserInfo) {
val token = result.token // val token = result.token
SettingPreference.saveToken(token) // SettingPreference.saveToken(token)
UserDataUtils.updateUserInfo(null) // UserDataUtils.updateUserInfo(null)
//
// mView?.jumpMainPage() //// mView?.jumpMainPage()
getAds() // getAds()
} // }
//
override fun onFailure(e: Throwable, code: String, errorMsg: String) { // override fun onFailure(e: Throwable, code: String, errorMsg: String) {
SettingPreference.saveToken("") // SettingPreference.saveToken("")
SettingPreference.saveUserInfo(null) // SettingPreference.saveUserInfo(null)
getAds() // getAds()
} // }
}) // })
} // }
private fun getAds() { private fun getAds() {
ApiClient.adApi.getAds("splash") ApiClient.adApi.getAds("splash")
......
package com.zxhl.main.page.presenter
import android.util.Log
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.box.HomeListEntity
import com.zxhl.main.page.contract.UserDetailsContract
class UserDetailsPresenter : UserDetailsContract.Presenter {
private val mView: UserDetailsContract.View
constructor(mView: UserDetailsContract.View) {
this.mView = mView
}
override fun getUserDetails(id: String?, free: String?) {
ApiClient.homeApi.getUserInfo(id,free).compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<HomeListEntity>() {
override fun onSuccess(result: HomeListEntity?) {
if (result != null) {
mView.setUserDetails(result)
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
}
})
}
override fun followUser(uid: String?) {
ApiClient.homeApi.followUser(uid).compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<Any>() {
override fun onSuccess(result: Any?) {
mView.followCallBack(true)
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.e("MXL", "ERROR" + code + errorMsg)
}
})
}
}
\ 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="#03C160" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="5dp"
android:topLeftRadius="5dp"
android:topRightRadius="0dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#ffBD8AFF"
android:startColor="#ff662CF5"
android:type="linear"
android:useLevel="true" />
<corners android:radius="25dp" />
</shape>
\ 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="#EAE1FF" />
<corners android:radius="3dp" />
</shape>
\ 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="#FF3B95" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="5dp"
android:topLeftRadius="5dp"
android:topRightRadius="0dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#ffFF85CC"
android:startColor="#ffE633A9"
android:type="linear"
android:useLevel="true" />
<corners android:radius="25dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/id_rl_item_user_photo_view"
android:layout_width="62dp"
android:layout_height="62dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp">
<com.zxhl.cms.widget.RecycleImageView
android:id="@+id/id_img_item_user_photo"
android:layout_width="60dp"
android:layout_centerInParent="true"
android:layout_height="60dp" />
</RelativeLayout>
\ No newline at end of file
...@@ -102,10 +102,12 @@ class UserCenterFragment : BaseFragment(), AdCallback<String>, ...@@ -102,10 +102,12 @@ class UserCenterFragment : BaseFragment(), AdCallback<String>,
.setLoadingUIProvider(CustomLoadingUIProvider()) // 自定义LoadingUI .setLoadingUIProvider(CustomLoadingUIProvider()) // 自定义LoadingUI
mAdapter = PublishPhotoAdapter(mActivity, this, this) mAdapter = PublishPhotoAdapter(mActivity, this, this)
id_ll_pay_vip?.setOnClickListener { id_ll_pay_vip?.setOnClickListener {
JumpUtils.payJump() // JumpUtils.payJump()
JumpUtils.becomeVipJump()
} }
id_ll_star_coin?.setOnClickListener { id_ll_star_coin?.setOnClickListener {
JumpUtils.starCoinpayJump() // JumpUtils.starCoinpayJump()
JumpUtils.coinStoreJump()
} }
id_rl_voice_room?.setOnClickListener { id_rl_voice_room?.setOnClickListener {
JumpUtils.VoiceRoomJump() JumpUtils.VoiceRoomJump()
......
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