diff --git a/app/src/main/assets/PCap Terminal.otf b/app/src/main/assets/PCap Terminal.otf
new file mode 100644
index 0000000..daf0652
Binary files /dev/null and b/app/src/main/assets/PCap Terminal.otf differ
diff --git a/app/src/main/java/es/dmoral/toastysample/MainActivity.java b/app/src/main/java/es/dmoral/toastysample/MainActivity.java
index f68c70d..8a472fd 100644
--- a/app/src/main/java/es/dmoral/toastysample/MainActivity.java
+++ b/app/src/main/java/es/dmoral/toastysample/MainActivity.java
@@ -80,6 +80,18 @@ public void onClick(View view) {
Toasty.info(MainActivity.this, getFormattedMessage()).show();
}
});
+ findViewById(R.id.button_custom_config).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Toasty.Config.getInstance()
+ .setTextColor(Color.GREEN)
+ .setToastTypeface(getAssets(), "PCap Terminal.otf")
+ .apply();
+ Toasty.custom(MainActivity.this, "sudo kill -9 everyone", getResources().getDrawable(R.drawable.laptop512),
+ Color.BLACK, Toast.LENGTH_SHORT, true, true).show();
+ Toasty.Config.reset(); // Use this if you want to use the configuration above only once
+ }
+ });
}
private CharSequence getFormattedMessage() {
diff --git a/app/src/main/res/drawable/laptop512.png b/app/src/main/res/drawable/laptop512.png
new file mode 100644
index 0000000..943eddf
Binary files /dev/null and b/app/src/main/res/drawable/laptop512.png differ
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 764840d..79238be 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,90 +1,106 @@
-
-
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin">
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
-
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0bf9648..ea0d248 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -7,4 +7,5 @@
INFO TOAST WITH FORMATTING
ERROR TOAST
SUCCESS TOAST
+ CUSTOM CONFIGURATION
diff --git a/toasty/src/main/java/es/dmoral/toasty/Toasty.java b/toasty/src/main/java/es/dmoral/toasty/Toasty.java
index c8ce8ea..f27a047 100644
--- a/toasty/src/main/java/es/dmoral/toasty/Toasty.java
+++ b/toasty/src/main/java/es/dmoral/toasty/Toasty.java
@@ -77,7 +77,7 @@ public static Toast normal(@NonNull Context context, @NonNull CharSequence messa
@CheckResult
public static Toast normal(@NonNull Context context, @NonNull CharSequence message, int duration,
Drawable icon, boolean withIcon) {
- return custom(context, message, icon, DEFAULT_TEXT_COLOR, duration, withIcon);
+ return custom(context, message, icon, duration, withIcon);
}
@CheckResult
@@ -93,7 +93,7 @@ public static Toast warning(@NonNull Context context, @NonNull CharSequence mess
@CheckResult
public static Toast warning(@NonNull Context context, @NonNull CharSequence message, int duration, boolean withIcon) {
return custom(context, message, ToastyUtils.getDrawable(context, R.drawable.ic_error_outline_white_48dp),
- DEFAULT_TEXT_COLOR, WARNING_COLOR, duration, withIcon, true);
+ WARNING_COLOR, duration, withIcon, true);
}
@CheckResult
@@ -109,7 +109,7 @@ public static Toast info(@NonNull Context context, @NonNull CharSequence message
@CheckResult
public static Toast info(@NonNull Context context, @NonNull CharSequence message, int duration, boolean withIcon) {
return custom(context, message, ToastyUtils.getDrawable(context, R.drawable.ic_info_outline_white_48dp),
- DEFAULT_TEXT_COLOR, INFO_COLOR, duration, withIcon, true);
+ INFO_COLOR, duration, withIcon, true);
}
@CheckResult
@@ -125,7 +125,7 @@ public static Toast success(@NonNull Context context, @NonNull CharSequence mess
@CheckResult
public static Toast success(@NonNull Context context, @NonNull CharSequence message, int duration, boolean withIcon) {
return custom(context, message, ToastyUtils.getDrawable(context, R.drawable.ic_check_white_48dp),
- DEFAULT_TEXT_COLOR, SUCCESS_COLOR, duration, withIcon, true);
+ SUCCESS_COLOR, duration, withIcon, true);
}
@CheckResult
@@ -141,26 +141,26 @@ public static Toast error(@NonNull Context context, @NonNull CharSequence messag
@CheckResult
public static Toast error(@NonNull Context context, @NonNull CharSequence message, int duration, boolean withIcon) {
return custom(context, message, ToastyUtils.getDrawable(context, R.drawable.ic_clear_white_48dp),
- DEFAULT_TEXT_COLOR, ERROR_COLOR, duration, withIcon, true);
+ ERROR_COLOR, duration, withIcon, true);
}
@CheckResult
public static Toast custom(@NonNull Context context, @NonNull CharSequence message, Drawable icon,
- @ColorInt int textColor, int duration, boolean withIcon) {
- return custom(context, message, icon, textColor, -1, duration, withIcon, false);
+ int duration, boolean withIcon) {
+ return custom(context, message, icon, -1, duration, withIcon, false);
}
@CheckResult
public static Toast custom(@NonNull Context context, @NonNull CharSequence message, @DrawableRes int iconRes,
- @ColorInt int textColor, @ColorInt int tintColor, int duration,
+ @ColorInt int tintColor, int duration,
boolean withIcon, boolean shouldTint) {
- return custom(context, message, ToastyUtils.getDrawable(context, iconRes), textColor,
+ return custom(context, message, ToastyUtils.getDrawable(context, iconRes),
tintColor, duration, withIcon, shouldTint);
}
@CheckResult
public static Toast custom(@NonNull Context context, @NonNull CharSequence message, Drawable icon,
- @ColorInt int textColor, @ColorInt int tintColor, int duration,
+ @ColorInt int tintColor, int duration,
boolean withIcon, boolean shouldTint) {
final Toast currentToast = new Toast(context);
final View toastLayout = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
@@ -182,7 +182,7 @@ public static Toast custom(@NonNull Context context, @NonNull CharSequence messa
} else
toastIcon.setVisibility(View.GONE);
- toastTextView.setTextColor(textColor);
+ toastTextView.setTextColor(DEFAULT_TEXT_COLOR);
toastTextView.setText(message);
if (assetManager == null)
toastTextView.setTypeface(Typeface.create(TOAST_TYPEFACE, Typeface.NORMAL));