Skip to content

Instantly share code, notes, and snippets.

@snadjafi
Created October 29, 2013 23:52
Show Gist options
  • Select an option

  • Save snadjafi/7224798 to your computer and use it in GitHub Desktop.

Select an option

Save snadjafi/7224798 to your computer and use it in GitHub Desktop.
public static KuaCustomDialogFragment newInstance(String messageBody, String title, String negativeButtonText, String positiveButtonText, boolean isCancelable)
{
KuaCustomDialogFragment mCustomDialog = new KuaCustomDialogFragment();
Bundle args = new Bundle();
args.putString("body", messageBody);
args.putBoolean("cancelable",isCancelable);
if (title!= null)
args.putString("title", title);
if (negativeButtonText == null && positiveButtonText != null)
args.putString("neutral", positiveButtonText);
if (negativeButtonText != null && positiveButtonText != null)
{
args.putString("negative", negativeButtonText);
args.putString("positive", positiveButtonText);
}
mCustomDialog.setArguments(args);
return mCustomDialog;
}
@Override
public void onAttach(Activity activity)
{
super.onAttach(activity);
if(getParentFragment() instanceof ReceiptListFragmentInterface)
receiptListCoordinator = (ReceiptListFragmentInterface) getParentFragment();
else if (activity instanceof ReceiptListFragmentInterface)
receiptListCoordinator = (ReceiptListFragmentInterface) activity;
else
throw new ClassCastException("Parent container must implement ReceiptListFragmentInterface");
receiptArrayList = new ArrayList<Receipt>();
receiptItemAdapter = new ReceiptItemAdapter(getActivity(), R.layout.row_receipt, R.layout.row_settings_header, receiptArrayList);
if (KuapayLibrary.receiptsProvider.isReceiptListDirty())
KuapayLibrary.receiptsProvider.fetchReceiptList(fetchReceiptResponseHandler);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment