use of net.iGap.adapter.payment.ChargeHistoryNumberAdapter in project iGap-Android by KianIranian-STDG.
the class ChargeFragment method historyButtonClicked.
private View.OnClickListener historyButtonClicked() {
return v -> {
ChargeFragment.this.hideKeyboard();
progressBar.setVisibility(View.VISIBLE);
historyButton.setEnabled(false);
closeKeyboard(editTextNumber);
favoriteNumberCall.enqueue(new Callback<GetFavoriteNumber>() {
@Override
public void onResponse(@NonNull Call<GetFavoriteNumber> call, @NonNull Response<GetFavoriteNumber> response) {
progressBar.setVisibility(View.GONE);
historyButton.setEnabled(true);
if (response.isSuccessful() && response.body() != null && response.body().getData() != null) {
if (response.body().getData().size() > 0) {
MaterialDialog dialog = new MaterialDialog.Builder(getContext()).customView(R.layout.popup_paymet_history, false).build();
View historyDialogView = dialog.getCustomView();
if (historyDialogView != null) {
RecyclerViewHistory = historyDialogView.findViewById(R.id.rv_history);
setDialogBackground(RecyclerViewHistory);
RecyclerViewHistory.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
ChargeHistoryNumberAdapter adapter = new ChargeHistoryNumberAdapter(response.body().getData());
RecyclerViewHistory.setAdapter(adapter);
adapter.setOnItemClickListener(position -> {
historyItemClicked = position;
onHistoryItemClicked();
isHistorySelected(true);
dialog.dismiss();
});
historyDialogView.findViewById(R.id.iv_close2).setOnClickListener(v12 -> dialog.dismiss());
}
dialog.show();
} else {
HelperError.showSnackMessage(getResources().getString(R.string.error), false);
}
}
}
@Override
public void onFailure(@NonNull Call<GetFavoriteNumber> call, @NonNull Throwable t) {
historyButton.setEnabled(true);
progressBar.setVisibility(View.GONE);
showError(getContext().getResources().getString(R.string.there_is_no_connection_to_server));
}
});
};
}
use of net.iGap.adapter.payment.ChargeHistoryNumberAdapter in project iGap-Android by KianIranian-STDG.
the class ChargeFragment method onHistoryItemClicked.
private void onHistoryItemClicked() {
ChargeHistoryNumberAdapter adapterHistory = (ChargeHistoryNumberAdapter) RecyclerViewHistory.getAdapter();
if (adapterHistory != null) {
if (historyItemClicked == -1) {
return;
}
String historyNumberPhone = adapterHistory.getHistoryNumberList().get(historyItemClicked).getPhoneNumber();
adapterHistory.getHistoryNumberList().get(historyItemClicked).getChargeType();
setPhoneNumberEditText(historyNumberPhone);
currentAmount = new Amount(adapterHistory.getHistoryNumberList().get(historyItemClicked).getAmount());
buttonAmount.setText(currentAmount.getTextAmount());
detectOperatorByNumber(editTextNumber.getText().toString());
}
}
Aggregations