Skip to content

Commit

Permalink
- Minor fixes
Browse files Browse the repository at this point in the history
- New version available 0.1.8
  • Loading branch information
Shashank02051997 committed Sep 16, 2020
1 parent eb91b3b commit dc2f031
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Add this to your module's `build.gradle` file (make sure the version matches the
```gradle
dependencies {
...
implementation 'com.github.Shashank02051997:FancyToast-Android:0.1.7'
implementation 'com.github.Shashank02051997:FancyToast-Android:0.1.8'
}
```
## Usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,18 @@ public FancyToast(Context context) {
super(context);
}

public static Toast makeText(Context context, String message, int duration, int type, boolean androidIcon) {
public static Toast makeText(Context context, CharSequence message, int duration, int type, boolean androidIcon) {
Toast toast = new Toast(context);
toast.setDuration(duration);
View layout = LayoutInflater.from(context).inflate(R.layout.fancytoast_layout, null, false);
TextView l1 = (TextView) layout.findViewById(R.id.toast_text);
LinearLayout linearLayout = (LinearLayout) layout.findViewById(R.id.toast_type);
ImageView img = (ImageView) layout.findViewById(R.id.toast_icon);
ImageView img1 = (ImageView) layout.findViewById(R.id.imageView4);
TextView l1 = layout.findViewById(R.id.toast_text);
LinearLayout linearLayout = layout.findViewById(R.id.toast_type);
ImageView img = layout.findViewById(R.id.toast_icon);
ImageView img1 = layout.findViewById(R.id.imageView4);
l1.setText(message);
if (androidIcon == true)
if (androidIcon)
img1.setVisibility(View.VISIBLE);
else if (androidIcon == false)
img1.setVisibility(View.GONE);
else img1.setVisibility(View.GONE);
switch (type) {
case 1:
linearLayout.setBackgroundResource(R.drawable.success_shape);
Expand Down Expand Up @@ -75,19 +74,19 @@ else if (androidIcon == false)



public static Toast makeText(Context context, String message, int duration, int type, int ImageResource, boolean androidIcon) {
public static Toast makeText(Context context, CharSequence message, int duration, int type, int ImageResource, boolean androidIcon) {
Toast toast = new Toast(context);
toast.setDuration(duration);
View layout = LayoutInflater.from(context).inflate(R.layout.fancytoast_layout, null, false);
TextView l1 = (TextView) layout.findViewById(R.id.toast_text);
LinearLayout linearLayout = (LinearLayout) layout.findViewById(R.id.toast_type);
ImageView img = (ImageView) layout.findViewById(R.id.toast_icon);
ImageView img1 = (ImageView) layout.findViewById(R.id.imageView4);
TextView l1 = layout.findViewById(R.id.toast_text);
LinearLayout linearLayout = layout.findViewById(R.id.toast_type);
ImageView img = layout.findViewById(R.id.toast_icon);
ImageView img1 = layout.findViewById(R.id.imageView4);
l1.setText(message);
img.setImageResource(ImageResource);
if (androidIcon == true)
if (androidIcon)
img1.setVisibility(View.VISIBLE);
else if (androidIcon == false)
img1.setVisibility(View.GONE);
else img1.setVisibility(View.GONE);
switch (type) {
case 1:
linearLayout.setBackgroundResource(R.drawable.success_shape);
Expand Down

0 comments on commit dc2f031

Please sign in to comment.