严重代码修改基本完成。
This commit is contained in:
parent
aed010d3c0
commit
0589972ab4
BIN
~$$顺序图.~vsdx
BIN
~$$顺序图.~vsdx
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -117,8 +117,9 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
* @return byte[]
|
||||
*/
|
||||
public static byte[] hexStringToBytes(String hexString) {
|
||||
byte[] nullreplace=null;
|
||||
if (hexString == null || "".equals(hexString)) {
|
||||
return null;
|
||||
return nullreplace;
|
||||
}
|
||||
hexString = hexString.toUpperCase();
|
||||
int length = hexString.length() / 2;
|
||||
|
@ -373,15 +374,19 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
Bitmap bitmap = BitmapFactory.decodeStream(stream , null, opts);
|
||||
return bitmap;
|
||||
} catch (OutOfMemoryError e) {
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static final int MAX_DECODE_PICTURE_SIZE = 1920 * 1440;
|
||||
public static Bitmap extractThumbNail(final String path, final int height, final int width, final boolean crop) {
|
||||
Assert.assertTrue(path != null && !path.equals("") && height > 0 && width > 0);
|
||||
Assert.assertTrue(path != null && !"".equals(path) && height > 0 && width > 0);
|
||||
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
|
||||
|
@ -392,7 +397,6 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
tmp.recycle();
|
||||
tmp = null;
|
||||
}
|
||||
|
||||
Log.d(TAG, "extractThumbNail: round=" + width + "x" + height + ", crop=" + crop);
|
||||
final double beY = options.outHeight * 1.0 / height;
|
||||
final double beX = options.outWidth * 1.0 / width;
|
||||
|
@ -453,6 +457,8 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
|
||||
} catch (final OutOfMemoryError e) {
|
||||
Log.e(TAG, "decode bitmap failed: " + e.getMessage());
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
options = null;
|
||||
}
|
||||
|
||||
|
@ -461,7 +467,8 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
|
||||
public static final void showResultDialog(Context context, String msg,
|
||||
String title) {
|
||||
if(msg == null) return;
|
||||
if(msg == null)
|
||||
return;
|
||||
String rmsg = msg.replace(",", "\n");
|
||||
Log.d("Util", rmsg);
|
||||
new AlertDialog.Builder(context).setTitle(title).setMessage(rmsg)
|
||||
|
@ -480,17 +487,13 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
mProgressDialog = ProgressDialog.show(context, title, message);
|
||||
}
|
||||
|
||||
public static AlertDialog showConfirmCancelDialog(Context context,
|
||||
String title, String message,
|
||||
DialogInterface.OnClickListener posListener) {
|
||||
AlertDialog dlg = new AlertDialog.Builder(context).setMessage(message)
|
||||
.setPositiveButton("确认", posListener)
|
||||
.setNegativeButton("取消", null).create();
|
||||
public static AlertDialog showConfirmCancelDialog(Context context,String message,DialogInterface.OnClickListener posListener)
|
||||
{
|
||||
AlertDialog dlg = new AlertDialog.Builder(context).setMessage(message).setPositiveButton("确认", posListener).setNegativeButton("取消", null).create();
|
||||
dlg.setCanceledOnTouchOutside(false);
|
||||
dlg.show();
|
||||
return dlg;
|
||||
}
|
||||
|
||||
public static final void dismissDialog() {
|
||||
if (mProgressDialog != null) {
|
||||
mProgressDialog.dismiss();
|
||||
|
@ -518,7 +521,6 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
if (mToast != null) {
|
||||
mToast.cancel();
|
||||
mToast = null;
|
||||
|
@ -565,10 +567,12 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
|
||||
Log.v(TAG, "image download finished." + imageUri);
|
||||
} catch (OutOfMemoryError e) {
|
||||
e.printStackTrace();
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
bitmap = null;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
Log.v(TAG, "getbitmap bmp fail---");
|
||||
bitmap = null;
|
||||
}
|
||||
|
@ -585,8 +589,8 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
// =兼容android 5.0
|
||||
// ==========
|
||||
|
||||
public static String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT";
|
||||
public static int Build_VERSION_KITKAT = 19;
|
||||
public static final String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT";
|
||||
public static final int Build_VERSION_KITKAT = 19;
|
||||
public static String getPath(final Context context, final Uri uri) {
|
||||
|
||||
final boolean isKitKat = Build.VERSION.SDK_INT >= 19;
|
||||
|
|
Loading…
Reference in New Issue