merge
This commit is contained in:
commit
a4637f2ca3
|
@ -17,11 +17,9 @@ public class Good extends BmobObject implements Serializable{
|
|||
//private String id; 商品ID, 默认
|
||||
|
||||
private String shopID = ""; // 商店ID
|
||||
private String shopName = ""; //商店名称
|
||||
private String type = ""; // 类型
|
||||
private String name = ""; // 名称
|
||||
private String price = ""; // 价格
|
||||
private BmobFile picGood = null; // 商品主图
|
||||
|
||||
public Good(String name, String price) {
|
||||
this.name = name;
|
||||
|
|
|
@ -21,8 +21,6 @@ public class Shop extends BmobObject implements Serializable{
|
|||
private String phone; // 联系电话
|
||||
private String info; // 简介
|
||||
private String sale; // 促销信息
|
||||
private BmobFile picShop; // 商店主图
|
||||
|
||||
public String getUserID() {
|
||||
return userID;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ import cn.bmob.v3.BmobObject;
|
|||
*/
|
||||
public class BXTNews extends BmobObject{
|
||||
|
||||
//private String id;
|
||||
|
||||
private String title; //标题
|
||||
private String topic; //讲座主题
|
||||
private String speaker; //主 讲 人
|
||||
|
|
|
@ -9,9 +9,6 @@ import cn.bmob.v3.BmobObject;
|
|||
*/
|
||||
public class SComment extends BmobObject {
|
||||
|
||||
// private String id;
|
||||
// private String time;
|
||||
|
||||
private String shopID;
|
||||
private String shopName;
|
||||
private String userID;
|
||||
|
|
|
@ -12,6 +12,8 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -44,6 +46,7 @@ import junit.framework.Assert;
|
|||
* @date 2014-5-9
|
||||
* @author Stone
|
||||
*/
|
||||
|
||||
public class Util {
|
||||
|
||||
/**
|
||||
|
@ -52,6 +55,7 @@ public class Util {
|
|||
* @param phoneNumber
|
||||
* @return true 有效 / false 无效
|
||||
*/
|
||||
|
||||
public static boolean isPhoneNumberValid(String phoneNumber) {
|
||||
|
||||
boolean isValid = false;
|
||||
|
@ -93,8 +97,9 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
*/
|
||||
public static String bytesToHexString(byte[] src){
|
||||
StringBuilder stringBuilder = new StringBuilder("");
|
||||
String nullreplace="";
|
||||
if (src == null || src.length <= 0) {
|
||||
return null;
|
||||
return nullreplace;
|
||||
}
|
||||
for (int i = 0; i < src.length; i++) {
|
||||
int v = src[i] & 0xFF;
|
||||
|
@ -112,8 +117,9 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
* @return byte[]
|
||||
*/
|
||||
public static byte[] hexStringToBytes(String hexString) {
|
||||
if (hexString == null || hexString.equals("")) {
|
||||
return null;
|
||||
byte[] nullreplace=null;
|
||||
if (hexString == null || "".equals(hexString)) {
|
||||
return nullreplace;
|
||||
}
|
||||
hexString = hexString.toUpperCase();
|
||||
int length = hexString.length() / 2;
|
||||
|
@ -148,15 +154,17 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
try {
|
||||
bytes = str.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
}
|
||||
if (bytes == null) return null;
|
||||
if (bytes == null)
|
||||
return null;
|
||||
StringBuilder sb=new StringBuilder(bytes.length*2);
|
||||
//将字节数组中每个字节拆解成2位16进制整数
|
||||
for(int i=0;i<bytes.length;i++)
|
||||
{
|
||||
sb.append(hexString.charAt((bytes[i]&0xf0)>>4));
|
||||
sb.append(hexString.charAt((bytes[i]&0x0f)>>0));
|
||||
sb.append(hexString.charAt(bytes[i]&0x0f));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -177,7 +185,8 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +196,8 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -203,7 +213,8 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
try {
|
||||
output.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -221,12 +232,13 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
inStream = httpConnection.getInputStream();
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
}
|
||||
byte[] data = inputStreamToByte(inStream);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -241,21 +253,23 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
bytestream.close();
|
||||
return imgdata;
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
}
|
||||
|
||||
return null;
|
||||
byte[] nullreplace=new byte[0];
|
||||
return nullreplace;
|
||||
}
|
||||
|
||||
public static byte[] readFromFile(String fileName, int offset, int len) {
|
||||
byte[] nullreplace=new byte[0];
|
||||
if (fileName == null) {
|
||||
return null;
|
||||
return nullreplace;
|
||||
}
|
||||
|
||||
File file = new File(fileName);
|
||||
if (!file.exists()) {
|
||||
Log.i(TAG, "readFromFile: file not found");
|
||||
return null;
|
||||
return nullreplace;
|
||||
}
|
||||
|
||||
if (len == -1) {
|
||||
|
@ -266,15 +280,15 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
|
||||
if(offset <0){
|
||||
Log.e(TAG, "readFromFile invalid offset:" + offset);
|
||||
return null;
|
||||
return nullreplace;
|
||||
}
|
||||
if(len <=0 ){
|
||||
Log.e(TAG, "readFromFile invalid len:" + len);
|
||||
return null;
|
||||
return nullreplace;
|
||||
}
|
||||
if(offset + len > (int) file.length()){
|
||||
Log.e(TAG, "readFromFile invalid file len:" + file.length());
|
||||
return null;
|
||||
return nullreplace;
|
||||
}
|
||||
|
||||
byte[] b = null;
|
||||
|
@ -287,7 +301,8 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "readFromFile : errMsg = " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
Logger logger = Logger.getLogger("lavasoft");
|
||||
logger.log(Level.SEVERE, "sthwrong", e);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
@ -321,35 +336,17 @@ private static final String TAG = "SDK_Sample.Util";
|
|||
return roundedSize;
|
||||
}
|
||||
|
||||
private static int computeInitialSampleSize(BitmapFactory.Options options,
|
||||
|
||||
int minSideLength, int maxNumOfPixels) {
|
||||
|
||||
private static int computeInitialSampleSize(BitmapFactory.Options options,int minSideLength, int maxNumOfPixels)
|
||||
{
|
||||
double w = options.outWidth;
|
||||
|
||||
double h = options.outHeight;
|
||||
|
||||
int lowerBound = (maxNumOfPixels == -1) ? 1 :
|
||||
|
||||
(int) Math.ceil(Math.sqrt(w * h / maxNumOfPixels));
|
||||
|
||||
int upperBound = (minSideLength == -1) ? 128 :
|
||||
|
||||
(int) Math.min(Math.floor(w / minSideLength),
|
||||
|
||||
Math.floor(h / minSideLength));
|
||||
|
||||
int lowerBound = (maxNumOfPixels == -1) ? 1 :(int) Math.ceil(Math.sqrt(w * h / maxNumOfPixels));
|
||||
int upperBound = (minSideLength == -1) ? 128 :(int) Math.min(Math.floor(w / minSideLength),Math.floor(h / minSideLength));
|
||||
if (upperBound < lowerBound) {
|
||||
|
||||
// return the larger one when there is no overlapping zone.
|
||||
|
||||
return lowerBound;
|
||||
|
||||
}
|
||||
|
||||
if ((maxNumOfPixels == -1) &&
|
||||
|
||||
(minSideLength == -1)) {
|
||||
if ((maxNumOfPixels == -1) &&(minSideLength == -1)) {
|
||||
|
||||
return 1;
|
||||
|
||||
|
@ -377,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();
|
||||
|
||||
|
@ -396,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;
|
||||
|
@ -457,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;
|
||||
}
|
||||
|
||||
|
@ -465,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)
|
||||
|
@ -484,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();
|
||||
|
@ -522,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;
|
||||
|
@ -569,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;
|
||||
}
|
||||
|
@ -589,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;
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue