提交 9710722b 编写于 作者: B Blankj

see 01/31 log

上级 cc7a785d
......@@ -41,7 +41,7 @@
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.12.3-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.12.4-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -41,7 +41,7 @@ If this ptoject helps you a lot, and you would like to support this ptoject's fu
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.12.3-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.12.4-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -67,7 +67,7 @@ dependencies {
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
// implementation 'com.blankj:utilcode:1.12.3'
// implementation 'com.blankj:utilcode:1.12.4'
}
......@@ -249,7 +249,6 @@ public class ActivityActivity extends BaseBackActivity {
private Bundle getOption(int type) {
switch (type) {
default:
case 0:
return ActivityOptionsCompat.makeCustomAnimation(this,
R.anim.slide_in_right_1000,
......@@ -277,6 +276,8 @@ public class ActivityActivity extends BaseBackActivity {
viewSharedElement,
getString(R.string.activity_shared_element))
.toBundle();
default:
return null;
}
}
}
......@@ -61,8 +61,6 @@ public class ScreenActivity extends BaseBackActivity {
.append("isTablet: " + ScreenUtils.isTablet())
.create()
);
}
@Override
......
......@@ -32,8 +32,8 @@ ext {
min_sdk_version = 14
target_sdk_version = 23
version_code = 1_012_003
version_name = '1.12.3'// E.g 1.9.72 => 1,009,072
version_code = 1_012_004
version_name = '1.12.4'// E.g 1.9.72 => 1,009,072
// App dependencies
support_version = '26.1.0'
......
package com.blankj.subutil.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2018/01/30
* desc : 克隆相关工具类
* </pre>
*/
public final class CloneUtils {
public static <T> T deepClone(final Serializable data) {
if (data == null) return null;
return (T) bytes2Object(serializable2Bytes((Serializable) data));
}
private static byte[] serializable2Bytes(final Serializable serializable) {
if (serializable == null) return null;
ByteArrayOutputStream baos;
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(baos = new ByteArrayOutputStream());
oos.writeObject(serializable);
return baos.toByteArray();
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
try {
if (oos != null) {
oos.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
private static Object bytes2Object(final byte[] bytes) {
if (bytes == null) return null;
ObjectInputStream ois = null;
try {
ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
return ois.readObject();
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
try {
if (ois != null) {
ois.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
* 18/01/27 修复 ToastUtils 默认样式问题,发布 1.12.2,新增 DeviceUtils#getSDKVersionName,发布 1.12.3
* 18/01/31 修复 default 相关的逻辑错误,发布 1.12.4
* 18/01/28 修复 ToastUtils 默认样式问题,发布 1.12.2,新增 DeviceUtils#getSDKVersionName,发布 1.12.3
* 18/01/27 修复 PermissionUtils 某些机型闪烁问题,发布 1.12.1
* 18/01/17 完善 ReflectUtils 及 单元测试,发布 1.12.0 版本
* 18/01/16 完善 ReflectUtils 及 单元测试
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
compile 'com.blankj:utilcode:1.12.3'
compile 'com.blankj:utilcode:1.12.4'
```
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
compile 'com.blankj:utilcode:1.12.3'
compile 'com.blankj:utilcode:1.12.4'
```
......
......@@ -576,33 +576,32 @@ public final class ImageUtils {
/**
* 获取图片旋转角度
* <p>返回 -1 表示异常</p>
*
* @param filePath 文件路径
* @return 旋转角度
*/
public static int getRotateDegree(final String filePath) {
int degree = 0;
try {
ExifInterface exifInterface = new ExifInterface(filePath);
int orientation = exifInterface.getAttributeInt(
ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_NORMAL);
ExifInterface.ORIENTATION_NORMAL
);
switch (orientation) {
default:
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
return 90;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
return 180;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
return 270;
default:
return 0;
}
} catch (IOException e) {
e.printStackTrace();
return -1;
}
return degree;
}
/**
......
......@@ -150,7 +150,6 @@ public final class ScreenUtils {
*/
public static int getScreenRotation(@NonNull final Activity activity) {
switch (activity.getWindowManager().getDefaultDisplay().getRotation()) {
default:
case Surface.ROTATION_0:
return 0;
case Surface.ROTATION_90:
......@@ -159,6 +158,8 @@ public final class ScreenUtils {
return 180;
case Surface.ROTATION_270:
return 270;
default:
return 0;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册