更新
This commit is contained in:
629
.lanhu/after_sales/specs.json
Normal file
629
.lanhu/after_sales/specs.json
Normal file
File diff suppressed because one or more lines are too long
BIN
.lanhu/after_sales/申请售后.png
Normal file
BIN
.lanhu/after_sales/申请售后.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 181 KiB |
50
.lanhu/promo/background_slice.json
Normal file
50
.lanhu/promo/background_slice.json
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"status": "success",
|
||||||
|
"design_id": "5b290b9c-2247-45fd-a0ea-f4383a97364a",
|
||||||
|
"design_name": "推广码",
|
||||||
|
"version": "3e734bc2-fb0e-478e-bfdd-e4392a80dea3",
|
||||||
|
"canvas_size": {
|
||||||
|
"width": 196.5,
|
||||||
|
"height": 426
|
||||||
|
},
|
||||||
|
"total_slices": 1,
|
||||||
|
"slices": [
|
||||||
|
{
|
||||||
|
"id": "177:6394",
|
||||||
|
"name": "矩形 337",
|
||||||
|
"type": "shapeLayer",
|
||||||
|
"download_url": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png",
|
||||||
|
"size": "393x742",
|
||||||
|
"format": "png",
|
||||||
|
"svg_url": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSliceSVGf70f9e3a-b84f-440b-91f9-fc2ce4cb31bc.svg",
|
||||||
|
"scale_urls": {
|
||||||
|
"1x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_393,h_742/format,png",
|
||||||
|
"2x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_786,h_1484/format,png",
|
||||||
|
"3x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_1179,h_2226/format,png",
|
||||||
|
"ios_1x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_393,h_742/format,png",
|
||||||
|
"ios_2x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_786,h_1484/format,png",
|
||||||
|
"ios_3x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_1179,h_2226/format,png",
|
||||||
|
"android_mdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_393,h_742/format,png",
|
||||||
|
"android_hdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_590,h_1113/format,png",
|
||||||
|
"android_xhdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_786,h_1484/format,png",
|
||||||
|
"android_xxhdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_1179,h_2226/format,png",
|
||||||
|
"android_xxxhdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png"
|
||||||
|
},
|
||||||
|
"logical_size": {
|
||||||
|
"width": 393,
|
||||||
|
"height": 742,
|
||||||
|
"note": "1x logical px; stored at 4x = 1572x2968px"
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 110
|
||||||
|
},
|
||||||
|
"parent_name": "推广码",
|
||||||
|
"layer_path": "推广码/矩形 337",
|
||||||
|
"metadata": {
|
||||||
|
"opacity": 1,
|
||||||
|
"border_radius": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
3
.lanhu/promo/names.json
Normal file
3
.lanhu/promo/names.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"177:6394": "icon_mine_promo_background"
|
||||||
|
}
|
||||||
87
.lanhu/promo/slices.json
Normal file
87
.lanhu/promo/slices.json
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"status": "success",
|
||||||
|
"design_id": "5b290b9c-2247-45fd-a0ea-f4383a97364a",
|
||||||
|
"design_name": "推广码",
|
||||||
|
"version": "3e734bc2-fb0e-478e-bfdd-e4392a80dea3",
|
||||||
|
"canvas_size": {
|
||||||
|
"width": 196.5,
|
||||||
|
"height": 426
|
||||||
|
},
|
||||||
|
"total_slices": 2,
|
||||||
|
"slices": [
|
||||||
|
{
|
||||||
|
"id": "177:6394",
|
||||||
|
"name": "矩形 337",
|
||||||
|
"type": "shapeLayer",
|
||||||
|
"download_url": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png",
|
||||||
|
"size": "393x742",
|
||||||
|
"format": "png",
|
||||||
|
"svg_url": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSliceSVGf70f9e3a-b84f-440b-91f9-fc2ce4cb31bc.svg",
|
||||||
|
"scale_urls": {
|
||||||
|
"1x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_393,h_742/format,png",
|
||||||
|
"2x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_786,h_1484/format,png",
|
||||||
|
"3x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_1179,h_2226/format,png",
|
||||||
|
"ios_1x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_393,h_742/format,png",
|
||||||
|
"ios_2x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_786,h_1484/format,png",
|
||||||
|
"ios_3x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_1179,h_2226/format,png",
|
||||||
|
"android_mdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_393,h_742/format,png",
|
||||||
|
"android_hdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_590,h_1113/format,png",
|
||||||
|
"android_xhdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_786,h_1484/format,png",
|
||||||
|
"android_xxhdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png?x-oss-process=image/resize,w_1179,h_2226/format,png",
|
||||||
|
"android_xxxhdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGf7a02fe35b5800dc8588629ec5a2ee04.png"
|
||||||
|
},
|
||||||
|
"logical_size": {
|
||||||
|
"width": 393,
|
||||||
|
"height": 742,
|
||||||
|
"note": "1x logical px; stored at 4x = 1572x2968px"
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 110
|
||||||
|
},
|
||||||
|
"parent_name": "推广码",
|
||||||
|
"layer_path": "推广码/矩形 337",
|
||||||
|
"metadata": {
|
||||||
|
"opacity": 1,
|
||||||
|
"border_radius": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "177:7027",
|
||||||
|
"name": "矩形 338",
|
||||||
|
"type": "shapeLayer",
|
||||||
|
"download_url": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png",
|
||||||
|
"size": "393x742",
|
||||||
|
"format": "png",
|
||||||
|
"svg_url": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSliceSVG1e588f07-5b70-445b-b31e-5b056ae443d5.svg",
|
||||||
|
"scale_urls": {
|
||||||
|
"1x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png?x-oss-process=image/resize,w_393,h_742/format,png",
|
||||||
|
"2x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png?x-oss-process=image/resize,w_786,h_1484/format,png",
|
||||||
|
"3x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png?x-oss-process=image/resize,w_1179,h_2226/format,png",
|
||||||
|
"ios_1x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png?x-oss-process=image/resize,w_393,h_742/format,png",
|
||||||
|
"ios_2x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png?x-oss-process=image/resize,w_786,h_1484/format,png",
|
||||||
|
"ios_3x": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png?x-oss-process=image/resize,w_1179,h_2226/format,png",
|
||||||
|
"android_mdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png?x-oss-process=image/resize,w_393,h_742/format,png",
|
||||||
|
"android_hdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png?x-oss-process=image/resize,w_590,h_1113/format,png",
|
||||||
|
"android_xhdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png?x-oss-process=image/resize,w_786,h_1484/format,png",
|
||||||
|
"android_xxhdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png?x-oss-process=image/resize,w_1179,h_2226/format,png",
|
||||||
|
"android_xxxhdpi": "https://lanhu-oss-2537-2.lanhuapp.com/MasterSlicePNGe1b752df20c1d2c6ef023b9202ffd647.png"
|
||||||
|
},
|
||||||
|
"logical_size": {
|
||||||
|
"width": 393,
|
||||||
|
"height": 742,
|
||||||
|
"note": "1x logical px; stored at 4x = 1572x2968px"
|
||||||
|
},
|
||||||
|
"position": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 110
|
||||||
|
},
|
||||||
|
"parent_name": "推广码",
|
||||||
|
"layer_path": "推广码/矩形 338",
|
||||||
|
"metadata": {
|
||||||
|
"opacity": 1,
|
||||||
|
"border_radius": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
1
.lanhu/promo/specs/推广码.html
Normal file
1
.lanhu/promo/specs/推广码.html
Normal file
File diff suppressed because one or more lines are too long
365
.lanhu/promo/specs/推广码_specs.json
Normal file
365
.lanhu/promo/specs/推广码_specs.json
Normal file
File diff suppressed because one or more lines are too long
BIN
.lanhu/promo/推广码.png
Normal file
BIN
.lanhu/promo/推广码.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 335 KiB |
@@ -198,11 +198,11 @@
|
|||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".point.PointsOrderActivity"
|
android:name=".order.PointsOrderActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".point.PointsOrderDetailActivity"
|
android:name=".order.PointsOrderDetailActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
@@ -223,6 +223,9 @@
|
|||||||
android:name=".mine.PersonalInfoActivity"
|
android:name=".mine.PersonalInfoActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".mine.PromoCodeActivity"
|
||||||
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".carbon.CarbonPointsActivity"
|
android:name=".carbon.CarbonPointsActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import com.ckkj.griddle.R;
|
|||||||
import com.ckkj.griddle.base.BaseActivity;
|
import com.ckkj.griddle.base.BaseActivity;
|
||||||
import com.ckkj.griddle.databinding.AddressEditLayoutBinding;
|
import com.ckkj.griddle.databinding.AddressEditLayoutBinding;
|
||||||
import com.ckkj.griddle.mine.entity.ShippingAddressEntity;
|
import com.ckkj.griddle.mine.entity.ShippingAddressEntity;
|
||||||
import com.ckkj.griddle.mine.mvp.MineContract;
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
import com.ckkj.griddle.mine.mvp.MineImpl;
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
import com.ckkj.griddle.mine.mvp.MinePresenter;
|
import com.ckkj.griddle.mine.mvp.mine.MinePresenter;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import android.view.View;
|
|||||||
import com.ckkj.griddle.R;
|
import com.ckkj.griddle.R;
|
||||||
import com.ckkj.griddle.base.BaseActivity;
|
import com.ckkj.griddle.base.BaseActivity;
|
||||||
import com.ckkj.griddle.databinding.ChangeEmailLayoutBinding;
|
import com.ckkj.griddle.databinding.ChangeEmailLayoutBinding;
|
||||||
import com.ckkj.griddle.mine.mvp.MineContract;
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
import com.ckkj.griddle.mine.mvp.MineImpl;
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
import com.ckkj.griddle.mine.mvp.MinePresenter;
|
import com.ckkj.griddle.mine.mvp.mine.MinePresenter;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import com.ckkj.griddle.R;
|
|||||||
import com.ckkj.griddle.base.BaseActivity;
|
import com.ckkj.griddle.base.BaseActivity;
|
||||||
import com.ckkj.griddle.base.entity.UserInfoEntity;
|
import com.ckkj.griddle.base.entity.UserInfoEntity;
|
||||||
import com.ckkj.griddle.databinding.ChangePhoneLayoutBinding;
|
import com.ckkj.griddle.databinding.ChangePhoneLayoutBinding;
|
||||||
import com.ckkj.griddle.mine.mvp.MineContract;
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
import com.ckkj.griddle.mine.mvp.MineImpl;
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
import com.ckkj.griddle.mine.mvp.MinePresenter;
|
import com.ckkj.griddle.mine.mvp.mine.MinePresenter;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ import com.ckkj.griddle.base.entity.UserInfoEntity;
|
|||||||
import com.ckkj.griddle.databinding.MineFragmentLayoutBinding;
|
import com.ckkj.griddle.databinding.MineFragmentLayoutBinding;
|
||||||
import com.ckkj.griddle.dialog.CustomerServiceDialog;
|
import com.ckkj.griddle.dialog.CustomerServiceDialog;
|
||||||
import com.ckkj.griddle.fault.DeviceFaultLHistoryActivity;
|
import com.ckkj.griddle.fault.DeviceFaultLHistoryActivity;
|
||||||
import com.ckkj.griddle.mine.mvp.MineContract;
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
import com.ckkj.griddle.mine.mvp.MineImpl;
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
import com.ckkj.griddle.mine.mvp.MinePresenter;
|
import com.ckkj.griddle.mine.mvp.mine.MinePresenter;
|
||||||
import com.ckkj.griddle.mine.order.MyOrderActivity;
|
import com.ckkj.griddle.mine.order.MyOrderActivity;
|
||||||
import com.ckkj.griddle.mine.share.ShareEarningsActivity;
|
import com.ckkj.griddle.mine.share.ShareEarningsActivity;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
@@ -41,7 +41,7 @@ public class MineFragment extends BaseFragment<MineFragmentLayoutBinding, MinePr
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OnClick({R.id.cv_mine_profile, R.id.ll_mine_devices, R.id.btn_points_history,
|
@OnClick({R.id.cv_mine_profile, R.id.ll_mine_devices, R.id.btn_points_history,
|
||||||
R.id.ll_mine_addresses, R.id.ll_mine_shares,
|
R.id.btn_promo, R.id.ll_mine_addresses, R.id.ll_mine_shares,
|
||||||
R.id.ll_mine_repairs, R.id.ll_mine_cart, R.id.ll_mine_orders, R.id.ll_mine_reviews,
|
R.id.ll_mine_repairs, R.id.ll_mine_cart, R.id.ll_mine_orders, R.id.ll_mine_reviews,
|
||||||
R.id.ll_mine_refunds, R.id.ll_mine_coupons, R.id.ll_mine_service})
|
R.id.ll_mine_refunds, R.id.ll_mine_coupons, R.id.ll_mine_service})
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -74,6 +74,10 @@ public class MineFragment extends BaseFragment<MineFragmentLayoutBinding, MinePr
|
|||||||
goTo(mContext, PointsHistoryActivity.class, null);
|
goTo(mContext, PointsHistoryActivity.class, null);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case R.id.btn_promo:
|
||||||
|
goTo(mContext, PromoCodeActivity.class, null);
|
||||||
|
break;
|
||||||
|
|
||||||
case R.id.ll_mine_addresses:
|
case R.id.ll_mine_addresses:
|
||||||
// 个人中心进入收货地址管理,后续新增和编辑在列表页继续发起。
|
// 个人中心进入收货地址管理,后续新增和编辑在列表页继续发起。
|
||||||
goTo(mContext, ShippingAddressActivity.class, null);
|
goTo(mContext, ShippingAddressActivity.class, null);
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import com.ckkj.griddle.base.BaseActivity;
|
|||||||
import com.ckkj.griddle.databinding.MyDevicesLayoutBinding;
|
import com.ckkj.griddle.databinding.MyDevicesLayoutBinding;
|
||||||
import com.ckkj.griddle.mine.adapter.MyDevicesAdapter;
|
import com.ckkj.griddle.mine.adapter.MyDevicesAdapter;
|
||||||
import com.ckkj.griddle.mine.entity.MyDevicesEntity;
|
import com.ckkj.griddle.mine.entity.MyDevicesEntity;
|
||||||
import com.ckkj.griddle.mine.mvp.MineContract;
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
import com.ckkj.griddle.mine.mvp.MineImpl;
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
import com.ckkj.griddle.mine.mvp.MinePresenter;
|
import com.ckkj.griddle.mine.mvp.mine.MinePresenter;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ import com.ckkj.griddle.R;
|
|||||||
import com.ckkj.griddle.base.BaseActivity;
|
import com.ckkj.griddle.base.BaseActivity;
|
||||||
import com.ckkj.griddle.base.entity.UserInfoEntity;
|
import com.ckkj.griddle.base.entity.UserInfoEntity;
|
||||||
import com.ckkj.griddle.databinding.PersonalInfoLayoutBinding;
|
import com.ckkj.griddle.databinding.PersonalInfoLayoutBinding;
|
||||||
import com.ckkj.griddle.mine.mvp.MineContract;
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
import com.ckkj.griddle.mine.mvp.MineImpl;
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
import com.ckkj.griddle.mine.mvp.MinePresenter;
|
import com.ckkj.griddle.mine.mvp.mine.MinePresenter;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import com.ckkj.griddle.databinding.PointsHistoryLayoutBinding;
|
|||||||
import com.ckkj.griddle.main.activity.MainActivity;
|
import com.ckkj.griddle.main.activity.MainActivity;
|
||||||
import com.ckkj.griddle.mine.adapter.PointsHistoryMonthAdapter;
|
import com.ckkj.griddle.mine.adapter.PointsHistoryMonthAdapter;
|
||||||
import com.ckkj.griddle.mine.entity.PointsHistoryEntity;
|
import com.ckkj.griddle.mine.entity.PointsHistoryEntity;
|
||||||
import com.ckkj.griddle.mine.mvp.MineContract;
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
import com.ckkj.griddle.mine.mvp.MineImpl;
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
import com.ckkj.griddle.mine.mvp.MinePresenter;
|
import com.ckkj.griddle.mine.mvp.mine.MinePresenter;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|||||||
365
app/src/main/java/com/ckkj/griddle/mine/PromoCodeActivity.java
Normal file
365
app/src/main/java/com/ckkj/griddle/mine/PromoCodeActivity.java
Normal file
@@ -0,0 +1,365 @@
|
|||||||
|
package com.ckkj.griddle.mine;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.ContentResolver;
|
||||||
|
import android.content.ContentValues;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.media.MediaScannerConnection;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.DataSource;
|
||||||
|
import com.bumptech.glide.load.engine.GlideException;
|
||||||
|
import com.bumptech.glide.request.RequestListener;
|
||||||
|
import com.bumptech.glide.request.target.Target;
|
||||||
|
import com.ckkj.griddle.R;
|
||||||
|
import com.ckkj.griddle.base.BaseActivity;
|
||||||
|
import com.ckkj.griddle.base.BaseFragment;
|
||||||
|
import com.ckkj.griddle.base.entity.UserInfoEntity;
|
||||||
|
import com.ckkj.griddle.databinding.PromoCodeLayoutBinding;
|
||||||
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
|
import com.ckkj.griddle.mine.mvp.mine.MinePresenter;
|
||||||
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
|
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||||
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
import butterknife.OnClick;
|
||||||
|
import butterknife.OnLongClick;
|
||||||
|
|
||||||
|
/** 我的推广码:复用个人中心资料,支持更换海报背景和长按保存图片。 */
|
||||||
|
public class PromoCodeActivity extends BaseActivity<PromoCodeLayoutBinding, MinePresenter>
|
||||||
|
implements MineContract.MineView {
|
||||||
|
|
||||||
|
private static final String TAG = "PromoCodeActivity";
|
||||||
|
private static final String STATE_BACKGROUND = "promo_code_background";
|
||||||
|
private final ExecutorService saveExecutor = Executors.newSingleThreadExecutor();
|
||||||
|
private String inviteCode = "";
|
||||||
|
private String backgroundUri = "";
|
||||||
|
private boolean backgroundLoading;
|
||||||
|
private boolean saving;
|
||||||
|
|
||||||
|
// 只访问用户主动选择的图片,不申请整个相册的读取权限。
|
||||||
|
private final ActivityResultLauncher<String[]> backgroundLauncher = registerForActivityResult(
|
||||||
|
new ActivityResultContracts.OpenDocument(), uri -> {
|
||||||
|
if (uri == null) return;
|
||||||
|
try {
|
||||||
|
getContentResolver().takePersistableUriPermission(
|
||||||
|
uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
} catch (SecurityException exception) {
|
||||||
|
// 部分文件提供方只授予临时访问权,当前页面仍可展示所选图片。
|
||||||
|
Log.w(TAG, "无法保留背景图片的长期访问权限", exception);
|
||||||
|
}
|
||||||
|
backgroundUri = uri.toString();
|
||||||
|
renderBackground();
|
||||||
|
});
|
||||||
|
|
||||||
|
private final ActivityResultLauncher<String> storagePermissionLauncher = registerForActivityResult(
|
||||||
|
new ActivityResultContracts.RequestPermission(), granted -> {
|
||||||
|
hidePermissionDialog();
|
||||||
|
if (granted) {
|
||||||
|
savePoster();
|
||||||
|
} else {
|
||||||
|
showError(getString(R.string.promo_code_storage_denied));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MinePresenter createPresenter() {
|
||||||
|
return new MinePresenter(new MineImpl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLayoutResId(Bundle savedInstanceState) {
|
||||||
|
return R.layout.promo_code_layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initData(Bundle savedInstanceState) {
|
||||||
|
super.initData(savedInstanceState);
|
||||||
|
// 标题栏与状态栏保持白色,避免顶部出现色差。
|
||||||
|
ImmersionBar.with(this).statusBarColor(R.color.white)
|
||||||
|
.statusBarDarkFont(true).navigationBarColor(R.color.white).init();
|
||||||
|
mPresenter.loadProfile();
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
backgroundUri = savedInstanceState.getString(STATE_BACKGROUND, "");
|
||||||
|
if (!TextUtils.isEmpty(backgroundUri)) renderBackground();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnClick({R.id.img_back, R.id.btn_promo_change_background})
|
||||||
|
public void onClick(View v) {
|
||||||
|
switch (v.getId()) {
|
||||||
|
case R.id.img_back:
|
||||||
|
finish();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.btn_promo_change_background:
|
||||||
|
selectBackground();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnLongClick({R.id.fl_promo_poster})
|
||||||
|
public boolean onPosterLongClick(View v) {
|
||||||
|
requestSavePoster();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showProfile(@Nullable UserInfoEntity userInfo) {
|
||||||
|
inviteCode = userInfo == null || userInfo.getInviteCode() == null
|
||||||
|
? "" : userInfo.getInviteCode().trim();
|
||||||
|
LinearLayout container = viewBinding.llPromoCodeCharacters;
|
||||||
|
container.removeAllViews();
|
||||||
|
boolean empty = TextUtils.isEmpty(inviteCode);
|
||||||
|
viewBinding.tvPromoCodeEmpty.setVisibility(empty ? View.VISIBLE : View.GONE);
|
||||||
|
container.setContentDescription(empty ? getString(R.string.promo_code_empty)
|
||||||
|
: getString(R.string.promo_code_accessibility, inviteCode));
|
||||||
|
// 按实际字符数等分宽度,不截断邀请码;空资料展示六个占位格。
|
||||||
|
int count = empty ? 6 : inviteCode.length();
|
||||||
|
int gap = Math.round(11 * getResources().getDisplayMetrics().density);
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
TextView character = (TextView) getLayoutInflater().inflate(
|
||||||
|
R.layout.item_promo_code_character, container, false);
|
||||||
|
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) character.getLayoutParams();
|
||||||
|
params.setMarginStart(i == 0 ? 0 : gap);
|
||||||
|
character.setLayoutParams(params);
|
||||||
|
character.setText(empty ? "—" : inviteCode.substring(i, i + 1));
|
||||||
|
container.addView(character);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectBackground() {
|
||||||
|
if (saving) return;
|
||||||
|
try {
|
||||||
|
backgroundLauncher.launch(new String[]{"image/*"});
|
||||||
|
} catch (ActivityNotFoundException exception) {
|
||||||
|
showError(getString(R.string.promo_code_picker_unavailable));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderBackground() {
|
||||||
|
backgroundLoading = true;
|
||||||
|
Glide.with(this).load(Uri.parse(backgroundUri))
|
||||||
|
// 海报导出通过软件 Canvas 绘制,不能使用硬件位图。
|
||||||
|
.disallowHardwareConfig().centerCrop()
|
||||||
|
.placeholder(R.mipmap.icon_mine_promo_background)
|
||||||
|
.error(R.mipmap.icon_mine_promo_background)
|
||||||
|
.listener(new RequestListener<Drawable>() {
|
||||||
|
@Override
|
||||||
|
public boolean onLoadFailed(@Nullable GlideException exception, Object model,
|
||||||
|
Target<Drawable> target, boolean isFirstResource) {
|
||||||
|
backgroundLoading = false;
|
||||||
|
backgroundUri = "";
|
||||||
|
showError(getString(R.string.promo_code_background_failed));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onResourceReady(Drawable resource, Object model,
|
||||||
|
Target<Drawable> target, DataSource dataSource,
|
||||||
|
boolean isFirstResource) {
|
||||||
|
backgroundLoading = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).into(viewBinding.ivPromoBackground);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void requestSavePoster() {
|
||||||
|
if (saving) return;
|
||||||
|
if (backgroundLoading) {
|
||||||
|
showError(getString(R.string.promo_code_background_loading));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(inviteCode)) {
|
||||||
|
showError(getString(R.string.promo_code_empty));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Android 10 及以上通过 MediaStore 保存,无需申请存储权限。
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
|
||||||
|
|| ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||||
|
== PackageManager.PERMISSION_GRANTED) {
|
||||||
|
savePoster();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showDialogtext(null, false, false, false,
|
||||||
|
getString(R.string.promo_code_storage_title),
|
||||||
|
getString(R.string.promo_code_storage_message),
|
||||||
|
getString(R.string.promo_code_permission_cancel),
|
||||||
|
getString(R.string.promo_code_permission_allow), new BaseFragment.OnDialogClick() {
|
||||||
|
@Override
|
||||||
|
public void onCancelClick() {
|
||||||
|
// 取消授权保留当前海报,不触发保存。
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick() {
|
||||||
|
showPermissionDialog(ContextCompat.getDrawable(PromoCodeActivity.this,
|
||||||
|
R.mipmap.img_permission_file), true,
|
||||||
|
getString(R.string.promo_code_storage_title),
|
||||||
|
getString(R.string.promo_code_storage_message));
|
||||||
|
storagePermissionLauncher.launch(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 在主线程截取海报,再到后台写入相册;不包含标题栏与更换背景按钮。 */
|
||||||
|
private void savePoster() {
|
||||||
|
if (saving || isFinishing() || isDestroyed()) return;
|
||||||
|
View poster = viewBinding.flPromoPoster;
|
||||||
|
int width = poster.getWidth();
|
||||||
|
int height = poster.getHeight();
|
||||||
|
if (width <= 0 || height <= 0) return;
|
||||||
|
Bitmap bitmap = null;
|
||||||
|
try {
|
||||||
|
float scale = Math.min(2f, 1440f / Math.max(width, height));
|
||||||
|
bitmap = Bitmap.createBitmap(Math.max(1, Math.round(width * scale)),
|
||||||
|
Math.max(1, Math.round(height * scale)), Bitmap.Config.ARGB_8888);
|
||||||
|
Canvas canvas = new Canvas(bitmap);
|
||||||
|
canvas.scale(scale, scale);
|
||||||
|
viewBinding.btnPromoChangeBackground.setVisibility(View.INVISIBLE);
|
||||||
|
poster.draw(canvas);
|
||||||
|
} catch (RuntimeException | OutOfMemoryError exception) {
|
||||||
|
if (bitmap != null) bitmap.recycle();
|
||||||
|
showError(getString(R.string.promo_code_save_failed));
|
||||||
|
return;
|
||||||
|
} finally {
|
||||||
|
viewBinding.btnPromoChangeBackground.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
saving = true;
|
||||||
|
Bitmap snapshot = bitmap;
|
||||||
|
Context context = getApplicationContext();
|
||||||
|
saveExecutor.execute(() -> {
|
||||||
|
boolean success;
|
||||||
|
try {
|
||||||
|
success = writePosterToGallery(context, snapshot);
|
||||||
|
} finally {
|
||||||
|
snapshot.recycle();
|
||||||
|
}
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
saving = false;
|
||||||
|
if (isFinishing() || isDestroyed()) return;
|
||||||
|
ToastUtil.showShort(this, getString(success
|
||||||
|
? R.string.promo_code_saved : R.string.promo_code_save_failed));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 分区存储与旧版公共图片目录分别处理,失败时清理本次生成的文件。 */
|
||||||
|
private static boolean writePosterToGallery(Context context, Bitmap bitmap) {
|
||||||
|
ContentResolver resolver = context.getContentResolver();
|
||||||
|
Uri uri = null;
|
||||||
|
File file = null;
|
||||||
|
boolean success = false;
|
||||||
|
try {
|
||||||
|
String name = "promo_code_" + System.currentTimeMillis() + ".png";
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.put(MediaStore.Images.Media.DISPLAY_NAME, name);
|
||||||
|
values.put(MediaStore.Images.Media.MIME_TYPE, "image/png");
|
||||||
|
values.put(MediaStore.Images.Media.RELATIVE_PATH,
|
||||||
|
Environment.DIRECTORY_PICTURES + "/ElectricGriddle");
|
||||||
|
values.put(MediaStore.Images.Media.IS_PENDING, 1);
|
||||||
|
uri = resolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
|
||||||
|
if (uri == null) throw new IOException("Unable to create gallery image");
|
||||||
|
try (OutputStream output = resolver.openOutputStream(uri)) {
|
||||||
|
if (output == null || !bitmap.compress(Bitmap.CompressFormat.PNG, 100, output)) {
|
||||||
|
throw new IOException("Unable to write gallery image");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
values.clear();
|
||||||
|
values.put(MediaStore.Images.Media.IS_PENDING, 0);
|
||||||
|
if (resolver.update(uri, values, null, null) <= 0) {
|
||||||
|
throw new IOException("Unable to publish gallery image");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
File directory = new File(Environment.getExternalStoragePublicDirectory(
|
||||||
|
Environment.DIRECTORY_PICTURES), "ElectricGriddle");
|
||||||
|
if (!directory.isDirectory() && !directory.mkdirs()) {
|
||||||
|
throw new IOException("Unable to create gallery directory");
|
||||||
|
}
|
||||||
|
file = new File(directory, name);
|
||||||
|
try (OutputStream output = new FileOutputStream(file)) {
|
||||||
|
if (!bitmap.compress(Bitmap.CompressFormat.PNG, 100, output)) {
|
||||||
|
throw new IOException("Unable to write gallery image");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MediaScannerConnection.scanFile(context, new String[]{file.getAbsolutePath()},
|
||||||
|
new String[]{"image/png"}, null);
|
||||||
|
}
|
||||||
|
success = true;
|
||||||
|
} catch (IOException | RuntimeException exception) {
|
||||||
|
Log.e(TAG, "保存推广码图片失败", exception);
|
||||||
|
} finally {
|
||||||
|
if (!success) {
|
||||||
|
try {
|
||||||
|
if (uri != null) resolver.delete(uri, null, null);
|
||||||
|
if (file != null && file.exists() && !file.delete()) {
|
||||||
|
Log.w(TAG, "未能清理保存失败的推广图片");
|
||||||
|
}
|
||||||
|
} catch (RuntimeException exception) {
|
||||||
|
Log.w(TAG, "清理推广图片失败", exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
|
outState.putString(STATE_BACKGROUND, backgroundUri);
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
// 已提交的保存任务允许完成,任务回调不再操作已销毁页面。
|
||||||
|
saveExecutor.shutdown();
|
||||||
|
hidePermissionDialog();
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showError(String message) {
|
||||||
|
if (!isFinishing() && !isDestroyed() && !TextUtils.isEmpty(message)) {
|
||||||
|
ToastUtil.showShort(this, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void logOut(BaseBean bean) {
|
||||||
|
// 登录失效沿用 BaseActivity 的统一处理。
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,9 +17,9 @@ import com.ckkj.griddle.base.BaseFragment;
|
|||||||
import com.ckkj.griddle.databinding.ShippingAddressLayoutBinding;
|
import com.ckkj.griddle.databinding.ShippingAddressLayoutBinding;
|
||||||
import com.ckkj.griddle.mine.adapter.ShippingAddressAdapter;
|
import com.ckkj.griddle.mine.adapter.ShippingAddressAdapter;
|
||||||
import com.ckkj.griddle.mine.entity.ShippingAddressEntity;
|
import com.ckkj.griddle.mine.entity.ShippingAddressEntity;
|
||||||
import com.ckkj.griddle.mine.mvp.MineContract;
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
import com.ckkj.griddle.mine.mvp.MineImpl;
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
import com.ckkj.griddle.mine.mvp.MinePresenter;
|
import com.ckkj.griddle.mine.mvp.mine.MinePresenter;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ckkj.griddle.mine.mvp;
|
package com.ckkj.griddle.mine.mvp.mine;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ckkj.griddle.mine.mvp;
|
package com.ckkj.griddle.mine.mvp.mine;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ckkj.griddle.mine.mvp;
|
package com.ckkj.griddle.mine.mvp.mine;
|
||||||
|
|
||||||
import com.ckkj.griddle.base.BasePresenter;
|
import com.ckkj.griddle.base.BasePresenter;
|
||||||
import com.ckkj.griddle.mine.entity.MyDevicesEntity;
|
import com.ckkj.griddle.mine.entity.MyDevicesEntity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ckkj.griddle.mine.mvp;
|
package com.ckkj.griddle.mine.mvp.share;
|
||||||
|
|
||||||
import com.ckkj.griddle.base.IView;
|
import com.ckkj.griddle.base.IView;
|
||||||
import com.ckkj.griddle.mine.entity.ShareEarningsEntity;
|
import com.ckkj.griddle.mine.entity.ShareEarningsEntity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ckkj.griddle.mine.mvp;
|
package com.ckkj.griddle.mine.mvp.share;
|
||||||
|
|
||||||
import com.ckkj.griddle.mine.entity.ShareEarningsEntity;
|
import com.ckkj.griddle.mine.entity.ShareEarningsEntity;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ckkj.griddle.mine.mvp;
|
package com.ckkj.griddle.mine.mvp.share;
|
||||||
|
|
||||||
import com.ckkj.griddle.base.BasePresenter;
|
import com.ckkj.griddle.base.BasePresenter;
|
||||||
import com.ckkj.griddle.mine.entity.ShareEarningsEntity;
|
import com.ckkj.griddle.mine.entity.ShareEarningsEntity;
|
||||||
@@ -21,7 +21,8 @@ import com.ckkj.griddle.base.BaseActivity;
|
|||||||
import com.ckkj.griddle.custom.GridSpacingItemDecoration;
|
import com.ckkj.griddle.custom.GridSpacingItemDecoration;
|
||||||
import com.ckkj.griddle.databinding.AfterSalesApplyLayoutBinding;
|
import com.ckkj.griddle.databinding.AfterSalesApplyLayoutBinding;
|
||||||
import com.ckkj.griddle.fault.adapter.FaultReportImageAdapter;
|
import com.ckkj.griddle.fault.adapter.FaultReportImageAdapter;
|
||||||
import com.ckkj.griddle.mine.order.adapter.MyOrderGoodsAdapter;
|
import com.ckkj.griddle.mine.order.adapter.AfterSalesGoodsAdapter;
|
||||||
|
import com.ckkj.griddle.mine.order.entity.AfterSalesGoods;
|
||||||
import com.ckkj.griddle.mine.order.entity.AfterSalesRequest;
|
import com.ckkj.griddle.mine.order.entity.AfterSalesRequest;
|
||||||
import com.ckkj.griddle.mine.order.entity.MyOrderDetailEntity;
|
import com.ckkj.griddle.mine.order.entity.MyOrderDetailEntity;
|
||||||
import com.ckkj.griddle.mine.order.mvp.MyOrderContract;
|
import com.ckkj.griddle.mine.order.mvp.MyOrderContract;
|
||||||
@@ -32,19 +33,19 @@ import com.ckkj.griddle.utils.show.ToastUtil;
|
|||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
|
|
||||||
/** 售后申请:按当前订单展示商品,维护独立的类型、原因和凭证草稿。 */
|
/** 售后申请:维护商品选择、类型、原因和凭证草稿。 */
|
||||||
public class AfterSalesApplyActivity extends BaseActivity<AfterSalesApplyLayoutBinding, MyOrderPresenter>
|
public class AfterSalesApplyActivity extends BaseActivity<AfterSalesApplyLayoutBinding, MyOrderPresenter>
|
||||||
implements MyOrderContract.MyOrderView {
|
implements MyOrderContract.MyOrderView {
|
||||||
public static final String EXTRA_ORDER_ID = MyOrderDetailActivity.EXTRA_ORDER_ID;
|
public static final String EXTRA_ORDER_ID = MyOrderDetailActivity.EXTRA_ORDER_ID;
|
||||||
private final AfterSalesEvidenceHelper evidenceHelper =
|
private final AfterSalesEvidenceHelper evidenceHelper =
|
||||||
new AfterSalesEvidenceHelper(this, this::renderEvidence);
|
new AfterSalesEvidenceHelper(this, this::renderEvidence);
|
||||||
private MyOrderDetailEntity detail;
|
private MyOrderDetailEntity detail;
|
||||||
private MyOrderGoodsAdapter goodsAdapter;
|
private final List<AfterSalesGoods> goods = AfterSalesGoods.createPreviewItems();
|
||||||
|
private boolean[] selectedGoods = {true, false, false};
|
||||||
private FaultReportImageAdapter evidenceAdapter;
|
private FaultReportImageAdapter evidenceAdapter;
|
||||||
private AfterSalesRequest.Type type = AfterSalesRequest.Type.REFUND_ONLY;
|
private AfterSalesRequest.Type type = AfterSalesRequest.Type.REFUND_ONLY;
|
||||||
private AfterSalesRequest.Reason reason = AfterSalesRequest.Reason.NO_LONGER_NEEDED;
|
private AfterSalesRequest.Reason reason = AfterSalesRequest.Reason.NO_LONGER_NEEDED;
|
||||||
@@ -66,7 +67,6 @@ public class AfterSalesApplyActivity extends BaseActivity<AfterSalesApplyLayoutB
|
|||||||
super.initData(savedInstanceState);
|
super.initData(savedInstanceState);
|
||||||
ImmersionBar.with(this).statusBarColor(R.color.white).statusBarDarkFont(true)
|
ImmersionBar.with(this).statusBarColor(R.color.white).statusBarDarkFont(true)
|
||||||
.keyboardEnable(true).init();
|
.keyboardEnable(true).init();
|
||||||
initGoods();
|
|
||||||
initEvidence();
|
initEvidence();
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
int typeIndex = savedInstanceState.getInt("after_sales_type", 0);
|
int typeIndex = savedInstanceState.getInt("after_sales_type", 0);
|
||||||
@@ -79,16 +79,24 @@ public class AfterSalesApplyActivity extends BaseActivity<AfterSalesApplyLayoutB
|
|||||||
}
|
}
|
||||||
amountRestored = savedInstanceState.containsKey("after_sales_amount");
|
amountRestored = savedInstanceState.containsKey("after_sales_amount");
|
||||||
refundCents = savedInstanceState.getLong("after_sales_amount");
|
refundCents = savedInstanceState.getLong("after_sales_amount");
|
||||||
|
boolean[] selection = savedInstanceState.getBooleanArray("after_sales_goods");
|
||||||
|
if (selection != null && selection.length == goods.size()) {
|
||||||
|
selectedGoods = selection;
|
||||||
|
for (int i = 0; i < goods.size(); i++) {
|
||||||
|
if (!goods.get(i).selectable) selectedGoods[i] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
viewBinding.etAfterSalesDescription.setText(
|
viewBinding.etAfterSalesDescription.setText(
|
||||||
savedInstanceState.getString("after_sales_description", ""));
|
savedInstanceState.getString("after_sales_description", ""));
|
||||||
}
|
}
|
||||||
|
initGoods();
|
||||||
evidenceHelper.restore(savedInstanceState);
|
evidenceHelper.restore(savedInstanceState);
|
||||||
renderSelections();
|
renderSelections();
|
||||||
mPresenter.getOrderDetail(getIntent().getStringExtra(EXTRA_ORDER_ID));
|
mPresenter.getOrderDetail(getIntent().getStringExtra(EXTRA_ORDER_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initGoods() {
|
private void initGoods() {
|
||||||
goodsAdapter = new MyOrderGoodsAdapter();
|
AfterSalesGoodsAdapter goodsAdapter = new AfterSalesGoodsAdapter(goods, selectedGoods);
|
||||||
viewBinding.rvAfterSalesGoods.setLayoutManager(new LinearLayoutManager(this) {
|
viewBinding.rvAfterSalesGoods.setLayoutManager(new LinearLayoutManager(this) {
|
||||||
@Override
|
@Override
|
||||||
public boolean canScrollVertically() {
|
public boolean canScrollVertically() {
|
||||||
@@ -97,6 +105,13 @@ public class AfterSalesApplyActivity extends BaseActivity<AfterSalesApplyLayoutB
|
|||||||
});
|
});
|
||||||
viewBinding.rvAfterSalesGoods.setAdapter(goodsAdapter);
|
viewBinding.rvAfterSalesGoods.setAdapter(goodsAdapter);
|
||||||
viewBinding.rvAfterSalesGoods.setItemAnimator(null);
|
viewBinding.rvAfterSalesGoods.setItemAnimator(null);
|
||||||
|
goodsAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||||
|
if (detail == null || !goods.get(position).selectable) return;
|
||||||
|
selectedGoods[position] = !selectedGoods[position];
|
||||||
|
goodsAdapter.notifyItemChanged(position);
|
||||||
|
refundCents = refundLimit();
|
||||||
|
renderAmount();
|
||||||
|
});
|
||||||
final int spacing = Math.round(16 * getResources().getDisplayMetrics().density);
|
final int spacing = Math.round(16 * getResources().getDisplayMetrics().density);
|
||||||
viewBinding.rvAfterSalesGoods.addItemDecoration(new RecyclerView.ItemDecoration() {
|
viewBinding.rvAfterSalesGoods.addItemDecoration(new RecyclerView.ItemDecoration() {
|
||||||
@Override
|
@Override
|
||||||
@@ -138,13 +153,10 @@ public class AfterSalesApplyActivity extends BaseActivity<AfterSalesApplyLayoutB
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
detail = data;
|
detail = data;
|
||||||
goodsAdapter.setNewData(new ArrayList<>(data.order.goods));
|
long limit = refundLimit();
|
||||||
// 上限取商品总额,不受订单优惠展示或用户输入影响。
|
refundCents = amountRestored ? Math.min(limit, Math.max(0, refundCents)) : limit;
|
||||||
refundCents = amountRestored ? Math.min(data.subtotalCents, Math.max(0, refundCents))
|
|
||||||
: data.subtotalCents;
|
|
||||||
renderAmount();
|
renderAmount();
|
||||||
viewBinding.llAfterSalesContent.setVisibility(View.VISIBLE);
|
viewBinding.llAfterSalesContent.setVisibility(View.VISIBLE);
|
||||||
viewBinding.tvAfterSalesSubmit.setEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderSelections() {
|
private void renderSelections() {
|
||||||
@@ -157,9 +169,18 @@ public class AfterSalesApplyActivity extends BaseActivity<AfterSalesApplyLayoutB
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderAmount() {
|
private void renderAmount() {
|
||||||
|
long limit = refundLimit();
|
||||||
viewBinding.tvAfterSalesAmount.setText(getString(R.string.my_order_price, decimal(refundCents)));
|
viewBinding.tvAfterSalesAmount.setText(getString(R.string.my_order_price, decimal(refundCents)));
|
||||||
viewBinding.tvAfterSalesMaxAmount.setText(
|
viewBinding.tvAfterSalesMaxAmount.setText(
|
||||||
getString(R.string.after_sales_max_amount, decimal(detail.subtotalCents)));
|
getString(R.string.after_sales_max_amount, decimal(limit)));
|
||||||
|
viewBinding.ivAfterSalesEditAmount.setEnabled(limit > 0);
|
||||||
|
viewBinding.ivAfterSalesEditAmount.setAlpha(limit > 0 ? 1f : 0.4f);
|
||||||
|
viewBinding.tvAfterSalesSubmit.setEnabled(limit > 0);
|
||||||
|
viewBinding.tvAfterSalesSubmit.setAlpha(limit > 0 ? 1f : 0.4f);
|
||||||
|
}
|
||||||
|
|
||||||
|
private long refundLimit() {
|
||||||
|
return AfterSalesGoods.refundLimit(goods, selectedGoods);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String decimal(long cents) {
|
private String decimal(long cents) {
|
||||||
@@ -222,14 +243,14 @@ public class AfterSalesApplyActivity extends BaseActivity<AfterSalesApplyLayoutB
|
|||||||
if (detail == null) return false;
|
if (detail == null) return false;
|
||||||
try {
|
try {
|
||||||
long cents = AfterSalesRequest.parseAmountCents(value);
|
long cents = AfterSalesRequest.parseAmountCents(value);
|
||||||
return cents > 0 && cents <= detail.subtotalCents;
|
return cents > 0 && cents <= refundLimit();
|
||||||
} catch (IllegalArgumentException | ArithmeticException e) {
|
} catch (IllegalArgumentException | ArithmeticException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editRefundAmount() {
|
private void editRefundAmount() {
|
||||||
if (detail == null || (dialog != null && dialog.isShowing())) return;
|
if (detail == null || refundLimit() == 0 || (dialog != null && dialog.isShowing())) return;
|
||||||
showEditDialog(getString(R.string.after_sales_edit_amount),
|
showEditDialog(getString(R.string.after_sales_edit_amount),
|
||||||
getString(R.string.after_sales_amount_hint), true,
|
getString(R.string.after_sales_amount_hint), true,
|
||||||
getString(android.R.string.cancel), getString(android.R.string.ok), new OnDialogClick() {
|
getString(android.R.string.cancel), getString(android.R.string.ok), new OnDialogClick() {
|
||||||
@@ -283,12 +304,12 @@ public class AfterSalesApplyActivity extends BaseActivity<AfterSalesApplyLayoutB
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void submitApplication() {
|
private void submitApplication() {
|
||||||
if (detail == null) return;
|
if (detail == null || refundLimit() == 0) return;
|
||||||
if (evidenceHelper.isProcessing()) {
|
if (evidenceHelper.isProcessing()) {
|
||||||
showError(getString(R.string.fault_report_media_processing));
|
showError(getString(R.string.fault_report_media_processing));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mPresenter.validateAfterSales(new AfterSalesRequest(detail.order.id, type, reason, refundCents,
|
mPresenter.validateAfterSales(new AfterSalesRequest(detail.order.id, selectedGoods, type, reason, refundCents,
|
||||||
viewBinding.etAfterSalesDescription.getText().toString(), evidenceHelper.getEvidence()));
|
viewBinding.etAfterSalesDescription.getText().toString(), evidenceHelper.getEvidence()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,6 +334,7 @@ public class AfterSalesApplyActivity extends BaseActivity<AfterSalesApplyLayoutB
|
|||||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
outState.putInt("after_sales_type", type.ordinal());
|
outState.putInt("after_sales_type", type.ordinal());
|
||||||
outState.putInt("after_sales_reason", reason.ordinal());
|
outState.putInt("after_sales_reason", reason.ordinal());
|
||||||
|
outState.putBooleanArray("after_sales_goods", selectedGoods);
|
||||||
if (detail != null || amountRestored) outState.putLong("after_sales_amount", refundCents);
|
if (detail != null || amountRestored) outState.putLong("after_sales_amount", refundCents);
|
||||||
outState.putString("after_sales_description", viewBinding.etAfterSalesDescription.getText().toString());
|
outState.putString("after_sales_description", viewBinding.etAfterSalesDescription.getText().toString());
|
||||||
evidenceHelper.save(outState);
|
evidenceHelper.save(outState);
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.ckkj.griddle.mine.order.adapter;
|
||||||
|
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
|
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.mine.order.entity.AfterSalesGoods;
|
||||||
|
import com.ckkj.griddle.mine.order.entity.MyOrderEntity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AfterSalesGoodsAdapter extends BaseQuickAdapter<AfterSalesGoods, BaseViewHolder> {
|
||||||
|
private final boolean[] selection;
|
||||||
|
|
||||||
|
public AfterSalesGoodsAdapter(List<AfterSalesGoods> items, boolean[] selection) {
|
||||||
|
super(R.layout.item_after_sales_goods, items);
|
||||||
|
this.selection = selection;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, AfterSalesGoods item) {
|
||||||
|
MyOrderEntity.Goods goods = item.goods;
|
||||||
|
boolean selected = item.selectable && selection[getData().indexOf(item)];
|
||||||
|
helper.itemView.setSelected(selected);
|
||||||
|
helper.itemView.setEnabled(item.selectable);
|
||||||
|
helper.itemView.setClickable(item.selectable);
|
||||||
|
helper.itemView.setFocusable(item.selectable);
|
||||||
|
|
||||||
|
ImageView check = helper.getView(R.id.iv_after_sales_goods_check);
|
||||||
|
check.setVisibility(item.selectable ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
check.setImageResource(selected ? R.drawable.after_sales_goods_checked : R.mipmap.icon_cart_unchecked);
|
||||||
|
|
||||||
|
TextView name = helper.getView(R.id.tv_after_sales_goods_name);
|
||||||
|
TextView spec = helper.getView(R.id.tv_after_sales_goods_spec);
|
||||||
|
TextView price = helper.getView(R.id.tv_after_sales_goods_price);
|
||||||
|
name.setText(goods.nameRes);
|
||||||
|
spec.setText(goods.quantity == 1 ? goods.specification : mContext.getString(
|
||||||
|
R.string.my_order_specification, goods.specification, goods.quantity));
|
||||||
|
price.setText(mContext.getString(R.string.my_order_price,
|
||||||
|
BigDecimal.valueOf(goods.priceCents, 2).toPlainString()));
|
||||||
|
int disabledText = 0xFF999999;
|
||||||
|
name.setTextColor(item.selectable ? 0xFF222222 : disabledText);
|
||||||
|
spec.setTextColor(item.selectable ? 0xFF666666 : disabledText);
|
||||||
|
price.setTextColor(item.selectable ? 0xFFE84248 : disabledText);
|
||||||
|
|
||||||
|
ImageView cover = helper.getView(R.id.iv_after_sales_goods_cover);
|
||||||
|
if (item.selectable) {
|
||||||
|
cover.clearColorFilter();
|
||||||
|
} else {
|
||||||
|
cover.setColorFilter(0x66000000, PorterDuff.Mode.SRC_ATOP);
|
||||||
|
}
|
||||||
|
int radius = Math.round(10 * mContext.getResources().getDisplayMetrics().density);
|
||||||
|
Glide.with(cover).load(goods.coverRes)
|
||||||
|
.transform(new CenterCrop(), new RoundedCorners(radius)).into(cover);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.ckkj.griddle.mine.order.entity;
|
||||||
|
|
||||||
|
import com.ckkj.griddle.R;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public final class AfterSalesGoods {
|
||||||
|
public final MyOrderEntity.Goods goods;
|
||||||
|
public final boolean selectable;
|
||||||
|
|
||||||
|
private AfterSalesGoods(String specification, long priceCents, boolean selectable) {
|
||||||
|
goods = new MyOrderEntity.Goods(R.string.my_order_goods_preview,
|
||||||
|
R.mipmap.icon_cart_goods_preview, specification, 1, priceCents);
|
||||||
|
this.selectable = selectable;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep the after-sales preview fixture separate from the other order screens.
|
||||||
|
public static List<AfterSalesGoods> createPreviewItems() {
|
||||||
|
return Arrays.asList(new AfterSalesGoods("0.5kg", 20800, true),
|
||||||
|
new AfterSalesGoods("1kg", 32800, true),
|
||||||
|
new AfterSalesGoods("0.5kg", 20800, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long refundLimit(List<AfterSalesGoods> items, boolean[] selection) {
|
||||||
|
if (selection == null || selection.length != items.size()) return 0;
|
||||||
|
long limit = 0;
|
||||||
|
for (int i = 0; i < items.size(); i++) {
|
||||||
|
if (!selection[i]) continue;
|
||||||
|
AfterSalesGoods item = items.get(i);
|
||||||
|
if (!item.selectable) return 0;
|
||||||
|
limit += item.goods.priceCents * item.goods.quantity;
|
||||||
|
}
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,15 +10,17 @@ public class AfterSalesRequest {
|
|||||||
public enum Reason { NO_LONGER_NEEDED, QUALITY_PROBLEM, NOT_AS_DESCRIBED }
|
public enum Reason { NO_LONGER_NEEDED, QUALITY_PROBLEM, NOT_AS_DESCRIBED }
|
||||||
|
|
||||||
public final String orderId;
|
public final String orderId;
|
||||||
|
public final boolean[] selectedGoods;
|
||||||
public final Type type;
|
public final Type type;
|
||||||
public final Reason reason;
|
public final Reason reason;
|
||||||
public final long refundCents;
|
public final long refundCents;
|
||||||
public final String description;
|
public final String description;
|
||||||
public final List<String> evidence;
|
public final List<String> evidence;
|
||||||
|
|
||||||
public AfterSalesRequest(String orderId, Type type, Reason reason, long refundCents,
|
public AfterSalesRequest(String orderId, boolean[] selectedGoods, Type type, Reason reason, long refundCents,
|
||||||
String description, List<String> evidence) {
|
String description, List<String> evidence) {
|
||||||
this.orderId = orderId;
|
this.orderId = orderId;
|
||||||
|
this.selectedGoods = selectedGoods.clone();
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
this.refundCents = refundCents;
|
this.refundCents = refundCents;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ckkj.griddle.mine.order.mvp;
|
package com.ckkj.griddle.mine.order.mvp;
|
||||||
|
|
||||||
import com.ckkj.griddle.R;
|
import com.ckkj.griddle.R;
|
||||||
|
import com.ckkj.griddle.mine.order.entity.AfterSalesGoods;
|
||||||
import com.ckkj.griddle.mine.order.entity.MyOrderEntity;
|
import com.ckkj.griddle.mine.order.entity.MyOrderEntity;
|
||||||
import com.ckkj.griddle.mine.order.entity.MyOrderDetailEntity;
|
import com.ckkj.griddle.mine.order.entity.MyOrderDetailEntity;
|
||||||
import com.ckkj.griddle.mine.order.entity.AfterSalesRequest;
|
import com.ckkj.griddle.mine.order.entity.AfterSalesRequest;
|
||||||
@@ -60,7 +61,8 @@ public class MyOrderImpl implements MyOrderContract.DataModel {
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
if (request.type == null || request.reason == null) {
|
if (request.type == null || request.reason == null) {
|
||||||
error = R.string.after_sales_select_required;
|
error = R.string.after_sales_select_required;
|
||||||
} else if (request.refundCents <= 0 || request.refundCents > detail.subtotalCents) {
|
} else if (request.refundCents <= 0 || request.refundCents > AfterSalesGoods.refundLimit(
|
||||||
|
AfterSalesGoods.createPreviewItems(), request.selectedGoods)) {
|
||||||
error = R.string.after_sales_amount_invalid;
|
error = R.string.after_sales_amount_invalid;
|
||||||
} else if (request.description.isEmpty()) {
|
} else if (request.description.isEmpty()) {
|
||||||
error = R.string.after_sales_description_required;
|
error = R.string.after_sales_description_required;
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ import com.ckkj.griddle.base.BaseActivity;
|
|||||||
import com.ckkj.griddle.databinding.PickupManageLayoutBinding;
|
import com.ckkj.griddle.databinding.PickupManageLayoutBinding;
|
||||||
import com.ckkj.griddle.mine.adapter.PickupPointAdapter;
|
import com.ckkj.griddle.mine.adapter.PickupPointAdapter;
|
||||||
import com.ckkj.griddle.mine.entity.PickupPointEntity;
|
import com.ckkj.griddle.mine.entity.PickupPointEntity;
|
||||||
import com.ckkj.griddle.mine.mvp.MineContract;
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
import com.ckkj.griddle.mine.mvp.MineImpl;
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
import com.ckkj.griddle.mine.mvp.MinePresenter;
|
import com.ckkj.griddle.mine.mvp.mine.MinePresenter;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import com.ckkj.griddle.dialog.ShareQrcodeDialog;
|
|||||||
import com.ckkj.griddle.dialog.ShareRulesDialog;
|
import com.ckkj.griddle.dialog.ShareRulesDialog;
|
||||||
import com.ckkj.griddle.mine.adapter.ShareEarningsAdapter;
|
import com.ckkj.griddle.mine.adapter.ShareEarningsAdapter;
|
||||||
import com.ckkj.griddle.mine.entity.ShareEarningsEntity;
|
import com.ckkj.griddle.mine.entity.ShareEarningsEntity;
|
||||||
import com.ckkj.griddle.mine.mvp.ShareContract;
|
import com.ckkj.griddle.mine.mvp.share.ShareContract;
|
||||||
import com.ckkj.griddle.mine.mvp.ShareImpl;
|
import com.ckkj.griddle.mine.mvp.share.ShareImpl;
|
||||||
import com.ckkj.griddle.mine.mvp.SharePresenter;
|
import com.ckkj.griddle.mine.mvp.share.SharePresenter;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.ckkj.griddle.utils.manager.MingDengUserInfoManager;
|
import com.ckkj.griddle.utils.manager.MingDengUserInfoManager;
|
||||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ckkj.griddle.point;
|
package com.ckkj.griddle.order;
|
||||||
|
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -13,12 +13,12 @@ import com.ckkj.griddle.R;
|
|||||||
import com.ckkj.griddle.base.BaseActivity;
|
import com.ckkj.griddle.base.BaseActivity;
|
||||||
import com.ckkj.griddle.databinding.PointsOrderListBinding;
|
import com.ckkj.griddle.databinding.PointsOrderListBinding;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.ckkj.griddle.point.adapter.PointsOrderAdapter;
|
import com.ckkj.griddle.order.adapter.PointsOrderAdapter;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity.Filter;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity.Filter;
|
||||||
import com.ckkj.griddle.point.mvp.PointsOrderContract;
|
import com.ckkj.griddle.order.mvp.PointsOrderContract;
|
||||||
import com.ckkj.griddle.point.mvp.PointsOrderImpl;
|
import com.ckkj.griddle.order.mvp.PointsOrderImpl;
|
||||||
import com.ckkj.griddle.point.mvp.PointsOrderPresenter;
|
import com.ckkj.griddle.order.mvp.PointsOrderPresenter;
|
||||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ckkj.griddle.point;
|
package com.ckkj.griddle.order;
|
||||||
|
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
@@ -16,12 +16,12 @@ import com.ckkj.griddle.R;
|
|||||||
import com.ckkj.griddle.base.BaseActivity;
|
import com.ckkj.griddle.base.BaseActivity;
|
||||||
import com.ckkj.griddle.databinding.PointsOrderDetailBinding;
|
import com.ckkj.griddle.databinding.PointsOrderDetailBinding;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.ckkj.griddle.point.adapter.PointsOrderAdapter;
|
import com.ckkj.griddle.order.adapter.PointsOrderAdapter;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderDetailEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderDetailEntity;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity;
|
||||||
import com.ckkj.griddle.point.mvp.PointsOrderContract;
|
import com.ckkj.griddle.order.mvp.PointsOrderContract;
|
||||||
import com.ckkj.griddle.point.mvp.PointsOrderImpl;
|
import com.ckkj.griddle.order.mvp.PointsOrderImpl;
|
||||||
import com.ckkj.griddle.point.mvp.PointsOrderPresenter;
|
import com.ckkj.griddle.order.mvp.PointsOrderPresenter;
|
||||||
import com.ckkj.griddle.utils.show.ToastUtil;
|
import com.ckkj.griddle.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ckkj.griddle.point.adapter;
|
package com.ckkj.griddle.order.adapter;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -11,7 +11,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
|||||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
import com.chad.library.adapter.base.BaseViewHolder;
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
import com.ckkj.griddle.R;
|
import com.ckkj.griddle.R;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ckkj.griddle.point.entity;
|
package com.ckkj.griddle.order.entity;
|
||||||
|
|
||||||
/** 订单详情扩展信息,商品、状态、金额及提货码复用列表中的订单数据。 */
|
/** 订单详情扩展信息,商品、状态、金额及提货码复用列表中的订单数据。 */
|
||||||
public class PointsOrderDetailEntity {
|
public class PointsOrderDetailEntity {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ckkj.griddle.point.entity;
|
package com.ckkj.griddle.order.entity;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.ckkj.griddle.point.mvp;
|
package com.ckkj.griddle.order.mvp;
|
||||||
|
|
||||||
import com.ckkj.griddle.base.IView;
|
import com.ckkj.griddle.base.IView;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderDetailEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderDetailEntity;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.ckkj.griddle.point.mvp;
|
package com.ckkj.griddle.order.mvp;
|
||||||
|
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderDetailEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderDetailEntity;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity.Filter;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity.Filter;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity.Status;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity.Status;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.ckkj.griddle.point.mvp;
|
package com.ckkj.griddle.order.mvp;
|
||||||
|
|
||||||
import com.ckkj.griddle.base.BasePresenter;
|
import com.ckkj.griddle.base.BasePresenter;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderDetailEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderDetailEntity;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -5,8 +5,8 @@ import android.text.TextUtils;
|
|||||||
import com.ckkj.griddle.MyApplication;
|
import com.ckkj.griddle.MyApplication;
|
||||||
import com.ckkj.griddle.R;
|
import com.ckkj.griddle.R;
|
||||||
import com.ckkj.griddle.mine.entity.PickupPointEntity;
|
import com.ckkj.griddle.mine.entity.PickupPointEntity;
|
||||||
import com.ckkj.griddle.mine.mvp.MineContract;
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
import com.ckkj.griddle.mine.mvp.MineImpl;
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
import com.ckkj.griddle.network.BaseBean;
|
import com.ckkj.griddle.network.BaseBean;
|
||||||
import com.ckkj.griddle.network.NetWorkManager;
|
import com.ckkj.griddle.network.NetWorkManager;
|
||||||
import com.ckkj.griddle.shop.entity.MallGoodsPageEntity;
|
import com.ckkj.griddle.shop.entity.MallGoodsPageEntity;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<solid android:color="#F5F5F5" />
|
<solid android:color="#F2F2F2" />
|
||||||
<corners android:radius="10dp" />
|
<corners android:radius="10dp" />
|
||||||
</shape>
|
</shape>
|
||||||
|
|||||||
16
app/src/main/res/drawable/after_sales_goods_checked.xml
Normal file
16
app/src/main/res/drawable/after_sales_goods_checked.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="18dp"
|
||||||
|
android:height="18dp"
|
||||||
|
android:viewportWidth="18"
|
||||||
|
android:viewportHeight="18">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF6900"
|
||||||
|
android:pathData="M5,0H13Q18,0 18,5V13Q18,18 13,18H5Q0,18 0,13V5Q0,0 5,0Z" />
|
||||||
|
<path
|
||||||
|
android:pathData="M5.5,9.3L8,11.8L12.5,6.5"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="1.7" />
|
||||||
|
</vector>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<shape>
|
<shape>
|
||||||
<solid android:color="#F5F5F5" />
|
<solid android:color="#F2F2F2" />
|
||||||
<corners android:radius="6dp" />
|
<corners android:radius="6dp" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
<corners android:radius="9999dp" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||||
|
<solid android:color="#66000000" />
|
||||||
|
<corners android:radius="6dp" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||||
|
<solid android:color="#66000000" />
|
||||||
|
<corners android:radius="16dp" />
|
||||||
|
</shape>
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:fillViewport="true"
|
android:fillViewport="true"
|
||||||
android:background="#F5F5F5">
|
android:background="#F2F2F2">
|
||||||
|
|
||||||
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
<com.ckkj.griddle.custom.view.AdaptiveContentLayout
|
||||||
android:id="@+id/ll_after_sales_content"
|
android:id="@+id/ll_after_sales_content"
|
||||||
@@ -53,8 +53,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
style="@style/OrderDetailSection"
|
style="@style/OrderDetailSection"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:layout_marginTop="0dp">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rv_after_sales_goods"
|
android:id="@+id/rv_after_sales_goods"
|
||||||
@@ -94,6 +93,7 @@
|
|||||||
style="@style/AfterSalesOption"
|
style="@style/AfterSalesOption"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="0dp"
|
||||||
android:text="@string/after_sales_exchange" />
|
android:text="@string/after_sales_exchange" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="#FF3B30" />
|
android:textColor="#E84248" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_after_sales_max_amount"
|
android:id="@+id/tv_after_sales_max_amount"
|
||||||
@@ -134,14 +134,14 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:textColor="#FF3B30" />
|
android:textColor="#E84248" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_after_sales_edit_amount"
|
android:id="@+id/iv_after_sales_edit_amount"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:padding="11dp"
|
android:padding="16dp"
|
||||||
android:src="@mipmap/icon_fault_report_edit"
|
android:src="@mipmap/icon_fault_report_edit"
|
||||||
android:contentDescription="@string/after_sales_edit_amount"
|
android:contentDescription="@string/after_sales_edit_amount"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
@@ -179,6 +179,7 @@
|
|||||||
style="@style/AfterSalesOption"
|
style="@style/AfterSalesOption"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="0dp"
|
||||||
android:text="@string/after_sales_reason_description" />
|
android:text="@string/after_sales_reason_description" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -198,7 +199,7 @@
|
|||||||
style="@style/MyOrderText"
|
style="@style/MyOrderText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="122dp"
|
android:minHeight="90dp"
|
||||||
android:gravity="top|start"
|
android:gravity="top|start"
|
||||||
android:padding="12dp"
|
android:padding="12dp"
|
||||||
android:background="@drawable/after_sales_description_bg"
|
android:background="@drawable/after_sales_description_bg"
|
||||||
@@ -232,6 +233,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:background="#F2F2F2"
|
||||||
android:paddingHorizontal="24dp"
|
android:paddingHorizontal="24dp"
|
||||||
android:paddingVertical="20dp"
|
android:paddingVertical="20dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
@@ -243,6 +245,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
|
android:alpha="0.4"
|
||||||
android:background="@drawable/order_detail_primary"
|
android:background="@drawable/order_detail_primary"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:text="@string/after_sales_submit" />
|
android:text="@string/after_sales_submit" />
|
||||||
|
|||||||
54
app/src/main/res/layout/item_after_sales_goods.xml
Normal file
54
app/src/main/res/layout/item_after_sales_goods.xml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?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:gravity="top"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_after_sales_goods_check"
|
||||||
|
android:layout_width="18dp"
|
||||||
|
android:layout_height="18dp"
|
||||||
|
android:layout_marginTop="31dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:importantForAccessibility="no" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_after_sales_goods_cover"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
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_after_sales_goods_name"
|
||||||
|
style="@style/MyOrderText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_after_sales_goods_spec"
|
||||||
|
style="@style/MyOrderText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_after_sales_goods_price"
|
||||||
|
style="@style/MyOrderText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
20
app/src/main/res/layout/item_promo_code_character.xml
Normal file
20
app/src/main/res/layout/item_promo_code_character.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/promo_code_character_background"
|
||||||
|
android:gravity="center"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="30sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:autoSizeMaxTextSize="30sp"
|
||||||
|
app:autoSizeMinTextSize="12sp"
|
||||||
|
app:autoSizeStepGranularity="1sp"
|
||||||
|
app:autoSizeTextType="uniform"
|
||||||
|
tools:text="4" />
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
android:background="@color/device_preview_background"
|
android:background="@color/device_preview_background"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".point.PointsOrderDetailActivity">
|
tools:context=".order.PointsOrderDetailActivity">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/include_title"
|
android:id="@+id/include_title"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
android:background="@color/device_preview_background"
|
android:background="@color/device_preview_background"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".point.PointsOrderActivity">
|
tools:context=".order.PointsOrderActivity">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/include_title"
|
android:id="@+id/include_title"
|
||||||
|
|||||||
187
app/src/main/res/layout/promo_code_layout.xml
Normal file
187
app/src/main/res/layout/promo_code_layout.xml
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
<?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"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".mine.PromoCodeActivity">
|
||||||
|
|
||||||
|
<!-- 两侧预留相同宽度,保证中英文标题均相对屏幕居中。 -->
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:background="@color/white">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginHorizontal="48dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:text="@string/promo_code_save_hint"
|
||||||
|
android:textColor="#222222"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_back"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:contentDescription="@string/promo_code_back"
|
||||||
|
android:padding="13dp"
|
||||||
|
android:src="@mipmap/img_back_black" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="#C9B79F"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:scrollbars="none">
|
||||||
|
|
||||||
|
<!-- 短窗口保持内容最小高度并允许滚动,折叠展开时限制海报宽度。 -->
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="640dp">
|
||||||
|
|
||||||
|
<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="480dp">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/fl_promo_poster"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#C9B79F"
|
||||||
|
android:longClickable="true"
|
||||||
|
android:minHeight="640dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_promo_background"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@mipmap/icon_mine_promo_background"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<!-- 对应设计稿覆盖在背景图上的 10% 黑色蒙层。 -->
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="#1A000000"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingHorizontal="24dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="240" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_promo_slogan"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:minHeight="29dp"
|
||||||
|
android:text="@string/promo_code_slogan"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btn_promo_change_background"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:background="@drawable/promo_code_background_button"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:foreground="?attr/selectableItemBackground"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
|
android:text="@string/promo_code_change_background"
|
||||||
|
android:textColor="#222222"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="177" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_promo_code_panel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/promo_code_panel_background"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="20dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:minHeight="24dp"
|
||||||
|
android:text="@string/promo_code_label"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<!-- 根据实际邀请码动态填充,保留前导零,不写死设计稿示例。 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_promo_code_characters"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="42dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:importantForAccessibility="yes"
|
||||||
|
android:orientation="horizontal" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_promo_code_empty"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/promo_code_empty"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="50" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</com.ckkj.griddle.custom.view.AdaptiveContentLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
</LinearLayout>
|
||||||
BIN
app/src/main/res/mipmap-xxxhdpi/icon_mine_promo_background.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/icon_mine_promo_background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 344 KiB |
@@ -9,7 +9,7 @@
|
|||||||
<string name="after_sales_max_amount">Max refund: ¥%1$s</string>
|
<string name="after_sales_max_amount">Max refund: ¥%1$s</string>
|
||||||
<string name="after_sales_edit_amount">Edit Refund Amount</string>
|
<string name="after_sales_edit_amount">Edit Refund Amount</string>
|
||||||
<string name="after_sales_amount_hint">Enter refund amount (up to 2 decimal places)</string>
|
<string name="after_sales_amount_hint">Enter refund amount (up to 2 decimal places)</string>
|
||||||
<string name="after_sales_amount_invalid">Refund must be greater than zero and cannot exceed the goods total</string>
|
<string name="after_sales_amount_invalid">Refund must be greater than zero and cannot exceed the selected items total</string>
|
||||||
<string name="after_sales_reason"><font color="#FF3B30">*</font> After-sales Reason</string>
|
<string name="after_sales_reason"><font color="#FF3B30">*</font> After-sales Reason</string>
|
||||||
<string name="after_sales_reason_unwanted">No Longer Needed</string>
|
<string name="after_sales_reason_unwanted">No Longer Needed</string>
|
||||||
<string name="after_sales_reason_quality">Quality Problem</string>
|
<string name="after_sales_reason_quality">Quality Problem</string>
|
||||||
|
|||||||
20
app/src/main/res/values-en/strings_promo_code.xml
Normal file
20
app/src/main/res/values-en/strings_promo_code.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="promo_code_save_hint">Long press to save image</string>
|
||||||
|
<string name="promo_code_back">Back</string>
|
||||||
|
<string name="promo_code_slogan">Mum\'s Injera Never Stops</string>
|
||||||
|
<string name="promo_code_change_background">Change Background</string>
|
||||||
|
<string name="promo_code_label">Your Referral Code</string>
|
||||||
|
<string name="promo_code_accessibility">Your referral code: %1$s</string>
|
||||||
|
<string name="promo_code_empty">No referral code available</string>
|
||||||
|
<string name="promo_code_picker_unavailable">No image picker available</string>
|
||||||
|
<string name="promo_code_background_failed">Unable to read this image. Please choose another.</string>
|
||||||
|
<string name="promo_code_background_loading">Loading background. Please save in a moment.</string>
|
||||||
|
<string name="promo_code_saved">Referral image saved to your gallery</string>
|
||||||
|
<string name="promo_code_save_failed">Unable to save. Please try again.</string>
|
||||||
|
<string name="promo_code_storage_title">Storage permission</string>
|
||||||
|
<string name="promo_code_storage_message">Used only to save the referral image to your gallery when requested.</string>
|
||||||
|
<string name="promo_code_storage_denied">Storage permission is required. Please allow it in system settings and try again.</string>
|
||||||
|
<string name="promo_code_permission_cancel">Cancel</string>
|
||||||
|
<string name="promo_code_permission_allow">Allow</string>
|
||||||
|
</resources>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<string name="after_sales_max_amount">最多可退:¥%1$s</string>
|
<string name="after_sales_max_amount">最多可退:¥%1$s</string>
|
||||||
<string name="after_sales_edit_amount">编辑退款金额</string>
|
<string name="after_sales_edit_amount">编辑退款金额</string>
|
||||||
<string name="after_sales_amount_hint">请输入退款金额,最多两位小数</string>
|
<string name="after_sales_amount_hint">请输入退款金额,最多两位小数</string>
|
||||||
<string name="after_sales_amount_invalid">退款金额必须大于0,且不能超过商品总额</string>
|
<string name="after_sales_amount_invalid">退款金额必须大于0,且不能超过所选商品总额</string>
|
||||||
<string name="after_sales_reason"><font color="#FF3B30">*</font> 售后原因</string>
|
<string name="after_sales_reason"><font color="#FF3B30">*</font> 售后原因</string>
|
||||||
<string name="after_sales_reason_unwanted">不想要了</string>
|
<string name="after_sales_reason_unwanted">不想要了</string>
|
||||||
<string name="after_sales_reason_quality">商品质量问题</string>
|
<string name="after_sales_reason_quality">商品质量问题</string>
|
||||||
|
|||||||
20
app/src/main/res/values/strings_promo_code.xml
Normal file
20
app/src/main/res/values/strings_promo_code.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="promo_code_save_hint">长按保存图片</string>
|
||||||
|
<string name="promo_code_back">返回</string>
|
||||||
|
<string name="promo_code_slogan">妈妈的英吉拉,美味不停歇</string>
|
||||||
|
<string name="promo_code_change_background">更换背景</string>
|
||||||
|
<string name="promo_code_label">你的推广码</string>
|
||||||
|
<string name="promo_code_accessibility">你的推广码:%1$s</string>
|
||||||
|
<string name="promo_code_empty">暂无推广码</string>
|
||||||
|
<string name="promo_code_picker_unavailable">未找到可用的图片选择器</string>
|
||||||
|
<string name="promo_code_background_failed">图片无法读取,请重新选择</string>
|
||||||
|
<string name="promo_code_background_loading">背景加载中,请稍后保存</string>
|
||||||
|
<string name="promo_code_saved">推广图片已保存到相册</string>
|
||||||
|
<string name="promo_code_save_failed">保存失败,请稍后重试</string>
|
||||||
|
<string name="promo_code_storage_title">存储权限使用说明</string>
|
||||||
|
<string name="promo_code_storage_message">用于将推广图片保存到相册,仅在保存时申请。</string>
|
||||||
|
<string name="promo_code_storage_denied">保存图片需要存储权限,请在系统设置中允许后重试</string>
|
||||||
|
<string name="promo_code_permission_cancel">取消</string>
|
||||||
|
<string name="promo_code_permission_allow">允许</string>
|
||||||
|
</resources>
|
||||||
@@ -2,11 +2,12 @@ package com.ckkj.griddle.mine.mvp;
|
|||||||
|
|
||||||
import com.ckkj.griddle.mine.entity.MyDevicesEntity;
|
import com.ckkj.griddle.mine.entity.MyDevicesEntity;
|
||||||
import com.ckkj.griddle.mine.entity.PointsHistoryEntity;
|
import com.ckkj.griddle.mine.entity.PointsHistoryEntity;
|
||||||
|
import com.ckkj.griddle.mine.mvp.mine.MineContract;
|
||||||
|
import com.ckkj.griddle.mine.mvp.mine.MineImpl;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.ckkj.griddle.mine.order.entity;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class AfterSalesGoodsTest {
|
||||||
|
private final List<AfterSalesGoods> items = AfterSalesGoods.createPreviewItems();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void refundLimitTracksSelection() {
|
||||||
|
assertEquals(20800L, AfterSalesGoods.refundLimit(items, new boolean[]{true, false, false}));
|
||||||
|
assertEquals(53600L, AfterSalesGoods.refundLimit(items, new boolean[]{true, true, false}));
|
||||||
|
assertEquals(32800L, AfterSalesGoods.refundLimit(items, new boolean[]{false, true, false}));
|
||||||
|
assertEquals(0L, AfterSalesGoods.refundLimit(items, new boolean[]{false, false, false}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void refundLimitRejectsDisabledOrMismatchedSelection() {
|
||||||
|
assertEquals(0L, AfterSalesGoods.refundLimit(items, new boolean[]{true, false, true}));
|
||||||
|
assertEquals(0L, AfterSalesGoods.refundLimit(items, new boolean[]{true, false}));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.ckkj.griddle.point.mvp;
|
package com.ckkj.griddle.order.mvp;
|
||||||
|
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderDetailEntity;
|
import com.ckkj.griddle.order.entity.PointsOrderDetailEntity;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity.Filter;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity.Filter;
|
||||||
import com.ckkj.griddle.point.entity.PointsOrderEntity.Status;
|
import com.ckkj.griddle.order.entity.PointsOrderEntity.Status;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
Reference in New Issue
Block a user