feat : 新增 用户地区接口

This commit is contained in:
eggmanQQQ
2024-10-24 14:16:10 +08:00
parent b6dceb99bc
commit a571555198
128 changed files with 168 additions and 68 deletions

View File

@@ -27,6 +27,7 @@ import androidx.fragment.app.Fragment;
import com.bumptech.glide.request.RequestOptions;
import com.chwl.app.R;
import com.chwl.app.ui.utils.ImageLoadUtils;
import com.chwl.app.ui.utils.ImageLoadUtilsV2;
import com.chwl.app.ui.widget.magicindicator.buildins.UIUtil;
import com.chwl.library.utils.LogUtil;
@@ -109,14 +110,24 @@ public class BigPhotoItemFragment extends Fragment {
if (item.isNetImage() && item.isImage()) {
limitUrl = ImageLoadUtilsV2.getSizeUrl(item.getPath(), width);
}
GlideApp.with(image.getContext())
.load(limitUrl)
.error(R.drawable.default_cover)
.placeholder(R.drawable.default_cover)
.apply(new RequestOptions()
.override(width, argsHeight)
.fitCenter())
.into(image);
if (limitUrl.endsWith(".gif") || limitUrl.endsWith(".GIF")) {
GlideApp.with(image.getContext())
.asGif()
.load(limitUrl)
.error(R.drawable.default_cover)
.placeholder(R.drawable.default_cover)
.apply(new RequestOptions().override(width, argsHeight).fitCenter())
.into(image);
} else {
GlideApp.with(image.getContext())
.asBitmap()
.load(limitUrl)
.error(R.drawable.default_cover)
.placeholder(R.drawable.default_cover)
.apply(new RequestOptions().override(width, argsHeight).fitCenter())
.into(image);
}
}

View File

