Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overload newInfoDialog and newAlertDialog for customizable text of button #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,24 @@ public static AlertDialog newYesNoDialog(final Context context, String dialogTit
*/
public static AlertDialog newMessageDialog(final Context context, String dialogTitle,
String screenMessage, int iconResourceId) {
return newMessageDialog(context, dialogTitle, screenMessage, "Okay", iconResourceId);
}

/**
* Creates a new AlertDialog to display a simple message
*
* @param context
* @param dialogTitle
* @param screenMessage
* @param buttonText
* @param iconResourceId
* @return
*/
public static AlertDialog newMessageDialog(final Context context, String dialogTitle,
String screenMessage, String buttonText, int iconResourceId) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setCancelable(false);
builder.setPositiveButton("Okay", new OnClickListener() {
builder.setPositiveButton(buttonText, new OnClickListener() {

public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,22 @@ public AlertDialog newInfoDialog(int titleResourceId, int messageResourceId) {
getString(messageResourceId), android.R.drawable.ic_dialog_info);
}

public AlertDialog newInfoDialog(int titleResourceId, int messageResourceId, int buttonTextResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), getString(buttonTextResourceId), android.R.drawable.ic_dialog_info);
}

public AlertDialog newAlertDialog(int titleResourceId, int messageResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), android.R.drawable.ic_dialog_alert);
}

public AlertDialog newAlertDialog(int titleResourceId, int messageResourceId, int buttonTextResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), getString(buttonTextResourceId), android.R.drawable.ic_dialog_alert);
}


public AlertDialog newErrorHandlerDialog(int titleResourceId, Exception error) {
return BetterActivityHelper.newErrorHandlerDialog(this, getString(titleResourceId), error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,22 @@ public AlertDialog newInfoDialog(int titleResourceId, int messageResourceId) {
getString(messageResourceId), android.R.drawable.ic_dialog_info);
}

public AlertDialog newInfoDialog(int titleResourceId, int messageResourceId, int buttonTextResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), getString(buttonTextResourceId), android.R.drawable.ic_dialog_info);
}

public AlertDialog newAlertDialog(int titleResourceId, int messageResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), android.R.drawable.ic_dialog_alert);
}

public AlertDialog newAlertDialog(int titleResourceId, int messageResourceId, int buttonTextResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), getString(buttonTextResourceId), android.R.drawable.ic_dialog_alert);
}


public AlertDialog newErrorHandlerDialog(int titleResourceId, Exception error) {
return BetterActivityHelper.newErrorHandlerDialog(this, getString(titleResourceId), error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,21 @@ public AlertDialog newInfoDialog(int titleResourceId, int messageResourceId) {
getString(messageResourceId), android.R.drawable.ic_dialog_info);
}

public AlertDialog newInfoDialog(int titleResourceId, int messageResourceId, int buttonTextResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), getString(buttonTextResourceId), android.R.drawable.ic_dialog_info);
}

public AlertDialog newAlertDialog(int titleResourceId, int messageResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), android.R.drawable.ic_dialog_alert);
}

public AlertDialog newAlertDialog(int titleResourceId, int messageResourceId, int buttonTextResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), getString(buttonTextResourceId), android.R.drawable.ic_dialog_alert);
}

public AlertDialog newErrorHandlerDialog(int titleResourceId, Exception error) {
return BetterActivityHelper.newErrorHandlerDialog(this, getString(titleResourceId), error);
}
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/github/droidfu/activities/BetterMapActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,22 @@ public AlertDialog newInfoDialog(int titleResourceId, int messageResourceId) {
getString(messageResourceId), android.R.drawable.ic_dialog_info);
}

public AlertDialog newInfoDialog(int titleResourceId, int messageResourceId, int buttonTextResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), getString(buttonTextResourceId), android.R.drawable.ic_dialog_info);
}

public AlertDialog newAlertDialog(int titleResourceId, int messageResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), android.R.drawable.ic_dialog_alert);
}

public AlertDialog newAlertDialog(int titleResourceId, int messageResourceId, int buttonTextResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), getString(buttonTextResourceId), android.R.drawable.ic_dialog_alert);
}


public AlertDialog newErrorHandlerDialog(int titleResourceId, Exception error) {
return BetterActivityHelper.newErrorHandlerDialog(this, getString(titleResourceId), error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,22 @@ public AlertDialog newInfoDialog(int titleResourceId, int messageResourceId) {
getString(messageResourceId), android.R.drawable.ic_dialog_info);
}

public AlertDialog newInfoDialog(int titleResourceId, int messageResourceId, int buttonTextResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), getString(buttonTextResourceId), android.R.drawable.ic_dialog_info);
}

public AlertDialog newAlertDialog(int titleResourceId, int messageResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), android.R.drawable.ic_dialog_alert);
}

public AlertDialog newAlertDialog(int titleResourceId, int messageResourceId, int buttonTextResourceId) {
return BetterActivityHelper.newMessageDialog(this, getString(titleResourceId),
getString(messageResourceId), getString(buttonTextResourceId), android.R.drawable.ic_dialog_alert);
}


public AlertDialog newErrorHandlerDialog(int titleResourceId, Exception error) {
return BetterActivityHelper.newErrorHandlerDialog(this, getString(titleResourceId), error);
}
Expand Down