Skip to content

Commit c6b0ff9

Browse files
committed
showToast methods now return a Toast object
1 parent 3e93210 commit c6b0ff9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

WordPressUtils/src/main/java/org/wordpress/android/util/ToastUtils.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,23 @@ private ToastUtils() {
1515
throw new AssertionError();
1616
}
1717

18-
public static void showToast(Context context, int stringResId) {
19-
showToast(context, stringResId, Duration.SHORT);
18+
public static Toast showToast(Context context, int stringResId) {
19+
return showToast(context, stringResId, Duration.SHORT);
2020
}
2121

22-
public static void showToast(Context context, int stringResId, Duration duration) {
23-
showToast(context, context.getString(stringResId), duration);
22+
public static Toast showToast(Context context, int stringResId, Duration duration) {
23+
return showToast(context, context.getString(stringResId), duration);
2424
}
2525

26-
public static void showToast(Context context, String text) {
27-
showToast(context, text, Duration.SHORT);
26+
public static Toast showToast(Context context, String text) {
27+
return showToast(context, text, Duration.SHORT);
2828
}
2929

30-
public static void showToast(Context context, String text, Duration duration) {
30+
public static Toast showToast(Context context, String text, Duration duration) {
3131
Toast toast = Toast.makeText(context, text,
3232
(duration == Duration.SHORT ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG));
3333
toast.setGravity(Gravity.CENTER, 0, 0);
3434
toast.show();
35+
return toast;
3536
}
3637
}

0 commit comments

Comments
 (0)