@@ -65,21 +65,23 @@ class VipSetActivity : BaseViewBindingActivity<VipSetActivityBinding>(), ILog, V
, R.drawable.vip_icon_lv8
, R.drawable.vip_icon_lv9
)
UserModel.get().getUserInfo(AuthModel.get().currentUid)
.compose(bindToLifecycle())
.doOnSuccess {
it.userVipInfoVO?.let { vInfo->
setSwitchView(binding.vipSetSwitch1,vInfo.enterFollow)//不被关注
setSwitchView(binding.vipSetSwitch2,vInfo.preventTrace)//防跟随
setSwitchView(binding.vipSetSwitch3,vInfo.enterHide)//开关隐身进房状态
setSwitchView(binding.vipSetSwitch4,vInfo.preventKick)//防踢
if (AuthModel.get().isLogin) {
UserModel.get().getUserInfoFromServerUpdate(AuthModel.get().currentUid)
.compose(bindToLifecycle())
.doOnSuccess {
it.userVipInfoVO?.let { vInfo ->
setSwitchView(binding.vipSetSwitch1, vInfo.preventFollow)//不被关注
setSwitchView(binding.vipSetSwitch2, vInfo.preventTrace)//防跟随
setSwitchView(binding.vipSetSwitch3, vInfo.enterHide)//开关隐身进房状态
setSwitchView(binding.vipSetSwitch4, vInfo.preventKick)//防踢
}
}
}
.doOnError {
.doOnError {
}
.subscribe()
}
}
.subscribe()
}
override fun needSteepStateBar(): Boolean {

View File

@@ -35,6 +35,7 @@ import com.chwl.app.vip.util.VipHelper
import com.chwl.core.auth.AuthModel
import com.chwl.core.file.FileModel
import com.chwl.core.user.UserModel
import com.chwl.core.user.bean.RegionInfoBean
import com.chwl.core.user.bean.UserInfo
import com.chwl.core.user.bean.UserPhoto
import com.chwl.core.utils.CoreLogger
@@ -299,45 +300,24 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
this@UserInfoModifyActivity,
ResUtil.getString(R.string.ui_user_userinfomodifyactivity_02)
)
UserModel.get().areaInfo.subscribe(object : SingleObserver<List<String>> {
UserModel.get().areaInfo.subscribe(object : SingleObserver<List<RegionInfoBean>> {
override fun onSubscribe(d: Disposable) {
mCompositeDisposable.add(d)
}
override fun onSuccess(areaList: List<String>) {
override fun onSuccess(areaList: List<RegionInfoBean>) {
dialogManager.dismissDialog()
if (areaList.isNotEmpty()) {
UserAreaDialog.newInstance(areaList)
val newList = areaList.map {
it.name
}
UserAreaDialog.newInstance(newList)
.apply {
setAction {
reportArea(it)
}
}.show(this@UserInfoModifyActivity)
}
}
override fun onError(e: Throwable) {
dialogManager.dismissDialog()
toast(e.message)
}
})
} R.id.layout_area -> {
dialogManager.showProgressDialog(
this@UserInfoModifyActivity,
ResUtil.getString(R.string.ui_user_userinfomodifyactivity_02)
)
UserModel.get().areaInfo.subscribe(object : SingleObserver<List<String>> {
override fun onSubscribe(d: Disposable) {
mCompositeDisposable.add(d)
}
override fun onSuccess(areaList: List<String>) {
dialogManager.dismissDialog()
if (areaList.isNotEmpty()) {
UserAreaDialog.newInstance(areaList)
.apply {
setAction {
reportArea(it)
val find = areaList.find { data -> data.name == it }
if (find != null) {
reportArea(it,find.id)
}
}
}.show(this@UserInfoModifyActivity)
}
@@ -383,13 +363,13 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
}
}
private fun reportArea(area: String) {
private fun reportArea(area: String, id:Long) {
binding.tvArea.text = area
dialogManager.showProgressDialog(
this@UserInfoModifyActivity,
ResUtil.getString(R.string.ui_user_userinfomodifyactivity_02)
)
UserModel.get().saveArea(area).subscribe(object : SingleObserver<String> {
UserModel.get().saveArea(id).subscribe(object : SingleObserver<String> {
override fun onSubscribe(d: Disposable) {
mCompositeDisposable.add(d)
}

View File

@@ -54,7 +54,7 @@ public class PhotoAdapter extends PagerAdapter {
//拿到userphoto对象
UserPhoto userPhoto = bigImagesList.get(position);
//把对象设置到imageview里面去
ImageLoadUtils.loadImage(context, userPhoto.getPhotoUrl(), imageView);
ImageLoadUtils.load(userPhoto.getPhotoUrl(), imageView);
//然后把imageview添加到容器里面去
container.addView(imageView);
imageView.setOnClickListener(new View.OnClickListener() {

View File

@@ -3,9 +3,18 @@ package com.chwl.app.ui.user.dialog
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import android.widget.ImageView
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.databinding.DialogUserAreaPickerBinding
import com.chwl.app.ui.user.adapter.ArrayWheelAdapter
import com.chwl.core.bean.response.ServiceResult
import com.chwl.core.user.bean.RegionInfoBean
import com.chwl.core.utils.net.RxHelper
import com.chwl.library.net.rxnet.RxNet
import com.google.gson.JsonElement
import io.reactivex.Single
import retrofit2.http.GET
import retrofit2.http.Query
import java.io.Serializable
@@ -74,4 +83,19 @@ class UserAreaDialog :
}
}
private fun getAreaList() : Single<List<RegionInfoBean>> {
return api.getRegionInfoList()
.compose(RxHelper.handleBeanData())
.compose(RxHelper.handleSchedulers())
}
private final val api = RxNet.create(Api::class.java);
interface Api{
/**
* 地区列表
*/
@GET("/regionInfo/list")
fun getRegionInfoList(): Single<ServiceResult<List<RegionInfoBean>>>
}
}

View File

@@ -407,6 +407,16 @@ public class ImageLoadUtils {
GlideApp.with(context.getApplicationContext()).load(url).dontAnimate().into(imageView);
}
public static void load(String url, ImageView imageView) {
if (url != null && !TextUtils.isEmpty(url)){
if (url.endsWith(".gif") || url.endsWith(".GIF")) {
GlideApp.with(imageView.getContext()).asGif().load(url).dontAnimate().into(imageView);
} else {
GlideApp.with(imageView.getContext()).asBitmap().load(url).dontAnimate().into(imageView);
}
}
}
public static void loadImage(ImageView imageView, String url) {
GlideApp.with(imageView).load(url).dontAnimate().into(imageView);
}

View File

@@ -103,7 +103,7 @@ public class ImageLoadUtilsV2 {
if (size > 0) {
url = getSizeUrl(url, isSquare, size);
}
GlideRequest<Drawable> requests = GlideApp.with(context).load(url);
GlideRequest<Drawable> requests = GlideApp.with(context).asDrawable().load(url);
if (transformations != null && transformations.length > 0) {
requests = requests.transforms(transformations);
}

View File

@@ -215,7 +215,7 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
GiftDialog.OnGiftDialogBtnClickListener listener) {
LoadingDialog loadingDialog = new LoadingDialog(context);
loadingDialog.show();
UserModel.get().getUserInfo(uid)
UserModel.get().getUserInfoFromServerUpdate(uid)
.compose(RxHelper.bindContext(context))
.subscribe(userInfo -> {
List<ViewItem> list = ButtonItemFactory.createCommonButtonItems(

View File

@@ -8,6 +8,7 @@ import android.view.View
import android.widget.TextView
import androidx.activity.viewModels
import androidx.core.view.isVisible
import androidx.lifecycle.Observer
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
@@ -194,6 +195,7 @@ class VipCenterActivity : BaseViewBindingActivity<ActivityVipCenterBinding>(),
}
authInfoList = filteredList
authAdapter.setNewData(filteredList)
//todo do vip 奖励 配置
vipIdentificationsAdapter = VipCenterIdentificationsAdapter(this, it, this)
recyclerView.adapter = vipIdentificationsAdapter
}
@@ -268,6 +270,14 @@ class VipCenterActivity : BaseViewBindingActivity<ActivityVipCenterBinding>(),
getString(R.string.me_failed_to_get_aristocrat_data).toast()
}
}
vipViewModel.openVipData.observe(this,object : Observer<Boolean?> {
override fun onChanged(value: Boolean?) {
requestChargeList{
vipViewModel.getVipPageInfo()
}
}
})
}
override fun onItemClick(position: Int) {

View File

@@ -50,6 +50,9 @@ class VipViewModel : BaseViewModel() {
val getVipRebateSuccessFlow = MutableSharedFlow<VipRebateInfo>()
val openVipData = MutableLiveData<Boolean>()
// private val _sendBroadcastLiveData = MutableLiveData<Boolean>()
// val sendBroadcastLiveData: LiveData<Boolean> = _sendBroadcastLiveData
@@ -163,6 +166,7 @@ class VipViewModel : BaseViewModel() {
fun openVipWithDiamond(vipLevel: Int) {
safeLaunch(true) {
VipModel.openVipWithDiamond(vipLevel)
openVipData.postValue(true)
}
}

View File

@@ -39,8 +39,7 @@ class VipCenterIdentificationsAdapter(
val filteredList = items.filter {
it.authType == 1 || it.authType == 5 || it.authType == 8 || it.authType ==
11 || it.authType == 12
it.authType == 1 || it.authType == 5 || it.authType == 8 || it.authType == 11 || it.authType == 12
}
val item = filteredList[position]
@@ -114,6 +113,19 @@ class VipCenterIdentificationsAdapter(
9 -> holder.contentImageView.setImageResource(R.drawable.vip_center_identification_entry_lv9)
}
}
5 -> {
// resourceName = "vip_center_identification_entry_lv$lv"
when (it.vipLevel) {
4 -> holder.contentImageView.setImageResource(R.drawable.vip_center_identification_entry_lv4)
5 -> holder.contentImageView.setImageResource(R.drawable.vip_center_identification_entry_lv5)
6 -> holder.contentImageView.setImageResource(R.drawable.vip_center_identification_entry_lv6)
7 -> holder.contentImageView.setImageResource(R.drawable.vip_center_identification_entry_lv7)
8 -> holder.contentImageView.setImageResource(R.drawable.vip_center_identification_entry_lv8)
9 -> holder.contentImageView.setImageResource(R.drawable.vip_center_identification_entry_lv9)
}
}
}
// val resourceId = context.resources

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Some files were not shown because too many files have changed in this diff Show More