This commit is contained in:
seven332 committed 2015-03-08 21:47:41 +08:00
1 parent 795682f31f
commit ea1861ee34
3 files changed
+51 -24

No files matched your search

@@ -15,7 +15,6 @@
package com.hippo.effect.ripple;
import android.annotation.TargetApi;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Color;
@@ -30,9 +29,6 @@ import com.hippo.widget.HotspotTouchHelper;
public final class RippleSalon {
private static final boolean USE_OLD_RIPPLE =
Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP;
private static final Drawable MASK = new ColorDrawable(Color.BLACK);
public static void addRipple(View c, boolean dark) {
@@ -46,9 +42,8 @@ public final class RippleSalon {
addRipple(v, color, v.getBackground());
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void addRipple(View v, ColorStateList color, Drawable content) {
if (USE_OLD_RIPPLE) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
RippleDrawable rippleDrawable = new RippleDrawable(color, content);
v.setOnTouchListener(new HotspotTouchHelper(rippleDrawable));
//noinspection deprecation
@@ -489,7 +489,7 @@ public class HttpHelper {
}
public static class PostFormDataHelper extends GetStringHelper {
private static final String BOUNDARY = "------WebKitFormBoundary7eDB0hDQ91s22Tkf";
private static final String BOUNDARY = "----WebKitFormBoundary7eDB0hDQ91s22Tkf";
private final List<FormData> mDataList;
@@ -507,15 +507,17 @@ public class HttpHelper {
conn.setUseCaches(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type",
"multipart/form-data; boundary=----WebKitFormBoundary7eDB0hDQ91s22Tkf");
"multipart/form-data; boundary=" + BOUNDARY);
DataOutputStream out = new DataOutputStream(conn.getOutputStream());
for (FormData data : mDataList) {
out.write("--".getBytes());
out.write(BOUNDARY.getBytes());
out.write("\r\n".getBytes());
data.doOutPut(out);
}
out.write("--".getBytes());
out.write(BOUNDARY.getBytes());
out.write("--".getBytes());
@@ -549,7 +551,6 @@ public class HttpHelper {
// Bitmap bmp = BitmapFactory.decodeStream(conn.getInputStream(), null, Ui.getBitmapOpt());
// bitmap might be incomplete.
int size = conn.getContentLength();
ByteArrayOutputStream a;
FastByteArrayOutputStream fbaos = new FastByteArrayOutputStream(size == -1 ? 24 * 1024 : (size + 100));
Utils.copy(conn.getInputStream(), fbaos);
Bitmap bmp = BitmapFactory.decodeByteArray(fbaos.getBuffer(), 0, fbaos.size(), null);
+46 -15
View File
@@ -21,7 +21,7 @@ public class Log {
private static final String TAG = Log.class.getSimpleName();
private static final String avoidNull(String str) {
private static String avoidNull(String str) {
return str == null ? TextUtils.STRING_NULL : str;
}
@@ -47,6 +47,15 @@ public class Log {
}
}
/**
* Call {@link android.util.Log#v(String, String, Throwable)} with default tag.
* @param msg The message you would like logged.
* @param tr An exception to log
*/
public static int v(String msg, Throwable tr) {
return v(TAG, msg, tr);
}
/**
* It is {@link android.util.Log#v(String, String, Throwable)}, only work when debug.
* @param tag Used to identify the source of a log message. It usually identifies
@@ -84,6 +93,15 @@ public class Log {
}
}
/**
* Call {@link android.util.Log#d(String, String, Throwable)} with default tag.
* @param msg The message you would like logged.
* @param tr An exception to log
*/
public static int d(String msg, Throwable tr) {
return d(TAG, msg, tr);
}
/**
* It is {@link android.util.Log#d(String, String, Throwable)}, only work when debug.
* @param tag Used to identify the source of a log message. It usually identifies
@@ -121,6 +139,15 @@ public class Log {
}
}
/**
* Call {@link android.util.Log#i(String, String, Throwable)} with default tag.
* @param msg The message you would like logged.
* @param tr An exception to log
*/
public static int i(String msg, Throwable tr) {
return i(TAG, msg, tr);
}
/**
* It is {@link android.util.Log#i(String, String, Throwable)}, only work when debug.
* @param tag Used to identify the source of a log message. It usually identifies
@@ -158,6 +185,15 @@ public class Log {
}
}
/**
* Call {@link android.util.Log#w(String, String, Throwable)} with default tag.
* @param msg The message you would like logged.
* @param tr An exception to log
*/
public static int w(String msg, Throwable tr) {
return w(TAG, msg, tr);
}
/**
* It is {@link android.util.Log#w(String, String, Throwable)}, only work when debug.
* @param tag Used to identify the source of a log message. It usually identifies
@@ -173,20 +209,6 @@ public class Log {
}
}
/**
* It is {@link android.util.Log#w(String, Throwable)}, only work when debug.
* @param tag Used to identify the source of a log message. It usually identifies
* the class or activity where the log call occurs.
* @param tr An exception to log
*/
public static int w(String tag, Throwable tr) {
if (BuildConfig.DEBUG) {
return android.util.Log.w(tag, tr);
} else {
return 0;
}
}
/**
* Call {@link android.util.Log#e(String, String)} with default tag.
* @param msg The message you would like logged.
@@ -209,6 +231,15 @@ public class Log {
}
}
/**
* Call {@link android.util.Log#e(String, String, Throwable)} with default tag.
* @param msg The message you would like logged.
* @param tr An exception to log
*/
public static int e(String msg, Throwable tr) {
return e(TAG, msg, tr);
}
/**
* It is {@link android.util.Log#e(String, String, Throwable)}, only work when debug.
* @param tag Used to identify the source of a log message. It usually identifies