package de.thedevstack.conversationsplus.ui.dialogs; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.database.Cursor; import android.graphics.drawable.Drawable; import android.view.View; import android.widget.AdapterView; import android.widget.ListAdapter; import de.thedevstack.conversationsplus.R; /** * Created by tzur on 29.09.2015. */ public class AbstractAlertDialog { protected AlertDialog.Builder builder; public AbstractAlertDialog(Context context, String title) { this.builder = new AlertDialog.Builder(context); this.builder.setTitle(title); this.builder.setPositiveButton(R.string.cplus_ok, null); } public AbstractAlertDialog(Context context, int titleTextId) { this(context, context.getString(titleTextId)); } public void show() { this.builder.show(); } public Context getContext() { return builder.getContext(); } public AlertDialog.Builder setTitle(int titleId) { return builder.setTitle(titleId); } public AlertDialog.Builder setTitle(CharSequence title) { return builder.setTitle(title); } public AlertDialog.Builder setIcon(int iconId) { return builder.setIcon(iconId); } public AlertDialog.Builder setIcon(Drawable icon) { return builder.setIcon(icon); } public AlertDialog.Builder setMessage(CharSequence message) { return builder.setMessage(message); } public AlertDialog.Builder setMessage(int messageId) { return builder.setMessage(messageId); } public AlertDialog.Builder setIconAttribute(int attrId) { return builder.setIconAttribute(attrId); } public AlertDialog.Builder setPositiveButton(int textId, DialogInterface.OnClickListener listener) { return builder.setPositiveButton(textId, listener); } public AlertDialog.Builder setPositiveButton(CharSequence text, DialogInterface.OnClickListener listener) { return builder.setPositiveButton(text, listener); } public AlertDialog.Builder setNegativeButton(int textId, DialogInterface.OnClickListener listener) { return builder.setNegativeButton(textId, listener); } public AlertDialog.Builder setNegativeButton(CharSequence text, DialogInterface.OnClickListener listener) { return builder.setNegativeButton(text, listener); } public AlertDialog.Builder setNeutralButton(int textId, DialogInterface.OnClickListener listener) { return builder.setNeutralButton(textId, listener); } public AlertDialog.Builder setNeutralButton(CharSequence text, DialogInterface.OnClickListener listener) { return builder.setNeutralButton(text, listener); } public AlertDialog.Builder setCancelable(boolean cancelable) { return builder.setCancelable(cancelable); } public AlertDialog.Builder setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) { return builder.setOnCancelListener(onCancelListener); } public AlertDialog.Builder setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) { return builder.setOnDismissListener(onDismissListener); } public AlertDialog.Builder setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) { return builder.setOnKeyListener(onKeyListener); } public AlertDialog.Builder setAdapter(ListAdapter adapter, DialogInterface.OnClickListener listener) { return builder.setAdapter(adapter, listener); } public AlertDialog.Builder setCursor(Cursor cursor, DialogInterface.OnClickListener listener, String labelColumn) { return builder.setCursor(cursor, listener, labelColumn); } public AlertDialog.Builder setView(View view) { return builder.setView(view); } public AlertDialog.Builder setView(int layoutResId) { return builder.setView(layoutResId); } public AlertDialog.Builder setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener) { return builder.setOnItemSelectedListener(listener); } }