Search in sources :

Example 1 with AdapterChargeAmount

use of net.iGap.adapter.payment.AdapterChargeAmount in project iGap-Android by KianIranian-STDG.

the class ChargeFragment method choosePriceButtonClicked.

private void choosePriceButtonClicked() {
    if (currentOperator != null) {
        MaterialDialog dialog = new MaterialDialog.Builder(requireContext()).customView(R.layout.popup_paymet_amount, false).build();
        View amountDialogView = dialog.getCustomView();
        if (amountDialogView != null) {
            RecyclerViewAmount = amountDialogView.findViewById(R.id.rv_amount);
            RecyclerViewAmount.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
            RecyclerViewAmount.setAdapter(new AdapterChargeAmount(faceValueList, amountSelectedIndex != -1 ? amountSelectedIndex : amountDefaultIndex));
            amountDialogView.findViewById(R.id.close_view3).setOnClickListener(v12 -> dialog.dismiss());
            amountDialogView.findViewById(R.id.btn_dialog3).setOnClickListener(v1 -> {
                AdapterChargeAmount adapterAmount = (AdapterChargeAmount) RecyclerViewAmount.getAdapter();
                if (adapterAmount != null) {
                    if (adapterAmount.getSelectedPosition() == -1) {
                        return;
                    }
                    amountSelectedIndex = adapterAmount.getSelectedPosition();
                    currentAmount = faceValueList.get(amountSelectedIndex);
                    buttonAmount.setText(currentAmount.getTextAmount());
                    dialog.dismiss();
                }
            });
        }
        dialog.show();
    } else {
        showError(getContext().getResources().getString(R.string.please_select_operator));
    }
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) AppCompatTextView(androidx.appcompat.widget.AppCompatTextView) CircleImageView(net.iGap.module.CircleImageView) ScrollView(android.widget.ScrollView) AdapterChargeAmount(net.iGap.adapter.payment.AdapterChargeAmount)

Aggregations

View (android.view.View)1 ScrollView (android.widget.ScrollView)1 AppCompatImageView (androidx.appcompat.widget.AppCompatImageView)1 AppCompatTextView (androidx.appcompat.widget.AppCompatTextView)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)1 AdapterChargeAmount (net.iGap.adapter.payment.AdapterChargeAmount)1 CircleImageView (net.iGap.module.CircleImageView)1