|
|
@@ -11,7 +11,6 @@ import androidx.lifecycle.LifecycleOwner;
|
|
|
import androidx.lifecycle.LiveData;
|
|
|
import androidx.lifecycle.MutableLiveData;
|
|
|
|
|
|
-
|
|
|
import com.atmob.app.lib.base.BaseDialog;
|
|
|
import com.datarecovery.master.R;
|
|
|
import com.datarecovery.master.data.api.bean.PayOptionsBean;
|
|
|
@@ -24,11 +23,9 @@ import java.util.List;
|
|
|
@BaseDialog.FullScreen(height = false, gravity = Gravity.BOTTOM)
|
|
|
public class ChoosePaymentWayDialog extends BaseDialog<DialogChoosePaymentWayBinding> {
|
|
|
|
|
|
- private ActionHandler actionHandler;
|
|
|
-
|
|
|
private final List<PayOptionsBean> paymentWayList;
|
|
|
-
|
|
|
private final MutableLiveData<Integer> selectedPosition = new MutableLiveData<>(0);
|
|
|
+ private ActionHandler actionHandler;
|
|
|
|
|
|
@SuppressLint("UseCompatLoadingForDrawables")
|
|
|
public ChoosePaymentWayDialog(@NonNull Context context, LifecycleOwner lifecycleOwner, LiveData<String> payNowTxt, List<PayOptionsBean> paymentWayList) {
|
|
|
@@ -67,29 +64,29 @@ public class ChoosePaymentWayDialog extends BaseDialog<DialogChoosePaymentWayBin
|
|
|
|
|
|
|
|
|
public void paymentShow() {
|
|
|
- if (paymentWayList == null || paymentWayList.size() == 0) {
|
|
|
+ if (paymentWayList == null || paymentWayList.isEmpty()) {
|
|
|
ToastUtil.show(R.string.no_pay_way, ToastUtil.LENGTH_SHORT);
|
|
|
return;
|
|
|
}
|
|
|
if (paymentWayList.size() == 1) {
|
|
|
-
|
|
|
+ PayOptionsBean payOptionsBean = paymentWayList.get(0);
|
|
|
+ actionHandler.onPayClick(payOptionsBean.getPayPlatform(), payOptionsBean.getPayMethod());
|
|
|
} else {
|
|
|
show();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
protected void onDismiss() {
|
|
|
super.onDismiss();
|
|
|
}
|
|
|
|
|
|
- public interface ActionHandler {
|
|
|
- void onPayClick(int payPlatform, int payMethod);
|
|
|
- }
|
|
|
-
|
|
|
public ChoosePaymentWayDialog setActionHandler(ActionHandler actionHandler) {
|
|
|
this.actionHandler = actionHandler;
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
+ public interface ActionHandler {
|
|
|
+ void onPayClick(int payPlatform, int payMethod);
|
|
|
+ }
|
|
|
}
|