新增装扮商城
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package com.yizhuan.erban.decoration.adapter
|
||||
|
||||
import android.widget.ImageView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.ui.utils.load
|
||||
import com.yizhuan.xchat_android_core.decoration.DecorationInfo
|
||||
import com.yizhuan.xchat_android_core.room.game.GameInfo
|
||||
|
||||
|
||||
open class DecorationCommonAdapter(layoutResId: Int = R.layout.item_decoration_common) :
|
||||
BaseQuickAdapter<DecorationInfo, BaseViewHolder>(layoutResId) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: DecorationInfo) {
|
||||
helper.getView<ImageView>(R.id.iv_pic).load(item.pic)
|
||||
helper.setText(R.id.tv_name, "${item.name}(${item.dressDay})天")
|
||||
.setText(R.id.tv_price, item.dressPrice.toString())
|
||||
.setGone(R.id.tv_limit, false)
|
||||
.addOnClickListener(R.id.tv_buy, R.id.tv_send)
|
||||
}
|
||||
|
||||
}
|
@@ -37,7 +37,6 @@ public class MyCarAdapter extends BaseAdapter<CarInfo> {
|
||||
.fitCenter()
|
||||
.into(binding.ivCarCover);
|
||||
|
||||
helper.addOnClickListener(R.id.tv_buy);
|
||||
helper.addOnClickListener(R.id.tv_used);
|
||||
|
||||
// 倒计时
|
||||
|
@@ -1,7 +1,22 @@
|
||||
package com.yizhuan.erban.decoration.helper;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.xchat_android_core.decoration.DecorationInfo;
|
||||
import com.yizhuan.xchat_android_core.decoration.DecorationInfoEvent;
|
||||
import com.yizhuan.xchat_android_core.decoration.DecorationModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
/**
|
||||
* create by lvzebiao @2019/3/21
|
||||
*/
|
||||
@@ -28,4 +43,36 @@ public class DecorationHelper {
|
||||
return "";
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public static void showBuyDialog(Context context,
|
||||
DialogManager dialogManager,
|
||||
String targetNick,
|
||||
long targetUid) {
|
||||
DecorationInfo decorationInfo = EventBus.getDefault().getStickyEvent(DecorationInfoEvent.class).getDecorationInfo();
|
||||
dialogManager.showOkCancelDialog(
|
||||
"赠送确认",
|
||||
context.getResources().getString(
|
||||
R.string.donate_decoration_info_text,
|
||||
decorationInfo.getName(),
|
||||
targetNick,
|
||||
String.valueOf(decorationInfo.getDressDay())
|
||||
|
||||
),
|
||||
"赠送",
|
||||
"取消",
|
||||
true,
|
||||
() -> {
|
||||
dialogManager.showProgressDialog(context);
|
||||
DecorationModel.INSTANCE.sendDecoration(decorationInfo.getDressType(), decorationInfo.getDressId(), targetUid)
|
||||
.compose(RxHelper.bindContext(context))
|
||||
.subscribe(s -> {
|
||||
dialogManager.dismissDialog();
|
||||
SingleToastUtil.showToast("赠送成功");
|
||||
}, throwable -> {
|
||||
dialogManager.dismissDialog();
|
||||
SingleToastUtil.showToast(throwable.getMessage());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,116 +0,0 @@
|
||||
package com.yizhuan.erban.decoration.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.netease.nim.uikit.common.ui.recyclerview.decoration.SpacingDecoration;
|
||||
import com.yizhuan.erban.BR;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingFragment;
|
||||
import com.yizhuan.erban.constants.BundleKeys;
|
||||
import com.yizhuan.erban.databinding.FragmentRexylerviewBindBinding;
|
||||
import com.yizhuan.erban.decoration.adapter.CarShopAdapter;
|
||||
import com.yizhuan.erban.decoration.viewmodel.CarShopVm;
|
||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.erban.ui.widget.marqueeview.Utils;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by huangmeng1 on 2018/5/7.
|
||||
*/
|
||||
@ActLayoutRes(R.layout.fragment_rexylerview_bind)
|
||||
public class CarShopFragment extends BaseBindingFragment<FragmentRexylerviewBindBinding> {
|
||||
private CarShopVm carShopVm;
|
||||
private CarShopAdapter carShopAdapter;
|
||||
|
||||
private DecorationStoreActivity activity;
|
||||
|
||||
public CarShopAdapter getCarShopAdapter() {
|
||||
return carShopAdapter;
|
||||
}
|
||||
|
||||
public static CarShopFragment newInstance(int position, String uid) {
|
||||
CarShopFragment carShopFragment = new CarShopFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(Constants.KEY_POSITION, position);
|
||||
bundle.putString(BundleKeys.KEY_EXTRA_1, uid);
|
||||
carShopFragment.setArguments(bundle);
|
||||
return carShopFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
this.activity = (DecorationStoreActivity) activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate() {
|
||||
carShopVm = new CarShopVm();
|
||||
if (getArguments() != null) {
|
||||
carShopVm.setUid(getArguments().getString(BundleKeys.KEY_EXTRA_1));
|
||||
}
|
||||
mBinding.setViewmodel(carShopVm);
|
||||
|
||||
carShopAdapter = new CarShopAdapter(R.layout.item_car_shop, BR.carInfo);
|
||||
carShopAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
if (activity != null) {
|
||||
activity.showCarDetail((CarInfo) adapter.getData().get(position));
|
||||
}
|
||||
});
|
||||
carShopAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
carShopAdapter.setSelectPosition(position);
|
||||
carShopAdapter.notifyDataSetChanged();
|
||||
if (activity != null) {
|
||||
activity.showCarPrice((CarInfo) adapter.getData().get(position));
|
||||
}
|
||||
});
|
||||
carShopAdapter.setOnLoadMoreListener(() -> loadData(true, false));
|
||||
mBinding.swipeRefresh.setOnRefreshListener(() -> loadData(false, false));
|
||||
|
||||
mBinding.recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
|
||||
int heightSpace = Utils.dip2px(mContext, 10);
|
||||
mBinding.recyclerView.setAdapter(carShopAdapter);
|
||||
mBinding.recyclerView.addItemDecoration(new SpacingDecoration(heightSpace, heightSpace, true));
|
||||
|
||||
loadData(false, getArguments().getInt(Constants.KEY_POSITION) == 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser) {
|
||||
super.setUserVisibleHint(isVisibleToUser);
|
||||
if (isVisibleToUser && activity != null) {
|
||||
activity.setCar(true);
|
||||
List<CarInfo> list = carShopAdapter.getData();
|
||||
int selectPosition = carShopAdapter.getSelectPosition();
|
||||
if (!ListUtils.isListEmpty(list) && selectPosition < list.size()) {
|
||||
activity.showCarPrice(list.get(selectPosition));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLoading = false;
|
||||
|
||||
private void loadData(boolean isLode, boolean isFirst) {
|
||||
if (isLoading) {
|
||||
return;
|
||||
}
|
||||
isLoading = true;
|
||||
|
||||
carShopVm.loadData(isLode).compose(bindToLifecycle())
|
||||
.doAfterTerminate(() -> setUserVisibleHint(isFirst))
|
||||
.subscribe(new DontWarnObserver<List<CarInfo>>() {
|
||||
@Override
|
||||
public void accept(List<CarInfo> carInfos, String error) {
|
||||
super.accept(carInfos, error);
|
||||
isLoading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,105 @@
|
||||
package com.yizhuan.erban.decoration.view
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.databinding.FragmentDecorationCommonBinding
|
||||
import com.yizhuan.erban.decoration.adapter.DecorationCommonAdapter
|
||||
import com.yizhuan.erban.decoration.viewmodel.DecorationViewModel
|
||||
import com.yizhuan.erban.ui.relation.FansListActivity
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.xchat_android_core.decoration.DecorationInfo
|
||||
import com.yizhuan.xchat_android_core.decoration.DecorationInfoEvent
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* Created by huangmeng1 on 2018/5/7.
|
||||
*/
|
||||
@ActLayoutRes(R.layout.fragment_decoration_common)
|
||||
class DecorationCommonFragment : BaseViewBindingFragment<FragmentDecorationCommonBinding>() {
|
||||
|
||||
companion object {
|
||||
fun newInstance(dressType: Int): DecorationCommonFragment {
|
||||
val args = Bundle()
|
||||
args.putInt("dressType", dressType)
|
||||
val fragment = DecorationCommonFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private val dressType: Int by lazy { requireArguments().getInt("dressType") }
|
||||
private lateinit var rvDelegate: RVDelegate<DecorationInfo>
|
||||
private lateinit var decorationAdapter: DecorationCommonAdapter
|
||||
private val decorationViewModel: DecorationViewModel by viewModels()
|
||||
|
||||
override fun init() {
|
||||
|
||||
decorationViewModel.loadingLiveData.observe(viewLifecycleOwner) {
|
||||
if (it) dialogManager.showProgressDialog(mContext)
|
||||
else dialogManager.dismissDialog()
|
||||
}
|
||||
decorationAdapter = if (dressType == DecorationStoreActivity.TAB_USER_CARD) {
|
||||
DecorationCommonAdapter(R.layout.item_decoration_user_card)
|
||||
} else {
|
||||
DecorationCommonAdapter()
|
||||
}
|
||||
rvDelegate = RVDelegate.Builder<DecorationInfo>()
|
||||
.setAdapter(decorationAdapter)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setEmptyView(EmptyViewHelper.createEmptyView(mContext, "暂无装扮"))
|
||||
.setLayoutManager(
|
||||
if (dressType == DecorationStoreActivity.TAB_USER_CARD) {
|
||||
LinearLayoutManager(mContext)
|
||||
} else {
|
||||
GridLayoutManager(mContext, 2, GridLayoutManager.VERTICAL, false)
|
||||
}
|
||||
)
|
||||
.build()
|
||||
decorationViewModel.getDecorationInfoList(dressType)
|
||||
decorationViewModel.decorationInfoListLiveData.observe(viewLifecycleOwner) {
|
||||
rvDelegate.loadData(it)
|
||||
}
|
||||
|
||||
decorationAdapter.setOnItemChildClickListener { _, view, position ->
|
||||
val decorationInfo =
|
||||
decorationAdapter.getItem(position) ?: return@setOnItemChildClickListener
|
||||
when (view.id) {
|
||||
R.id.tv_buy -> {
|
||||
dialogManager.showOkCancelDialog(
|
||||
"购买确认",
|
||||
mContext.resources.getString(
|
||||
R.string.buy_decoration_info_text,
|
||||
decorationInfo.name,
|
||||
decorationInfo.dressDay.toString()
|
||||
),
|
||||
"购买",
|
||||
"取消",
|
||||
true
|
||||
) {
|
||||
decorationViewModel.buyDecoration(
|
||||
decorationInfo.dressType,
|
||||
decorationInfo.dressId
|
||||
)
|
||||
}
|
||||
}
|
||||
R.id.tv_send -> {
|
||||
EventBus.getDefault().postSticky(DecorationInfoEvent(decorationInfo))
|
||||
FansListActivity.start(mContext, FansListActivity.TYPE_DECORATION)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
EventBus.getDefault().removeStickyEvent(DecorationInfoEvent::class.java)
|
||||
}
|
||||
|
||||
}
|
@@ -1,494 +0,0 @@
|
||||
package com.yizhuan.erban.decoration.view;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Paint;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.tencent.qgame.animplayer.util.ScaleType;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||
import com.yizhuan.erban.databinding.ActivityDecorationStoreBinding;
|
||||
import com.yizhuan.erban.decoration.helper.DecorationDialogHelper;
|
||||
import com.yizhuan.erban.decoration.helper.DecorationSaleType;
|
||||
import com.yizhuan.erban.decoration.view.widgets.CarMagicIndicator;
|
||||
import com.yizhuan.erban.ui.user.decorationsend.DecorationSendActivity;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadKt;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.ViewPagerHelper;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.decoration.bean.BaseDecoration;
|
||||
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo;
|
||||
import com.yizhuan.xchat_android_core.decoration.headwear.bean.HeadWearInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.TabInfo;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
@ActLayoutRes(R.layout.activity_decoration_store)
|
||||
public class DecorationStoreActivity extends BaseBindingActivity<ActivityDecorationStoreBinding> implements CarMagicIndicator.OnItemSelectListener {
|
||||
public final static int TAB_HEAD_WEAR = 0;
|
||||
public final static int TAB_CAR = 1;
|
||||
public final static int TAB_NAMEPLATE = 2;
|
||||
private final static String IS_CHECK_MY_DECORATION = "IS_CHECK_MY_DECORATION";
|
||||
private SVGAParser mSVGAParser;
|
||||
private long userId;
|
||||
private boolean isCar;
|
||||
private CarInfo buyCarInfo;
|
||||
private HeadWearInfo wearInfo;
|
||||
private UserInfo cacheLoginUserInfo;
|
||||
private HeadWearFragment wearFragment;
|
||||
private CarShopFragment shopFragment;
|
||||
private boolean isBuy;
|
||||
|
||||
public static void start(Context context, long userId) {
|
||||
Intent intent = new Intent(context, DecorationStoreActivity.class);
|
||||
intent.putExtra("userId", userId);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void start(Context context, long userId, int position) {
|
||||
Intent intent = new Intent(context, DecorationStoreActivity.class);
|
||||
intent.putExtra("userId", userId);
|
||||
intent.putExtra(Constants.KEY_POSITION, position);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public void setCar(boolean car) {
|
||||
isCar = car;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
protected void init() {
|
||||
|
||||
userId = getIntent().getLongExtra("userId", 0);
|
||||
int currentItem = getIntent().getIntExtra(Constants.KEY_POSITION, TAB_HEAD_WEAR);
|
||||
|
||||
mBinding.setClick(this);
|
||||
mSVGAParser = new SVGAParser(this);
|
||||
|
||||
wearFragment = HeadWearFragment.newInstance(currentItem, userId + "");
|
||||
shopFragment = CarShopFragment.newInstance(currentItem, userId + "");
|
||||
|
||||
List<TabInfo> tabInfoList = new ArrayList<>(2);
|
||||
tabInfoList.add(new TabInfo(0, "头饰"));
|
||||
tabInfoList.add(new TabInfo(1, "座驾"));
|
||||
CommonNavigator commonNavigator = new CommonNavigator(this);
|
||||
commonNavigator.setAdjustMode(true);
|
||||
CarMagicIndicator indicator = new CarMagicIndicator(this, tabInfoList, 0);
|
||||
indicator.setOnItemSelectListener(this);
|
||||
commonNavigator.setAdapter(indicator);
|
||||
mBinding.tabLayout.setNavigator(commonNavigator);
|
||||
|
||||
ViewPagerHelper.bind(mBinding.tabLayout, mBinding.viewpager);
|
||||
|
||||
mBinding.viewpager.setOffscreenPageLimit(2);
|
||||
mBinding.viewpager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
if (position == 0) {
|
||||
return wearFragment;
|
||||
} else if (position == 1) {
|
||||
return shopFragment;
|
||||
}
|
||||
return wearFragment;
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.viewpager.setCurrentItem(currentItem);
|
||||
|
||||
UserModel.get().getUserInfo(userId).subscribe(new Consumer<UserInfo>() {
|
||||
@Override
|
||||
public void accept(UserInfo userInfo) throws Exception {
|
||||
cacheLoginUserInfo = userInfo;
|
||||
if (cacheLoginUserInfo != null) {
|
||||
mBinding.setIsSelf(cacheLoginUserInfo.getUid() == AuthModel.get().getCurrentUid());
|
||||
ImageLoadUtils.loadImage(DecorationStoreActivity.this, cacheLoginUserInfo.getAvatar(), mBinding.ivAvatar);
|
||||
if (cacheLoginUserInfo.getUserHeadwear() != null && !TextUtils.isEmpty(cacheLoginUserInfo.getUserHeadwear().getPic())) {
|
||||
// 头饰
|
||||
NobleUtil.loadHeadWear(cacheLoginUserInfo.getUserHeadwear().getPic(), mBinding.ivHeadWear);
|
||||
} else if (cacheLoginUserInfo.getNobleInfo() != null && !TextUtils.isEmpty(cacheLoginUserInfo.getNobleInfo().getHeadWear())) {
|
||||
// 头饰
|
||||
NobleUtil.loadResource(cacheLoginUserInfo.getNobleInfo().getHeadWear(), mBinding.ivHeadWear);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Boolean isCheckMyDecoration = (Boolean) SharedPreferenceUtils.get(DecorationStoreActivity.IS_CHECK_MY_DECORATION, true);
|
||||
if (isCheckMyDecoration != null && isCheckMyDecoration) {
|
||||
mBinding.tvRedTip.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
mBinding.tvRedTip.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
mBinding.rlCarDetail.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
super.onClick(v);
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_back:
|
||||
finish();
|
||||
break;
|
||||
case R.id.tv_edit:
|
||||
startActivity(new Intent(this, MyDecorationActivity.class));
|
||||
mBinding.tvRedTip.setVisibility(View.INVISIBLE);
|
||||
SharedPreferenceUtils.put(DecorationStoreActivity.IS_CHECK_MY_DECORATION, true);
|
||||
break;
|
||||
case R.id.tv_buy:
|
||||
if (isCar && buyCarInfo != null) {
|
||||
showSureDialog(DecorationSaleType.BUY_CAR);
|
||||
} else if (!isCar && wearInfo != null) {
|
||||
showSureDialog(DecorationSaleType.BUY_HEAD_WEAR);
|
||||
}
|
||||
break;
|
||||
case R.id.tv_go_send:
|
||||
if (isCar && buyCarInfo != null) {
|
||||
DecorationSendActivity.start(this, buyCarInfo);
|
||||
} else if (!isCar && wearInfo != null) {
|
||||
DecorationSendActivity.start(this, wearInfo);
|
||||
}
|
||||
break;
|
||||
case R.id.tv_send:
|
||||
if (isCar && buyCarInfo != null) {
|
||||
showSureDialog(DecorationSaleType.SEND_CAR);
|
||||
} else if (!isCar && wearInfo != null) {
|
||||
showSureDialog(DecorationSaleType.SEND_HEAD_WEAR);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void showSureDialog(int type) {
|
||||
if (cacheLoginUserInfo == null) return;
|
||||
BaseDecoration decoration;
|
||||
if (type == DecorationSaleType.BUY_CAR || type == DecorationSaleType.SEND_CAR) {
|
||||
decoration = buyCarInfo;
|
||||
} else {
|
||||
decoration = wearInfo;
|
||||
}
|
||||
if (decoration == null) {
|
||||
return;
|
||||
}
|
||||
DecorationDialogHelper.Options options = new DecorationDialogHelper.Builder()
|
||||
.setTargetUid(cacheLoginUserInfo.getUid())
|
||||
.setNick(cacheLoginUserInfo.getNick())
|
||||
.setType(type)
|
||||
.setDecoration(decoration)
|
||||
.create();
|
||||
DecorationDialogHelper helper = new DecorationDialogHelper(context, getDialogManager(), options);
|
||||
helper.showBuyOrDonateDialog();
|
||||
helper.setOnOpDecorationListener(new DecorationDialogHelper.OnOpDecorationListener() {
|
||||
@Override
|
||||
public void onBuyCarSuccess() {
|
||||
// 更新商店这辆车的数据
|
||||
if (shopFragment != null && shopFragment.getCarShopAdapter() != null)
|
||||
shopFragment.getCarShopAdapter().setCarInfoHasBeenBought(buyCarInfo);
|
||||
|
||||
setPrice(buyCarInfo, true);
|
||||
isBuy = false;
|
||||
setBuyButton(isBuy);
|
||||
setGoSendButton(isBuy);
|
||||
|
||||
mBinding.tvRedTip.setVisibility(View.VISIBLE);
|
||||
SharedPreferenceUtils.put(DecorationStoreActivity.IS_CHECK_MY_DECORATION, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBuyHeadwearSuccess() {
|
||||
// 更新商店头饰的数据
|
||||
if (wearFragment != null && wearFragment.getShopAdapter() != null) {
|
||||
wearFragment.getShopAdapter().setCarInfoHasBeenBought(wearInfo);
|
||||
}
|
||||
setPrice(wearInfo, true);
|
||||
isBuy = false;
|
||||
setBuyButton(isBuy);
|
||||
setGoSendButton(isBuy);
|
||||
|
||||
mBinding.tvRedTip.setVisibility(View.VISIBLE);
|
||||
SharedPreferenceUtils.put(DecorationStoreActivity.IS_CHECK_MY_DECORATION, false);
|
||||
|
||||
//更新用户信息
|
||||
UserModel.get().updateCurrentUserInfo().subscribe();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (mBinding.rlCarDetail.getVisibility() == View.VISIBLE) {
|
||||
dismissCarDetail();
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
public void showCarPrice(CarInfo carInfo) {
|
||||
if (carInfo == null || carInfo.getCarId() <= 0) return;
|
||||
//座驾标签
|
||||
if (carInfo.getLabelType() == CarInfo.TAG_TYPE_NORMAL) {
|
||||
mBinding.llLimitContainer.setVisibility(View.GONE);
|
||||
mBinding.tvOriginalPrice.setVisibility(View.GONE);
|
||||
|
||||
} else if (CarInfo.TAG_TYPE_NEW == carInfo.getLabelType()) {
|
||||
mBinding.llLimitContainer.setVisibility(View.GONE);
|
||||
mBinding.tvOriginalPrice.setVisibility(View.GONE);
|
||||
|
||||
} else if (CarInfo.TAG_TYPE_DISCOUNT == carInfo.getLabelType()) {
|
||||
mBinding.llLimitContainer.setVisibility(View.GONE);
|
||||
mBinding.tvOriginalPrice.setVisibility(View.VISIBLE);
|
||||
setOriginalPrice(carInfo);
|
||||
|
||||
} else if (CarInfo.TAG_TYPE_LIMIT == carInfo.getLabelType()) {
|
||||
mBinding.llLimitContainer.setVisibility(View.VISIBLE);
|
||||
mBinding.tvLimitDesc.setText(carInfo.getLimitDesc());
|
||||
if (TextUtils.isEmpty(carInfo.getRedirectLink())) {
|
||||
mBinding.tvGoWeb.setVisibility(View.GONE);
|
||||
} else {
|
||||
mBinding.tvGoWeb.setVisibility(View.VISIBLE);
|
||||
mBinding.tvGoWeb.setOnClickListener(v -> {
|
||||
CommonWebViewActivity.start(DecorationStoreActivity.this, carInfo.getRedirectLink());
|
||||
});
|
||||
}
|
||||
return;
|
||||
|
||||
} else if (CarInfo.TAG_TYPE_EXCLUSIVE == carInfo.getLabelType()) {
|
||||
mBinding.llLimitContainer.setVisibility(View.VISIBLE);
|
||||
mBinding.tvLimitDesc.setText(carInfo.getLimitDesc());
|
||||
if (TextUtils.isEmpty(carInfo.getRedirectLink())) {
|
||||
mBinding.tvGoWeb.setVisibility(View.GONE);
|
||||
} else {
|
||||
mBinding.tvGoWeb.setVisibility(View.VISIBLE);
|
||||
mBinding.tvGoWeb.setOnClickListener(v -> CommonWebViewActivity.start(DecorationStoreActivity.this, carInfo.getRedirectLink()));
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
buyCarInfo = carInfo;
|
||||
boolean buyState = carInfo.getRemainingDay() > 0 && carInfo.getStatus() == CarInfo.STATUS_USER_CAN_USE;
|
||||
setPrice(carInfo, buyState);
|
||||
isBuy = !buyState;
|
||||
|
||||
setBuyButton(isBuy);
|
||||
setGoSendButton(isBuy);
|
||||
}
|
||||
|
||||
private void setBuyButton(boolean isBuy) {
|
||||
if (isBuy) {
|
||||
mBinding.tvBuy.setBackgroundResource(R.drawable.bg_button_buy);
|
||||
mBinding.tvBuy.setText("购买");
|
||||
|
||||
} else {
|
||||
mBinding.tvBuy.setBackgroundResource(R.drawable.bg_button_remain);
|
||||
mBinding.tvBuy.setText("续费");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setGoSendButton(boolean isBuy) {
|
||||
mBinding.tvGoSend.setBackgroundResource(R.drawable.bg_left_button_buy);
|
||||
mBinding.tvGoSend.setTextColor(ContextCompat.getColor(this, R.color.color_333333));
|
||||
// if (isBuy) {
|
||||
// mBinding.tvGoSend.setBackgroundResource(R.drawable.bg_left_button_buy);
|
||||
// mBinding.tvGoSend.setTextColor(ContextCompat.getColor(this, R.color.color_333333));
|
||||
//
|
||||
// } else {
|
||||
// mBinding.tvGoSend.setBackgroundResource(R.drawable.bg_left_button_remain);
|
||||
// mBinding.tvGoSend.setTextColor(ContextCompat.getColor(this, R.color.color_FC6E6D));
|
||||
// }
|
||||
}
|
||||
|
||||
private void setPrice(BaseDecoration bean, boolean isRenewPrice) {
|
||||
|
||||
StringBuilder price = new StringBuilder();
|
||||
|
||||
if (bean.isGoldSale()) {
|
||||
price.append(isRenewPrice ? String.valueOf(bean.getRenewPrice()) : String.valueOf(bean.getPrice()));
|
||||
price.append("钻石");
|
||||
}
|
||||
|
||||
if (bean.isGoldAndRadishSale())
|
||||
price.append("/");
|
||||
|
||||
if (bean.isRadishSale()) {
|
||||
price.append(isRenewPrice ? String.valueOf(bean.getRadishRenewPrice()) : String.valueOf(bean.getRadishPrice()));
|
||||
price.append("萝卜");
|
||||
}
|
||||
|
||||
mBinding.tvPrice.setText(com.yizhuan.xchat_android_core.utils.TextUtils.textTwoColors(price.toString(), "(" + bean.getDays() + "天)",
|
||||
ContextCompat.getColor(this, R.color.appColor),
|
||||
ContextCompat.getColor(this, R.color.color_999999)));
|
||||
}
|
||||
|
||||
private void setOriginalPrice(BaseDecoration bean) {
|
||||
StringBuilder price = new StringBuilder();
|
||||
|
||||
if (bean.isGoldSale()) {
|
||||
price.append(bean.getOriginalPrice());
|
||||
price.append("钻石");
|
||||
}
|
||||
|
||||
if (bean.isGoldAndRadishSale())
|
||||
price.append("/");
|
||||
|
||||
if (bean.isRadishSale()) {
|
||||
price.append(bean.getRadishOriginalPrice());
|
||||
price.append("萝卜");
|
||||
}
|
||||
mBinding.tvOriginalPrice.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); //中划线
|
||||
mBinding.tvOriginalPrice.setText(price + "(" + bean.getDays() + "天)");
|
||||
}
|
||||
|
||||
public void showHeadWearPrice(HeadWearInfo headWearInfo) {
|
||||
if (headWearInfo == null || headWearInfo.getHeadwearId() <= 0) return;
|
||||
NobleUtil.loadHeadWear(headWearInfo.getPic(), mBinding.ivHeadWear);
|
||||
//头饰标签
|
||||
if (HeadWearInfo.LABEL_TYPE_NORMAL == headWearInfo.getLabelType()) {
|
||||
mBinding.llLimitContainer.setVisibility(View.GONE);
|
||||
mBinding.tvOriginalPrice.setVisibility(View.GONE);
|
||||
} else if (HeadWearInfo.LABEL_TYPE_NEW == headWearInfo.getLabelType()) {
|
||||
mBinding.llLimitContainer.setVisibility(View.GONE);
|
||||
mBinding.tvOriginalPrice.setVisibility(View.GONE);
|
||||
} else if (HeadWearInfo.LABEL_TYPE_DISCOUNT == headWearInfo.getLabelType()) {
|
||||
mBinding.llLimitContainer.setVisibility(View.GONE);
|
||||
mBinding.tvOriginalPrice.setVisibility(View.VISIBLE);
|
||||
setOriginalPrice(headWearInfo);
|
||||
} else if (HeadWearInfo.LABEL_TYPE_LIMIT == headWearInfo.getLabelType()) {
|
||||
mBinding.llLimitContainer.setVisibility(View.VISIBLE);
|
||||
mBinding.tvLimitDesc.setText(headWearInfo.getLimitDesc());
|
||||
if (TextUtils.isEmpty(headWearInfo.getRedirectLink())) {
|
||||
mBinding.tvGoWeb.setVisibility(View.GONE);
|
||||
} else {
|
||||
mBinding.tvGoWeb.setVisibility(View.VISIBLE);
|
||||
mBinding.tvGoWeb.setOnClickListener(v -> {
|
||||
CommonWebViewActivity.start(DecorationStoreActivity.this, headWearInfo.getRedirectLink());
|
||||
});
|
||||
}
|
||||
return;
|
||||
} else if (HeadWearInfo.LABEL_TYPE_EXCLUSIVE == headWearInfo.getLabelType()) {
|
||||
mBinding.llLimitContainer.setVisibility(View.VISIBLE);
|
||||
mBinding.tvLimitDesc.setText(headWearInfo.getLimitDesc());
|
||||
if (TextUtils.isEmpty(headWearInfo.getRedirectLink())) {
|
||||
mBinding.tvGoWeb.setVisibility(View.GONE);
|
||||
} else {
|
||||
mBinding.tvGoWeb.setVisibility(View.VISIBLE);
|
||||
mBinding.tvGoWeb.setOnClickListener(v -> CommonWebViewActivity.start(DecorationStoreActivity.this, headWearInfo.getRedirectLink()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
wearInfo = headWearInfo;
|
||||
boolean buyState = headWearInfo.getStatus() == HeadWearInfo.STATUS_IN_USED;
|
||||
setPrice(headWearInfo, buyState);
|
||||
isBuy = !buyState;
|
||||
|
||||
setBuyButton(isBuy);
|
||||
setGoSendButton(isBuy);
|
||||
}
|
||||
|
||||
public void showCarDetail(CarInfo carInfo) {
|
||||
if (carInfo == null || carInfo.getCarId() <= 0) return;
|
||||
|
||||
mBinding.rlCarDetail.setVisibility(View.VISIBLE);
|
||||
|
||||
if (carInfo.getOtherViewType() == 1 && !TextUtils.isEmpty(carInfo.getViewUrl())) {
|
||||
showVAPAnimation(carInfo.getViewUrl());
|
||||
} else {
|
||||
showSvgaAnimation(carInfo.getEffect());
|
||||
}
|
||||
mBinding.tvBuyCancel.setOnClickListener(v -> dismissCarDetail());
|
||||
|
||||
}
|
||||
|
||||
private void showVAPAnimation(String url) {
|
||||
mBinding.vapAnimView.setLoop(99999);
|
||||
mBinding.vapAnimView.setScaleType(ScaleType.FIT_CENTER);
|
||||
ImageLoadKt.loadAnim(mBinding.vapAnimView, url);
|
||||
}
|
||||
|
||||
private void showSvgaAnimation(String effect) {
|
||||
//effect = TextUtils.isEmpty(effect) && BuildConfig.DEBUG ? "https://image.zhongjialx.com/svga/Noble_OpenEffect_7_1.svga" : effect;
|
||||
try {
|
||||
URL url = new URL(effect);
|
||||
mSVGAParser.parse(url, new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity svgaVideoEntity) {
|
||||
if (mBinding.rlCarDetail.getVisibility() == View.GONE) return;
|
||||
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity);
|
||||
mBinding.svgaCarPlay.setLoops(-1);
|
||||
mBinding.svgaCarPlay.setImageDrawable(drawable);
|
||||
mBinding.svgaCarPlay.startAnimation();
|
||||
mBinding.svgaCarPlay.setClearsAfterStop(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
// Toast.makeText(DecorationStoreActivity.this, "网络异常", Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort("网络异常");
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void dismissCarDetail() {
|
||||
if (mBinding.rlCarDetail != null) {
|
||||
mBinding.svgaCarPlay.stopAnimation(true);
|
||||
mBinding.svgaCarPlay.setImageDrawable(null);
|
||||
mBinding.rlCarDetail.setVisibility(View.GONE);
|
||||
mBinding.vapAnimView.stopPlay();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelect(int position) {
|
||||
mBinding.viewpager.setCurrentItem(position);
|
||||
}
|
||||
}
|
@@ -0,0 +1,119 @@
|
||||
package com.yizhuan.erban.decoration.view
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.view.View
|
||||
import androidx.activity.viewModels
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentPagerAdapter
|
||||
import androidx.viewpager.widget.ViewPager.SimpleOnPageChangeListener
|
||||
import com.netease.nim.uikit.StatusBarUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.base.TitleBar
|
||||
import com.yizhuan.erban.databinding.ActivityDecorationStoreBinding
|
||||
import com.yizhuan.erban.decoration.view.widgets.CarMagicIndicator
|
||||
import com.yizhuan.erban.decoration.view.widgets.MyDecorationMagicIndicator
|
||||
import com.yizhuan.erban.decoration.viewmodel.DecorationViewModel
|
||||
import com.yizhuan.erban.home.helper.BannerHelper
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.ViewPagerHelper
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
import com.yizhuan.xchat_android_core.Constants
|
||||
import com.yizhuan.xchat_android_core.home.bean.TabInfo
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||
|
||||
@ActLayoutRes(R.layout.activity_decoration_store)
|
||||
class DecorationStoreActivity : BaseViewBindingActivity<ActivityDecorationStoreBinding>(),
|
||||
CarMagicIndicator.OnItemSelectListener, MyDecorationMagicIndicator.OnItemSelectListener {
|
||||
|
||||
companion object {
|
||||
|
||||
const val TAB_HEAD_WEAR = 0
|
||||
const val TAB_CAR = 1
|
||||
const val TAB_NAMEPLATE = 2
|
||||
const val TAB_USER_CARD = 3
|
||||
const val TAB_CHAT_BUBBLE = 4
|
||||
|
||||
@JvmStatic
|
||||
fun start(context: Context, position: Int) {
|
||||
val intent = Intent(context, DecorationStoreActivity::class.java)
|
||||
intent.putExtra(Constants.KEY_POSITION, position)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
private var mPosition = 0
|
||||
private val decorationViewModel: DecorationViewModel by viewModels()
|
||||
|
||||
override fun init() {
|
||||
initWhiteTitleBar("装扮商城")
|
||||
mTitleBar?.addAction(object : TitleBar.TextAction(
|
||||
"我的装扮", Color.parseColor("#999999")
|
||||
) {
|
||||
override fun performAction(view: View) {
|
||||
MyDecorationActivity.start(this@DecorationStoreActivity, 0)
|
||||
}
|
||||
})
|
||||
mPosition = intent.getIntExtra(Constants.KEY_POSITION, 0)
|
||||
initViews()
|
||||
decorationViewModel.bannerLiveData.observe(this)
|
||||
{
|
||||
BannerHelper.setBanner(binding.rollView, it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initViews() {
|
||||
val viewPager = binding.viewpager
|
||||
val mMagicIndicator = binding.viewIndicator
|
||||
val tabInfoList: MutableList<TabInfo> = ArrayList(5)
|
||||
tabInfoList.add(TabInfo(TAB_HEAD_WEAR, "头饰"))
|
||||
tabInfoList.add(TabInfo(TAB_CAR, "座驾"))
|
||||
tabInfoList.add(TabInfo(TAB_NAMEPLATE, "铭牌"))
|
||||
tabInfoList.add(TabInfo(TAB_USER_CARD, "资料卡"))
|
||||
tabInfoList.add(TabInfo(TAB_CHAT_BUBBLE, "聊天气泡"))
|
||||
val commonNavigator = CommonNavigator(this)
|
||||
commonNavigator.isAdjustMode = true
|
||||
val indicator = MyDecorationMagicIndicator(this, tabInfoList)
|
||||
indicator.setOnItemSelectListener(this)
|
||||
commonNavigator.adapter = indicator
|
||||
mMagicIndicator.navigator = commonNavigator
|
||||
ViewPagerHelper.bind(mMagicIndicator, viewPager)
|
||||
viewPager.adapter = object : FragmentPagerAdapter(
|
||||
supportFragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
|
||||
) {
|
||||
override fun getCount(): Int {
|
||||
return tabInfoList.size
|
||||
}
|
||||
|
||||
override fun getItem(position: Int): Fragment {
|
||||
return DecorationCommonFragment.newInstance(position)
|
||||
}
|
||||
}
|
||||
viewPager.addOnPageChangeListener(object : SimpleOnPageChangeListener() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
super.onPageSelected(position)
|
||||
if (position == 1) {
|
||||
mMagicIndicator.findViewById<View>(R.id.car_badge_garage).visibility =
|
||||
View.GONE
|
||||
}
|
||||
}
|
||||
})
|
||||
viewPager.currentItem = mPosition
|
||||
}
|
||||
|
||||
override fun onItemSelect(position: Int) {
|
||||
binding.viewpager.currentItem = position
|
||||
}
|
||||
|
||||
override fun needSteepStateBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun setStatusBar() {
|
||||
super.setStatusBar()
|
||||
StatusBarUtil.transparencyBar(this)
|
||||
StatusBarUtil.StatusBarLightMode(this)
|
||||
}
|
||||
|
||||
}
|
@@ -1,107 +0,0 @@
|
||||
package com.yizhuan.erban.decoration.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.netease.nim.uikit.common.ui.recyclerview.decoration.SpacingDecoration;
|
||||
import com.yizhuan.erban.BR;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingFragment;
|
||||
import com.yizhuan.erban.databinding.FragmentRexylerviewBindBinding;
|
||||
import com.yizhuan.erban.decoration.adapter.HeadWearShopAdapter;
|
||||
import com.yizhuan.erban.decoration.viewmodel.HeadWearVm;
|
||||
import com.yizhuan.erban.ui.widget.marqueeview.Utils;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.decoration.headwear.bean.HeadWearInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by huangmeng1 on 2018/5/7.
|
||||
*/
|
||||
@ActLayoutRes(R.layout.fragment_rexylerview_bind)
|
||||
public class HeadWearFragment extends BaseBindingFragment<FragmentRexylerviewBindBinding> {
|
||||
private HeadWearVm headWearVm;
|
||||
private HeadWearShopAdapter shopAdapter;
|
||||
private DecorationStoreActivity activity;
|
||||
|
||||
public HeadWearShopAdapter getShopAdapter() {
|
||||
return shopAdapter;
|
||||
}
|
||||
|
||||
public static HeadWearFragment newInstance(int position, String uid) {
|
||||
HeadWearFragment headWearFragment = new HeadWearFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(Constants.KEY_POSITION, position);
|
||||
bundle.putString("uid", uid);
|
||||
headWearFragment.setArguments(bundle);
|
||||
return headWearFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
this.activity = (DecorationStoreActivity) activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser) {
|
||||
super.setUserVisibleHint(isVisibleToUser);
|
||||
if (isVisibleToUser && activity != null) {
|
||||
activity.setCar(false);
|
||||
if (!ListUtils.isListEmpty(shopAdapter.getData())) {
|
||||
activity.showHeadWearPrice(shopAdapter.getData().get(shopAdapter.getSelectPosition()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate() {
|
||||
|
||||
headWearVm = new HeadWearVm();
|
||||
headWearVm.setUid(getArguments().getString("uid"));
|
||||
mBinding.setViewmodel(headWearVm);
|
||||
shopAdapter = new HeadWearShopAdapter(R.layout.item_head_wear, BR.headWearInfo);
|
||||
|
||||
shopAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
shopAdapter.setSelectPosition(position);
|
||||
if (activity != null) {
|
||||
activity.showHeadWearPrice((HeadWearInfo) adapter.getData().get(position));
|
||||
}
|
||||
});
|
||||
|
||||
shopAdapter.setOnLoadMoreListener(() -> loadData(true, false));
|
||||
mBinding.swipeRefresh.setOnRefreshListener(() -> loadData(false, false));
|
||||
|
||||
mBinding.recyclerView.setAdapter(shopAdapter);
|
||||
mBinding.recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3));
|
||||
int heightSpace = Utils.dip2px(mContext, 10);
|
||||
mBinding.recyclerView.addItemDecoration(new SpacingDecoration(heightSpace, heightSpace, true));
|
||||
|
||||
loadData(false, getArguments().getInt(Constants.KEY_POSITION) == 0);
|
||||
}
|
||||
|
||||
private boolean isLoading = false;
|
||||
|
||||
private void loadData(boolean isLode, boolean isFirst) {
|
||||
if (isLoading) {
|
||||
return;
|
||||
}
|
||||
isLoading = true;
|
||||
headWearVm.loadData(isLode).compose(bindToLifecycle())
|
||||
.doAfterSuccess(headWearInfos -> {
|
||||
setUserVisibleHint(isFirst);
|
||||
})
|
||||
.subscribe(new DontWarnObserver<List<HeadWearInfo>>() {
|
||||
@Override
|
||||
public void accept(List<HeadWearInfo> headWearInfos, String error) {
|
||||
super.accept(headWearInfos, error);
|
||||
isLoading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -70,10 +70,6 @@ public class MyCarFragment extends BaseBindingFragment<FrgMyDecorationCommonBind
|
||||
mCarGarageAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
|
||||
switch (view.getId()) {
|
||||
case R.id.tv_buy:
|
||||
mCarView.showDetail(mCarGarageAdapter.getItem(position));
|
||||
break;
|
||||
|
||||
case R.id.tv_used:
|
||||
startDriving(mCarGarageAdapter.getItem(position));
|
||||
break;
|
||||
|
@@ -51,14 +51,9 @@ public class MyHeadWearFragment extends BaseBindingFragment<FrgMyDecorationCommo
|
||||
shopAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
|
||||
switch (view.getId()) {
|
||||
case R.id.tv_buy:
|
||||
showSureDialog(position);
|
||||
break;
|
||||
|
||||
case R.id.tv_used:
|
||||
setUsedStatus(position);
|
||||
break;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -0,0 +1,62 @@
|
||||
package com.yizhuan.erban.decoration.viewmodel
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.yizhuan.erban.base.BaseViewModel
|
||||
import com.yizhuan.xchat_android_core.bean.response.ListResult
|
||||
import com.yizhuan.xchat_android_core.decoration.DecorationInfo
|
||||
import com.yizhuan.xchat_android_core.decoration.DecorationModel
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
|
||||
import com.yizhuan.xchat_android_core.home.model.HomeModel
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
|
||||
class DecorationViewModel : BaseViewModel() {
|
||||
|
||||
private val BANNER_TYPE = "3"
|
||||
|
||||
private val _bannerLiveData = MutableLiveData<List<BannerInfo>>()
|
||||
val bannerLiveData: LiveData<List<BannerInfo>> = _bannerLiveData
|
||||
|
||||
private val _decorationInfoListLiveData = MutableLiveData<ListResult<DecorationInfo>>()
|
||||
val decorationInfoListLiveData: LiveData<ListResult<DecorationInfo>> =
|
||||
_decorationInfoListLiveData
|
||||
|
||||
init {
|
||||
getBannerInfo()
|
||||
}
|
||||
|
||||
fun getBannerInfo() {
|
||||
safeLaunch(
|
||||
block = {
|
||||
_bannerLiveData.value = HomeModel.getHomeBanner(BANNER_TYPE)
|
||||
},
|
||||
onError = {
|
||||
_bannerLiveData.value = null
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun getDecorationInfoList(dressType: Int) {
|
||||
safeLaunch(
|
||||
block = {
|
||||
_decorationInfoListLiveData.value =
|
||||
ListResult.success(DecorationModel.getDecorationInfoList(dressType), 1)
|
||||
},
|
||||
onError = {
|
||||
_decorationInfoListLiveData.value = ListResult.failed(1)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun buyDecoration(dressType: Int, dressId: Int) {
|
||||
safeLaunch(
|
||||
true,
|
||||
block = {
|
||||
DecorationModel.buyDecoration(dressType, dressId)
|
||||
"购买成功".toast()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -18,6 +18,7 @@ public abstract class AbstractSelectFriendAction<T> {
|
||||
public static final int TYPE_SHARE = 4;
|
||||
public static final int ROOM_MSG = 5;
|
||||
public static final int TYPE_CP = 7;
|
||||
public static final int TYPE_SEND_DECORATION = 8;
|
||||
/**
|
||||
* 世界动态
|
||||
*/
|
||||
@@ -25,7 +26,7 @@ public abstract class AbstractSelectFriendAction<T> {
|
||||
/**
|
||||
* 模厅的搜索
|
||||
*/
|
||||
public static final int TYPE_MODULE_HALL = 5;
|
||||
public static final int TYPE_MODULE_HALL = 9;
|
||||
|
||||
protected Context context;
|
||||
protected DialogManager dialogManager;
|
||||
|
@@ -46,7 +46,6 @@ import com.yizhuan.erban.ui.withdraw.BinderAlipayActivity;
|
||||
import com.yizhuan.erban.vip.VipMainActivity;
|
||||
import com.yizhuan.tutu.mentoring_relationship.activity.MentoringRelationshipActivity;
|
||||
import com.yizhuan.xchat_android_core.DemoCache;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.community.event.SquareTaskEvent;
|
||||
import com.yizhuan.xchat_android_core.home.event.VisitorUnreadCountEvent;
|
||||
@@ -71,7 +70,6 @@ import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 08/06/2018.
|
||||
@@ -107,21 +105,21 @@ public class RouterHandler {
|
||||
break;
|
||||
case RouterType.CAR:
|
||||
if (JavaUtil.str2int(routerValue) == 0) {
|
||||
DecorationStoreActivity.start(context, AuthModel.get().getCurrentUid(), DecorationStoreActivity.TAB_CAR);
|
||||
DecorationStoreActivity.start(context, DecorationStoreActivity.TAB_CAR);
|
||||
} else {
|
||||
MyDecorationActivity.start(context, 1);
|
||||
}
|
||||
break;
|
||||
case RouterType.DECORATION:
|
||||
if (JavaUtil.str2int(routerValue) == 0) {
|
||||
DecorationStoreActivity.start(context, AuthModel.get().getCurrentUid());
|
||||
DecorationStoreActivity.start(context,0);
|
||||
} else {
|
||||
MyDecorationActivity.start(context, 0);
|
||||
}
|
||||
break;
|
||||
case RouterType.NAMEPLATE:
|
||||
if (JavaUtil.str2int(routerValue) == 0) {
|
||||
DecorationStoreActivity.start(context, AuthModel.get().getCurrentUid(), DecorationStoreActivity.TAB_NAMEPLATE);
|
||||
DecorationStoreActivity.start(context, DecorationStoreActivity.TAB_NAMEPLATE);
|
||||
} else {
|
||||
MyDecorationActivity.start(context, 2);
|
||||
}
|
||||
@@ -352,7 +350,7 @@ public class RouterHandler {
|
||||
if (intRouterValue < 0 || intRouterValue > 4) {
|
||||
intRouterValue = 0;
|
||||
}
|
||||
DecorationStoreActivity.start(context, AuthModel.get().getCurrentUid(), intRouterValue);
|
||||
DecorationStoreActivity.start(context, intRouterValue);
|
||||
break;
|
||||
case RouterType.MY_DECORATION:
|
||||
if (intRouterValue < 0 || intRouterValue > 4) {
|
||||
|
@@ -19,6 +19,6 @@ public class DecorationAction extends BaseAction {
|
||||
|
||||
@Override
|
||||
public void onClick() {
|
||||
DecorationStoreActivity.start(getActivity(), JavaUtil.str2long(getAccount()));
|
||||
DecorationStoreActivity.start(getActivity(), JavaUtil.str2int(getAccount()));
|
||||
}
|
||||
}
|
||||
|
@@ -34,22 +34,17 @@ public class FriendListAdapter extends BaseQuickAdapter<UserInfo, BaseViewHolder
|
||||
|
||||
private Activity context;
|
||||
private int type = AbstractSelectFriendAction.TYPE_NORMAL;
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public FriendListAdapter(Activity context) {
|
||||
super(R.layout.list_item_friend_new);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void sendListener(UserInfo attentionInfo);
|
||||
}
|
||||
|
||||
public void setRylListener(OnItemClickListener onClickListener) {
|
||||
onItemClickListener = onClickListener;
|
||||
}
|
||||
@@ -69,7 +64,8 @@ public class FriendListAdapter extends BaseQuickAdapter<UserInfo, BaseViewHolder
|
||||
nobleAvatarView.setData(item.getAvatar(), item.getNobleUsers());
|
||||
nobleAvatarView.setOnClickListener(v -> {
|
||||
if (type == AbstractSelectFriendAction.TYPE_NORMAL
|
||||
|| type == AbstractSelectFriendAction.TYPE_CP) {
|
||||
|| type == AbstractSelectFriendAction.TYPE_CP
|
||||
|| type == AbstractSelectFriendAction.TYPE_SEND_DECORATION) {
|
||||
UserInfoActivity.Companion.start(context, item.getUid());
|
||||
}
|
||||
});
|
||||
@@ -131,6 +127,7 @@ public class FriendListAdapter extends BaseQuickAdapter<UserInfo, BaseViewHolder
|
||||
NimRoomP2PMessageActivity.start(context, String.valueOf(item.getUid()));
|
||||
break;
|
||||
case AbstractSelectFriendAction.TYPE_CP:
|
||||
case AbstractSelectFriendAction.TYPE_SEND_DECORATION:
|
||||
UserInfoActivity.Companion.start(context, item.getUid());
|
||||
break;
|
||||
}
|
||||
@@ -140,6 +137,7 @@ public class FriendListAdapter extends BaseQuickAdapter<UserInfo, BaseViewHolder
|
||||
switch (type) {
|
||||
case AbstractSelectFriendAction.TYPE_CAR:
|
||||
case AbstractSelectFriendAction.TYPE_WEAR:
|
||||
case AbstractSelectFriendAction.TYPE_SEND_DECORATION:
|
||||
helper.getView(R.id.tv_send).setVisibility(View.VISIBLE);
|
||||
helper.getView(R.id.tv_send).setOnClickListener(v -> {
|
||||
if (onItemClickListener != null) {
|
||||
@@ -172,4 +170,8 @@ public class FriendListAdapter extends BaseQuickAdapter<UserInfo, BaseViewHolder
|
||||
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void sendListener(UserInfo attentionInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseFragment;
|
||||
import com.yizhuan.erban.common.NoDataFragment;
|
||||
import com.yizhuan.erban.decoration.helper.DecorationHelper;
|
||||
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
||||
import com.yizhuan.erban.friend.view.SelectFriendActivity;
|
||||
import com.yizhuan.xchat_android_core.im.friend.IMFriendModel;
|
||||
@@ -115,6 +116,13 @@ public class FriendListFragment extends BaseFragment {
|
||||
inviteCp(attentionInfo);
|
||||
});
|
||||
break;
|
||||
case AbstractSelectFriendAction.TYPE_SEND_DECORATION:
|
||||
adapter.setRylListener(attentionInfo ->
|
||||
DecorationHelper.showBuyDialog(mContext,
|
||||
getDialogManager(),
|
||||
attentionInfo.getNick(),
|
||||
attentionInfo.getUid()));
|
||||
break;
|
||||
default:
|
||||
adapter.setRylListener((attentionInfo) -> {
|
||||
if (selectFriendActivity != null && attentionInfo != null) {
|
||||
|
@@ -27,6 +27,7 @@ class FansListActivity : BaseActivity() {
|
||||
const val TYPE_ATTENTION = "attention"
|
||||
const val TYPE_FRIEND = "Friend"
|
||||
const val TYPE_CP = "relation_cp"
|
||||
const val TYPE_DECORATION = "type_decoration"
|
||||
|
||||
@JvmStatic
|
||||
fun start(context: Context, type: String) {
|
||||
@@ -40,7 +41,8 @@ class FansListActivity : BaseActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_fans)
|
||||
when (intent.getStringExtra(KEY_TYPE) ?: "") {
|
||||
val type = intent.getStringExtra(KEY_TYPE) ?: ""
|
||||
when (type) {
|
||||
TYPE_ATTENTION -> {
|
||||
initWhiteTitleBar(getString(R.string.my_attention))
|
||||
commitF(AttentionFragment.newInstance(Constants.FAN_NO_MAIN_PAGE_TYPE))
|
||||
@@ -51,24 +53,29 @@ class FansListActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
|
||||
TYPE_CP -> {
|
||||
TYPE_CP, TYPE_DECORATION -> {
|
||||
val searchType = if (TYPE_CP == type) {
|
||||
AbstractSelectFriendAction.TYPE_CP
|
||||
} else {
|
||||
AbstractSelectFriendAction.TYPE_SEND_DECORATION
|
||||
}
|
||||
initWhiteTitleBar(getString(R.string.title_select_friend))
|
||||
findViewById<ViewGroup>(R.id.layout_search)?.apply {
|
||||
visibility = View.VISIBLE
|
||||
setOnClickListener {
|
||||
SearchActivity.start(
|
||||
this@FansListActivity,
|
||||
AbstractSelectFriendAction.TYPE_CP
|
||||
searchType
|
||||
)
|
||||
}
|
||||
findViewById<TextView>(R.id.search_edit).setOnClickListener {
|
||||
SearchActivity.start(
|
||||
this@FansListActivity,
|
||||
AbstractSelectFriendAction.TYPE_CP
|
||||
searchType
|
||||
)
|
||||
}
|
||||
}
|
||||
commitF(FriendListFragment.newInstance(false, AbstractSelectFriendAction.TYPE_CP))
|
||||
commitF(FriendListFragment.newInstance(false, searchType))
|
||||
}
|
||||
else -> {
|
||||
initWhiteTitleBar(getString(R.string.fan))
|
||||
|
@@ -81,33 +81,27 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
*/
|
||||
@CreatePresenter(SearchPresenter.class)
|
||||
public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter> implements ISearchView, View.OnClickListener, ContactsIndicatorAdapter.OnItemSelectListener {
|
||||
public static final int CODE_REQUEST_TO_SEARCH = 200;
|
||||
private static final String MARK = "isCar";
|
||||
private static final String CAR_INFO = "carInfo";
|
||||
private static final String WEAR_INFO = "wearInfo";
|
||||
private static final String SHOW_HISTORY = "show_history";
|
||||
|
||||
public static final int CODE_REQUEST_TO_SEARCH = 200;
|
||||
protected EditText searchEdit;
|
||||
protected int type = AbstractSelectFriendAction.TYPE_NORMAL;
|
||||
private ImageView ivBack;
|
||||
private TextView tvSearch;
|
||||
private ImageView ivClearText;
|
||||
|
||||
private View clSearchHistoryContainer;
|
||||
private RecyclerView rvSearchHistory;
|
||||
private View flClearSearchHistory;
|
||||
|
||||
private View clRoomHistoryContainer;
|
||||
private RecyclerView rvRoomHistory;
|
||||
private View flClearRoomHistory;
|
||||
|
||||
private MagicIndicator indicator;
|
||||
private ViewPager viewPager;
|
||||
|
||||
private LinearLayout llSearchDetail;
|
||||
|
||||
private CarInfo carInfo;
|
||||
private HeadWearInfo wearInfo;
|
||||
protected int type = AbstractSelectFriendAction.TYPE_NORMAL;
|
||||
private int secondOperator = -1;
|
||||
private boolean mShowHistory = false;
|
||||
|
||||
@@ -117,6 +111,26 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
|
||||
private SearchDetailFragment roomFrg;
|
||||
private SearchDetailFragment userFrg;
|
||||
private TextWatcher textWatcher = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (s.length() <= 0) {
|
||||
ivClearText.setVisibility(View.GONE);
|
||||
showHistory();
|
||||
} else {
|
||||
ivClearText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static void start(Context context, CarInfo carInfo) {
|
||||
Intent intent = new Intent(context, SearchActivity.class);
|
||||
@@ -183,6 +197,7 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
wearInfo = (HeadWearInfo) getIntent().getSerializableExtra(WEAR_INFO);
|
||||
break;
|
||||
case AbstractSelectFriendAction.TYPE_CP:
|
||||
case AbstractSelectFriendAction.TYPE_SEND_DECORATION:
|
||||
indicator.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
@@ -229,7 +244,8 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
|
||||
if (mShowHistory) {
|
||||
showSearchHistory();
|
||||
if (type != AbstractSelectFriendAction.TYPE_CP) {
|
||||
if (type != AbstractSelectFriendAction.TYPE_CP &&
|
||||
type != AbstractSelectFriendAction.TYPE_SEND_DECORATION) {
|
||||
showRoomHistory();
|
||||
}
|
||||
}
|
||||
@@ -239,8 +255,8 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
|
||||
List<Fragment> mTabs = new ArrayList<>();
|
||||
//CP
|
||||
if (type == AbstractSelectFriendAction.TYPE_CP) {
|
||||
userFrg = SearchDetailFragment.newInstance(SearchDetailFragment.TYPE_SEARCH_USER, AbstractSelectFriendAction.TYPE_CP);
|
||||
if (type == AbstractSelectFriendAction.TYPE_CP || type == AbstractSelectFriendAction.TYPE_SEND_DECORATION) {
|
||||
userFrg = SearchDetailFragment.newInstance(SearchDetailFragment.TYPE_SEARCH_USER, type);
|
||||
mTabs.add(userFrg);
|
||||
viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), mTabs, null));
|
||||
return;
|
||||
@@ -268,7 +284,6 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
ViewPagerHelper.bind(indicator, viewPager);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemSelect(int position) {
|
||||
viewPager.setCurrentItem(position);
|
||||
@@ -356,28 +371,6 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
getMvpPresenter().getInRoomRecord();
|
||||
}
|
||||
|
||||
private TextWatcher textWatcher = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (s.length() <= 0) {
|
||||
ivClearText.setVisibility(View.GONE);
|
||||
showHistory();
|
||||
} else {
|
||||
ivClearText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
public void update(List<SearchRoomInfo> homeRooms) {
|
||||
|
||||
@@ -477,7 +470,9 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
}
|
||||
|
||||
private void starSearch(String str) {
|
||||
if (userFrg == null || roomFrg == null && type != AbstractSelectFriendAction.TYPE_CP) {
|
||||
if (userFrg == null || roomFrg == null &&
|
||||
type != AbstractSelectFriendAction.TYPE_CP &&
|
||||
type != AbstractSelectFriendAction.TYPE_SEND_DECORATION) {
|
||||
initSearchDetail();
|
||||
}
|
||||
if (roomFrg != null) {
|
||||
@@ -580,7 +575,7 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
} else {
|
||||
SingleToastUtil.showToast("分享成功");
|
||||
DynamicModel.get().reportShare(dynamicImMsg.getPublishUid(),
|
||||
dynamicImMsg.getWorldId(), dynamicImMsg.getDynamicId())
|
||||
dynamicImMsg.getWorldId(), dynamicImMsg.getDynamicId())
|
||||
.subscribe();
|
||||
}
|
||||
}
|
||||
|
@@ -87,6 +87,11 @@ public class SearchAdapter extends BaseQuickAdapter<SearchRoomInfo, SearchAdapte
|
||||
holder.stvOp.setEnabled(cpState != 1 && cpState != 2);
|
||||
holder.addOnClickListener(R.id.stv_op);
|
||||
holder.stvOp.setBackground(context.getResources().getDrawable(R.drawable.bg_button_relation_invite));
|
||||
}
|
||||
else if (fromType == AbstractSelectFriendAction.TYPE_SEND_DECORATION) {
|
||||
holder.stvOp.setVisibility(View.VISIBLE);
|
||||
holder.stvOp.setText("赠送");
|
||||
holder.addOnClickListener(R.id.stv_op);
|
||||
} else {
|
||||
holder.stvOp.setVisibility(View.GONE);
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.widget.MessageView;
|
||||
import com.yizhuan.erban.base.BaseMvpFragment;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.decoration.helper.DecorationHelper;
|
||||
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
||||
import com.yizhuan.erban.friend.view.SelectFriendActivity;
|
||||
import com.yizhuan.erban.module_hall.HallDataManager;
|
||||
@@ -29,10 +30,12 @@ import com.yizhuan.xchat_android_core.bean.RoomHistoryInfo;
|
||||
import com.yizhuan.xchat_android_core.community.dynamic.DynamicModel;
|
||||
import com.yizhuan.xchat_android_core.community.im.DynamicImMsg;
|
||||
import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment;
|
||||
import com.yizhuan.xchat_android_core.decoration.DecorationInfoEvent;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
|
||||
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.DirectoryHelper;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
@@ -40,6 +43,8 @@ import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@@ -128,6 +133,12 @@ public class SearchDetailFragment extends BaseMvpFragment<ISearchView, SearchPre
|
||||
cpDelegate = new FriendFragmentCpDelegate(this);
|
||||
}
|
||||
cpDelegate.inviteCp(targetUid);
|
||||
}
|
||||
if (fromType == AbstractSelectFriendAction.TYPE_SEND_DECORATION) {
|
||||
DecorationHelper.showBuyDialog(mContext,
|
||||
getDialogManager(),
|
||||
item.getNick(),
|
||||
item.getUid());
|
||||
} else {
|
||||
showSureDialog(item.getUid() + "", item.getAvatar(), item.getNick());
|
||||
}
|
||||
|
@@ -156,12 +156,12 @@ public class UserInfoCarFragment extends BaseBindingFragment<LayoutUserCarStoreB
|
||||
if (carInfo.getStatus() == CarInfo.STATUS_OFF_SHELF) {
|
||||
toast(R.string.car_user_info_off_shelf);
|
||||
} else {
|
||||
DecorationStoreActivity.start(mContext, userId, DecorationStoreActivity.TAB_CAR);
|
||||
DecorationStoreActivity.start(mContext, DecorationStoreActivity.TAB_CAR);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (userInfoItem.getItemType() == UserInfoItem.TYPE_CAR_BUTTON) {
|
||||
DecorationStoreActivity.start(mContext, userId, DecorationStoreActivity.TAB_CAR);
|
||||
DecorationStoreActivity.start(mContext, DecorationStoreActivity.TAB_CAR);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -346,7 +346,7 @@ public class JSInterface {
|
||||
@JavascriptInterface
|
||||
public void openDecorateMallPage(int type) {
|
||||
if (type <= 0) return;
|
||||
DecorationStoreActivity.start(context, AuthModel.get().getCurrentUid(), type - 1);
|
||||
DecorationStoreActivity.start(context, type - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/ic_decoration_diamond.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_decoration_diamond.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1010 B |
10
app/src/main/res/drawable/shape_decoration_item_top.xml
Normal file
10
app/src/main/res/drawable/shape_decoration_item_top.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#ffeae5fc" />
|
||||
<corners
|
||||
android:bottomLeftRadius="0dp"
|
||||
android:bottomRightRadius="0dp"
|
||||
android:topLeftRadius="10dp"
|
||||
android:topRightRadius="10dp" />
|
||||
</shape>
|
10
app/src/main/res/drawable/shape_decoration_limit.xml
Normal file
10
app/src/main/res/drawable/shape_decoration_limit.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#fffb486a" />
|
||||
<corners
|
||||
android:bottomLeftRadius="10dp"
|
||||
android:bottomRightRadius="0dp"
|
||||
android:topLeftRadius="0dp"
|
||||
android:topRightRadius="10dp" />
|
||||
</shape>
|
8
app/src/main/res/drawable/shape_white_10dp_round.xml
Normal file
8
app/src/main/res/drawable/shape_white_10dp_round.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#FFFFFF" />
|
||||
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
@@ -1,296 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg_normal_1c1b22">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="android.view.View.OnClickListener" />
|
||||
|
||||
<variable
|
||||
name="position"
|
||||
type="Integer" />
|
||||
|
||||
<variable
|
||||
name="isSelf"
|
||||
type="Boolean"/>
|
||||
<import type="android.view.View" />
|
||||
</data>
|
||||
<com.yizhuan.erban.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_30" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_roll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/title_bar"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
<com.yizhuan.erban.ui.widget.rollviewpager.RollPagerView
|
||||
android:id="@+id/roll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="202dp"
|
||||
android:background="@drawable/bg_decoration_store">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:onClick="@{click}"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/icon_user_back" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:gravity="center"
|
||||
android:text="头饰座驾"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:id="@+id/tv_edit_container"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_alignParentEnd="true"-->
|
||||
<!--android:layout_marginRight="@dimen/dp_15"-->
|
||||
<!--android:layout_marginTop="@dimen/dp_20"-->
|
||||
<!--android:gravity="center_vertical"-->
|
||||
<!--android:orientation="horizontal">-->
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/tv_red_tip"-->
|
||||
<!--android:layout_width="8dp"-->
|
||||
<!--android:layout_height="8dp"-->
|
||||
<!--android:background="@drawable/shape_circle_red_small"-->
|
||||
<!--android:visibility="visible"-->
|
||||
<!--android:layout_marginEnd="@dimen/dp_5"/>-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/tv_edit"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="48dp"-->
|
||||
<!--android:layout_alignParentEnd="true"-->
|
||||
<!--android:gravity="center"-->
|
||||
<!--android:onClick="@{click}"-->
|
||||
<!--android:text="我的装扮"-->
|
||||
<!--android:textColor="@color/white"-->
|
||||
<!--android:textSize="14dp" />-->
|
||||
|
||||
<!--</LinearLayout>-->
|
||||
<FrameLayout
|
||||
android:id="@+id/tv_edit_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click}"
|
||||
android:text="我的装扮"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_red_tip"
|
||||
android:layout_width="6dp"
|
||||
android:layout_height="6dp"
|
||||
android:background="@drawable/shape_circle_red_small"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_gravity="end"
|
||||
android:visibility="visible"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="88dp"
|
||||
android:layout_below="@id/tv_edit_container"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="67dp"
|
||||
android:layout_height="67dp"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_head_wear"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitXY" />
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/bg_view_half_radiu" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator
|
||||
android:id="@+id/tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:background="@color/white"/>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_buy_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="59dp"
|
||||
android:background="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/dp_10"
|
||||
android:paddingRight="@dimen/dp_10">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/ll_limit_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_limit_desc"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="15sp"
|
||||
tools:text="七夕专属"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_go_web"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="33dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/bg_go_web"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:text="获取方式"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="14sp"
|
||||
tools:text="3000钻石/30000萝卜(7天)"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_original_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="11sp"
|
||||
tools:text="3000钻石/30000萝卜(7天)"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_go_send"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="33dp"
|
||||
android:background="@drawable/bg_left_button_buy"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click}"
|
||||
android:text="赠送"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="14sp"
|
||||
android:visibility="@{isSelf?View.VISIBLE:View.GONE}"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_buy"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="33dp"
|
||||
android:background="@drawable/bg_button_buy"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click}"
|
||||
android:text="购买"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="14sp"
|
||||
android:visibility="@{isSelf?View.VISIBLE:View.GONE}"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_send"
|
||||
android:layout_width="77dp"
|
||||
android:layout_height="33dp"
|
||||
android:background="@drawable/bg_go_web"
|
||||
android:gravity="center"
|
||||
android:text="赠送"
|
||||
android:onClick="@{click}"
|
||||
android:visibility="@{isSelf?View.GONE:View.VISIBLE}"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_car_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#CE000000"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="346dp"
|
||||
android:layout_height="375dp"
|
||||
android:layout_above="@+id/tv_buy_cancel"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="#0CFFFFFF"
|
||||
android:layout_marginBottom="75dp"/>
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_car_play"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/tv_buy_cancel"/>
|
||||
|
||||
<com.tencent.qgame.animplayer.AnimView
|
||||
android:id="@+id/vap_anim_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/tv_buy_cancel"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tv_buy_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon_close_red"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="55dp"/>
|
||||
</RelativeLayout>
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:visibility="gone"
|
||||
app:rollviewpager_hint_gravity="left"
|
||||
app:rollviewpager_hint_paddingBottom="8dp"
|
||||
tools:visibility="visible" />
|
||||
</FrameLayout>
|
||||
</layout>
|
||||
|
||||
|
||||
<com.yizhuan.erban.ui.widget.magicindicator.MagicIndicator
|
||||
android:id="@+id/view_indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_below="@+id/fl_roll_view"
|
||||
android:layout_marginTop="@dimen/dp_10" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/view_indicator" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
21
app/src/main/res/layout/fragment_decoration_common.xml
Normal file
21
app/src/main/res/layout/fragment_decoration_common.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.yizhuan.erban.common.widget.StatusLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/status_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="14dp"
|
||||
android:paddingEnd="14dp" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</com.yizhuan.erban.common.widget.StatusLayout>
|
102
app/src/main/res/layout/item_decoration_common.xml
Normal file
102
app/src/main/res/layout/item_decoration_common.xml
Normal file
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:background="@drawable/shape_white_10dp_round"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_pic_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/shape_decoration_item_top"
|
||||
app:layout_constraintDimensionRatio="166:92"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_pic_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_limit"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="20dp"
|
||||
android:background="@drawable/shape_decoration_limit"
|
||||
android:gravity="center"
|
||||
android:text="限时"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/view_pic_bg"
|
||||
tools:text="公爵贵族聊天气泡(12天)" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:drawableStart="@drawable/ic_decoration_diamond"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#ffffbc51"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_name"
|
||||
tools:text="52000" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_send"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/bg_common_cancel"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="赠送"
|
||||
android:textColor="@color/color_FFA957"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_buy"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_price" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_buy"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:background="@drawable/bg_common_confirm"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="购买"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_send"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_send" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
123
app/src/main/res/layout/item_decoration_user_card.xml
Normal file
123
app/src/main/res/layout/item_decoration_user_card.xml
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:background="@drawable/shape_white_10dp_round"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_pic_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/shape_decoration_item_top"
|
||||
app:layout_constraintDimensionRatio="345:180"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_user_card_wear_mask"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="23dp"
|
||||
android:layout_marginEnd="23dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_user_card_wear_mask"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_pic"
|
||||
app:layout_constraintDimensionRatio="570:220"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_pic"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_pic" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="25dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitXY"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_pic_bg"
|
||||
app:layout_constraintDimensionRatio="660:360"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:src="@drawable/bg_user_card_wear" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_limit"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="20dp"
|
||||
android:background="@drawable/shape_decoration_limit"
|
||||
android:gravity="center"
|
||||
android:text="限时"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/view_pic_bg"
|
||||
tools:text="公爵贵族聊天气泡(12天)" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:drawableStart="@drawable/ic_decoration_diamond"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#ffffbc51"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/tv_name"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:text="52000" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_send"
|
||||
android:layout_width="146dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/bg_common_cancel"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="赠送"
|
||||
android:textColor="@color/color_FFA957"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_buy"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_price" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_buy"
|
||||
android:layout_width="146dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="13dp"
|
||||
android:background="@drawable/bg_common_confirm"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="购买"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_send"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_send" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -0,0 +1,13 @@
|
||||
package com.yizhuan.xchat_android_core.decoration
|
||||
|
||||
data class DecorationInfo(
|
||||
val dressDay: Int = 0,
|
||||
val dressId: Int = 0,
|
||||
val dressPrice: Int = 0,
|
||||
val dressSeq: Int = 0,
|
||||
val dressType: Int = 0,
|
||||
val id: Int = 0,
|
||||
val iosPic: String = "",
|
||||
val name: String = "",
|
||||
val pic: String = "",
|
||||
)
|
@@ -0,0 +1,15 @@
|
||||
package com.yizhuan.xchat_android_core.decoration;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DecorationInfoEvent {
|
||||
private DecorationInfo decorationInfo;
|
||||
|
||||
public DecorationInfoEvent() {
|
||||
}
|
||||
|
||||
public DecorationInfoEvent(DecorationInfo decorationInfo) {
|
||||
this.decorationInfo = decorationInfo;
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
package com.yizhuan.xchat_android_core.decoration
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper
|
||||
import com.yizhuan.xchat_android_core.utils.net.launchRequest
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet
|
||||
import io.reactivex.Single
|
||||
import retrofit2.http.*
|
||||
|
||||
object DecorationModel : BaseModel() {
|
||||
|
||||
private val api = RxNet.create(Api::class.java)
|
||||
|
||||
suspend fun getDecorationInfoList(dressType: Int): List<DecorationInfo>? =
|
||||
launchRequest {
|
||||
api.getDecorationInfoList(dressType)
|
||||
}
|
||||
|
||||
suspend fun buyDecoration(dressType: Int, dressId: Int): String? =
|
||||
launchRequest {
|
||||
api.buyDecoration(dressType, dressId)
|
||||
}
|
||||
|
||||
fun sendDecoration(
|
||||
dressType: Int,
|
||||
dressId: Int,
|
||||
targetUid: Long,
|
||||
): Single<String> {
|
||||
return api.sendDecoration(dressType, dressId, targetUid)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleStringData())
|
||||
}
|
||||
|
||||
|
||||
private interface Api {
|
||||
|
||||
/**
|
||||
* 获取装扮商城列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/dress/shop/list")
|
||||
suspend fun getDecorationInfoList(@Query("dressType") dressType: Int): ServiceResult<List<DecorationInfo>>
|
||||
|
||||
/**
|
||||
* 购买装扮
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dress/shop/buy")
|
||||
suspend fun buyDecoration(
|
||||
@Field("dressType") dressType: Int,
|
||||
@Field("dressId") dressId: Int
|
||||
): ServiceResult<String>
|
||||
|
||||
/**
|
||||
* 赠送装扮
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dress/shop/send")
|
||||
fun sendDecoration(
|
||||
@Field("dressType") dressType: Int,
|
||||
@Field("dressId") dressId: Int,
|
||||
@Field("targetUid") targetUid: Long,
|
||||
): Single<ServiceResult<String>>
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user