更新
BIN
app/src/main/assets/food_mock/banner.jpg
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
app/src/main/assets/food_mock/beef_noodles.jpg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
app/src/main/assets/food_mock/breakfast_curry.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
app/src/main/assets/food_mock/breakfast_pasta.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/assets/food_mock/cold_noodles.jpg
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
app/src/main/assets/food_mock/egg_tart.jpg
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
app/src/main/assets/food_mock/fried_rice.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
app/src/main/assets/food_mock/fruit_drinks.jpg
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
app/src/main/assets/food_mock/meatball.jpg
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
app/src/main/assets/food_mock/mushroom_stew.jpg
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
app/src/main/assets/food_mock/pepper_pork.jpg
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
app/src/main/assets/food_mock/stir_fried_beef.jpg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
app/src/main/assets/food_mock/vegetable_pasta.jpg
Normal file
|
After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1,71 @@
|
||||
package com.ckkj.griddle.coupon.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.coupon.entity.CouponEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/** 两个 Tab 共用券卡,完整重置领取区域,避免条目复用后串显。 */
|
||||
public class CouponAdapter extends BaseQuickAdapter<CouponEntity, BaseViewHolder> {
|
||||
private boolean claimMode;
|
||||
|
||||
public CouponAdapter() {
|
||||
super(R.layout.item_coupon);
|
||||
}
|
||||
|
||||
public void setClaimMode(boolean claimMode) {
|
||||
this.claimMode = claimMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, CouponEntity coupon) {
|
||||
boolean percentage = coupon.type == CouponEntity.Type.PERCENTAGE;
|
||||
String value = percentage
|
||||
? mContext.getString(R.string.coupon_percentage_amount, coupon.discountPercent)
|
||||
: mContext.getString(R.string.checkout_coupon_amount, decimal(coupon.discountCents));
|
||||
String title = percentage
|
||||
? mContext.getString(R.string.coupon_percentage_title, coupon.discountPercent)
|
||||
: mContext.getString(R.string.checkout_coupon_title, decimal(coupon.discountCents));
|
||||
String description;
|
||||
if (percentage) {
|
||||
description = mContext.getString(R.string.coupon_percentage_description,
|
||||
decimal(coupon.maximumDiscountCents), decimal(coupon.minimumSpendCents));
|
||||
} else if (coupon.minimumSpendCents > 0) {
|
||||
description = mContext.getString(R.string.coupon_minimum_description,
|
||||
decimal(coupon.minimumSpendCents));
|
||||
} else {
|
||||
description = mContext.getString(R.string.checkout_coupon_description);
|
||||
}
|
||||
helper.setText(R.id.tv_coupon_manage_amount, value)
|
||||
.setText(R.id.tv_coupon_manage_type, mContext.getString(
|
||||
coupon.type == CouponEntity.Type.NO_THRESHOLD
|
||||
? R.string.checkout_coupon_threshold : R.string.coupon_full_reduction))
|
||||
.setText(R.id.tv_coupon_manage_title, title)
|
||||
.setText(R.id.tv_coupon_manage_description, description)
|
||||
.setText(R.id.tv_coupon_manage_validity,
|
||||
mContext.getString(R.string.checkout_coupon_validity, coupon.validUntil))
|
||||
.addOnClickListener(R.id.tv_coupon_manage_claim);
|
||||
|
||||
TextView claim = helper.getView(R.id.tv_coupon_manage_claim);
|
||||
claim.setVisibility(claimMode ? View.VISIBLE : View.GONE);
|
||||
claim.setEnabled(!coupon.owned);
|
||||
claim.setAlpha(coupon.owned ? 0.5f : 1f);
|
||||
claim.setText(coupon.owned ? R.string.coupon_claimed : R.string.coupon_get_now);
|
||||
View content = helper.getView(R.id.ll_coupon_manage_description);
|
||||
content.setPaddingRelative(content.getPaddingStart(), content.getPaddingTop(),
|
||||
dp(claimMode ? 56 : 8), content.getPaddingBottom());
|
||||
}
|
||||
|
||||
private String decimal(long cents) {
|
||||
return BigDecimal.valueOf(cents, 2).stripTrailingZeros().toPlainString();
|
||||
}
|
||||
|
||||
private int dp(int value) {
|
||||
return Math.round(value * mContext.getResources().getDisplayMetrics().density);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ckkj.griddle.coupon.entity;
|
||||
|
||||
/** 优惠券展示数据:金额使用分,券编号用于区分领取状态。 */
|
||||
public class CouponEntity {
|
||||
public enum Type {
|
||||
NO_THRESHOLD,
|
||||
FULL_REDUCTION,
|
||||
PERCENTAGE
|
||||
}
|
||||
|
||||
public final String id;
|
||||
public final Type type;
|
||||
public final long discountCents;
|
||||
public final int discountPercent;
|
||||
public final long minimumSpendCents;
|
||||
public final long maximumDiscountCents;
|
||||
public final String validUntil;
|
||||
public final boolean owned;
|
||||
|
||||
public CouponEntity(String id, Type type, long discountCents, int discountPercent,
|
||||
long minimumSpendCents, long maximumDiscountCents,
|
||||
String validUntil, boolean owned) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
this.discountCents = discountCents;
|
||||
this.discountPercent = discountPercent;
|
||||
this.minimumSpendCents = minimumSpendCents;
|
||||
this.maximumDiscountCents = maximumDiscountCents;
|
||||
this.validUntil = validUntil;
|
||||
this.owned = owned;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ckkj.griddle.coupon.mvp;
|
||||
|
||||
import com.ckkj.griddle.base.IView;
|
||||
import com.ckkj.griddle.coupon.entity.CouponEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 优惠券列表、Tab 切换和领取的基础协议。 */
|
||||
public class CouponContract {
|
||||
public enum Tab {
|
||||
MY_COUPONS,
|
||||
GET_COUPONS
|
||||
}
|
||||
|
||||
public interface CallBack<T> {
|
||||
void success(T data);
|
||||
void fail(String message);
|
||||
}
|
||||
|
||||
public interface DataModel {
|
||||
void getCoupons(Tab tab, CallBack<List<CouponEntity>> callback);
|
||||
void claimCoupon(String couponId, CallBack<CouponEntity> callback);
|
||||
void restoreClaimedIds(List<String> ids);
|
||||
}
|
||||
|
||||
public interface CouponView extends IView {
|
||||
void showCoupons(List<CouponEntity> coupons);
|
||||
void onCouponClaimed(CouponEntity coupon);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.ckkj.griddle.coupon.mvp;
|
||||
|
||||
import com.ckkj.griddle.MyApplication;
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.coupon.entity.CouponEntity;
|
||||
import com.ckkj.griddle.coupon.entity.CouponEntity.Type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/** 本地优惠券预览数据,后续查询、领取接口统一在此替换。 */
|
||||
public class CouponImpl implements CouponContract.DataModel {
|
||||
private final Set<String> claimedIds = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void getCoupons(CouponContract.Tab tab,
|
||||
CouponContract.CallBack<List<CouponEntity>> callback) {
|
||||
List<CouponEntity> result = new ArrayList<>();
|
||||
if (tab == CouponContract.Tab.MY_COUPONS) {
|
||||
result.addAll(createPreview("owned_", true));
|
||||
}
|
||||
for (CouponEntity coupon : createPreview("available_", false)) {
|
||||
CouponEntity current = withOwned(coupon, claimedIds.contains(coupon.id));
|
||||
if (tab == CouponContract.Tab.GET_COUPONS || current.owned) result.add(current);
|
||||
}
|
||||
callback.success(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void claimCoupon(String couponId, CouponContract.CallBack<CouponEntity> callback) {
|
||||
for (CouponEntity coupon : createPreview("available_", false)) {
|
||||
if (!coupon.id.equals(couponId)) continue;
|
||||
if (claimedIds.contains(couponId)) break;
|
||||
// 仅更新本地预览;接入服务端后应以领取接口成功结果为准。
|
||||
claimedIds.add(couponId);
|
||||
callback.success(withOwned(coupon, true));
|
||||
return;
|
||||
}
|
||||
callback.fail(MyApplication.getContext().getString(R.string.coupon_claim_unavailable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreClaimedIds(List<String> ids) {
|
||||
claimedIds.clear();
|
||||
if (ids != null) claimedIds.addAll(ids);
|
||||
}
|
||||
|
||||
private List<CouponEntity> createPreview(String prefix, boolean owned) {
|
||||
return Arrays.asList(
|
||||
new CouponEntity(prefix + "1", Type.NO_THRESHOLD, 1000, 0,
|
||||
0, 0, "2026-12-31", owned),
|
||||
new CouponEntity(prefix + "2", Type.FULL_REDUCTION, 1000, 0,
|
||||
20000, 0, "2026-12-31", owned),
|
||||
new CouponEntity(prefix + "3", Type.PERCENTAGE, 0, 9,
|
||||
20000, 5000, "2026-12-31", owned));
|
||||
}
|
||||
|
||||
private CouponEntity withOwned(CouponEntity coupon, boolean owned) {
|
||||
return new CouponEntity(coupon.id, coupon.type, coupon.discountCents, coupon.discountPercent,
|
||||
coupon.minimumSpendCents, coupon.maximumDiscountCents, coupon.validUntil, owned);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.ckkj.griddle.coupon.mvp;
|
||||
|
||||
import com.ckkj.griddle.base.BasePresenter;
|
||||
import com.ckkj.griddle.coupon.entity.CouponEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 优惠券协调层,页面不直接处理券源和领取校验。 */
|
||||
public class CouponPresenter extends BasePresenter<CouponContract.CouponView> {
|
||||
private final CouponContract.DataModel impl;
|
||||
|
||||
public CouponPresenter(CouponContract.DataModel impl) {
|
||||
this.impl = impl;
|
||||
}
|
||||
|
||||
public void getCoupons(CouponContract.Tab tab) {
|
||||
impl.getCoupons(tab, new CouponContract.CallBack<List<CouponEntity>>() {
|
||||
@Override
|
||||
public void success(List<CouponEntity> coupons) {
|
||||
if (getView() != null) getView().showCoupons(coupons);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String message) {
|
||||
if (getView() != null) getView().showError(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void claimCoupon(String couponId) {
|
||||
impl.claimCoupon(couponId, new CouponContract.CallBack<CouponEntity>() {
|
||||
@Override
|
||||
public void success(CouponEntity coupon) {
|
||||
if (getView() != null) getView().onCouponClaimed(coupon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String message) {
|
||||
if (getView() != null) getView().showError(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void restoreClaimedIds(List<String> ids) {
|
||||
impl.restoreClaimedIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.ckkj.griddle.shop;
|
||||
package com.ckkj.griddle.food;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
@@ -11,19 +10,18 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.base.BaseActivity;
|
||||
import com.ckkj.griddle.base.BaseFragment;
|
||||
import com.ckkj.griddle.custom.view.CustomRefreshHeader;
|
||||
import com.ckkj.griddle.databinding.AllGoodsLayoutBinding;
|
||||
import com.ckkj.griddle.databinding.AllGoodsFragmentBinding;
|
||||
import com.ckkj.griddle.network.BaseBean;
|
||||
import com.ckkj.griddle.shop.adapter.ShopFoodAdapter;
|
||||
import com.ckkj.griddle.shop.entity.ShopBannerEntity;
|
||||
import com.ckkj.griddle.shop.entity.ShopCategoryEntity;
|
||||
import com.ckkj.griddle.shop.entity.ShopGoodsPageEntity;
|
||||
import com.ckkj.griddle.shop.mvp.ShopContract;
|
||||
import com.ckkj.griddle.shop.mvp.ShopImpl;
|
||||
import com.ckkj.griddle.shop.mvp.ShopPresenter;
|
||||
import com.ckkj.griddle.food.adapter.ShopFoodAdapter;
|
||||
import com.ckkj.griddle.food.entity.ShopBannerEntity;
|
||||
import com.ckkj.griddle.food.entity.ShopCategoryEntity;
|
||||
import com.ckkj.griddle.food.entity.ShopGoodsPageEntity;
|
||||
import com.ckkj.griddle.food.mvp.ShopContract;
|
||||
import com.ckkj.griddle.food.mvp.ShopImpl;
|
||||
import com.ckkj.griddle.food.mvp.ShopPresenter;
|
||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.scwang.smart.refresh.footer.ClassicsFooter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -32,9 +30,9 @@ import java.util.List;
|
||||
import butterknife.OnClick;
|
||||
|
||||
/**
|
||||
* 所有商品:复用商城 MVP,分页请求不包含分类 ID。
|
||||
* 主页面商城 Tab:复用全部商品列表和商城 MVP,保留下拉刷新及分页。
|
||||
*/
|
||||
public class AllGoodsActivity extends BaseActivity<AllGoodsLayoutBinding, ShopPresenter>
|
||||
public class AllGoodsFragment extends BaseFragment<AllGoodsFragmentBinding, ShopPresenter>
|
||||
implements ShopContract.ShopView {
|
||||
|
||||
private static final int PAGE_SIZE = 20;
|
||||
@@ -46,26 +44,20 @@ public class AllGoodsActivity extends BaseActivity<AllGoodsLayoutBinding, ShopPr
|
||||
private boolean loading;
|
||||
private boolean requestSucceeded;
|
||||
private boolean noMoreData;
|
||||
private boolean viewReady;
|
||||
|
||||
@Override
|
||||
public ShopPresenter createPresenter() {
|
||||
return new ShopPresenter(new ShopImpl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutResId(Bundle savedInstanceState) {
|
||||
return R.layout.all_goods_layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData(Bundle savedInstanceState) {
|
||||
super.initData(savedInstanceState);
|
||||
ImmersionBar.with(this)
|
||||
.statusBarColor(R.color.f9f9f9)
|
||||
.statusBarDarkFont(true)
|
||||
.init();
|
||||
viewBinding.includeTitle.tvTitle.setTypeface(
|
||||
viewBinding.includeTitle.tvTitle.getTypeface(), Typeface.BOLD);
|
||||
viewReady = true;
|
||||
loadedPage = 0;
|
||||
requestingPage = 0;
|
||||
loading = false;
|
||||
noMoreData = false;
|
||||
initGoodsList();
|
||||
initRefresh();
|
||||
requestGoods(1);
|
||||
@@ -74,7 +66,7 @@ public class AllGoodsActivity extends BaseActivity<AllGoodsLayoutBinding, ShopPr
|
||||
/** 复用 BaseQuickAdapter 和 Glide,卡片间距由列表统一管理。 */
|
||||
private void initGoodsList() {
|
||||
goodsAdapter = new ShopFoodAdapter(R.layout.all_goods_item);
|
||||
viewBinding.rvAllGoods.setLayoutManager(new GridLayoutManager(this, 2));
|
||||
viewBinding.rvAllGoods.setLayoutManager(new GridLayoutManager(mContext, 2));
|
||||
viewBinding.rvAllGoods.setItemAnimator(null);
|
||||
viewBinding.rvAllGoods.setAdapter(goodsAdapter);
|
||||
final int gap = Math.round(12 * getResources().getDisplayMetrics().density);
|
||||
@@ -123,13 +115,9 @@ public class AllGoodsActivity extends BaseActivity<AllGoodsLayoutBinding, ShopPr
|
||||
mPresenter.getAllShopGoods(page, PAGE_SIZE);
|
||||
}
|
||||
|
||||
@OnClick({R.id.img_back, R.id.tv_all_goods_state})
|
||||
@OnClick({R.id.tv_all_goods_state})
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.img_back:
|
||||
finish();
|
||||
break;
|
||||
|
||||
case R.id.tv_all_goods_state:
|
||||
if (!loading) {
|
||||
requestGoods(1);
|
||||
@@ -143,6 +131,7 @@ public class AllGoodsActivity extends BaseActivity<AllGoodsLayoutBinding, ShopPr
|
||||
|
||||
@Override
|
||||
public void getShopGoodsSuccess(ShopGoodsPageEntity data) {
|
||||
if (!viewReady) return;
|
||||
ShopGoodsPageEntity result = data == null ? new ShopGoodsPageEntity() : data;
|
||||
if (requestingPage == 1) {
|
||||
goodsAdapter.setNewData(new ArrayList<>(result.getRows()));
|
||||
@@ -162,6 +151,7 @@ public class AllGoodsActivity extends BaseActivity<AllGoodsLayoutBinding, ShopPr
|
||||
|
||||
@Override
|
||||
public void onShopRequestFinished(ShopContract.RequestType type) {
|
||||
if (!viewReady) return;
|
||||
if (type != ShopContract.RequestType.GOODS) {
|
||||
return;
|
||||
}
|
||||
@@ -178,11 +168,12 @@ public class AllGoodsActivity extends BaseActivity<AllGoodsLayoutBinding, ShopPr
|
||||
|
||||
@Override
|
||||
public void showError(String message) {
|
||||
if (!viewReady) return;
|
||||
// 加载失败保留已有商品;首屏失败提供点击重试入口。
|
||||
if (goodsAdapter.getData().isEmpty()) {
|
||||
showState(R.string.shop_all_goods_retry);
|
||||
}
|
||||
ToastUtil.showShort(this, TextUtils.isEmpty(message)
|
||||
ToastUtil.showShort(mContext, TextUtils.isEmpty(message)
|
||||
? getString(R.string.shop_all_goods_load_failed) : message);
|
||||
}
|
||||
|
||||
@@ -201,14 +192,20 @@ public class AllGoodsActivity extends BaseActivity<AllGoodsLayoutBinding, ShopPr
|
||||
// 当前页面展示全部商品,不请求分类。
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetChange(int netModel) {
|
||||
// 与美食首页保持一致,网络变化不自动刷新,用户可下拉刷新或点击重试。
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logOut(BaseBean bean) {
|
||||
// 登录失效沿用父类的统一处理。
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
public void onDestroyView() {
|
||||
viewReady = false;
|
||||
viewBinding.rvAllGoods.setAdapter(null);
|
||||
super.onDestroy();
|
||||
super.onDestroyView();
|
||||
}
|
||||
}
|
||||
169
app/src/main/java/com/ckkj/griddle/food/mock/FoodMockData.java
Normal file
@@ -0,0 +1,169 @@
|
||||
package com.ckkj.griddle.food.mock;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.food.entity.ShopBannerEntity;
|
||||
import com.ckkj.griddle.food.entity.ShopCategoryEntity;
|
||||
import com.ckkj.griddle.food.entity.ShopGoodsEntity;
|
||||
import com.ckkj.griddle.food.entity.ShopGoodsPageEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 美食页面临时模拟数据,仅供界面展示,图片来自设计稿并存放在本地。
|
||||
* TODO 接口联调时恢复页面中的 Presenter 调用,删除本类、food_mock_strings 和 assets/food_mock。
|
||||
*/
|
||||
public final class FoodMockData {
|
||||
|
||||
/** 本地资源直接交给现有 Glide 适配器加载,无需网络或修改正式实体。 */
|
||||
private static final String ASSET_PREFIX = "file:///android_asset/food_mock/";
|
||||
|
||||
private static final long CATEGORY_BREAKFAST = 1L;
|
||||
private static final long CATEGORY_MAIN_DISHES = 2L;
|
||||
private static final long CATEGORY_DRINKS = 3L;
|
||||
private static final long CATEGORY_SNACK = 4L;
|
||||
|
||||
/** 前八项对应设计稿的推荐卡片;短标题、长标题混排,便于查看两行省略效果。 */
|
||||
private static final Recipe[] RECIPES = {
|
||||
new Recipe(CATEGORY_MAIN_DISHES, R.string.food_mock_beef_noodles, "beef_noodles"),
|
||||
new Recipe(CATEGORY_MAIN_DISHES, R.string.food_mock_fried_rice, "fried_rice"),
|
||||
new Recipe(CATEGORY_SNACK, R.string.food_mock_egg_tart, "egg_tart"),
|
||||
new Recipe(CATEGORY_MAIN_DISHES, R.string.food_mock_mushroom_stew, "mushroom_stew"),
|
||||
new Recipe(CATEGORY_MAIN_DISHES, R.string.food_mock_meatball, "meatball"),
|
||||
new Recipe(CATEGORY_MAIN_DISHES, R.string.food_mock_pepper_pork, "pepper_pork"),
|
||||
new Recipe(CATEGORY_MAIN_DISHES, R.string.food_mock_cold_noodles, "cold_noodles"),
|
||||
new Recipe(CATEGORY_MAIN_DISHES, R.string.food_mock_stir_fried_beef, "stir_fried_beef"),
|
||||
new Recipe(CATEGORY_BREAKFAST, R.string.food_mock_breakfast_pasta, "breakfast_pasta"),
|
||||
new Recipe(CATEGORY_BREAKFAST, R.string.food_mock_vegetable_pasta, "vegetable_pasta"),
|
||||
new Recipe(CATEGORY_BREAKFAST, R.string.food_mock_breakfast_curry, "breakfast_curry"),
|
||||
new Recipe(CATEGORY_BREAKFAST, R.string.food_mock_breakfast_rice, "fried_rice"),
|
||||
new Recipe(CATEGORY_BREAKFAST, R.string.food_mock_breakfast_tart, "egg_tart"),
|
||||
new Recipe(CATEGORY_BREAKFAST, R.string.food_mock_breakfast_noodles, "cold_noodles"),
|
||||
new Recipe(CATEGORY_DRINKS, R.string.food_mock_orange_drink, "fruit_drinks"),
|
||||
new Recipe(CATEGORY_DRINKS, R.string.food_mock_berry_drink, "fruit_drinks"),
|
||||
new Recipe(CATEGORY_DRINKS, R.string.food_mock_fruit_drink, "fruit_drinks"),
|
||||
new Recipe(CATEGORY_DRINKS, R.string.food_mock_drink_combo, "fruit_drinks"),
|
||||
new Recipe(CATEGORY_SNACK, R.string.food_mock_tart_combo, "egg_tart"),
|
||||
new Recipe(CATEGORY_SNACK, R.string.food_mock_meatball_combo, "meatball"),
|
||||
new Recipe(CATEGORY_SNACK, R.string.food_mock_mushroom_bowl, "mushroom_stew"),
|
||||
new Recipe(CATEGORY_SNACK, R.string.food_mock_pasta_bowl, "vegetable_pasta"),
|
||||
new Recipe(CATEGORY_SNACK, R.string.food_mock_beef_bowl, "stir_fried_beef"),
|
||||
new Recipe(CATEGORY_SNACK, R.string.food_mock_noodle_bowl, "cold_noodles")
|
||||
};
|
||||
|
||||
private FoodMockData() {
|
||||
}
|
||||
|
||||
/** 三张本地轮播图,沿用页面现有自动轮播和指示器逻辑。 */
|
||||
public static List<ShopBannerEntity> getBanners(Context context) {
|
||||
List<ShopBannerEntity> banners = new ArrayList<>();
|
||||
banners.add(createBanner(context, "food_mock_banner_1",
|
||||
R.string.food_mock_banner_promotion, "banner"));
|
||||
banners.add(createBanner(context, "food_mock_banner_2",
|
||||
R.string.food_mock_breakfast_pasta, "breakfast_pasta"));
|
||||
banners.add(createBanner(context, "food_mock_banner_3",
|
||||
R.string.food_mock_beef_noodles, "beef_noodles"));
|
||||
return banners;
|
||||
}
|
||||
|
||||
/** 分类文案读取项目已有的中英文资源,语言切换后重新进入页面即可生效。 */
|
||||
public static List<ShopCategoryEntity> getCategories(Context context) {
|
||||
List<ShopCategoryEntity> categories = new ArrayList<>();
|
||||
categories.add(createCategory(context, CATEGORY_BREAKFAST, R.string.food_category_breakfast));
|
||||
categories.add(createCategory(context, CATEGORY_MAIN_DISHES, R.string.food_category_main_dishes));
|
||||
categories.add(createCategory(context, CATEGORY_DRINKS, R.string.food_category_drinks));
|
||||
categories.add(createCategory(context, CATEGORY_SNACK, R.string.food_category_snack));
|
||||
return categories;
|
||||
}
|
||||
|
||||
/** 分类切换时返回对应美食,每次创建新列表,避免适配器互相影响。 */
|
||||
public static ShopGoodsPageEntity getCategoryGoods(Context context, long categoryId,
|
||||
int page, int pageSize) {
|
||||
List<ShopGoodsEntity> goods = new ArrayList<>();
|
||||
for (int index = 0; index < RECIPES.length; index++) {
|
||||
if (RECIPES[index].categoryId == categoryId) {
|
||||
goods.add(createGoods(context, index));
|
||||
}
|
||||
}
|
||||
return paginate(goods, page, pageSize);
|
||||
}
|
||||
|
||||
/** 首页推荐固定展示设计稿中的八张卡片,不与分类区共用可变列表。 */
|
||||
public static List<ShopGoodsEntity> getRecommendedGoods(Context context) {
|
||||
return getAllGoods(context, 1, 8).getRows();
|
||||
}
|
||||
|
||||
/** 共 24 条美食数据,沿用每页 20 条的规则,支持刷新、加载更多及无更多状态。 */
|
||||
public static ShopGoodsPageEntity getAllGoods(Context context, int page, int pageSize) {
|
||||
List<ShopGoodsEntity> goods = new ArrayList<>();
|
||||
for (int index = 0; index < RECIPES.length; index++) {
|
||||
goods.add(createGoods(context, index));
|
||||
}
|
||||
return paginate(goods, page, pageSize);
|
||||
}
|
||||
|
||||
/** 总数始终为完整数据量,越界页返回空列表,避免反复加载相同数据。 */
|
||||
private static ShopGoodsPageEntity paginate(List<ShopGoodsEntity> goods,
|
||||
int page, int pageSize) {
|
||||
ShopGoodsPageEntity result = new ShopGoodsPageEntity();
|
||||
result.setTotal(goods.size());
|
||||
List<ShopGoodsEntity> rows = new ArrayList<>();
|
||||
if (page > 0 && pageSize > 0) {
|
||||
long start = (long) (page - 1) * pageSize;
|
||||
if (start < goods.size()) {
|
||||
int end = (int) Math.min(start + pageSize, goods.size());
|
||||
rows.addAll(goods.subList((int) start, end));
|
||||
}
|
||||
}
|
||||
result.setRows(rows);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ShopGoodsEntity createGoods(Context context, int index) {
|
||||
Recipe recipe = RECIPES[index];
|
||||
ShopGoodsEntity goods = new ShopGoodsEntity();
|
||||
goods.setId("food_mock_" + (index + 1));
|
||||
goods.setGoodsName(context.getString(recipe.nameRes));
|
||||
goods.setGoodsImg(imagePath(recipe.imageName));
|
||||
return goods;
|
||||
}
|
||||
|
||||
private static ShopBannerEntity createBanner(Context context, String id,
|
||||
@StringRes int nameRes, String imageName) {
|
||||
ShopBannerEntity banner = new ShopBannerEntity();
|
||||
banner.setId(id);
|
||||
banner.setGoodsName(context.getString(nameRes));
|
||||
banner.setGoodsImg(imagePath(imageName));
|
||||
return banner;
|
||||
}
|
||||
|
||||
private static ShopCategoryEntity createCategory(Context context, long id,
|
||||
@StringRes int nameRes) {
|
||||
ShopCategoryEntity category = new ShopCategoryEntity();
|
||||
category.setId(id);
|
||||
category.setCategoryName(context.getString(nameRes));
|
||||
return category;
|
||||
}
|
||||
|
||||
private static String imagePath(String imageName) {
|
||||
return ASSET_PREFIX + imageName + ".jpg";
|
||||
}
|
||||
|
||||
/** 仅保存模拟内容描述,不扩展正式接口实体。 */
|
||||
private static final class Recipe {
|
||||
private final long categoryId;
|
||||
@StringRes
|
||||
private final int nameRes;
|
||||
private final String imageName;
|
||||
|
||||
private Recipe(long categoryId, @StringRes int nameRes, String imageName) {
|
||||
this.categoryId = categoryId;
|
||||
this.nameRes = nameRes;
|
||||
this.imageName = imageName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,330 @@
|
||||
package com.ckkj.griddle.mine.order;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.base.BaseActivity;
|
||||
import com.ckkj.griddle.custom.GridSpacingItemDecoration;
|
||||
import com.ckkj.griddle.databinding.AfterSalesApplyLayoutBinding;
|
||||
import com.ckkj.griddle.fault.adapter.FaultReportImageAdapter;
|
||||
import com.ckkj.griddle.mine.order.adapter.MyOrderGoodsAdapter;
|
||||
import com.ckkj.griddle.mine.order.entity.AfterSalesRequest;
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderDetailEntity;
|
||||
import com.ckkj.griddle.mine.order.mvp.MyOrderContract;
|
||||
import com.ckkj.griddle.mine.order.mvp.MyOrderImpl;
|
||||
import com.ckkj.griddle.mine.order.mvp.MyOrderPresenter;
|
||||
import com.ckkj.griddle.network.BaseBean;
|
||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.OnClick;
|
||||
|
||||
/** 售后申请:按当前订单展示商品,维护独立的类型、原因和凭证草稿。 */
|
||||
public class AfterSalesApplyActivity extends BaseActivity<AfterSalesApplyLayoutBinding, MyOrderPresenter>
|
||||
implements MyOrderContract.MyOrderView {
|
||||
public static final String EXTRA_ORDER_ID = MyOrderDetailActivity.EXTRA_ORDER_ID;
|
||||
private final AfterSalesEvidenceHelper evidenceHelper =
|
||||
new AfterSalesEvidenceHelper(this, this::renderEvidence);
|
||||
private MyOrderDetailEntity detail;
|
||||
private MyOrderGoodsAdapter goodsAdapter;
|
||||
private FaultReportImageAdapter evidenceAdapter;
|
||||
private AfterSalesRequest.Type type = AfterSalesRequest.Type.REFUND_ONLY;
|
||||
private AfterSalesRequest.Reason reason = AfterSalesRequest.Reason.NO_LONGER_NEEDED;
|
||||
private long refundCents;
|
||||
private boolean amountRestored;
|
||||
|
||||
@Override
|
||||
public MyOrderPresenter createPresenter() {
|
||||
return new MyOrderPresenter(new MyOrderImpl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutResId(Bundle savedInstanceState) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData(Bundle savedInstanceState) {
|
||||
super.initData(savedInstanceState);
|
||||
ImmersionBar.with(this).statusBarColor(R.color.white).statusBarDarkFont(true)
|
||||
.keyboardEnable(true).init();
|
||||
initGoods();
|
||||
initEvidence();
|
||||
if (savedInstanceState != null) {
|
||||
int typeIndex = savedInstanceState.getInt("after_sales_type", 0);
|
||||
int reasonIndex = savedInstanceState.getInt("after_sales_reason", 0);
|
||||
if (typeIndex >= 0 && typeIndex < AfterSalesRequest.Type.values().length) {
|
||||
type = AfterSalesRequest.Type.values()[typeIndex];
|
||||
}
|
||||
if (reasonIndex >= 0 && reasonIndex < AfterSalesRequest.Reason.values().length) {
|
||||
reason = AfterSalesRequest.Reason.values()[reasonIndex];
|
||||
}
|
||||
amountRestored = savedInstanceState.containsKey("after_sales_amount");
|
||||
refundCents = savedInstanceState.getLong("after_sales_amount");
|
||||
viewBinding.etAfterSalesDescription.setText(
|
||||
savedInstanceState.getString("after_sales_description", ""));
|
||||
}
|
||||
evidenceHelper.restore(savedInstanceState);
|
||||
renderSelections();
|
||||
mPresenter.getOrderDetail(getIntent().getStringExtra(EXTRA_ORDER_ID));
|
||||
}
|
||||
|
||||
private void initGoods() {
|
||||
goodsAdapter = new MyOrderGoodsAdapter();
|
||||
viewBinding.rvAfterSalesGoods.setLayoutManager(new LinearLayoutManager(this) {
|
||||
@Override
|
||||
public boolean canScrollVertically() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
viewBinding.rvAfterSalesGoods.setAdapter(goodsAdapter);
|
||||
viewBinding.rvAfterSalesGoods.setItemAnimator(null);
|
||||
final int spacing = Math.round(16 * getResources().getDisplayMetrics().density);
|
||||
viewBinding.rvAfterSalesGoods.addItemDecoration(new RecyclerView.ItemDecoration() {
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
|
||||
@NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
outRect.set(0, parent.getChildAdapterPosition(view) > 0 ? spacing : 0, 0, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initEvidence() {
|
||||
evidenceAdapter = new FaultReportImageAdapter();
|
||||
viewBinding.rvAfterSalesEvidence.setLayoutManager(new GridLayoutManager(this, 3));
|
||||
viewBinding.rvAfterSalesEvidence.setItemAnimator(null);
|
||||
viewBinding.rvAfterSalesEvidence.addItemDecoration(new GridSpacingItemDecoration(3,
|
||||
Math.round(6 * getResources().getDisplayMetrics().density), false));
|
||||
viewBinding.rvAfterSalesEvidence.setAdapter(evidenceAdapter);
|
||||
evidenceAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
switch (view.getId()) {
|
||||
case R.id.ll_fault_report_placeholder:
|
||||
evidenceHelper.showSource();
|
||||
break;
|
||||
case R.id.iv_fault_report_delete:
|
||||
evidenceHelper.remove(position);
|
||||
break;
|
||||
case R.id.iv_fault_report_image:
|
||||
evidenceHelper.preview(position);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showOrderDetail(MyOrderDetailEntity data) {
|
||||
if (data == null) {
|
||||
showError(null);
|
||||
return;
|
||||
}
|
||||
detail = data;
|
||||
goodsAdapter.setNewData(new ArrayList<>(data.order.goods));
|
||||
// 上限取商品总额,不受订单优惠展示或用户输入影响。
|
||||
refundCents = amountRestored ? Math.min(data.subtotalCents, Math.max(0, refundCents))
|
||||
: data.subtotalCents;
|
||||
renderAmount();
|
||||
viewBinding.llAfterSalesContent.setVisibility(View.VISIBLE);
|
||||
viewBinding.tvAfterSalesSubmit.setEnabled(true);
|
||||
}
|
||||
|
||||
private void renderSelections() {
|
||||
viewBinding.tvAfterSalesRefundOnly.setSelected(type == AfterSalesRequest.Type.REFUND_ONLY);
|
||||
viewBinding.tvAfterSalesReturnRefund.setSelected(type == AfterSalesRequest.Type.RETURN_REFUND);
|
||||
viewBinding.tvAfterSalesExchange.setSelected(type == AfterSalesRequest.Type.EXCHANGE);
|
||||
viewBinding.tvAfterSalesReasonUnwanted.setSelected(reason == AfterSalesRequest.Reason.NO_LONGER_NEEDED);
|
||||
viewBinding.tvAfterSalesReasonQuality.setSelected(reason == AfterSalesRequest.Reason.QUALITY_PROBLEM);
|
||||
viewBinding.tvAfterSalesReasonDescription.setSelected(reason == AfterSalesRequest.Reason.NOT_AS_DESCRIBED);
|
||||
}
|
||||
|
||||
private void renderAmount() {
|
||||
viewBinding.tvAfterSalesAmount.setText(getString(R.string.my_order_price, decimal(refundCents)));
|
||||
viewBinding.tvAfterSalesMaxAmount.setText(
|
||||
getString(R.string.after_sales_max_amount, decimal(detail.subtotalCents)));
|
||||
}
|
||||
|
||||
private String decimal(long cents) {
|
||||
return BigDecimal.valueOf(cents, 2).toPlainString();
|
||||
}
|
||||
|
||||
private void renderEvidence() {
|
||||
if (evidenceAdapter == null) return;
|
||||
List<String> display = evidenceHelper.getEvidence();
|
||||
if (display.size() < 5) display.add("");
|
||||
evidenceAdapter.setNewData(display);
|
||||
}
|
||||
|
||||
@OnClick({R.id.iv_after_sales_back, R.id.tv_after_sales_refund_only,
|
||||
R.id.tv_after_sales_return_refund, R.id.tv_after_sales_exchange,
|
||||
R.id.tv_after_sales_reason_unwanted, R.id.tv_after_sales_reason_quality,
|
||||
R.id.tv_after_sales_reason_description, R.id.iv_after_sales_edit_amount,
|
||||
R.id.tv_after_sales_submit})
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_after_sales_back:
|
||||
finish();
|
||||
break;
|
||||
case R.id.tv_after_sales_refund_only:
|
||||
type = AfterSalesRequest.Type.REFUND_ONLY;
|
||||
renderSelections();
|
||||
break;
|
||||
case R.id.tv_after_sales_return_refund:
|
||||
type = AfterSalesRequest.Type.RETURN_REFUND;
|
||||
renderSelections();
|
||||
break;
|
||||
case R.id.tv_after_sales_exchange:
|
||||
type = AfterSalesRequest.Type.EXCHANGE;
|
||||
renderSelections();
|
||||
break;
|
||||
case R.id.tv_after_sales_reason_unwanted:
|
||||
reason = AfterSalesRequest.Reason.NO_LONGER_NEEDED;
|
||||
renderSelections();
|
||||
break;
|
||||
case R.id.tv_after_sales_reason_quality:
|
||||
reason = AfterSalesRequest.Reason.QUALITY_PROBLEM;
|
||||
renderSelections();
|
||||
break;
|
||||
case R.id.tv_after_sales_reason_description:
|
||||
reason = AfterSalesRequest.Reason.NOT_AS_DESCRIBED;
|
||||
renderSelections();
|
||||
break;
|
||||
case R.id.iv_after_sales_edit_amount:
|
||||
editRefundAmount();
|
||||
break;
|
||||
case R.id.tv_after_sales_submit:
|
||||
submitApplication();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean validAmount(String value) {
|
||||
if (detail == null) return false;
|
||||
try {
|
||||
long cents = AfterSalesRequest.parseAmountCents(value);
|
||||
return cents > 0 && cents <= detail.subtotalCents;
|
||||
} catch (IllegalArgumentException | ArithmeticException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void editRefundAmount() {
|
||||
if (detail == null || (dialog != null && dialog.isShowing())) return;
|
||||
showEditDialog(getString(R.string.after_sales_edit_amount),
|
||||
getString(R.string.after_sales_amount_hint), true,
|
||||
getString(android.R.string.cancel), getString(android.R.string.ok), new OnDialogClick() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
// 取消编辑不改变原退款金额。
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClisk() { }
|
||||
|
||||
@Override
|
||||
public void onConfirmClisk(String content) {
|
||||
// 确认时再次校验,页面金额始终不超过实际商品总额。
|
||||
if (!validAmount(content)) {
|
||||
showError(getString(R.string.after_sales_amount_invalid));
|
||||
return;
|
||||
}
|
||||
refundCents = AfterSalesRequest.parseAmountCents(content);
|
||||
amountRestored = true;
|
||||
renderAmount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onView1Click() { }
|
||||
});
|
||||
EditText input = dialog.findViewById(R.id.et_input);
|
||||
TextView confirm = dialog.findViewById(R.id.btnRight);
|
||||
if (input == null || confirm == null) return;
|
||||
input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
||||
input.setFilters(new InputFilter[]{new InputFilter.LengthFilter(15)});
|
||||
input.setSingleLine(true);
|
||||
input.setText(decimal(refundCents));
|
||||
input.setSelection(input.length());
|
||||
confirm.setEnabled(validAmount(input.getText().toString()));
|
||||
// 复用父类弹窗;输入监听控制确认按钮,非法输入时弹窗不会提前关闭。
|
||||
input.addTextChangedListener(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) {
|
||||
boolean valid = validAmount(s.toString());
|
||||
confirm.setEnabled(valid);
|
||||
input.setError(valid ? null : getString(R.string.after_sales_amount_invalid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) { }
|
||||
});
|
||||
}
|
||||
|
||||
private void submitApplication() {
|
||||
if (detail == null) return;
|
||||
if (evidenceHelper.isProcessing()) {
|
||||
showError(getString(R.string.fault_report_media_processing));
|
||||
return;
|
||||
}
|
||||
mPresenter.validateAfterSales(new AfterSalesRequest(detail.order.id, type, reason, refundCents,
|
||||
viewBinding.etAfterSalesDescription.getText().toString(), evidenceHelper.getEvidence()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAfterSalesValidated(int errorResId) {
|
||||
// 当前仅完成表单及本地校验,后续用完整草稿接入售后接口。
|
||||
showError(getString(errorResId == 0 ? R.string.after_sales_submit_pending : errorResId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(String message) {
|
||||
ToastUtil.showShort(mContext, TextUtils.isEmpty(message)
|
||||
? getString(R.string.order_detail_failed) : message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logOut(BaseBean bean) {
|
||||
// 登录失效沿用父类统一处理。
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
outState.putInt("after_sales_type", type.ordinal());
|
||||
outState.putInt("after_sales_reason", reason.ordinal());
|
||||
if (detail != null || amountRestored) outState.putLong("after_sales_amount", refundCents);
|
||||
outState.putString("after_sales_description", viewBinding.etAfterSalesDescription.getText().toString());
|
||||
evidenceHelper.save(outState);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
evidenceHelper.destroy();
|
||||
if (dialog != null) dialog.dismiss();
|
||||
viewBinding.rvAfterSalesGoods.setAdapter(null);
|
||||
viewBinding.rvAfterSalesEvidence.setAdapter(null);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ckkj.griddle.mine.order;
|
||||
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.base.BaseActivity;
|
||||
import com.ckkj.griddle.utils.MediaSelectionHelper;
|
||||
|
||||
/** 售后沿用五个凭证及图片、视频选择规则。 */
|
||||
final class AfterSalesEvidenceHelper extends MediaSelectionHelper {
|
||||
AfterSalesEvidenceHelper(BaseActivity<?, ?> activity, Runnable onChanged) {
|
||||
super(activity, onChanged, 5, true, R.string.after_sales_camera_description,
|
||||
R.string.fault_report_image_limit, "after_sales");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
package com.ckkj.griddle.mine.order;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.base.BaseActivity;
|
||||
import com.ckkj.griddle.base.BaseFragment;
|
||||
import com.ckkj.griddle.databinding.MyOrderDetailLayoutBinding;
|
||||
import com.ckkj.griddle.mine.order.adapter.MyOrderGoodsAdapter;
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderDetailEntity;
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderEntity;
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderEntity.Status;
|
||||
import com.ckkj.griddle.mine.order.mvp.MyOrderContract;
|
||||
import com.ckkj.griddle.mine.order.mvp.MyOrderImpl;
|
||||
import com.ckkj.griddle.mine.order.mvp.MyOrderPresenter;
|
||||
import com.ckkj.griddle.network.BaseBean;
|
||||
import com.ckkj.griddle.review.ProductReviewActivity;
|
||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.OnClick;
|
||||
|
||||
/** 线上配送与线下自提共用详情,显示内容由交易类型和订单状态共同决定。 */
|
||||
public class MyOrderDetailActivity extends BaseActivity<MyOrderDetailLayoutBinding, MyOrderPresenter>
|
||||
implements MyOrderContract.MyOrderView {
|
||||
public static final String EXTRA_ORDER_ID = "order_detail_id";
|
||||
private MyOrderDetailEntity detail;
|
||||
private MyOrderGoodsAdapter goodsAdapter;
|
||||
|
||||
@Override
|
||||
public MyOrderPresenter createPresenter() {
|
||||
return new MyOrderPresenter(new MyOrderImpl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutResId(Bundle savedInstanceState) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData(Bundle savedInstanceState) {
|
||||
super.initData(savedInstanceState);
|
||||
ImmersionBar.with(this).statusBarColor(R.color.white).statusBarDarkFont(true).init();
|
||||
goodsAdapter = new MyOrderGoodsAdapter();
|
||||
viewBinding.rvDetailGoods.setLayoutManager(new LinearLayoutManager(this) {
|
||||
@Override
|
||||
public boolean canScrollVertically() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
viewBinding.rvDetailGoods.setItemAnimator(null);
|
||||
viewBinding.rvDetailGoods.setAdapter(goodsAdapter);
|
||||
final int spacing = Math.round(16 * getResources().getDisplayMetrics().density);
|
||||
viewBinding.rvDetailGoods.addItemDecoration(new RecyclerView.ItemDecoration() {
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
|
||||
@NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
outRect.set(0, parent.getChildAdapterPosition(view) > 0 ? spacing : 0, 0, 0);
|
||||
}
|
||||
});
|
||||
mPresenter.getOrderDetail(getIntent().getStringExtra(EXTRA_ORDER_ID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showOrderDetail(MyOrderDetailEntity data) {
|
||||
if (data == null) {
|
||||
showError(null);
|
||||
return;
|
||||
}
|
||||
detail = data;
|
||||
MyOrderEntity order = data.order;
|
||||
boolean online = order.orderType == MyOrderEntity.OrderType.ONLINE_PAYMENT;
|
||||
boolean receipt = order.status == Status.RECEIPT;
|
||||
int statusRes;
|
||||
switch (order.status) {
|
||||
case SHIPMENT:
|
||||
statusRes = R.string.order_detail_wait_ship;
|
||||
break;
|
||||
case RECEIPT:
|
||||
statusRes = R.string.order_detail_wait_receive;
|
||||
break;
|
||||
case REVIEW:
|
||||
statusRes = R.string.order_detail_wait_review;
|
||||
break;
|
||||
default:
|
||||
statusRes = R.string.order_detail_complete;
|
||||
break;
|
||||
}
|
||||
viewBinding.tvDetailStatus.setText(statusRes);
|
||||
viewBinding.tvDetailAutoReceive.setVisibility(receipt ? View.VISIBLE : View.GONE);
|
||||
viewBinding.llDetailTracking.setVisibility(online && receipt
|
||||
&& !TextUtils.isEmpty(data.trackingNumber) ? View.VISIBLE : View.GONE);
|
||||
viewBinding.tvDetailTracking.setText(getString(R.string.order_detail_tracking, data.trackingNumber));
|
||||
bindPickupCode(order);
|
||||
viewBinding.llDetailDelivery.setVisibility(online ? View.VISIBLE : View.GONE);
|
||||
viewBinding.llDetailStore.setVisibility(online ? View.GONE : View.VISIBLE);
|
||||
viewBinding.tvDetailAddress.setText(data.address);
|
||||
viewBinding.tvDetailRecipient.setText(data.recipient + " " + data.phone);
|
||||
viewBinding.tvDetailStore.setText(data.pickupName);
|
||||
viewBinding.tvDetailPhone.setText(data.phone);
|
||||
viewBinding.tvDetailStoreAddress.setText(data.address);
|
||||
Glide.with(this).load(R.mipmap.icon_pickup_store_avatar).circleCrop()
|
||||
.into(viewBinding.ivDetailStore);
|
||||
goodsAdapter.setNewData(new ArrayList<>(order.goods));
|
||||
viewBinding.tvDetailSubtotal.setText(money(data.subtotalCents));
|
||||
viewBinding.tvDetailCoupon.setText(discount(data.couponCents));
|
||||
viewBinding.tvDetailPoints.setText(discount(data.pointsCents));
|
||||
viewBinding.tvDetailPayable.setText(money(data.payableCents));
|
||||
viewBinding.tvDetailNumber.setText(order.id);
|
||||
viewBinding.rowTime.setVisibility(online ? View.VISIBLE : View.GONE);
|
||||
viewBinding.rowReference.setVisibility(online ? View.VISIBLE : View.GONE);
|
||||
viewBinding.tvDetailTime.setText(data.paymentTime);
|
||||
viewBinding.tvDetailReference.setText(data.paymentReference);
|
||||
viewBinding.tvDetailMethod.setText(online ? R.string.order_detail_online : R.string.order_detail_cash);
|
||||
viewBinding.tvDetailOrderStatus.setText(order.status.labelRes);
|
||||
// 两种交易类型使用同一套按钮规则,不从页面类型推断订单状态。
|
||||
viewBinding.tvDetailAction.setVisibility(order.canConfirmReceipt() || order.canReview()
|
||||
? View.VISIBLE : View.GONE);
|
||||
viewBinding.tvDetailAction.setText(order.canConfirmReceipt()
|
||||
? R.string.my_order_confirm_receipt : R.string.my_order_write_review);
|
||||
viewBinding.llDetailContent.setVisibility(View.VISIBLE);
|
||||
viewBinding.llDetailActions.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void bindPickupCode(MyOrderEntity order) {
|
||||
boolean visible = order.status == Status.SHIPMENT && order.hasPickupCode();
|
||||
viewBinding.scrollDetailPickup.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
viewBinding.llDetailDigits.removeAllViews();
|
||||
viewBinding.llDetailDigits.setContentDescription(null);
|
||||
if (!visible) return;
|
||||
viewBinding.llDetailDigits.setContentDescription(
|
||||
getString(R.string.my_order_pickup_accessibility, order.pickupCode));
|
||||
for (int i = 0; i < order.pickupCode.length(); i++) {
|
||||
TextView digit = (TextView) LayoutInflater.from(this)
|
||||
.inflate(R.layout.item_my_order_digit, viewBinding.llDetailDigits, false);
|
||||
digit.setText(String.valueOf(order.pickupCode.charAt(i)));
|
||||
viewBinding.llDetailDigits.addView(digit);
|
||||
}
|
||||
}
|
||||
|
||||
private String money(long cents) {
|
||||
return getString(R.string.my_order_price, decimal(cents));
|
||||
}
|
||||
|
||||
private String discount(long cents) {
|
||||
return getString(R.string.order_detail_discount, decimal(cents));
|
||||
}
|
||||
|
||||
private String decimal(long cents) {
|
||||
// 金额以分计算,避免浮点误差。
|
||||
return BigDecimal.valueOf(cents, 2).toPlainString();
|
||||
}
|
||||
|
||||
@OnClick({R.id.iv_detail_back, R.id.iv_detail_copy, R.id.ll_detail_delivery, R.id.ll_detail_store,
|
||||
R.id.tv_detail_after_sales, R.id.tv_detail_action})
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_detail_back:
|
||||
finish();
|
||||
break;
|
||||
case R.id.iv_detail_copy:
|
||||
copyTrackingNumber();
|
||||
break;
|
||||
case R.id.ll_detail_delivery:
|
||||
case R.id.ll_detail_store:
|
||||
showDeliverySnapshot();
|
||||
break;
|
||||
case R.id.tv_detail_after_sales:
|
||||
openAfterSales();
|
||||
break;
|
||||
case R.id.tv_detail_action:
|
||||
if (detail != null && detail.order.canConfirmReceipt()) {
|
||||
confirmReceipt();
|
||||
} else if (detail != null && detail.order.canReview()) {
|
||||
openReview();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void copyTrackingNumber() {
|
||||
if (detail == null || TextUtils.isEmpty(detail.trackingNumber)) return;
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
if (clipboard == null) return;
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText(getString(R.string.order_detail_copy),
|
||||
detail.trackingNumber));
|
||||
ToastUtil.showShort(mContext, getString(R.string.order_detail_copied));
|
||||
}
|
||||
|
||||
private void showDeliverySnapshot() {
|
||||
if (detail == null || (dialog != null && dialog.isShowing())) return;
|
||||
boolean online = detail.order.orderType == MyOrderEntity.OrderType.ONLINE_PAYMENT;
|
||||
// 详情使用下单快照,仅供查看,不跳转地址管理去更改已支付订单。
|
||||
String content = (online ? detail.recipient : detail.pickupName)
|
||||
+ "\n" + detail.phone + "\n" + detail.address;
|
||||
showDialogtext(null, false, false, true,
|
||||
getString(online ? R.string.order_detail_address_title : R.string.order_detail_pickup_title),
|
||||
content, getString(android.R.string.cancel), getString(android.R.string.ok), null);
|
||||
}
|
||||
|
||||
private void confirmReceipt() {
|
||||
if (dialog != null && dialog.isShowing()) return;
|
||||
showDialogtext(null, false, false, false,
|
||||
getString(R.string.my_order_confirm_receipt),
|
||||
getString(R.string.my_order_confirm_message, detail.order.id),
|
||||
getString(android.R.string.cancel), getString(android.R.string.ok),
|
||||
new BaseFragment.OnDialogClick() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
// 取消时保持订单原有状态。
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick() {
|
||||
// 接口尚未接入,不在本地伪造收货成功。
|
||||
showUnavailable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showUnavailable() {
|
||||
if (detail != null) showError(getString(R.string.my_order_action_unavailable, detail.order.id));
|
||||
}
|
||||
|
||||
private void openAfterSales() {
|
||||
if (detail == null) return;
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(AfterSalesApplyActivity.EXTRA_ORDER_ID, detail.order.id);
|
||||
goTo(mContext, AfterSalesApplyActivity.class, bundle);
|
||||
}
|
||||
|
||||
private void openReview() {
|
||||
if (detail == null) return;
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(ProductReviewActivity.EXTRA_ORDER_ID, detail.order.id);
|
||||
goTo(mContext, ProductReviewActivity.class, bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(String message) {
|
||||
ToastUtil.showShort(mContext, TextUtils.isEmpty(message)
|
||||
? getString(R.string.order_detail_failed) : message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logOut(BaseBean bean) {
|
||||
// 登录失效沿用父类统一处理。
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (dialog != null) dialog.dismiss();
|
||||
viewBinding.rvDetailGoods.setAdapter(null);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.ckkj.griddle.mine.order.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** 售后申请草稿:退款金额以分存储,类型和原因分别单选。 */
|
||||
public class AfterSalesRequest {
|
||||
public enum Type { REFUND_ONLY, RETURN_REFUND, EXCHANGE }
|
||||
public enum Reason { NO_LONGER_NEEDED, QUALITY_PROBLEM, NOT_AS_DESCRIBED }
|
||||
|
||||
public final String orderId;
|
||||
public final Type type;
|
||||
public final Reason reason;
|
||||
public final long refundCents;
|
||||
public final String description;
|
||||
public final List<String> evidence;
|
||||
|
||||
public AfterSalesRequest(String orderId, Type type, Reason reason, long refundCents,
|
||||
String description, List<String> evidence) {
|
||||
this.orderId = orderId;
|
||||
this.type = type;
|
||||
this.reason = reason;
|
||||
this.refundCents = refundCents;
|
||||
this.description = description == null ? "" : description.trim();
|
||||
this.evidence = new ArrayList<>(evidence);
|
||||
}
|
||||
|
||||
/** 仅接受非负十进制金额,最多两位小数,拒绝指数形式及溢出。 */
|
||||
public static long parseAmountCents(String input) {
|
||||
if (input == null || !input.trim().matches("[0-9]+(\\.[0-9]{1,2})?")) {
|
||||
throw new IllegalArgumentException("Invalid amount");
|
||||
}
|
||||
return new BigDecimal(input.trim()).movePointRight(2).longValueExact();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ckkj.griddle.mine.order.entity;
|
||||
|
||||
/** 下单时保存的地址、支付及优惠快照,不随地址管理中的修改而变化。 */
|
||||
public class MyOrderDetailEntity {
|
||||
public final MyOrderEntity order;
|
||||
public final String address;
|
||||
public final String recipient;
|
||||
public final String phone;
|
||||
public final String pickupName;
|
||||
public final String paymentTime;
|
||||
public final String paymentReference;
|
||||
public final String trackingNumber;
|
||||
public final long subtotalCents;
|
||||
public final long couponCents;
|
||||
public final long pointsCents;
|
||||
public final long payableCents;
|
||||
|
||||
public MyOrderDetailEntity(MyOrderEntity order, String address, String recipient, String phone,
|
||||
String pickupName, String paymentTime, String paymentReference,
|
||||
String trackingNumber, long couponCents, long pointsCents) {
|
||||
this.order = order;
|
||||
this.address = address;
|
||||
this.recipient = recipient;
|
||||
this.phone = phone;
|
||||
this.pickupName = pickupName;
|
||||
this.paymentTime = paymentTime;
|
||||
this.paymentReference = paymentReference;
|
||||
this.trackingNumber = trackingNumber;
|
||||
long subtotal = 0;
|
||||
for (MyOrderEntity.Goods goods : order.goods) {
|
||||
subtotal += goods.priceCents * goods.quantity;
|
||||
}
|
||||
this.subtotalCents = Math.max(0, subtotal);
|
||||
this.couponCents = Math.min(subtotalCents, Math.max(0, couponCents));
|
||||
this.pointsCents = Math.min(subtotalCents - this.couponCents, Math.max(0, pointsCents));
|
||||
this.payableCents = subtotalCents - this.couponCents - this.pointsCents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.ckkj.griddle.refund;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.ckkj.griddle.R;
|
||||
|
||||
/** 撤销售后确认弹窗,保持设计稿圆角、按钮及遮罩,不创建额外 Activity。 */
|
||||
final class RefundCancelDialog implements View.OnClickListener {
|
||||
private final Activity activity;
|
||||
private final Dialog dialog;
|
||||
private final Runnable onConfirm;
|
||||
|
||||
RefundCancelDialog(Activity activity, Runnable onConfirm) {
|
||||
this.activity = activity;
|
||||
this.onConfirm = onConfirm;
|
||||
dialog = new Dialog(activity);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(R.layout.dialog_refund_cancel);
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
dialog.findViewById(R.id.tv_refund_dialog_cancel).setOnClickListener(this);
|
||||
dialog.findViewById(R.id.tv_refund_dialog_confirm).setOnClickListener(this);
|
||||
}
|
||||
|
||||
void show() {
|
||||
dialog.show();
|
||||
Window window = dialog.getWindow();
|
||||
if (window == null) return;
|
||||
float density = activity.getResources().getDisplayMetrics().density;
|
||||
int available = Math.round(activity.getResources().getConfiguration().screenWidthDp * density);
|
||||
int width = Math.max(1, Math.min(Math.round(321 * density), available - Math.round(48 * density)));
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
window.setDimAmount(0.6f);
|
||||
window.setGravity(Gravity.CENTER);
|
||||
window.setLayout(width, WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
boolean isShowing() {
|
||||
return dialog.isShowing();
|
||||
}
|
||||
|
||||
void dismiss() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 确认与取消均先关闭弹窗,只有确认才转交当前申请编号进行撤销。
|
||||
dismiss();
|
||||
if (v.getId() == R.id.tv_refund_dialog_confirm && onConfirm != null) onConfirm.run();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package com.ckkj.griddle.refund;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.base.BaseActivity;
|
||||
import com.ckkj.griddle.databinding.ItemMyOrderGoodsBinding;
|
||||
import com.ckkj.griddle.databinding.RefundDetailLayoutBinding;
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderEntity;
|
||||
import com.ckkj.griddle.network.BaseBean;
|
||||
import com.ckkj.griddle.refund.entity.RefundDetailEntity;
|
||||
import com.ckkj.griddle.refund.entity.RefundEntity;
|
||||
import com.ckkj.griddle.refund.mvp.RefundContract;
|
||||
import com.ckkj.griddle.refund.mvp.RefundImpl;
|
||||
import com.ckkj.griddle.refund.mvp.RefundPresenter;
|
||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.OnClick;
|
||||
|
||||
/** 售后详情:审核中、已通过和已拒绝共用布局,依据真实申请状态展示。 */
|
||||
public class RefundDetailActivity extends BaseActivity<RefundDetailLayoutBinding, RefundPresenter>
|
||||
implements RefundContract.RefundDetailView {
|
||||
public static final String EXTRA_REFUND_ID = "refund_detail_id";
|
||||
public static final String EXTRA_CANCELLED_IDS = "refund_detail_cancelled_ids";
|
||||
public static final String RESULT_CANCELLED_ID = "refund_detail_cancelled_id";
|
||||
private static final String STATE_CANCELLED_HERE = "refund_detail_cancelled_here";
|
||||
|
||||
private final ArrayList<String> cancelledIds = new ArrayList<>();
|
||||
private String refundId;
|
||||
private boolean cancelledHere;
|
||||
private RefundDetailEntity detail;
|
||||
private RefundCancelDialog cancelDialog;
|
||||
|
||||
@Override
|
||||
public RefundPresenter createPresenter() {
|
||||
return new RefundPresenter(new RefundImpl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutResId(Bundle savedInstanceState) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData(Bundle savedInstanceState) {
|
||||
super.initData(savedInstanceState);
|
||||
ImmersionBar.with(this).statusBarColor(R.color.white).statusBarDarkFont(true).init();
|
||||
refundId = getIntent().getStringExtra(EXTRA_REFUND_ID);
|
||||
Bundle state = savedInstanceState == null ? getIntent().getExtras() : savedInstanceState;
|
||||
if (state != null) {
|
||||
ArrayList<String> savedIds = state.getStringArrayList(EXTRA_CANCELLED_IDS);
|
||||
if (savedIds != null) cancelledIds.addAll(savedIds);
|
||||
cancelledHere = state.getBoolean(STATE_CANCELLED_HERE, false);
|
||||
}
|
||||
mPresenter.restoreCancelledIds(cancelledIds);
|
||||
// 旋转、折叠等重建后,仍需把本页取消结果带回列表。
|
||||
if (cancelledHere) publishCancelledResult();
|
||||
mPresenter.getRefundDetail(refundId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showRefundDetail(RefundDetailEntity data) {
|
||||
if (data == null || data.refund == null || data.refund.goods == null) {
|
||||
showError(null);
|
||||
return;
|
||||
}
|
||||
detail = data;
|
||||
RefundEntity refund = data.refund;
|
||||
viewBinding.tvRefundDetailNumber.setText(refund.id);
|
||||
viewBinding.tvRefundDetailStatus.setText(refund.status.labelRes);
|
||||
viewBinding.tvRefundDetailStatus.setTextColor(Color.parseColor(
|
||||
refund.status == RefundEntity.Status.REJECTED ? "#E5484D" : "#222222"));
|
||||
viewBinding.tvRefundDetailAppliedTime.setText(data.appliedTime);
|
||||
viewBinding.llRefundDetailReview.setVisibility(data.isReviewed() ? View.VISIBLE : View.GONE);
|
||||
viewBinding.tvRefundDetailReviewedTime.setText(data.reviewedTime);
|
||||
viewBinding.tvRefundDetailReviewRemark.setText(data.reviewRemark);
|
||||
bindGoods(refund.goods);
|
||||
viewBinding.tvRefundDetailType.setText(refund.typeRes);
|
||||
viewBinding.tvRefundDetailReason.setText(data.reason);
|
||||
viewBinding.tvRefundDetailDescription.setText(data.description);
|
||||
bindEvidence(data);
|
||||
viewBinding.tvRefundDetailError.setVisibility(View.GONE);
|
||||
viewBinding.scrollRefundDetail.setVisibility(View.VISIBLE);
|
||||
viewBinding.llRefundDetailActions.setVisibility(refund.canCancel() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void bindGoods(MyOrderEntity.Goods goods) {
|
||||
ItemMyOrderGoodsBinding binding = viewBinding.includeRefundDetailGoods;
|
||||
binding.tvMyOrderGoodsName.setText(goods.nameRes);
|
||||
binding.tvMyOrderGoodsSpec.setText(getString(R.string.my_order_specification,
|
||||
goods.specification, goods.quantity));
|
||||
binding.tvMyOrderGoodsPrice.setText(getString(R.string.my_order_price,
|
||||
BigDecimal.valueOf(goods.priceCents, 2).toPlainString()));
|
||||
Glide.with(this).load(goods.coverRes)
|
||||
.transform(new CenterCrop(), new RoundedCorners(dp(10)))
|
||||
.into(binding.ivMyOrderGoodsCover);
|
||||
}
|
||||
|
||||
private void bindEvidence(RefundDetailEntity data) {
|
||||
viewBinding.flowRefundDetailEvidence.removeAllViews();
|
||||
int count = 0;
|
||||
// 凭证为只读展示,数量由详情数据决定,不添加上传或删除入口。
|
||||
for (String uri : data.evidenceUris) {
|
||||
if (TextUtils.isEmpty(uri)) continue;
|
||||
ImageView image = new ImageView(this);
|
||||
image.setLayoutParams(new ViewGroup.LayoutParams(dp(60), dp(60)));
|
||||
image.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
image.setContentDescription(getString(R.string.refund_detail_evidence_description, ++count));
|
||||
viewBinding.flowRefundDetailEvidence.addView(image);
|
||||
Glide.with(this).load(uri).placeholder(R.drawable.review_image_bg)
|
||||
.error(R.drawable.review_image_bg)
|
||||
.transform(new CenterCrop(), new RoundedCorners(dp(6))).into(image);
|
||||
}
|
||||
viewBinding.flowRefundDetailEvidence.setVisibility(count > 0 ? View.VISIBLE : View.GONE);
|
||||
viewBinding.tvRefundDetailNoEvidence.setVisibility(count == 0 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@OnClick({R.id.iv_refund_detail_back, R.id.tv_refund_detail_cancel})
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_refund_detail_back:
|
||||
finish();
|
||||
break;
|
||||
case R.id.tv_refund_detail_cancel:
|
||||
showCancelDialog();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void showCancelDialog() {
|
||||
if (detail == null || !detail.refund.canCancel()
|
||||
|| (cancelDialog != null && cancelDialog.isShowing())) return;
|
||||
cancelDialog = new RefundCancelDialog(this, () -> mPresenter.cancelRefund(refundId));
|
||||
cancelDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefundCancelled(RefundEntity refund) {
|
||||
if (refund == null || !TextUtils.equals(refundId, refund.id)) return;
|
||||
if (!cancelledIds.contains(refund.id)) cancelledIds.add(refund.id);
|
||||
cancelledHere = true;
|
||||
publishCancelledResult();
|
||||
mPresenter.getRefundDetail(refundId);
|
||||
ToastUtil.showShort(mContext, getString(R.string.refund_cancel_preview));
|
||||
}
|
||||
|
||||
private void publishCancelledResult() {
|
||||
Intent result = new Intent();
|
||||
result.putExtra(RESULT_CANCELLED_ID, refundId);
|
||||
setResult(RESULT_OK, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(String message) {
|
||||
String error = TextUtils.isEmpty(message) ? getString(R.string.refund_detail_load_failed) : message;
|
||||
if (detail == null) {
|
||||
viewBinding.tvRefundDetailError.setText(error);
|
||||
viewBinding.tvRefundDetailError.setVisibility(View.VISIBLE);
|
||||
viewBinding.scrollRefundDetail.setVisibility(View.GONE);
|
||||
viewBinding.llRefundDetailActions.setVisibility(View.GONE);
|
||||
}
|
||||
ToastUtil.showShort(mContext, error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logOut(BaseBean bean) {
|
||||
// 登录失效沿用父类统一处理。
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
outState.putStringArrayList(EXTRA_CANCELLED_IDS, new ArrayList<>(cancelledIds));
|
||||
outState.putBoolean(STATE_CANCELLED_HERE, cancelledHere);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (cancelDialog != null) cancelDialog.dismiss();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private int dp(int value) {
|
||||
return Math.round(value * getResources().getDisplayMetrics().density);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.ckkj.griddle.refund.adapter;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.refund.entity.RefundEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/** 退款条目完整绑定状态及取消按钮,防止列表复用后按钮串显。 */
|
||||
public class RefundAdapter extends BaseQuickAdapter<RefundEntity, BaseViewHolder> {
|
||||
public RefundAdapter() {
|
||||
super(R.layout.item_refund);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RefundEntity refund) {
|
||||
helper.setText(R.id.tv_refund_number, mContext.getString(R.string.refund_number, refund.id))
|
||||
.setText(R.id.tv_refund_status, mContext.getString(refund.status.labelRes))
|
||||
.setText(R.id.tv_refund_type, mContext.getString(R.string.refund_type,
|
||||
mContext.getString(refund.typeRes)))
|
||||
.setText(R.id.tv_my_order_goods_name, mContext.getString(refund.goods.nameRes))
|
||||
.setText(R.id.tv_my_order_goods_spec, mContext.getString(R.string.my_order_specification,
|
||||
refund.goods.specification, refund.goods.quantity))
|
||||
.setText(R.id.tv_my_order_goods_price, mContext.getString(R.string.my_order_price,
|
||||
BigDecimal.valueOf(refund.goods.priceCents, 2).toPlainString()))
|
||||
.addOnClickListener(R.id.tv_refund_cancel_request);
|
||||
helper.setTextColor(R.id.tv_refund_status, refund.status == RefundEntity.Status.REJECTED
|
||||
? Color.parseColor("#E5484D") : Color.parseColor("#222222"));
|
||||
helper.getView(R.id.tv_refund_cancel_request).setVisibility(
|
||||
refund.canCancel() ? View.VISIBLE : View.GONE);
|
||||
// 两侧文案在窄屏和长英文下均允许换行,不挤掉售后类型。
|
||||
float density = mContext.getResources().getDisplayMetrics().density;
|
||||
int width = Math.min(720, mContext.getResources().getConfiguration().screenWidthDp);
|
||||
((TextView) helper.getView(R.id.tv_refund_status)).setMaxWidth(Math.round((width - 44) * density / 2));
|
||||
((TextView) helper.getView(R.id.tv_refund_cancel_request)).setMaxWidth(Math.round((width - 42) * density / 2));
|
||||
helper.setTextColor(R.id.tv_my_order_goods_price, Color.parseColor("#E5484D"));
|
||||
ImageView image = helper.getView(R.id.iv_my_order_goods_cover);
|
||||
Glide.with(image).load(refund.goods.coverRes)
|
||||
.transform(new CenterCrop(), new RoundedCorners(Math.round(10 * density))).into(image);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ckkj.griddle.refund.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** 售后申请详情快照,审核信息和凭证独立于列表摘要。 */
|
||||
public class RefundDetailEntity {
|
||||
public final RefundEntity refund;
|
||||
public final String appliedTime;
|
||||
public final String reviewedTime;
|
||||
public final String reviewRemark;
|
||||
public final String reason;
|
||||
public final String description;
|
||||
public final List<String> evidenceUris;
|
||||
|
||||
public RefundDetailEntity(RefundEntity refund, String appliedTime, String reviewedTime,
|
||||
String reviewRemark, String reason, String description,
|
||||
List<String> evidenceUris) {
|
||||
this.refund = refund;
|
||||
this.appliedTime = appliedTime;
|
||||
this.reviewedTime = reviewedTime;
|
||||
this.reviewRemark = reviewRemark;
|
||||
this.reason = reason;
|
||||
this.description = description;
|
||||
this.evidenceUris = evidenceUris == null ? Collections.emptyList()
|
||||
: Collections.unmodifiableList(new ArrayList<>(evidenceUris));
|
||||
}
|
||||
|
||||
public boolean isReviewed() {
|
||||
return refund.status == RefundEntity.Status.APPROVED
|
||||
|| refund.status == RefundEntity.Status.REJECTED;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.ckkj.griddle.refund.entity;
|
||||
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderEntity;
|
||||
|
||||
/** 退款记录,业务状态独立于筛选条件,已取消记录保留在全部列表中。 */
|
||||
public class RefundEntity {
|
||||
public enum Status {
|
||||
ALL(R.string.refund_all), PENDING(R.string.refund_pending),
|
||||
APPROVED(R.string.refund_approved), REJECTED(R.string.refund_rejected),
|
||||
CANCELLED(R.string.refund_cancelled);
|
||||
|
||||
public final int labelRes;
|
||||
|
||||
Status(int labelRes) {
|
||||
this.labelRes = labelRes;
|
||||
}
|
||||
}
|
||||
|
||||
public final String id;
|
||||
public final Status status;
|
||||
public final int typeRes;
|
||||
public final MyOrderEntity.Goods goods;
|
||||
|
||||
public RefundEntity(String id, Status status, int typeRes, MyOrderEntity.Goods goods) {
|
||||
this.id = id;
|
||||
this.status = status;
|
||||
this.typeRes = typeRes;
|
||||
this.goods = goods;
|
||||
}
|
||||
|
||||
public boolean canCancel() {
|
||||
return status == Status.PENDING;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.ckkj.griddle.refund.mvp;
|
||||
|
||||
import com.ckkj.griddle.base.IView;
|
||||
import com.ckkj.griddle.refund.entity.RefundEntity;
|
||||
import com.ckkj.griddle.refund.entity.RefundDetailEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 退款列表、状态筛选及撤销申请的基础协议。 */
|
||||
public class RefundContract {
|
||||
public interface CallBack<T> {
|
||||
void success(T data);
|
||||
void fail(String message);
|
||||
}
|
||||
|
||||
public interface DataModel {
|
||||
void getRefunds(RefundEntity.Status filter, CallBack<List<RefundEntity>> callback);
|
||||
void getRefundDetail(String refundId, CallBack<RefundDetailEntity> callback);
|
||||
void cancelRefund(String refundId, CallBack<RefundEntity> callback);
|
||||
void restoreCancelledIds(List<String> ids);
|
||||
}
|
||||
|
||||
public interface RefundView extends IView {
|
||||
void showRefunds(List<RefundEntity> refunds);
|
||||
void onRefundCancelled(RefundEntity refund);
|
||||
}
|
||||
|
||||
/** 详情和列表复用退款协调层,详情不承担列表渲染。 */
|
||||
public interface RefundDetailView extends RefundView {
|
||||
void showRefundDetail(RefundDetailEntity detail);
|
||||
|
||||
@Override
|
||||
default void showRefunds(List<RefundEntity> refunds) { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.ckkj.griddle.refund.mvp;
|
||||
|
||||
import com.ckkj.griddle.MyApplication;
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderEntity;
|
||||
import com.ckkj.griddle.refund.entity.RefundEntity;
|
||||
import com.ckkj.griddle.refund.entity.RefundDetailEntity;
|
||||
import com.ckkj.griddle.refund.entity.RefundEntity.Status;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/** 当前提供本地预览数据,查询与取消接口均集中在此,页面不直接改动数据源。 */
|
||||
public class RefundImpl implements RefundContract.DataModel {
|
||||
private final Set<String> cancelledIds = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void getRefunds(Status filter, RefundContract.CallBack<List<RefundEntity>> callback) {
|
||||
List<RefundEntity> result = new ArrayList<>();
|
||||
for (RefundEntity refund : createPreview()) {
|
||||
if (filter == Status.ALL || filter == refund.status) result.add(refund);
|
||||
}
|
||||
callback.success(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRefundDetail(String refundId, RefundContract.CallBack<RefundDetailEntity> callback) {
|
||||
for (RefundEntity refund : createPreview()) {
|
||||
if (!refund.id.equals(refundId)) continue;
|
||||
boolean reviewed = refund.status == Status.APPROVED || refund.status == Status.REJECTED;
|
||||
String remark = reviewed ? MyApplication.getContext().getString(
|
||||
refund.status == Status.APPROVED ? R.string.refund_detail_preview_approved
|
||||
: R.string.refund_detail_preview_rejected) : "";
|
||||
// 暂用项目现有商品图展示凭证位置,接入接口后替换为该申请的真实附件地址。
|
||||
String evidence = "android.resource://" + MyApplication.getContext().getPackageName()
|
||||
+ "/" + R.mipmap.icon_cart_goods_preview;
|
||||
callback.success(new RefundDetailEntity(refund, "2026-11-10 10:20",
|
||||
reviewed ? "2026-11-10 11:20" : "", remark,
|
||||
MyApplication.getContext().getString(R.string.refund_detail_preview_reason),
|
||||
MyApplication.getContext().getString(R.string.refund_detail_preview_description),
|
||||
Arrays.asList(evidence, evidence, evidence, evidence)));
|
||||
return;
|
||||
}
|
||||
callback.fail(MyApplication.getContext().getString(R.string.refund_detail_load_failed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelRefund(String refundId, RefundContract.CallBack<RefundEntity> callback) {
|
||||
for (RefundEntity refund : createPreview()) {
|
||||
if (!refund.id.equals(refundId)) continue;
|
||||
if (!refund.canCancel()) break;
|
||||
// 仅更新本地预览;接入服务端后应在撤销接口成功回调中返回新状态。
|
||||
cancelledIds.add(refundId);
|
||||
callback.success(new RefundEntity(refund.id, Status.CANCELLED, refund.typeRes, refund.goods));
|
||||
return;
|
||||
}
|
||||
callback.fail(MyApplication.getContext().getString(R.string.refund_cancel_unavailable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreCancelledIds(List<String> ids) {
|
||||
cancelledIds.clear();
|
||||
if (ids != null) cancelledIds.addAll(ids);
|
||||
}
|
||||
|
||||
private List<RefundEntity> createPreview() {
|
||||
MyOrderEntity.Goods goods = new MyOrderEntity.Goods(R.string.my_order_goods_preview,
|
||||
R.mipmap.icon_cart_goods_preview, "0.5kg", 1, 20800);
|
||||
return Arrays.asList(
|
||||
new RefundEntity("SL20261020001", cancelledIds.contains("SL20261020001")
|
||||
? Status.CANCELLED : Status.PENDING, R.string.after_sales_refund_only, goods),
|
||||
new RefundEntity("SL20261020002", Status.REJECTED, R.string.after_sales_refund_only, goods),
|
||||
new RefundEntity("SL20261020003", Status.APPROVED, R.string.after_sales_refund_only, goods));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.ckkj.griddle.refund.mvp;
|
||||
|
||||
import com.ckkj.griddle.base.BasePresenter;
|
||||
import com.ckkj.griddle.refund.entity.RefundEntity;
|
||||
import com.ckkj.griddle.refund.entity.RefundDetailEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 退款协调层:转交筛选、取消申请及结果回调。 */
|
||||
public class RefundPresenter extends BasePresenter<RefundContract.RefundView> {
|
||||
private final RefundContract.DataModel impl;
|
||||
|
||||
public RefundPresenter(RefundContract.DataModel impl) {
|
||||
this.impl = impl;
|
||||
}
|
||||
|
||||
public void getRefunds(RefundEntity.Status filter) {
|
||||
impl.getRefunds(filter, new RefundContract.CallBack<List<RefundEntity>>() {
|
||||
@Override
|
||||
public void success(List<RefundEntity> refunds) {
|
||||
if (getView() != null) getView().showRefunds(refunds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String message) {
|
||||
if (getView() != null) getView().showError(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void cancelRefund(String refundId) {
|
||||
impl.cancelRefund(refundId, new RefundContract.CallBack<RefundEntity>() {
|
||||
@Override
|
||||
public void success(RefundEntity refund) {
|
||||
if (getView() != null) getView().onRefundCancelled(refund);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String message) {
|
||||
if (getView() != null) getView().showError(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getRefundDetail(String refundId) {
|
||||
impl.getRefundDetail(refundId, new RefundContract.CallBack<RefundDetailEntity>() {
|
||||
@Override
|
||||
public void success(RefundDetailEntity detail) {
|
||||
if (getView() instanceof RefundContract.RefundDetailView) {
|
||||
((RefundContract.RefundDetailView) getView()).showRefundDetail(detail);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String message) {
|
||||
if (getView() != null) getView().showError(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void restoreCancelledIds(List<String> ids) {
|
||||
impl.restoreCancelledIds(ids);
|
||||
}
|
||||
}
|
||||
104
app/src/main/java/com/ckkj/griddle/review/MyReviewsActivity.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package com.ckkj.griddle.review;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.base.BaseActivity;
|
||||
import com.ckkj.griddle.databinding.MyReviewsLayoutBinding;
|
||||
import com.ckkj.griddle.network.BaseBean;
|
||||
import com.ckkj.griddle.review.adapter.MyReviewAdapter;
|
||||
import com.ckkj.griddle.review.entity.MyReviewEntity;
|
||||
import com.ckkj.griddle.review.mvp.ReviewContract;
|
||||
import com.ckkj.griddle.review.mvp.ReviewImpl;
|
||||
import com.ckkj.griddle.review.mvp.ReviewPresenter;
|
||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.OnClick;
|
||||
|
||||
/** 个人中心的已发表评价列表,复用评价模块 MVP,不混用商品评价填写页。 */
|
||||
public class MyReviewsActivity extends BaseActivity<MyReviewsLayoutBinding, ReviewPresenter>
|
||||
implements ReviewContract.MyReviewsView {
|
||||
private MyReviewAdapter adapter;
|
||||
|
||||
@Override
|
||||
public ReviewPresenter createPresenter() {
|
||||
return new ReviewPresenter(new ReviewImpl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutResId(Bundle savedInstanceState) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData(Bundle savedInstanceState) {
|
||||
super.initData(savedInstanceState);
|
||||
ImmersionBar.with(this).statusBarColor(R.color.white).statusBarDarkFont(true).init();
|
||||
adapter = new MyReviewAdapter();
|
||||
viewBinding.tvMyReviewsCount.setText(getString(R.string.my_reviews_count, 0));
|
||||
viewBinding.rvMyReviews.setLayoutManager(new LinearLayoutManager(this));
|
||||
viewBinding.rvMyReviews.setItemAnimator(null);
|
||||
viewBinding.rvMyReviews.setAdapter(adapter);
|
||||
final int spacing = Math.round(10 * getResources().getDisplayMetrics().density);
|
||||
viewBinding.rvMyReviews.addItemDecoration(new RecyclerView.ItemDecoration() {
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
|
||||
@NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
outRect.set(0, parent.getChildAdapterPosition(view) > 0 ? spacing : 0, 0, 0);
|
||||
}
|
||||
});
|
||||
mPresenter.getMyReviews();
|
||||
}
|
||||
|
||||
@OnClick({R.id.iv_my_reviews_back})
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_my_reviews_back:
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyReviews(List<MyReviewEntity> reviews) {
|
||||
List<MyReviewEntity> data = reviews == null ? new ArrayList<>() : new ArrayList<>(reviews);
|
||||
adapter.setNewData(data);
|
||||
viewBinding.tvMyReviewsCount.setText(getString(R.string.my_reviews_count, data.size()));
|
||||
viewBinding.tvMyReviewsState.setText(R.string.my_reviews_empty);
|
||||
viewBinding.tvMyReviewsState.setVisibility(data.isEmpty() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(String message) {
|
||||
String error = TextUtils.isEmpty(message) ? getString(R.string.my_reviews_load_failed) : message;
|
||||
if (adapter != null && adapter.getData().isEmpty()) {
|
||||
viewBinding.tvMyReviewsState.setText(error);
|
||||
viewBinding.tvMyReviewsState.setVisibility(View.VISIBLE);
|
||||
}
|
||||
ToastUtil.showShort(mContext, error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logOut(BaseBean bean) {
|
||||
// 登录失效沿用父类统一处理。
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
viewBinding.rvMyReviews.setAdapter(null);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.ckkj.griddle.review.adapter;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.custom.view.FaultReportOptionsLayout;
|
||||
import com.ckkj.griddle.review.entity.MyReviewEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/** 我的评价条目:每次复用时完整重置星级、文字和图片,防止无图评价串显。 */
|
||||
public class MyReviewAdapter extends BaseQuickAdapter<MyReviewEntity, BaseViewHolder> {
|
||||
public MyReviewAdapter() {
|
||||
super(R.layout.item_my_review);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, MyReviewEntity review) {
|
||||
helper.setText(R.id.tv_my_review_goods_name, mContext.getString(review.goods.nameRes))
|
||||
.setText(R.id.tv_my_review_spec, mContext.getString(R.string.my_order_specification,
|
||||
review.goods.specification, review.goods.quantity))
|
||||
.setText(R.id.tv_my_review_price, mContext.getString(R.string.my_order_price,
|
||||
BigDecimal.valueOf(review.goods.priceCents, 2).toPlainString()))
|
||||
.setText(R.id.tv_my_review_comment, review.comment);
|
||||
helper.getView(R.id.tv_my_review_comment).setVisibility(
|
||||
TextUtils.isEmpty(review.comment) ? View.GONE : View.VISIBLE);
|
||||
ImageView cover = helper.getView(R.id.iv_my_review_goods);
|
||||
Glide.with(cover).load(review.goods.coverRes)
|
||||
.transform(new CenterCrop(), new RoundedCorners(dp(6))).into(cover);
|
||||
bindStars(helper.getView(R.id.ll_my_review_stars), review.rating);
|
||||
bindImages(helper.getView(R.id.flow_my_review_images), review);
|
||||
}
|
||||
|
||||
private void bindStars(LinearLayout container, int rating) {
|
||||
container.removeAllViews();
|
||||
container.setContentDescription(mContext.getString(R.string.my_reviews_rating_value, rating));
|
||||
for (int i = 0; i < 5; i++) {
|
||||
ImageView star = new ImageView(mContext);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(dp(14), dp(14));
|
||||
if (i > 0) params.setMarginStart(dp(4));
|
||||
star.setLayoutParams(params);
|
||||
star.setImageResource(i < rating ? R.drawable.review_star_selected : R.drawable.review_star_empty);
|
||||
star.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
container.addView(star);
|
||||
}
|
||||
}
|
||||
|
||||
private void bindImages(FaultReportOptionsLayout container, MyReviewEntity review) {
|
||||
// 先取消旧图片请求,再移除动态控件,空列表也会清掉上条评价的图片。
|
||||
for (int i = 0; i < container.getChildCount(); i++) {
|
||||
Glide.with(container).clear((ImageView) container.getChildAt(i));
|
||||
}
|
||||
container.removeAllViews();
|
||||
container.setVisibility(review.images.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
for (String uri : review.images) {
|
||||
ImageView image = new ImageView(mContext);
|
||||
image.setLayoutParams(new ViewGroup.LayoutParams(dp(80), dp(80)));
|
||||
image.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
image.setContentDescription(mContext.getString(R.string.my_reviews_photo));
|
||||
container.addView(image);
|
||||
Glide.with(image).load(Uri.parse(uri))
|
||||
.placeholder(R.drawable.review_image_bg)
|
||||
.error(R.drawable.ic_fault_report_album)
|
||||
.transform(new CenterCrop(), new RoundedCorners(dp(10))).into(image);
|
||||
}
|
||||
}
|
||||
|
||||
private int dp(int value) {
|
||||
return Math.round(value * mContext.getResources().getDisplayMetrics().density);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.ckkj.griddle.review.adapter;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.ckkj.griddle.R;
|
||||
|
||||
/** 评价图片列表:空地址代表添加卡片,三列布局统一由 RecyclerView 分配宽度。 */
|
||||
public class ReviewImageAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
|
||||
public ReviewImageAdapter() {
|
||||
super(R.layout.item_review_image);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, String uri) {
|
||||
boolean placeholder = TextUtils.isEmpty(uri);
|
||||
ImageView image = helper.getView(R.id.iv_review_image);
|
||||
helper.getView(R.id.ll_review_add_image).setVisibility(placeholder ? View.VISIBLE : View.GONE);
|
||||
helper.getView(R.id.iv_review_delete_image).setVisibility(placeholder ? View.GONE : View.VISIBLE);
|
||||
image.setVisibility(placeholder ? View.INVISIBLE : View.VISIBLE);
|
||||
helper.addOnClickListener(R.id.ll_review_add_image)
|
||||
.addOnClickListener(R.id.iv_review_delete_image)
|
||||
.addOnClickListener(R.id.iv_review_image);
|
||||
if (placeholder) {
|
||||
Glide.with(image).clear(image);
|
||||
} else {
|
||||
Glide.with(image).load(Uri.parse(uri)).centerCrop()
|
||||
.placeholder(R.drawable.review_image_bg)
|
||||
.error(R.drawable.ic_fault_report_album).into(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ckkj.griddle.review.entity;
|
||||
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** 已发表的商品评价;配图允许为空,列表按实际数据展示。 */
|
||||
public class MyReviewEntity {
|
||||
public final String id;
|
||||
public final MyOrderEntity.Goods goods;
|
||||
public final int rating;
|
||||
public final String comment;
|
||||
public final List<String> images;
|
||||
|
||||
public MyReviewEntity(String id, MyOrderEntity.Goods goods, int rating,
|
||||
String comment, List<String> images) {
|
||||
this.id = id;
|
||||
this.goods = goods;
|
||||
this.rating = Math.max(0, Math.min(5, rating));
|
||||
this.comment = comment;
|
||||
this.images = images == null ? new ArrayList<>() : new ArrayList<>(images);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ckkj.griddle.review.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** 商品评价草稿:保留当前订单、文字、整数评分及压缩后的图片地址。 */
|
||||
public class ProductReviewRequest {
|
||||
public final String orderId;
|
||||
public final String comment;
|
||||
public final int rating;
|
||||
public final List<String> images;
|
||||
|
||||
public ProductReviewRequest(String orderId, String comment, int rating, List<String> images) {
|
||||
this.orderId = orderId;
|
||||
this.comment = comment == null ? "" : comment.trim();
|
||||
this.rating = rating;
|
||||
this.images = new ArrayList<>(images);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.ckkj.griddle.review.mvp;
|
||||
|
||||
import com.ckkj.griddle.base.IView;
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderEntity;
|
||||
import com.ckkj.griddle.review.entity.ProductReviewRequest;
|
||||
import com.ckkj.griddle.review.entity.MyReviewEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 商品评价 MVP 协议,页面不直接处理订单数据来源和提交校验。 */
|
||||
public class ReviewContract {
|
||||
public interface CallBack<T> {
|
||||
void success(T data);
|
||||
void fail(String message);
|
||||
}
|
||||
|
||||
public interface DataModel {
|
||||
void getOrder(String orderId, CallBack<MyOrderEntity> callback);
|
||||
void validateReview(ProductReviewRequest request, CallBack<Integer> callback);
|
||||
void getMyReviews(CallBack<List<MyReviewEntity>> callback);
|
||||
}
|
||||
|
||||
public interface ReviewView extends IView {
|
||||
void showOrder(MyOrderEntity order);
|
||||
void onReviewValidated(int errorResId);
|
||||
}
|
||||
|
||||
public interface MyReviewsView extends ReviewView {
|
||||
void showMyReviews(List<MyReviewEntity> reviews);
|
||||
|
||||
@Override
|
||||
default void showOrder(MyOrderEntity order) { }
|
||||
|
||||
@Override
|
||||
default void onReviewValidated(int errorResId) { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.ckkj.griddle.review.mvp;
|
||||
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.BuildConfig;
|
||||
import com.ckkj.griddle.review.entity.MyReviewEntity;
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderDetailEntity;
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderEntity;
|
||||
import com.ckkj.griddle.mine.order.mvp.MyOrderContract;
|
||||
import com.ckkj.griddle.mine.order.mvp.MyOrderImpl;
|
||||
import com.ckkj.griddle.review.entity.ProductReviewRequest;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** 评价数据层:复用现有订单数据,预留真实评价接口接入位置。 */
|
||||
public class ReviewImpl implements ReviewContract.DataModel {
|
||||
private final MyOrderContract.DataModel orderModel = new MyOrderImpl();
|
||||
|
||||
@Override
|
||||
public void getMyReviews(ReviewContract.CallBack<List<MyReviewEntity>> callback) {
|
||||
// 当前提供设计稿本地预览,后续由接口返回评论正文和真实配图地址。
|
||||
MyOrderEntity.Goods goods = new MyOrderEntity.Goods(R.string.my_order_goods_preview,
|
||||
R.mipmap.icon_cart_goods_preview, "0.5kg", 1, 20800);
|
||||
String image = "android.resource://" + BuildConfig.APPLICATION_ID + "/"
|
||||
+ R.mipmap.icon_cart_goods_preview;
|
||||
String comment = com.ckkj.griddle.MyApplication.getContext()
|
||||
.getString(R.string.my_reviews_preview_comment);
|
||||
callback.success(Arrays.asList(
|
||||
new MyReviewEntity("REVIEW001", goods, 5, comment, Arrays.asList(image, image, image)),
|
||||
new MyReviewEntity("REVIEW002", goods, 5, comment, Collections.emptyList())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOrder(String orderId, ReviewContract.CallBack<MyOrderEntity> callback) {
|
||||
orderModel.getOrderDetail(orderId, new MyOrderContract.CallBack<MyOrderDetailEntity>() {
|
||||
@Override
|
||||
public void success(MyOrderDetailEntity detail) {
|
||||
callback.success(detail.order);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String message) {
|
||||
callback.fail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateReview(ProductReviewRequest request, ReviewContract.CallBack<Integer> callback) {
|
||||
getOrder(request.orderId, new ReviewContract.CallBack<MyOrderEntity>() {
|
||||
@Override
|
||||
public void success(MyOrderEntity order) {
|
||||
int error = 0;
|
||||
if (!order.canReview()) {
|
||||
error = R.string.review_order_unavailable;
|
||||
} else if (request.rating < 1 || request.rating > 5) {
|
||||
error = R.string.review_rating_required;
|
||||
} else if (request.comment.length() > 500) {
|
||||
error = R.string.review_comment_limit;
|
||||
} else if (request.images.size() > ReviewPresenter.MAX_IMAGE_COUNT) {
|
||||
error = R.string.review_image_limit;
|
||||
}
|
||||
callback.success(error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String message) {
|
||||
callback.fail(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.ckkj.griddle.review.mvp;
|
||||
|
||||
import com.ckkj.griddle.base.BasePresenter;
|
||||
import com.ckkj.griddle.mine.order.entity.MyOrderEntity;
|
||||
import com.ckkj.griddle.review.entity.ProductReviewRequest;
|
||||
import com.ckkj.griddle.review.entity.MyReviewEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 评价协调层:加载当前订单,统一转交评价草稿及校验结果。 */
|
||||
public class ReviewPresenter extends BasePresenter<ReviewContract.ReviewView> {
|
||||
public static final int MAX_IMAGE_COUNT = 6;
|
||||
private final ReviewContract.DataModel impl;
|
||||
|
||||
public ReviewPresenter(ReviewContract.DataModel impl) {
|
||||
this.impl = impl;
|
||||
}
|
||||
|
||||
public void getMyReviews() {
|
||||
impl.getMyReviews(new ReviewContract.CallBack<List<MyReviewEntity>>() {
|
||||
@Override
|
||||
public void success(List<MyReviewEntity> reviews) {
|
||||
if (getView() instanceof ReviewContract.MyReviewsView) {
|
||||
((ReviewContract.MyReviewsView) getView()).showMyReviews(reviews);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String message) {
|
||||
if (getView() != null) getView().showError(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getOrder(String orderId) {
|
||||
impl.getOrder(orderId, new ReviewContract.CallBack<MyOrderEntity>() {
|
||||
@Override
|
||||
public void success(MyOrderEntity order) {
|
||||
if (getView() != null) getView().showOrder(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String message) {
|
||||
if (getView() != null) getView().showError(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void validateReview(ProductReviewRequest request) {
|
||||
impl.validateReview(request, new ReviewContract.CallBack<Integer>() {
|
||||
@Override
|
||||
public void success(Integer errorResId) {
|
||||
if (getView() != null) getView().onReviewValidated(errorResId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String message) {
|
||||
if (getView() != null) getView().showError(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.ckkj.griddle.review.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.widget.AppCompatRatingBar;
|
||||
|
||||
import com.ckkj.griddle.R;
|
||||
|
||||
/** 基于原生评分条绘制设计稿星星,触摸、键盘及无障碍行为仍由 RatingBar 处理。 */
|
||||
public class ReviewRatingBar extends AppCompatRatingBar {
|
||||
private final Drawable selectedStar;
|
||||
private final Drawable emptyStar;
|
||||
private final float density;
|
||||
|
||||
public ReviewRatingBar(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
density = getResources().getDisplayMetrics().density;
|
||||
selectedStar = AppCompatResources.getDrawable(context, R.drawable.review_star_selected);
|
||||
emptyStar = AppCompatResources.getDrawable(context, R.drawable.review_star_empty);
|
||||
setNumStars(5);
|
||||
setStepSize(1f);
|
||||
setIsIndicator(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
// 五个星位各占 34dp,图形 24dp;48dp 高度保留足够的可点击区域。
|
||||
setMeasuredDimension(resolveSize(Math.round(170 * density) + getPaddingLeft()
|
||||
+ getPaddingRight(), widthMeasureSpec),
|
||||
resolveSize(Math.round(48 * density) + getPaddingTop()
|
||||
+ getPaddingBottom(), heightMeasureSpec));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void onDraw(Canvas canvas) {
|
||||
int available = getWidth() - getPaddingLeft() - getPaddingRight();
|
||||
float slot = available / 5f;
|
||||
int size = Math.max(0, Math.round(Math.min(24 * density,
|
||||
Math.min(slot, getHeight() - getPaddingTop() - getPaddingBottom()))));
|
||||
int top = getPaddingTop() + (getHeight() - getPaddingTop() - getPaddingBottom() - size) / 2;
|
||||
boolean rtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
Drawable star = i < Math.round(getRating()) ? selectedStar : emptyStar;
|
||||
if (star == null) continue;
|
||||
int position = rtl ? 4 - i : i;
|
||||
int left = getPaddingLeft() + Math.round(position * slot + (slot - size) / 2);
|
||||
star.setBounds(left, top, left + size, top + size);
|
||||
star.draw(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
package com.ckkj.griddle.utils;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.ckkj.griddle.R;
|
||||
import com.ckkj.griddle.base.BaseActivity;
|
||||
import com.ckkj.griddle.base.BaseFragment;
|
||||
import com.ckkj.griddle.dialog.FaultReportImageSourceDialog;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** 图片及视频选择:按业务配置数量、媒体类型和权限文案,统一复用鲁班压缩。 */
|
||||
public class MediaSelectionHelper {
|
||||
private final int maxCount;
|
||||
private final boolean allowVideo;
|
||||
private final int permissionDescription;
|
||||
private final int limitMessage;
|
||||
private final String statePrefix;
|
||||
private final BaseActivity<?, ?> activity;
|
||||
private final Runnable onChanged;
|
||||
private final ArrayList<String> evidence = new ArrayList<>();
|
||||
private final ArrayList<String> queue = new ArrayList<>();
|
||||
private final ActivityResultLauncher<String[]> albumLauncher;
|
||||
private final ActivityResultLauncher<Uri> cameraLauncher;
|
||||
private final ActivityResultLauncher<Uri> videoLauncher;
|
||||
private final ActivityResultLauncher<String> permissionLauncher;
|
||||
private FaultReportImageSourceDialog sourceDialog;
|
||||
private String pendingPath = "";
|
||||
private String pendingUri = "";
|
||||
private boolean recordVideo;
|
||||
private boolean processing;
|
||||
private boolean destroyed;
|
||||
|
||||
public MediaSelectionHelper(BaseActivity<?, ?> activity, Runnable onChanged, int maxCount,
|
||||
boolean allowVideo, int permissionDescription, int limitMessage,
|
||||
String statePrefix) {
|
||||
this.maxCount = maxCount;
|
||||
this.allowVideo = allowVideo;
|
||||
this.permissionDescription = permissionDescription;
|
||||
this.limitMessage = limitMessage;
|
||||
this.statePrefix = statePrefix;
|
||||
this.activity = activity;
|
||||
this.onChanged = onChanged;
|
||||
// 必须在 Activity 创建阶段注册,系统返回结果会在页面恢复后分发。
|
||||
albumLauncher = activity.registerForActivityResult(
|
||||
new ActivityResultContracts.OpenMultipleDocuments(), this::acceptSelection);
|
||||
cameraLauncher = activity.registerForActivityResult(
|
||||
new ActivityResultContracts.TakePicture(), this::onCaptureResult);
|
||||
videoLauncher = activity.registerForActivityResult(
|
||||
new ActivityResultContracts.CaptureVideo(), this::onCaptureResult);
|
||||
permissionLauncher = activity.registerForActivityResult(
|
||||
new ActivityResultContracts.RequestPermission(), granted -> {
|
||||
activity.hidePermissionDialog();
|
||||
if (granted) {
|
||||
capture();
|
||||
} else if (!ActivityCompat.shouldShowRequestPermissionRationale(
|
||||
activity, Manifest.permission.CAMERA)) {
|
||||
showSettings();
|
||||
} else {
|
||||
error(R.string.fault_report_camera_permission_required);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void restore(Bundle state) {
|
||||
if (state != null) {
|
||||
ArrayList<String> saved = state.getStringArrayList(statePrefix + "_evidence");
|
||||
ArrayList<String> pending = state.getStringArrayList(statePrefix + "_media_queue");
|
||||
if (saved != null) evidence.addAll(saved);
|
||||
if (pending != null) queue.addAll(pending);
|
||||
pendingPath = state.getString(statePrefix + "_capture_path", "");
|
||||
pendingUri = state.getString(statePrefix + "_capture_uri", "");
|
||||
recordVideo = state.getBoolean(statePrefix + "_capture_video");
|
||||
}
|
||||
onChanged.run();
|
||||
processNext();
|
||||
}
|
||||
|
||||
public void save(Bundle out) {
|
||||
out.putStringArrayList(statePrefix + "_evidence", new ArrayList<>(evidence));
|
||||
out.putStringArrayList(statePrefix + "_media_queue", new ArrayList<>(queue));
|
||||
out.putString(statePrefix + "_capture_path", pendingPath);
|
||||
out.putString(statePrefix + "_capture_uri", pendingUri);
|
||||
out.putBoolean(statePrefix + "_capture_video", recordVideo);
|
||||
}
|
||||
|
||||
public List<String> getEvidence() {
|
||||
return new ArrayList<>(evidence);
|
||||
}
|
||||
|
||||
public boolean isProcessing() {
|
||||
return processing || !queue.isEmpty();
|
||||
}
|
||||
|
||||
public void showSource() {
|
||||
if (isProcessing()) {
|
||||
error(R.string.fault_report_media_processing);
|
||||
return;
|
||||
}
|
||||
if (evidence.size() >= maxCount) {
|
||||
error(limitMessage);
|
||||
return;
|
||||
}
|
||||
if (sourceDialog != null && sourceDialog.isShowing()) return;
|
||||
sourceDialog = new FaultReportImageSourceDialog(activity,
|
||||
new FaultReportImageSourceDialog.OnImageSourceSelectedListener() {
|
||||
@Override
|
||||
public void onCameraSelected() {
|
||||
recordVideo = false;
|
||||
requestCamera();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSelected() {
|
||||
recordVideo = true;
|
||||
requestCamera();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAlbumSelected() {
|
||||
try {
|
||||
// 系统选择器只授权所选媒体,无需申请整个相册的访问权限。
|
||||
albumLauncher.launch(allowVideo ? new String[]{"image/*", "video/*"} : new String[]{"image/*"});
|
||||
} catch (ActivityNotFoundException e) {
|
||||
error(R.string.fault_report_gallery_unavailable);
|
||||
}
|
||||
}
|
||||
}, allowVideo);
|
||||
sourceDialog.show();
|
||||
}
|
||||
|
||||
private void requestCamera() {
|
||||
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.CAMERA)
|
||||
== PackageManager.PERMISSION_GRANTED) {
|
||||
capture();
|
||||
return;
|
||||
}
|
||||
activity.showDialogtext(null, false, false, false,
|
||||
activity.getString(R.string.fault_report_camera_permission_title),
|
||||
activity.getString(permissionDescription),
|
||||
activity.getString(R.string.fault_report_cancel),
|
||||
activity.getString(R.string.fault_report_allow),
|
||||
new BaseFragment.OnDialogClick() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
// 取消权限申请后,仍可选择系统相册。
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick() {
|
||||
activity.showPermissionDialog(ContextCompat.getDrawable(activity,
|
||||
R.mipmap.img_permission_file), true,
|
||||
activity.getString(R.string.fault_report_camera_permission_title),
|
||||
activity.getString(permissionDescription));
|
||||
activity.dialog.setCanceledOnTouchOutside(false);
|
||||
activity.dialog.setCancelable(false);
|
||||
permissionLauncher.launch(Manifest.permission.CAMERA);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showSettings() {
|
||||
activity.showDialogtext(null, false, false, true,
|
||||
activity.getString(R.string.fault_report_camera_permission_title),
|
||||
activity.getString(R.string.fault_report_camera_permission_settings),
|
||||
activity.getString(R.string.fault_report_cancel),
|
||||
activity.getString(R.string.fault_report_open_settings),
|
||||
new BaseFragment.OnDialogClick() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
// 保留当前表单。
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick() {
|
||||
activity.startActivity(new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
|
||||
Uri.parse("package:" + activity.getPackageName())));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void capture() {
|
||||
File directory = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||
if (directory == null) {
|
||||
error(R.string.fault_report_camera_storage_unavailable);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
File file = File.createTempFile(statePrefix + "_", recordVideo ? ".mp4" : ".jpg", directory);
|
||||
pendingPath = file.getAbsolutePath();
|
||||
pendingUri = FileProvider.getUriForFile(activity,
|
||||
activity.getPackageName() + ".provider", file).toString();
|
||||
if (recordVideo) videoLauncher.launch(Uri.parse(pendingUri));
|
||||
else cameraLauncher.launch(Uri.parse(pendingUri));
|
||||
} catch (IOException | RuntimeException e) {
|
||||
clearCapture(false);
|
||||
error(R.string.fault_report_camera_launch_failed);
|
||||
}
|
||||
}
|
||||
|
||||
private void onCaptureResult(boolean success) {
|
||||
if (success && !TextUtils.isEmpty(pendingUri)) {
|
||||
ArrayList<Uri> result = new ArrayList<>();
|
||||
result.add(Uri.parse(pendingUri));
|
||||
acceptSelection(result);
|
||||
clearCapture(true);
|
||||
} else {
|
||||
clearCapture(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void clearCapture(boolean keep) {
|
||||
if (!keep && !pendingPath.isEmpty()) new File(pendingPath).delete();
|
||||
pendingPath = "";
|
||||
pendingUri = "";
|
||||
}
|
||||
|
||||
private void acceptSelection(List<Uri> uris) {
|
||||
if (uris == null) return;
|
||||
for (Uri uri : uris) {
|
||||
if (uri == null || evidence.contains(uri.toString()) || queue.contains(uri.toString())) continue;
|
||||
if (evidence.size() + queue.size() >= maxCount) {
|
||||
error(limitMessage);
|
||||
break;
|
||||
}
|
||||
try {
|
||||
activity.getContentResolver().takePersistableUriPermission(uri,
|
||||
Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
} catch (SecurityException ignored) {
|
||||
// 相机返回的私有 Uri 不需要持久授权。
|
||||
}
|
||||
queue.add(uri.toString());
|
||||
}
|
||||
processNext();
|
||||
}
|
||||
|
||||
private void processNext() {
|
||||
if (destroyed || processing || queue.isEmpty()) return;
|
||||
Uri source = Uri.parse(queue.get(0));
|
||||
try {
|
||||
String mime = activity.getContentResolver().getType(source);
|
||||
if (allowVideo && mime != null && mime.startsWith("video/")) {
|
||||
finishProcessing(source.toString());
|
||||
return;
|
||||
}
|
||||
if (mime == null || !mime.startsWith("image/")) {
|
||||
finishProcessing(null);
|
||||
return;
|
||||
}
|
||||
File directory = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||
if (directory == null) {
|
||||
finishProcessing(null);
|
||||
return;
|
||||
}
|
||||
processing = true;
|
||||
LubanCompressUtil.getInstance().getCompressFile(activity.getApplicationContext(), source,
|
||||
directory, new LubanCompressUtil.CompressCallback() {
|
||||
@Override
|
||||
public void success(File file) {
|
||||
if (destroyed) {
|
||||
// 配置变化后新页面会重新处理队列,仅清理旧回调的新副本。
|
||||
if (file != null) file.delete();
|
||||
return;
|
||||
}
|
||||
if (file == null || !file.isFile() || file.length() == 0) {
|
||||
finishProcessing(null);
|
||||
return;
|
||||
}
|
||||
finishProcessing(FileProvider.getUriForFile(activity,
|
||||
activity.getPackageName() + ".provider", file).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String message) {
|
||||
if (!destroyed) finishProcessing(null);
|
||||
}
|
||||
});
|
||||
} catch (RuntimeException e) {
|
||||
finishProcessing(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void finishProcessing(String result) {
|
||||
processing = false;
|
||||
if (!queue.isEmpty()) queue.remove(0);
|
||||
if (result != null && evidence.size() < maxCount) evidence.add(result);
|
||||
else if (result == null) error(R.string.fault_report_media_failed);
|
||||
onChanged.run();
|
||||
processNext();
|
||||
}
|
||||
|
||||
public void remove(int position) {
|
||||
if (position >= 0 && position < evidence.size()) {
|
||||
evidence.remove(position);
|
||||
onChanged.run();
|
||||
}
|
||||
}
|
||||
|
||||
public void preview(int position) {
|
||||
if (position < 0 || position >= evidence.size()) return;
|
||||
Uri uri = Uri.parse(evidence.get(position));
|
||||
try {
|
||||
activity.startActivity(new Intent(Intent.ACTION_VIEW)
|
||||
.setDataAndType(uri, activity.getContentResolver().getType(uri))
|
||||
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION));
|
||||
} catch (RuntimeException e) {
|
||||
error(R.string.fault_report_preview_unavailable);
|
||||
}
|
||||
}
|
||||
|
||||
private void error(int messageRes) {
|
||||
activity.showError(activity.getString(messageRes));
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
destroyed = true;
|
||||
activity.hidePermissionDialog();
|
||||
if (sourceDialog != null) sourceDialog.dismiss();
|
||||
}
|
||||
}
|
||||
5
app/src/main/res/color/coupon_tab_text.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="#FF6900" android:state_selected="true" />
|
||||
<item android:color="#222222" />
|
||||
</selector>
|
||||
5
app/src/main/res/color/device_preview_switch_track.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true" android:color="#5284E8" />
|
||||
<item android:color="#E1E5EA" />
|
||||
</selector>
|
||||
5
app/src/main/res/color/main_tab_text.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:color="#FF6900" />
|
||||
<item android:color="#222222" />
|
||||
</selector>
|
||||
5
app/src/main/res/color/refund_tab_text.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:color="#FF6900" />
|
||||
<item android:color="#666666" />
|
||||
</selector>
|
||||
10
app/src/main/res/drawable/after_sales_check.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:drawable="@drawable/after_sales_check_mark" />
|
||||
<item>
|
||||
<shape>
|
||||
<size android:width="14dp" android:height="14dp" />
|
||||
<solid android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
14
app/src/main/res/drawable/after_sales_check_mark.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="14dp"
|
||||
android:height="14dp"
|
||||
android:viewportWidth="14"
|
||||
android:viewportHeight="14">
|
||||
<path
|
||||
android:pathData="M1,7 L5,11 L13,2"
|
||||
android:fillColor="@android:color/transparent"
|
||||
android:strokeColor="#333333"
|
||||
android:strokeWidth="1.4"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
5
app/src/main/res/drawable/after_sales_description_bg.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#F5F5F5" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
15
app/src/main/res/drawable/after_sales_option_bg.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true">
|
||||
<shape>
|
||||
<solid android:color="#FFF0E5" />
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="#F5F5F5" />
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/coupon_panel_bg.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/coupon_page_background" />
|
||||
<stroke android:width="2dp" android:color="#FFFFFF" />
|
||||
<corners android:topLeftRadius="30dp" android:topRightRadius="30dp" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/coupon_tab_indicator.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FF6900" />
|
||||
<corners android:radius="3dp" />
|
||||
</shape>
|
||||
6
app/src/main/res/drawable/device_preview_panel_bg.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/device_preview_page_background" />
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
28
app/src/main/res/drawable/device_preview_points_ring.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 原生圆环:灰色底环加绿色示例弧,文字独立显示,后续可通过 level 更新。 -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape
|
||||
android:shape="ring"
|
||||
android:innerRadiusRatio="3"
|
||||
android:thicknessRatio="6"
|
||||
android:useLevel="false">
|
||||
<solid android:color="@color/device_preview_page_background" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<rotate
|
||||
android:fromDegrees="270"
|
||||
android:toDegrees="270"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%">
|
||||
<shape
|
||||
android:shape="ring"
|
||||
android:innerRadiusRatio="3"
|
||||
android:thicknessRatio="6"
|
||||
android:useLevel="true">
|
||||
<solid android:color="#22A45D" />
|
||||
</shape>
|
||||
</rotate>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 首页顶部按钮的白色圆形底板,为 elevation 提供完整的圆形阴影轮廓。 -->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<solid android:color="@android:color/white" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/home_index_status_dot.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_activated="true">
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="#999999" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="#22A45D" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
14
app/src/main/res/drawable/icon_main_food_outline.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="28dp"
|
||||
android:height="28dp"
|
||||
android:viewportWidth="28"
|
||||
android:viewportHeight="28">
|
||||
<path
|
||||
android:pathData="M8,17 L8,14 C2,15 1,8 6,7 C8,2 14,2 17,7 C23,4 27,8 25,12 Q24,15 20,14 L20,17 Q14,15 8,17 M8,20 Q14,18 21,20 L21,24 Q14,22 8,24 Z"
|
||||
android:fillColor="@android:color/transparent"
|
||||
android:strokeColor="#222222"
|
||||
android:strokeWidth="1.4"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/icon_main_food_selected.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:gravity="bottom|end"
|
||||
android:drawable="@drawable/main_tab_glow" />
|
||||
<item android:drawable="@drawable/icon_main_food_outline" />
|
||||
</layer-list>
|
||||
14
app/src/main/res/drawable/icon_main_home_outline.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="28dp"
|
||||
android:height="28dp"
|
||||
android:viewportWidth="28"
|
||||
android:viewportHeight="28">
|
||||
<path
|
||||
android:pathData="M5,10 L14,4 L23,10 Q24,11 24,13 L24,22 Q24,24 22,24 L6,24 Q4,24 4,22 L4,13 Q4,11 5,10 M10,19 L18,19"
|
||||
android:fillColor="@android:color/transparent"
|
||||
android:strokeColor="#222222"
|
||||
android:strokeWidth="1.4"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/icon_main_home_selected.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:gravity="bottom|end"
|
||||
android:drawable="@drawable/main_tab_glow" />
|
||||
<item android:drawable="@drawable/icon_main_home_outline" />
|
||||
</layer-list>
|
||||
14
app/src/main/res/drawable/icon_main_mine_outline.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="28dp"
|
||||
android:height="28dp"
|
||||
android:viewportWidth="28"
|
||||
android:viewportHeight="28">
|
||||
<path
|
||||
android:pathData="M19,9 A5,5 0,1 1,9,9 A5,5 0,1 1,19,9 M8,17 L20,17 Q24,17 24,21 Q24,25 20,25 L8,25 Q4,25 4,21 Q4,17 8,17 Z"
|
||||
android:fillColor="@android:color/transparent"
|
||||
android:strokeColor="#222222"
|
||||
android:strokeWidth="1.4"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/icon_main_mine_selected.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:gravity="bottom|end"
|
||||
android:drawable="@drawable/main_tab_glow" />
|
||||
<item android:drawable="@drawable/icon_main_mine_outline" />
|
||||
</layer-list>
|
||||
14
app/src/main/res/drawable/icon_main_shop_outline.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="28dp"
|
||||
android:height="28dp"
|
||||
android:viewportWidth="28"
|
||||
android:viewportHeight="28">
|
||||
<path
|
||||
android:pathData="M8,4 L20,4 Q22,4 22.5,7 L24,23 Q24,25 21,25 L7,25 Q4,25 4,23 L5.5,7 Q6,4 8,4 Z M10,9 L10,10 Q10,14 14,14 Q18,14 18,10 L18,9"
|
||||
android:fillColor="@android:color/transparent"
|
||||
android:strokeColor="#222222"
|
||||
android:strokeWidth="1.4"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/icon_main_shop_selected.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:gravity="bottom|end"
|
||||
android:drawable="@drawable/main_tab_glow" />
|
||||
<item android:drawable="@drawable/icon_main_shop_outline" />
|
||||
</layer-list>
|
||||
7
app/src/main/res/drawable/main_tab_food_selector.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_selected="true"
|
||||
android:drawable="@drawable/icon_main_food_selected" />
|
||||
<item android:drawable="@drawable/icon_main_food_outline" />
|
||||
</selector>
|
||||
11
app/src/main/res/drawable/main_tab_glow.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||
<gradient
|
||||
android:type="radial"
|
||||
android:centerX="0.5"
|
||||
android:centerY="0.5"
|
||||
android:startColor="#FF6900"
|
||||
android:centerColor="#B3FF6900"
|
||||
android:endColor="#00FF6900"
|
||||
android:gradientRadius="10dp" />
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/main_tab_home_selector.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_selected="true"
|
||||
android:drawable="@drawable/icon_main_home_selected" />
|
||||
<item android:drawable="@drawable/icon_main_home_outline" />
|
||||
</selector>
|
||||
7
app/src/main/res/drawable/main_tab_mine_selector.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_selected="true"
|
||||
android:drawable="@drawable/icon_main_mine_selected" />
|
||||
<item android:drawable="@drawable/icon_main_mine_outline" />
|
||||
</selector>
|
||||
7
app/src/main/res/drawable/main_tab_shop_selector.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_selected="true"
|
||||
android:drawable="@drawable/icon_main_shop_selected" />
|
||||
<item android:drawable="@drawable/icon_main_shop_outline" />
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/order_detail_outline.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FFFFFF" />
|
||||
<corners android:radius="32dp" />
|
||||
<stroke android:width="1dp" android:color="#DCDCE1" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/order_detail_pickup.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FFF0E5" />
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/order_detail_primary.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FF6900" />
|
||||
<corners android:radius="32dp" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/order_detail_tracking.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#F5F5F5" />
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/refund_cancel_bg.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#DCDCE1" />
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/refund_dialog_bg.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FFFFFF" />
|
||||
<corners android:radius="16dp" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/refund_dialog_cancel_bg.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#F5F5F5" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/refund_dialog_confirm_bg.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FF6900" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
15
app/src/main/res/drawable/refund_tab_bg.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true">
|
||||
<shape>
|
||||
<solid android:color="#FFF0E5" />
|
||||
<corners android:radius="24dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="#F5F5F5" />
|
||||
<corners android:radius="24dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
5
app/src/main/res/drawable/review_image_bg.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#F5F5F5" />
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
10
app/src/main/res/drawable/review_star_empty.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#D8D8D8"
|
||||
android:pathData="M12,2 L15.09,8.26 L22,9.27 L17,14.14 L18.18,21.02 L12,17.77 L5.82,21.02 L7,14.14 L2,9.27 L8.91,8.26 Z" />
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/review_star_selected.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF6900"
|
||||
android:pathData="M12,2 L15.09,8.26 L22,9.27 L17,14.14 L18.18,21.02 L12,17.77 L5.82,21.02 L7,14.14 L2,9.27 L8.91,8.26 Z" />
|
||||
</vector>
|
||||
250
app/src/main/res/layout/after_sales_apply_layout.xml
Normal file
@@ -0,0 +1,250 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_after_sales_back"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="13dp"
|
||||
android:src="@mipmap/icon_cart_back"
|
||||
android:contentDescription="@string/my_order_back"
|
||||
android:clickable="true"
|
||||
android:focusable="true" />
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="48dp"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/after_sales_title" />
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- 宽屏限制内容宽度,窄屏及键盘弹出时保留纵向滚动。 -->
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true"
|
||||
android:background="#F5F5F5">
|
||||
|
||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
||||
android:id="@+id/ll_after_sales_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="invisible"
|
||||
app:maxContentWidth="720dp">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_after_sales_goods"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:overScrollMode="never" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/AfterSalesHeading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/after_sales_type" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_after_sales_refund_only"
|
||||
style="@style/AfterSalesOption"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/after_sales_refund_only" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_after_sales_return_refund"
|
||||
style="@style/AfterSalesOption"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/after_sales_return_refund" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_after_sales_exchange"
|
||||
style="@style/AfterSalesOption"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/after_sales_exchange" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/AfterSalesHeading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/after_sales_amount" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_after_sales_amount"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#FF3B30" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_after_sales_max_amount"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#FF3B30" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_after_sales_edit_amount"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="11dp"
|
||||
android:src="@mipmap/icon_fault_report_edit"
|
||||
android:contentDescription="@string/after_sales_edit_amount"
|
||||
android:clickable="true"
|
||||
android:focusable="true" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/AfterSalesHeading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/after_sales_reason" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_after_sales_reason_unwanted"
|
||||
style="@style/AfterSalesOption"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/after_sales_reason_unwanted" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_after_sales_reason_quality"
|
||||
style="@style/AfterSalesOption"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/after_sales_reason_quality" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_after_sales_reason_description"
|
||||
style="@style/AfterSalesOption"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/after_sales_reason_description" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/AfterSalesHeading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/after_sales_description" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_after_sales_description"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="122dp"
|
||||
android:gravity="top|start"
|
||||
android:padding="12dp"
|
||||
android:background="@drawable/after_sales_description_bg"
|
||||
android:hint="@string/after_sales_description_hint"
|
||||
android:inputType="textMultiLine|textCapSentences"
|
||||
android:maxLength="500" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/AfterSalesHeading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/after_sales_evidence" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_after_sales_evidence"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:overScrollMode="never" />
|
||||
</LinearLayout>
|
||||
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingVertical="20dp"
|
||||
android:orientation="vertical"
|
||||
app:maxContentWidth="720dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_after_sales_submit"
|
||||
style="@style/OrderDetailAction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:background="@drawable/order_detail_primary"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="@string/after_sales_submit" />
|
||||
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||
</LinearLayout>
|
||||
64
app/src/main/res/layout/all_goods_fragment.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/f9f9f9"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/CheckoutBold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/main_tab_shop"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<!-- 双列列表独立滚动,支持下拉刷新和上拉分页。 -->
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/refresh_all_goods"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_all_goods"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:paddingStart="28dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="28dp"
|
||||
android:paddingBottom="22dp"
|
||||
android:scrollbars="none"
|
||||
tools:itemCount="6"
|
||||
tools:listitem="@layout/all_goods_item" />
|
||||
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_all_goods"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- 空列表和首屏失败共用提示区,点击即可重新获取第一页。 -->
|
||||
<TextView
|
||||
android:id="@+id/tv_all_goods_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:padding="24dp"
|
||||
android:textColor="@color/points_order_text"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
181
app/src/main/res/layout/coupon_manage_layout.xml
Normal file
@@ -0,0 +1,181 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/coupon_page_background">
|
||||
|
||||
<!-- 礼盒背景延伸至系统状态栏,避免状态栏与标题栏出现色块分界。 -->
|
||||
<ImageView
|
||||
android:id="@+id/iv_coupon_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="230dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@mipmap/icon_coupon_header" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/status_bar_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_coupon_back"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/my_order_back"
|
||||
android:focusable="true"
|
||||
android:paddingHorizontal="22dp"
|
||||
android:paddingVertical="16dp"
|
||||
android:src="@mipmap/icon_cart_back"
|
||||
android:tint="#FFFFFF" />
|
||||
|
||||
<TextView
|
||||
style="@style/CouponText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="54dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/coupon_title"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<!-- 保留手机上的券卡比例,折叠展开或分屏时按窗口宽度自适应。 -->
|
||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/coupon_panel_bg"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="20dp"
|
||||
app:maxContentWidth="720dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="24dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_coupon_my_tab"
|
||||
style="@style/CouponTab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/coupon_my_coupons" />
|
||||
|
||||
<View
|
||||
android:id="@+id/indicator_coupon_my"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="4dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@drawable/coupon_tab_indicator"
|
||||
android:importantForAccessibility="no" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_coupon_get_tab"
|
||||
style="@style/CouponTab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/coupon_get_coupons" />
|
||||
|
||||
<View
|
||||
android:id="@+id/indicator_coupon_get"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="4dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@drawable/coupon_tab_indicator"
|
||||
android:importantForAccessibility="no"
|
||||
android:visibility="invisible" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_coupons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="24dp"
|
||||
android:scrollbars="none" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_coupon_state"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_coupon_state"
|
||||
style="@style/CouponText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="#666666" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_coupon_retry"
|
||||
style="@style/CouponText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:minHeight="44dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:text="@string/coupon_retry"
|
||||
android:textColor="#FF6900"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
29
app/src/main/res/layout/device_preview_title_content.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 本页独立标题样式,避免调整通用标题栏影响其他页面。 -->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="@color/white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
style="@style/DevicePreviewHeading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="48dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:text="@string/device_preview_title" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_back"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/device_preview_back"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="13dp"
|
||||
android:src="@mipmap/img_back_black" />
|
||||
</FrameLayout>
|
||||
61
app/src/main/res/layout/dialog_refund_cancel.xml
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 弹窗文字自然增高,小窗口或横屏时允许滚动。 -->
|
||||
<androidx.core.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/refund_dialog_bg"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/refund_cancel_title" />
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#666666"
|
||||
android:text="@string/refund_cancel_message" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="41dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_dialog_cancel"
|
||||
style="@style/RefundDialogButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/refund_dialog_cancel_bg"
|
||||
android:textColor="#666666"
|
||||
android:text="@string/refund_cancel" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_dialog_confirm"
|
||||
style="@style/RefundDialogButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="11dp"
|
||||
android:background="@drawable/refund_dialog_confirm_bg"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="@string/refund_confirm" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
141
app/src/main/res/layout/include_main_tabs.xml
Normal file
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
app:maxContentWidth="720dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_main_tab_home"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="60dp"
|
||||
android:paddingTop="7dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_main_tab_home"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@drawable/main_tab_home_selector"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_main_tab_home"
|
||||
style="@style/LoginDesignText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:minHeight="15dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/main_tab_home"
|
||||
android:textColor="@color/main_tab_text"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_main_tab_food"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="60dp"
|
||||
android:paddingTop="7dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_main_tab_food"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@drawable/main_tab_food_selector"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_main_tab_food"
|
||||
style="@style/LoginDesignText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:minHeight="15dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/main_tab_food"
|
||||
android:textColor="@color/main_tab_text"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_main_tab_shop"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="60dp"
|
||||
android:paddingTop="7dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_main_tab_shop"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@drawable/main_tab_shop_selector"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_main_tab_shop"
|
||||
style="@style/LoginDesignText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:minHeight="15dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/main_tab_shop"
|
||||
android:textColor="@color/main_tab_text"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_main_tab_mine"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="60dp"
|
||||
android:paddingTop="7dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_main_tab_mine"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:src="@drawable/main_tab_mine_selector"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_main_tab_mine"
|
||||
style="@style/LoginDesignText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:minHeight="15dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/main_tab_mine"
|
||||
android:textColor="@color/main_tab_text"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||
99
app/src/main/res/layout/item_coupon.xml
Normal file
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:minHeight="91dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/icon_coupon_amount_bg"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="4dp"
|
||||
android:paddingVertical="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_coupon_manage_amount"
|
||||
style="@style/CouponText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_coupon_manage_type"
|
||||
style="@style/CouponText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@mipmap/icon_coupon_content_bg"
|
||||
android:minHeight="91dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_coupon_manage_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_coupon_manage_title"
|
||||
style="@style/CouponText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_coupon_manage_description"
|
||||
style="@style/CouponText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_coupon_manage_validity"
|
||||
style="@style/CouponText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="22dp"
|
||||
android:textColor="#666666"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_coupon_manage_claim"
|
||||
style="@style/CouponText"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:background="@mipmap/icon_coupon_claim_bg"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:paddingHorizontal="4dp"
|
||||
android:paddingVertical="8dp"
|
||||
android:text="@string/coupon_get_now"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
91
app/src/main/res/layout/item_my_review.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 历史评价仅展示星级,不使用可交互评分条。 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_my_review_stars"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="14dp"
|
||||
android:orientation="horizontal"
|
||||
android:importantForAccessibility="yes" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="56dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:padding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@drawable/review_image_bg">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_my_review_goods"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_my_review_goods_name"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_my_review_spec"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#666666" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_my_review_price"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:textColor="#E5484D"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_my_review_comment"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<!-- 图片使用稿中 80dp 尺寸,数量动态增减,窄窗口和折叠屏自动换行。 -->
|
||||
<com.ckkj.griddle.custom.view.FaultReportOptionsLayout
|
||||
android:id="@+id/flow_my_review_images"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
75
app/src/main/res/layout/item_refund.xml
Normal file
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#FFFFFF"
|
||||
android:padding="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="top">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_number"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#666666" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_status"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:gravity="end" />
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/include_refund_goods"
|
||||
layout="@layout/item_my_order_goods"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="#DDDDDD" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="33dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_type"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#666666" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_cancel_request"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:minHeight="33dp"
|
||||
android:paddingHorizontal="20dp"
|
||||
android:paddingVertical="7dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/refund_cancel_bg"
|
||||
android:text="@string/refund_cancel_request"
|
||||
android:clickable="true"
|
||||
android:focusable="true" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
69
app/src/main/res/layout/item_review_image.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_review_image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/review_image_bg"
|
||||
android:clipToOutline="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:contentDescription="@string/review_preview_photo"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_review_add_image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/review_image_bg"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_review_image"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_review_image"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_review_image"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_review_image">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:src="@mipmap/icon_review_add"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="7dp"
|
||||
android:paddingHorizontal="4dp"
|
||||
android:gravity="center"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#666666"
|
||||
android:text="@string/review_add_photo" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_review_delete_image"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/bg_fault_report_delete"
|
||||
android:padding="6dp"
|
||||
android:src="@drawable/ic_fault_report_delete"
|
||||
android:contentDescription="@string/review_delete_photo"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
546
app/src/main/res/layout/my_order_detail_layout.xml
Normal file
@@ -0,0 +1,546 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_detail_back"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="13dp"
|
||||
android:src="@mipmap/icon_cart_back"
|
||||
android:contentDescription="@string/my_order_back"
|
||||
android:clickable="true"
|
||||
android:focusable="true" />
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="48dp"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/order_detail_title" />
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- 限制展开屏内容宽度;窄屏和大字体通过滚动完整展示。 -->
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true"
|
||||
android:background="#F5F5F5">
|
||||
|
||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
||||
android:id="@+id/ll_detail_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="invisible"
|
||||
app:maxContentWidth="720dp">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_status"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_auto_receive"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/order_detail_auto_receive"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textColor="#808080"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_detail_tracking"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:padding="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@drawable/order_detail_tracking"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_tracking"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#808080" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_detail_copy"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:padding="9dp"
|
||||
android:src="@mipmap/icon_order_tracking_copy"
|
||||
android:contentDescription="@string/order_detail_copy"
|
||||
android:clickable="true"
|
||||
android:focusable="true" />
|
||||
</LinearLayout>
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/scroll_detail_pickup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="33dp"
|
||||
android:padding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@drawable/order_detail_pickup">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="8dp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/my_order_pickup_code" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_detail_digits"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" />
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_detail_delivery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@mipmap/icon_checkout_address"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_address"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#808080" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_recipient"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:rotation="180"
|
||||
android:src="@mipmap/icon_cart_back"
|
||||
android:tint="#999999"
|
||||
android:importantForAccessibility="no" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_detail_store"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_detail_store"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@mipmap/icon_pickup_store_avatar"
|
||||
android:importantForAccessibility="no" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_store"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_phone"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:drawableStart="@mipmap/icon_pickup_phone"
|
||||
android:drawablePadding="6dp"
|
||||
android:textColor="#808080"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_store_address"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:drawableStart="@mipmap/icon_pickup_location"
|
||||
android:drawablePadding="6dp"
|
||||
android:textColor="#808080"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:rotation="180"
|
||||
android:src="@mipmap/icon_cart_back"
|
||||
android:tint="#999999"
|
||||
android:importantForAccessibility="no" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_detail_goods"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:overScrollMode="never" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row_subtotal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="10dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#808080"
|
||||
android:text="@string/order_detail_subtotal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_subtotal"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row_coupon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="10dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#808080"
|
||||
android:text="@string/order_detail_coupon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_coupon"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#FF3B30" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row_points"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="10dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#808080"
|
||||
android:text="@string/order_detail_points" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_points"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#FF3B30" />
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="#EEEEEE" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row_payable"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="10dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#808080"
|
||||
android:text="@string/order_detail_payable" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_payable"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row_number"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="10dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#808080"
|
||||
android:text="@string/order_detail_order_no" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_number"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="10dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#808080"
|
||||
android:text="@string/order_detail_payment_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_time"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row_method"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="10dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#808080"
|
||||
android:text="@string/order_detail_payment_method" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_method"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row_reference"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="10dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#808080"
|
||||
android:text="@string/order_detail_payment_reference" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_reference"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row_order_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="10dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#808080"
|
||||
android:text="@string/order_detail_status" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_order_status"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
||||
android:id="@+id/ll_detail_actions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingVertical="20dp"
|
||||
android:background="#F5F5F5"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal"
|
||||
app:maxContentWidth="720dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_after_sales"
|
||||
style="@style/OrderDetailAction"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/my_order_after_sales" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail_action"
|
||||
style="@style/OrderDetailAction"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/order_detail_primary"
|
||||
android:textColor="#FFFFFF"
|
||||
android:visibility="gone" />
|
||||
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||
</LinearLayout>
|
||||
125
app/src/main/res/layout/my_refund_layout.xml
Normal file
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="vertical">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_refund_back"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="13dp"
|
||||
android:src="@mipmap/icon_cart_back"
|
||||
android:contentDescription="@string/my_order_back"
|
||||
android:clickable="true"
|
||||
android:focusable="true" />
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="48dp"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/refund_title" />
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- 长英文标签横向滚动,避免窄屏和大字体时被截断。 -->
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingVertical="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_all"
|
||||
style="@style/RefundTab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/refund_all" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_pending"
|
||||
style="@style/RefundTab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:text="@string/refund_pending" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_approved"
|
||||
style="@style/RefundTab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:text="@string/refund_approved" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_rejected"
|
||||
style="@style/RefundTab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:text="@string/refund_rejected" />
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#F5F5F5">
|
||||
|
||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
app:maxContentWidth="720dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_count"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="39dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="#666666" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_refunds"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:paddingBottom="16dp"
|
||||
android:clipToPadding="false" />
|
||||
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_state"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="16dp"
|
||||
android:textColor="#999999"
|
||||
android:text="@string/refund_empty"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
81
app/src/main/res/layout/my_reviews_layout.xml
Normal file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_my_reviews_back"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="13dp"
|
||||
android:src="@mipmap/icon_cart_back"
|
||||
android:contentDescription="@string/my_order_back"
|
||||
android:clickable="true"
|
||||
android:focusable="true" />
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="48dp"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/my_reviews_title" />
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#F5F5F5">
|
||||
|
||||
<!-- 展开屏居中限宽;评价列表独立滚动,不在外层嵌套滚动容器。 -->
|
||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
app:maxContentWidth="720dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_my_reviews_count"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="39dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="10dp"
|
||||
android:textColor="#666666" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_my_reviews"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="16dp" />
|
||||
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_my_reviews_state"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="16dp"
|
||||
android:textColor="#999999"
|
||||
android:text="@string/my_reviews_empty"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
146
app/src/main/res/layout/product_review_layout.xml
Normal file
@@ -0,0 +1,146 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_review_back"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="13dp"
|
||||
android:src="@mipmap/icon_cart_back"
|
||||
android:contentDescription="@string/my_order_back"
|
||||
android:clickable="true"
|
||||
android:focusable="true" />
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="48dp"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/review_title" />
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- 评论、两行图片和评分随内容滚动,提交按钮固定在底部。 -->
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true"
|
||||
android:background="#F5F5F5">
|
||||
|
||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
||||
android:id="@+id/ll_review_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="invisible"
|
||||
app:maxContentWidth="720dp">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_review_goods"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:overScrollMode="never" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_review_comment"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="126dp"
|
||||
android:padding="0dp"
|
||||
android:gravity="top|start"
|
||||
android:background="@null"
|
||||
android:hint="@string/review_comment_hint"
|
||||
android:textColorHint="#999999"
|
||||
android:inputType="textMultiLine|textCapSentences"
|
||||
android:maxLength="500" />
|
||||
|
||||
<!-- 三列等宽正方形;最多六张图片,满额后不再显示添加卡片。 -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_review_images"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:overScrollMode="never" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.ckkj.griddle.custom.view.FaultReportOptionsLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="51dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:background="#FFFFFF">
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="51dp"
|
||||
android:paddingEnd="50dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/review_rating_label" />
|
||||
|
||||
<com.ckkj.griddle.review.widget.ReviewRatingBar
|
||||
android:id="@+id/rating_review_goods"
|
||||
android:layout_width="170dp"
|
||||
android:layout_height="51dp"
|
||||
android:numStars="5"
|
||||
android:stepSize="1"
|
||||
android:rating="0"
|
||||
android:isIndicator="false"
|
||||
android:contentDescription="@string/review_rating" />
|
||||
</com.ckkj.griddle.custom.view.FaultReportOptionsLayout>
|
||||
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingVertical="16dp"
|
||||
android:background="#F5F5F5"
|
||||
android:orientation="vertical"
|
||||
app:maxContentWidth="720dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_review_submit"
|
||||
style="@style/OrderDetailAction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:background="@drawable/order_detail_primary"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="@string/review_submit" />
|
||||
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||
</LinearLayout>
|
||||
304
app/src/main/res/layout/refund_detail_layout.xml
Normal file
@@ -0,0 +1,304 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFFFFF"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_refund_detail_back"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/my_order_back"
|
||||
android:focusable="true"
|
||||
android:padding="13dp"
|
||||
android:src="@mipmap/icon_cart_back" />
|
||||
|
||||
<TextView
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="48dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/refund_detail_title"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#F5F5F5">
|
||||
|
||||
<!-- 展开屏幕限制内容宽度;窄屏中字段换行,凭证按可用宽度自动折行。 -->
|
||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
app:maxContentWidth="720dp">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/scroll_refund_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="16dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/RefundDetailInfoRow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp">
|
||||
|
||||
<TextView
|
||||
style="@style/RefundDetailLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.42"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/refund_detail_number" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_detail_number"
|
||||
style="@style/RefundDetailValue"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.58"
|
||||
android:gravity="end" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/RefundDetailInfoRow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/RefundDetailLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.42"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/refund_detail_status" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_detail_status"
|
||||
style="@style/RefundDetailValue"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.58"
|
||||
android:gravity="end" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/RefundDetailInfoRow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/RefundDetailLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.42"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/refund_detail_applied_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_detail_applied_time"
|
||||
style="@style/RefundDetailValue"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.58"
|
||||
android:gravity="end" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 只有已通过、已拒绝显示审核时间和审核备注。 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_refund_detail_review"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/RefundDetailInfoRow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/RefundDetailLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.42"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/refund_detail_reviewed_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_detail_reviewed_time"
|
||||
style="@style/RefundDetailValue"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.58"
|
||||
android:gravity="end" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
style="@style/RefundDetailLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/refund_detail_review_remark" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_detail_review_remark"
|
||||
style="@style/RefundDetailValue"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include
|
||||
android:id="@+id/include_refund_detail_goods"
|
||||
layout="@layout/item_my_order_goods" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/OrderDetailSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/RefundDetailLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/refund_detail_type" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_detail_type"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp" />
|
||||
|
||||
<View
|
||||
style="@style/RefundDetailDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp" />
|
||||
|
||||
<TextView
|
||||
style="@style/RefundDetailLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/refund_detail_reason" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_detail_reason"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp" />
|
||||
|
||||
<View
|
||||
style="@style/RefundDetailDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp" />
|
||||
|
||||
<TextView
|
||||
style="@style/RefundDetailLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/refund_detail_description" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_detail_description"
|
||||
style="@style/MyOrderText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp" />
|
||||
|
||||
<View
|
||||
style="@style/RefundDetailDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp" />
|
||||
|
||||
<TextView
|
||||
style="@style/RefundDetailLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/refund_detail_evidence" />
|
||||
|
||||
<com.ckkj.griddle.custom.view.FaultReportOptionsLayout
|
||||
android:id="@+id/flow_refund_detail_evidence"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_detail_no_evidence"
|
||||
style="@style/RefundDetailLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/refund_detail_no_evidence"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_refund_detail_actions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_detail_cancel"
|
||||
style="@style/OrderDetailAction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/refund_cancel_request" />
|
||||
</LinearLayout>
|
||||
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_refund_detail_error"
|
||||
style="@style/RefundDetailLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="24dp"
|
||||
android:text="@string/refund_detail_load_failed"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
BIN
app/src/main/res/mipmap-xhdpi/bg_food_banner_scrim.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/mipmap-xhdpi/icon_coupon_amount_bg.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
app/src/main/res/mipmap-xhdpi/icon_coupon_claim_bg.png
Normal file
|
After Width: | Height: | Size: 13 KiB |