Skip to content

Commit 94b4e11

Browse files
committed
Updated shape
1 parent 48b420a commit 94b4e11

4 files changed

Lines changed: 46 additions & 32 deletions

File tree

.idea/workspace.xml

Lines changed: 33 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/github/pierry/simpletoast/SimpleToast.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.annotation.TargetApi;
44
import android.content.Context;
55
import android.graphics.drawable.GradientDrawable;
6+
import android.graphics.drawable.ShapeDrawable;
67
import android.os.Build;
78
import android.view.LayoutInflater;
89
import android.view.View;
@@ -58,13 +59,16 @@ public static void ok(Context context, String msg) {
5859

5960
LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.layout);
6061

61-
GradientDrawable gradientDrawable = new GradientDrawable();
62+
ShapeDrawable shape = (ShapeDrawable) linearLayout.getBackground();
63+
shape.getPaint().setColor(color);
64+
65+
/*GradientDrawable gradientDrawable = new GradientDrawable();
6266
gradientDrawable.setColor(color);
63-
gradientDrawable.setAlpha(255);
6467
gradientDrawable.setCornerRadius(4);
65-
gradientDrawable.setStroke(1, borderColor);
68+
gradientDrawable.so
69+
gradientDrawable.setStroke(1, borderColor);*/
6670

67-
linearLayout.setBackground(gradientDrawable);
71+
linearLayout.setBackground(shape);
6872

6973
Button button = (Button) view.findViewById(R.id.button);
7074
button.setText(msg);

app/src/main/res/drawable/background_empty.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
android:shape="rectangle" >
44
<corners android:radius="4dp" />
55
<stroke
6-
android:width="1dip"
6+
android:width="0dip"
77
android:color="@color/black" />
88
<solid android:color="@color/black" />
99
</shape>

app/src/main/res/layout/toast_base.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
xmlns:tools="http://schemas.android.com/tools"
33
android:id="@+id/layout"
44
android:layout_width="wrap_content"
5-
android:layout_height="wrap_content"
6-
android:background="@drawable/list_border_back_blue" >
5+
android:layout_height="wrap_content" >
76

87
<IconTextView
98
android:layout_height="wrap_content"
109
android:layout_width="wrap_content"
1110
android:id="@+id/img"
11+
android:layout_marginBottom="4dp"
12+
android:layout_marginLeft="4dp"
13+
android:layout_marginTop="4dp"
1214
android:textSize="40dp"
1315
android:textColor="@color/white" />
1416

0 commit comments

Comments
 (0)