use of net.iGap.adapter.payment.AdapterChargeType in project iGap-Android by KianIranian-STDG.
the class ChargeFragment method chooseChargeTypeClicked.
private void chooseChargeTypeClicked() {
if (currentOperator != null) {
MaterialDialog dialog = new MaterialDialog.Builder(getContext()).customView(R.layout.popup_paymet_type, false).build();
View typeDialogView = dialog.getCustomView();
if (typeDialogView != null) {
typeDialogView.findViewById(R.id.close_view4).setOnClickListener(v1 -> dialog.dismiss());
RecyclerViewAmount = typeDialogView.findViewById(R.id.rv_type);
RecyclerViewAmount.setAdapter(new AdapterChargeType(chargeTypesList, chargeTypeSelectedIndex != -1 ? chargeTypeSelectedIndex : chargeTypeDefaultIndex));
RecyclerViewAmount.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
typeDialogView.findViewById(R.id.btn_dialog4).setOnClickListener(v16 -> {
AdapterChargeType adapterChargeType = (AdapterChargeType) RecyclerViewAmount.getAdapter();
if (adapterChargeType != null) {
if (adapterChargeType.getSelectedPosition() == -1) {
return;
}
chargeTypeSelectedIndex = chargeTypeDefaultIndex = adapterChargeType.getSelectedPosition();
buttonChargeType.setText(chargeTypesList.get(chargeTypeDefaultIndex).getTitle());
dialog.dismiss();
}
});
}
dialog.show();
} else {
showError(getContext().getResources().getString(R.string.please_select_operator));
}
}
Aggregations