Skip to content

Commit

Permalink
see 11/01 log
Browse files Browse the repository at this point in the history
  • Loading branch information
Blankj committed Nov 1, 2016
1 parent cf13a09 commit b20421e
Show file tree
Hide file tree
Showing 14 changed files with 93 additions and 22 deletions.
3 changes: 2 additions & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ showShortSnackbar : 显示短时snackbar
showLongSnackbar : 显示长时snackbar
showIndefiniteSnackbar : 显示自定义时长snackbar
addView : 为SnackBar添加布局
dismissSnackbar : 取消snackbar显示
```

> - **SP相关→[SPUtils.java][sp.java][Test][sp.test]**
Expand Down Expand Up @@ -471,7 +472,7 @@ getEntries : 获取压缩文件中的文件对象
***
Gradle:
``` groovy
compile 'com.blankj:utilcode:1.3.2'
compile 'com.blankj:utilcode:1.3.3'
```

### Proguard
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ showShortSnackbar
showLongSnackbar
showIndefiniteSnackbar
addView
dismissSnackbar
```

> - **About SP→[SPUtils.java][sp.java][Test][sp.test]**
Expand Down Expand Up @@ -471,7 +472,7 @@ getEntries
***
Gradle:
``` groovy
compile 'com.blankj:utilcode:1.3.2'
compile 'com.blankj:utilcode:1.3.3'
```

### Proguard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void onClick(View view) {
SnackbarUtils.showShortSnackbar(getWindow().getDecorView(), "short snackbar", Color.WHITE, Color.BLUE);
break;
case R.id.btn_short_snackbar_with_action:
SnackbarUtils.showLongSnackbar(getWindow().getDecorView(), "short snackbar", Color.WHITE, Color.BLUE,
SnackbarUtils.showShortSnackbar(getWindow().getDecorView(), "short snackbar", Color.WHITE, Color.BLUE,
"Short", Color.YELLOW, new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -89,6 +89,9 @@ public void onClick(View v) {
});
SnackbarUtils.addView(R.layout.snackbar_add, 0);
break;
case R.id.btn_cancel_snackbar:
SnackbarUtils.dismissSnackbar();
break;
}
}
}
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_snackbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,14 @@
android:text="@string/snackbar.add_view_with_action"
/>


<Button
android:id="@+id/btn_cancel_snackbar"
style="@style/BtnFont"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/snackbar.cancel"
/>

</LinearLayout>
</ScrollView>
1 change: 1 addition & 0 deletions app/src/main/res/values/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<string name="snackbar.show_indefinite_with_action">Show Indefinite Snackbar With Action</string>
<string name="snackbar.add_view">Add View</string>
<string name="snackbar.add_view_with_action">Add View With Action</string>
<string name="snackbar.cancel">Cancel Snackbar</string>

<!--Toast相关-->
<string name="toast.toggle_is_jump_when_more">Toggle Is Jump When More</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ allprojects {

task clean(type: Delete) {
delete rootProject.buildDir
}
}
5 changes: 3 additions & 2 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ ext {
buildToolsVersion : "24.0.3",
minSdkVersion : 11,
targetSdkVersion : 24,
versionCode : 11,
versionName : "1.3.2"
versionCode : 12,
versionName : "1.3.3"
]

depsVersion = [
Expand All @@ -21,6 +21,7 @@ ext {
deps = [
// ------------- Android -------------
supportV4 : "com.android.support:support-v4:${depsVersion.support}",
supportV7 : "com.android.support:appcompat-v7:${depsVersion.support}",
design : "com.android.support:design:${depsVersion.support}",


Expand Down
4 changes: 2 additions & 2 deletions utilcode/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 11
targetSdkVersion 24
versionCode 11
versionName "1.3.2"
versionCode 12
versionName "1.3.3"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private static void showSnackbar(View parent, CharSequence text, int duration, i
}

/**
* 为SnackBar添加布局
* 为snackbar添加布局
* <p>在show...Snackbar之后调用</p>
*
* @param layoutId 布局文件
Expand All @@ -164,4 +164,14 @@ public static void addView(int layoutId, int index) {
params.gravity = Gravity.CENTER_VERTICAL;
layout.addView(child, index, params);
}

/**
* 取消snackbar显示
*/
public static void dismissSnackbar() {
if (snackbar != null) {
snackbar.dismiss();
snackbar = null;
}
}
}
22 changes: 22 additions & 0 deletions utilcode/src/main/res/drawable/snackbar_action_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@drawable/snackbar_action_bg_focused"/>
<item android:state_pressed="true" android:drawable="@drawable/snackbar_action_bg_focused"/>
<item android:drawable="@android:color/transparent"/>
</selector>

33 changes: 33 additions & 0 deletions utilcode/src/main/res/drawable/snackbar_action_bg_focused.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- Used as the canonical button shape. -->

<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetBottom="6dp"
android:insetLeft="4dp"
android:insetRight="4dp"
android:insetTop="6dp">
<shape android:shape="rectangle">
<corners android:radius="2dp"/>
<solid android:color="@android:color/white"/>
<padding
android:bottom="4dp"
android:left="8dp"
android:right="8dp"
android:top="4dp"/>
</shape>
</inset>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:textSize="14sp"
android:textColor="?android:textColorPrimary"
android:textColor="#000000"
android:maxLines="2"
android:layout_gravity="center_vertical|left|start"
android:ellipsize="end"
Expand All @@ -44,6 +44,6 @@
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:visibility="gone"
android:textColor="?attr/colorAccent"
style="?attr/borderlessButtonStyle"/>
android:textColor="#000000"
android:background="@drawable/snackbar_action_bg"/>
</merge>
3 changes: 0 additions & 3 deletions utilcode/src/main/res/values/strings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions utilcode/src/main/res/values/values.xml

This file was deleted.

0 comments on commit b20421e

Please sign in to comment.