Search in sources :

Example 1 with FaceValue

use of net.iGap.model.paymentPackage.FaceValue in project iGap-Android by KianIranian-STDG.

the class ChargeFragment method detectOperatorByNumber.

private void detectOperatorByNumber(String editText) {
    if (editText.length() == 10 && editText.charAt(0) != '0')
        editTextNumber.setText("0".concat(Objects.requireNonNull(editTextNumber.getText()).toString()));
    if (editText.length() == 11 || iconRemove.getText().toString().equals(getResources().getString(R.string.icon_edit))) {
        operators.clear();
        for (ConfigData configData : config.getData()) {
            operators.add(configData.getOperator());
            if (iconRemove.getText().toString().equals(getResources().getString(R.string.icon_edit))) {
                currentConfigData = null;
            } else {
                for (String preNumber : configData.getPreNumbers()) {
                    if (preNumber.equals(editText.substring(0, 4))) {
                        currentConfigData = configData;
                        break;
                    }
                }
            }
        }
    }
    if (currentConfigData != null) {
        faceValueList.clear();
        for (FaceValue faceValue : currentConfigData.getFaceValues()) {
            faceValueList.add(new Amount(faceValue.getKey()));
            if (faceValue.getSelected())
                amountDefaultIndex = faceValueList.size() - 1;
        }
        chargeTypesList.clear();
        chargeTypesList.addAll(currentConfigData.getTopupChargeTypes());
        if (currentConfigData != null)
            changeOperator(currentConfigData.getOperator());
    } else {
        faceValueList.clear();
        chargeTypesList.clear();
    }
}
Also used : FaceValue(net.iGap.model.paymentPackage.FaceValue) ConfigData(net.iGap.model.paymentPackage.ConfigData) AdapterChargeAmount(net.iGap.adapter.payment.AdapterChargeAmount) Amount(net.iGap.adapter.payment.Amount)

Aggregations

AdapterChargeAmount (net.iGap.adapter.payment.AdapterChargeAmount)1 Amount (net.iGap.adapter.payment.Amount)1 ConfigData (net.iGap.model.paymentPackage.ConfigData)1 FaceValue (net.iGap.model.paymentPackage.FaceValue)1