Open itsmeJithin opened 3 years ago
Main activity contains below code
ProductRegistrationDetails productRegistrationDetails = new ProductRegistrationDetails(); productRegistrationDetails.setActiveRegistrationFound(isActiveRegistrationFound); productRegistrationDetails.setNumberOfFreebies(numberOfFreebies); productRegistrationDetails.setNumberOfRegistrationBasedAdsPerMonth(numberOfRegistrationBasedAdsPerMonth); productRegistrationDetails.setRemainingProduct(remainingProduct); productRegistrationDetails.setTrialEnabled(isTrialEnabled); productRegistrationDetails.setTrialExpired(isTrialExpired); productRegistrationDetails.setUpgradedPackageIsUsing(isUpgradedPackageIsUsing); ProductRegistrationAdapter adapter = new ProductRegistrationAdapter(context, productRegistrationDetails); DialogPlus dialogPlus = DialogPlus.newDialog(this) .setAdapter(adapter) .setContentHolder(new ListHolder()) .setExpanded(true) .setCancelable(true) .setContentHeight(ViewGroup.LayoutParams.WRAP_CONTENT) .setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(DialogPlus dialog, Object item, View view, int position) { CustomSnackBar snackBar = new CustomSnackBar(context, view, "this is test", Snackbar.LENGTH_LONG, CustomSnackBar.INFO); snackBar.show(); } }) .create(); dialogPlus.show();
My Adapter Class
public class ProductRegistrationAdapter extends BaseAdapter { private static final String TAG = ProductRegistrationAdapter.class.getSimpleName(); private Context mContext; private ProductRegistrationDetails productRegistrationDetails; public ProductRegistrationAdapter(@NonNull Context context, ProductRegistrationDetails details) { this.mContext = context; productRegistrationDetails = details; } @Override public int getCount() { return 1; } @Override public Object getItem(int i) { return i; } @Override public long getItemId(int i) { return i; } @Override public View getView(final int i, View view, ViewGroup viewGroup) { ProductRegistrationAdapter.ViewHolder holder; if (view == null) { LayoutInflater inflater = (LayoutInflater) mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.registration_dialog, viewGroup, false); holder = new ProductRegistrationAdapter.ViewHolder(); holder.registerNow = (Button) view.findViewById(R.id.register_now); holder.info = (TextView) view.findViewById(R.id.dialog_info); view.setTag(holder); } else { holder = (ProductRegistrationAdapter.ViewHolder) view.getTag(); } return view; } private static class ViewHolder { TextView info; TextView Id; Button registerNow; } }
Main activity contains below code
My Adapter Class