Search in sources :

Example 1 with CreditsBalanceView

use of com.odysee.app.views.CreditsBalanceView in project odysee-android by OdyseeTeam.

the class WalletDetailAdapter method getView.

@Override
public View getView(int i, View view, ViewGroup viewGroup) {
    if (view == null) {
        view = inflater.inflate(R.layout.list_item_boosting_balance, viewGroup, false);
        CreditsBalanceView balanceView = view.findViewById(R.id.wallet_supporting_balance);
        TextView detailTextView = view.findViewById(R.id.detail);
        TextView detailExplanationTextView = view.findViewById(R.id.detail_explanation);
        WalletDetailItem item = (WalletDetailItem) getItem(i);
        detailTextView.setText(item.detail);
        detailExplanationTextView.setText(item.detailDesc);
        Helper.setViewText(balanceView, item.detailAmount);
        ProgressBar progressUnlockTips = view.findViewById(R.id.wallet_unlock_tips_progress);
        progressUnlockTips.setVisibility(item.isInProgress ? View.VISIBLE : View.GONE);
        ImageButton buttonLock = view.findViewById(R.id.lock_button);
        buttonLock.setVisibility((item.isUnlockable && !item.isInProgress) ? View.VISIBLE : View.GONE);
        if (item.isUnlockable) {
            buttonLock.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View view) {
                    if (view.getContext() != null) {
                        AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()).setTitle(R.string.unlock_tips).setMessage(R.string.confirm_unlock_tips).setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                unlockTips(view);
                            }
                        }).setNegativeButton(R.string.no, null);
                        builder.show();
                    }
                }
            });
        }
    }
    return view;
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) DialogInterface(android.content.DialogInterface) TextView(android.widget.TextView) CreditsBalanceView(com.odysee.app.views.CreditsBalanceView) View(android.view.View) CreditsBalanceView(com.odysee.app.views.CreditsBalanceView) WalletDetailItem(com.odysee.app.model.WalletDetailItem) ImageButton(android.widget.ImageButton) TextView(android.widget.TextView) ProgressBar(android.widget.ProgressBar)

Aggregations

DialogInterface (android.content.DialogInterface)1 View (android.view.View)1 ImageButton (android.widget.ImageButton)1 ProgressBar (android.widget.ProgressBar)1 TextView (android.widget.TextView)1 AlertDialog (androidx.appcompat.app.AlertDialog)1 WalletDetailItem (com.odysee.app.model.WalletDetailItem)1 CreditsBalanceView (com.odysee.app.views.CreditsBalanceView)1