use of ru.sash0k.thriftbox.ActivityHelper in project Thrift-box by Sash0k.
the class DeleteConfirmDialog method onCreateDialog.
// ============================================================================
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Context context = getActivity();
String[] categories = context.getResources().getStringArray(R.array.categories);
final Bundle args = getArguments();
final int id = args.getInt(BaseColumns._ID);
final String date = args.getString(DB.DATE);
final int category = args.getInt(DB.CATEGORY);
final String value = Utils.formatValue(args.getLong(DB.VALUE)) + Utils.ROUBLE + "?";
final String title = getString(R.string.delete_label) + " " + value;
final String msg = context.getString(R.string.delete_msg) + '\n' + date + divider + categories[category] + divider + value;
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context).setTitle(((ActivityHelper) getActivity()).parseRouble(title)).setMessage(((ActivityHelper) getActivity()).parseRouble(msg)).setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
new DB(context).deleteItem(context, id);
Utils.updateWidgets(context);
}
}).setNegativeButton(android.R.string.no, null);
return builder.create();
}
Aggregations