Skip to content

Commit e280ac2

Browse files
authored
Merge pull request Blankj#110 from c0state/fix_snackbar_layout_change
Change root snackbar element to “view”
2 parents 169a063 + 148b47d commit e280ac2

File tree

4 files changed

+11
-61
lines changed

4 files changed

+11
-61
lines changed

config.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ ext {
66
]
77

88
android = [
9-
compileSdkVersion : 24,
10-
buildToolsVersion : "24.0.3",
9+
compileSdkVersion : 25,
10+
buildToolsVersion : "25.0.2",
1111
minSdkVersion : 11,
12-
targetSdkVersion : 24,
12+
targetSdkVersion : 25,
1313
versionCode : 14,
1414
versionName : "1.3.5"
1515
]
1616

1717
depsVersion = [
18-
support : "24.0.0"
18+
support : "25.1.0"
1919
]
2020

2121
deps = [
@@ -37,4 +37,4 @@ ext {
3737
truth : 'com.google.truth:truth:0.29',
3838
robolectric : 'org.robolectric:robolectric:3.1.2'
3939
]
40-
}
40+
}

utilcode/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ android {
2121
dependencies {
2222
provided rootProject.ext.deps.design
2323
provided rootProject.ext.deps.supportV4
24+
provided rootProject.ext.deps.appcompatV7
2425
testCompile rootProject.ext.deps.junit
2526
testCompile rootProject.ext.deps.truth
2627
testCompile rootProject.ext.deps.robolectric
2728
}
2829
apply from: "https://raw.githubusercontent.com/xiaopansky/android-library-publish-to-jcenter/master/bintrayUpload.gradle"
29-
//gradlew bintrayUpload
30+
//gradlew bintrayUpload

utilcode/src/main/java/com/blankj/utilcode/utils/SnackbarUtils.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
import android.view.LayoutInflater;
77
import android.view.View;
88
import android.widget.LinearLayout;
9-
import android.widget.TextView;
10-
11-
import com.blankj.utilcode.R;
129

1310
import java.lang.ref.WeakReference;
1411

@@ -140,8 +137,9 @@ private static void showSnackbar(View parent, CharSequence text, int duration, @
140137
case Snackbar.LENGTH_INDEFINITE:
141138
snackbarWeakReference = new WeakReference<>(Snackbar.make(parent, text, Snackbar.LENGTH_INDEFINITE).setDuration(duration));
142139
}
143-
View view = snackbarWeakReference.get().getView();
144-
((TextView) view.findViewById(R.id.snackbar_text)).setTextColor(textColor);
140+
Snackbar snackbar = snackbarWeakReference.get();
141+
View view = snackbar.getView();
142+
snackbar.setActionTextColor(textColor);
145143
view.setBackgroundColor(bgColor);
146144
if (actionText != null && actionText.length() > 0 && listener != null) {
147145
snackbarWeakReference.get().setActionTextColor(actionTextColor);
@@ -180,4 +178,4 @@ public static void dismissSnackbar() {
180178
snackbarWeakReference = null;
181179
}
182180
}
183-
}
181+
}

utilcode/src/main/res/layout/design_layout_snackbar_include.xml

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)