diff --git a/.merge_file_a04244 b/.merge_file_a04244 new file mode 100644 index 0000000..b0a9ac8 --- /dev/null +++ b/.merge_file_a04244 @@ -0,0 +1,63 @@ +package com.stone.shop.model; + +import java.io.Serializable; + +import cn.bmob.v3.BmobObject; +import cn.bmob.v3.datatype.BmobFile; + +/** + * 商品实体类 + * @date 2014-4-24 + * @author Stone + */ +public class Good extends BmobObject implements Serializable{ + + private static final long serialVersionUID = -3248168273019127389L; + + //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; + this.price = price; + } + + public String getShopID() { + return shopID; + } + + public void setShopID(String shopID) { + this.shopID = shopID; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + +} diff --git a/.merge_file_a05096 b/.merge_file_a05096 new file mode 100644 index 0000000..5e22bde --- /dev/null +++ b/.merge_file_a05096 @@ -0,0 +1,82 @@ +package com.stone.shop.model; + +import java.io.Serializable; + +import cn.bmob.v3.BmobObject; +import cn.bmob.v3.datatype.BmobFile; + +/** + * 店铺实体类, 实现序列化, Activity之间实现传递 + * @date 2014-4-24 + * @author Stone + */ +public class Shop extends BmobObject implements Serializable{ + + private static final long serialVersionUID = -8796635595320697255L; + + private String userID; // 主人 + private String type; // 类型(11代表第一个GridView中的第一个) + private String name; // 店名 + private String location; // 地理位置 + private String phone; // 联系电话 + private String info; // 简介 + private String sale; // 促销信息 + private BmobFile picShop; // 商店主图 + + public String getUserID() { + return userID; + } + + public void setUserID(String userID) { + this.userID = userID; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + + public String getSale() { + return sale; + } + + public void setSale(String sale) { + this.sale = sale; + } + +} diff --git a/.merge_file_a05568 b/.merge_file_a05568 new file mode 100644 index 0000000..fb8f926 --- /dev/null +++ b/.merge_file_a05568 @@ -0,0 +1,78 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 博学堂讲座实体类 + * @date 2014-5-10 + * @author Stone + */ +public class BXTNews extends BmobObject{ + + //private String id; + + private String title; //标题 + private String topic; //讲座主题 + private String speaker; //主 讲 人 + private String time; //讲座时间 + private String location; //讲座地点 + private String holder1; //主办单位 + private String holder2; //承办单位 + private String points; //主讲内容提要 + private String speakerinfo; //主讲人简介 + + public String getTitle() { + return title; + } + public String getTopic() { + return topic; + } + public String getSpeaker() { + return speaker; + } + public String getTime() { + return time; + } + public String getLocation() { + return location; + } + public String getHolder1() { + return holder1; + } + public String getHolder2() { + return holder2; + } + public String getPoints() { + return points; + } + public String getSpeakerinfo() { + return speakerinfo; + } + public void setTitle(String title) { + this.title = title; + } + public void setTopic(String topic) { + this.topic = topic; + } + public void setSpeaker(String speaker) { + this.speaker = speaker; + } + public void setTime(String time) { + this.time = time; + } + public void setLocation(String location) { + this.location = location; + } + public void setHolder1(String holder1) { + this.holder1 = holder1; + } + public void setHolder2(String holder2) { + this.holder2 = holder2; + } + public void setPoints(String points) { + this.points = points; + } + public void setSpeakerinfo(String speakerinfo) { + this.speakerinfo = speakerinfo; + } +} diff --git a/.merge_file_a06448 b/.merge_file_a06448 new file mode 100644 index 0000000..75bed35 --- /dev/null +++ b/.merge_file_a06448 @@ -0,0 +1,99 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobUser; + +/** + * 用户实体类 + * @date 2014-4-24 + * @author Stone + */ +public class User extends BmobUser { + + public static String userId; + + + + private String sex; // 性别 + private String phone; // 电话 + private String qq; // QQ + private String school = "湖北工业大学"; // 学校 + private String cademy; // 学院 + private String dorPart; // 校区 + private String dorNum; // 寝室号 + private String state = "未登陆"; // 登录状态 + private String type = "普通用户"; // 用户类型(普通用户、黑名单、中奖者) + //private BmobFile picUser; // 头像 + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getQQ() { + return qq; + } + + public void setQQ(String qq) { + this.qq = qq; + } + + public String getSchool() { + return school; + } + + public void setSchool(String school) { + this.school = school; + } + + public String getCademy() { + return cademy; + } + + public void setCademy(String cademy) { + this.cademy = cademy; + } + + public String getDorPart() { + return dorPart; + } + + public void setDorPart(String dorPart) { + this.dorPart = dorPart; + } + + public String getDorNum() { + return dorNum; + } + + public void setDorNum(String dorNum) { + this.dorNum = dorNum; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + +} diff --git a/.merge_file_a08376 b/.merge_file_a08376 new file mode 100644 index 0000000..7abf4ae --- /dev/null +++ b/.merge_file_a08376 @@ -0,0 +1,61 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 店铺评论实体类 + * @date 2014-5-3 + * @author Stone + */ +public class SComment extends BmobObject { + + // private String id; + // private String time; + + private String shopID; + private String shopName; + private String userID; + private String userName; + private String content; + + public String getShopID() { + return shopID; + } + + public void setShopID(String shopID) { + this.shopID = shopID; + } + + public String getShopName() { + return shopName; + } + + public void setShopName(String shopName) { + this.shopName = shopName; + } + + public String getUserID() { + return userID; + } + + public void setUserID(String userID) { + this.userID = userID; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + +} diff --git a/.merge_file_a08744 b/.merge_file_a08744 new file mode 100644 index 0000000..fb8f926 --- /dev/null +++ b/.merge_file_a08744 @@ -0,0 +1,78 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 博学堂讲座实体类 + * @date 2014-5-10 + * @author Stone + */ +public class BXTNews extends BmobObject{ + + //private String id; + + private String title; //标题 + private String topic; //讲座主题 + private String speaker; //主 讲 人 + private String time; //讲座时间 + private String location; //讲座地点 + private String holder1; //主办单位 + private String holder2; //承办单位 + private String points; //主讲内容提要 + private String speakerinfo; //主讲人简介 + + public String getTitle() { + return title; + } + public String getTopic() { + return topic; + } + public String getSpeaker() { + return speaker; + } + public String getTime() { + return time; + } + public String getLocation() { + return location; + } + public String getHolder1() { + return holder1; + } + public String getHolder2() { + return holder2; + } + public String getPoints() { + return points; + } + public String getSpeakerinfo() { + return speakerinfo; + } + public void setTitle(String title) { + this.title = title; + } + public void setTopic(String topic) { + this.topic = topic; + } + public void setSpeaker(String speaker) { + this.speaker = speaker; + } + public void setTime(String time) { + this.time = time; + } + public void setLocation(String location) { + this.location = location; + } + public void setHolder1(String holder1) { + this.holder1 = holder1; + } + public void setHolder2(String holder2) { + this.holder2 = holder2; + } + public void setPoints(String points) { + this.points = points; + } + public void setSpeakerinfo(String speakerinfo) { + this.speakerinfo = speakerinfo; + } +} diff --git a/.merge_file_a09172 b/.merge_file_a09172 new file mode 100644 index 0000000..653e1f9 --- /dev/null +++ b/.merge_file_a09172 @@ -0,0 +1,756 @@ +package com.stone.util; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.RandomAccessFile; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.ContentUris; +import android.content.Context; +import android.content.DialogInterface; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Bitmap.CompressFormat; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.net.Uri; +import android.os.Build; +import android.os.Environment; +import android.provider.MediaStore; +import android.text.TextUtils; +import android.util.Log; +import android.widget.Toast; +import junit.framework.Assert; + +/** + * 工具类 + * + * @date 2014-5-9 + * @author Stone + */ +public class Util { + + /** + * 判断电话号码是否有效 + * + * @param phoneNumber + * @return true 有效 / false 无效 + */ + public static boolean isPhoneNumberValid(String phoneNumber) { + + boolean isValid = false; + + String expression = "((^(13|15|18)[0-9]{9}$)|(^0[1,2]{1}\\d{1}-?\\d{8}$)|(^0[3-9] {1}\\d{2}-?\\d{7,8}$)|(^0[1,2]{1}\\d{1}-?\\d{8}-(\\d{1,4})$)|(^0[3-9]{1}\\d{2}-? \\d{7,8}-(\\d{1,4})$))"; + CharSequence inputStr = phoneNumber; + + Pattern pattern = Pattern.compile(expression); + Matcher matcher = pattern.matcher(inputStr); + + if (matcher.matches()) { + isValid = true; + } + return isValid; + } + + // 判断网络是否连接 + public static boolean isNetworkConnected(Context context) { + if (context != null) { + ConnectivityManager mConnectivityManager = (ConnectivityManager) context + .getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo mNetworkInfo = mConnectivityManager + .getActiveNetworkInfo(); + if (mNetworkInfo != null) { + return mNetworkInfo.isAvailable(); + } + } + return false; + } + +private static final String TAG = "SDK_Sample.Util"; + + private static Dialog mProgressDialog; + private static Toast mToast; + + /* Convert byte[] to hex string.这里我们可以将byte转换成int,然后利用Integer.toHexString(int)来转换成16进制字符串。 + * @param src byte[] data + * @return hex string + */ + public static String bytesToHexString(byte[] src){ + StringBuilder stringBuilder = new StringBuilder(""); + if (src == null || src.length <= 0) { + return null; + } + for (int i = 0; i < src.length; i++) { + int v = src[i] & 0xFF; + String hv = Integer.toHexString(v); + if (hv.length() < 2) { + stringBuilder.append(0); + } + stringBuilder.append(hv); + } + return stringBuilder.toString(); + } + /** + * Convert hex string to byte[] + * @param hexString the hex string + * @return byte[] + */ + public static byte[] hexStringToBytes(String hexString) { + if (hexString == null || hexString.equals("")) { + return null; + } + hexString = hexString.toUpperCase(); + int length = hexString.length() / 2; + char[] hexChars = hexString.toCharArray(); + byte[] d = new byte[length]; + for (int i = 0; i < length; i++) { + int pos = i * 2; + d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); + } + return d; + } + /** + * Convert char to byte + * @param c char + * @return byte + */ + private static byte charToByte(char c) { + return (byte) "0123456789ABCDEF".indexOf(c); + } + + /* + * 16进制数字字符集 + */ + private static String hexString="0123456789ABCDEF"; + /* + * 将字符串编码成16进制数字,适用于所有字符(包括中文) + */ + public static String toHexString(String str) + { +//根据默认编码获取字节数组 + byte[] bytes = null; + try { + bytes = str.getBytes("UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + if (bytes == null) return null; + StringBuilder sb=new StringBuilder(bytes.length*2); +//将字节数组中每个字节拆解成2位16进制整数 + for(int i=0;i>4)); + sb.append(hexString.charAt((bytes[i]&0x0f)>>0)); + } + return sb.toString(); + } + + //转换十六进制编码为字符串 + public static String hexToString(String s) + { + if("0x".equals(s.substring(0, 2))) + { + s =s.substring(2); + } + byte[] baKeyword = new byte[s.length()/2]; + for(int i = 0; i < baKeyword.length; i++) + { + try + { + baKeyword[i] = (byte)(0xff & Integer.parseInt(s.substring(i*2, i*2+2),16)); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + try + { + s = new String(baKeyword, "utf-8");//UTF-16le:Not + } + catch (Exception e1) + { + e1.printStackTrace(); + } + return s; + } + + public static byte[] bmpToByteArray(final Bitmap bmp, final boolean needRecycle) { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + bmp.compress(CompressFormat.PNG, 100, output); + if (needRecycle) { + bmp.recycle(); + } + + byte[] result = output.toByteArray(); + try { + output.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + return result; + } + + public static byte[] getHtmlByteArray(final String url) { + URL htmlUrl = null; + InputStream inStream = null; + try { + htmlUrl = new URL(url); + URLConnection connection = htmlUrl.openConnection(); + HttpURLConnection httpConnection = (HttpURLConnection)connection; + int responseCode = httpConnection.getResponseCode(); + if(responseCode == HttpURLConnection.HTTP_OK){ + inStream = httpConnection.getInputStream(); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + byte[] data = inputStreamToByte(inStream); + + return data; + } + + public static byte[] inputStreamToByte(InputStream is) { + try{ + ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); + int ch; + while ((ch = is.read()) != -1) { + bytestream.write(ch); + } + byte imgdata[] = bytestream.toByteArray(); + bytestream.close(); + return imgdata; + }catch(Exception e){ + e.printStackTrace(); + } + + return null; + } + + public static byte[] readFromFile(String fileName, int offset, int len) { + if (fileName == null) { + return null; + } + + File file = new File(fileName); + if (!file.exists()) { + Log.i(TAG, "readFromFile: file not found"); + return null; + } + + if (len == -1) { + len = (int) file.length(); + } + + Log.d(TAG, "readFromFile : offset = " + offset + " len = " + len + " offset + len = " + (offset + len)); + + if(offset <0){ + Log.e(TAG, "readFromFile invalid offset:" + offset); + return null; + } + if(len <=0 ){ + Log.e(TAG, "readFromFile invalid len:" + len); + return null; + } + if(offset + len > (int) file.length()){ + Log.e(TAG, "readFromFile invalid file len:" + file.length()); + return null; + } + + byte[] b = null; + try { + RandomAccessFile in = new RandomAccessFile(fileName, "r"); + b = new byte[len]; + in.seek(offset); + in.readFully(b); + in.close(); + + } catch (Exception e) { + Log.e(TAG, "readFromFile : errMsg = " + e.getMessage()); + e.printStackTrace(); + } + return b; + } + + public static int computeSampleSize(BitmapFactory.Options options, + + int minSideLength, int maxNumOfPixels) { + + int initialSize = computeInitialSampleSize(options, minSideLength, + + maxNumOfPixels); + + int roundedSize; + + if (initialSize <= 8) { + + roundedSize = 1; + + while (roundedSize < initialSize) { + + roundedSize <<= 1; + + } + + } else { + + roundedSize = (initialSize + 7) / 8 * 8; + + } + + return roundedSize; + } + + 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)); + + if (upperBound < lowerBound) { + + // return the larger one when there is no overlapping zone. + + return lowerBound; + + } + + if ((maxNumOfPixels == -1) && + + (minSideLength == -1)) { + + return 1; + + } else if (minSideLength == -1) { + + return lowerBound; + + } else { + + return upperBound; + + } + } + + /** + * 以最省内存的方式读取图片 + */ + public static Bitmap readBitmap(final String path){ + try{ + FileInputStream stream = new FileInputStream(new File(path+"test.jpg")); + BitmapFactory.Options opts = new BitmapFactory.Options(); + opts.inSampleSize = 8; + opts.inPurgeable=true; + opts.inInputShareable=true; + Bitmap bitmap = BitmapFactory.decodeStream(stream , null, opts); + return bitmap; + } catch (OutOfMemoryError e) { + return null; + } catch (Exception 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); + + BitmapFactory.Options options = new BitmapFactory.Options(); + + try { + options.inJustDecodeBounds = true; + Bitmap tmp = BitmapFactory.decodeFile(path, options); + if (tmp != null) { + 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; + Log.d(TAG, "extractThumbNail: extract beX = " + beX + ", beY = " + beY); + options.inSampleSize = (int) (crop ? (beY > beX ? beX : beY) : (beY < beX ? beX : beY)); + if (options.inSampleSize <= 1) { + options.inSampleSize = 1; + } + + // NOTE: out of memory error + while (options.outHeight * options.outWidth / options.inSampleSize > MAX_DECODE_PICTURE_SIZE) { + options.inSampleSize++; + } + + int newHeight = height; + int newWidth = width; + if (crop) { + if (beY > beX) { + newHeight = (int) (newWidth * 1.0 * options.outHeight / options.outWidth); + } else { + newWidth = (int) (newHeight * 1.0 * options.outWidth / options.outHeight); + } + } else { + if (beY < beX) { + newHeight = (int) (newWidth * 1.0 * options.outHeight / options.outWidth); + } else { + newWidth = (int) (newHeight * 1.0 * options.outWidth / options.outHeight); + } + } + + options.inJustDecodeBounds = false; + + Log.i(TAG, "bitmap required size=" + newWidth + "x" + newHeight + ", orig=" + options.outWidth + "x" + options.outHeight + ", sample=" + options.inSampleSize); + Bitmap bm = BitmapFactory.decodeFile(path, options); + if (bm == null) { + Log.e(TAG, "bitmap decode failed"); + return null; + } + + Log.i(TAG, "bitmap decoded size=" + bm.getWidth() + "x" + bm.getHeight()); + final Bitmap scale = Bitmap.createScaledBitmap(bm, newWidth, newHeight, true); + if (scale != null) { + bm.recycle(); + bm = scale; + } + + if (crop) { + final Bitmap cropped = Bitmap.createBitmap(bm, (bm.getWidth() - width) >> 1, (bm.getHeight() - height) >> 1, width, height); + if (cropped == null) { + return bm; + } + + bm.recycle(); + bm = cropped; + Log.i(TAG, "bitmap croped size=" + bm.getWidth() + "x" + bm.getHeight()); + } + return bm; + + } catch (final OutOfMemoryError e) { + Log.e(TAG, "decode bitmap failed: " + e.getMessage()); + options = null; + } + + return null; + } + + public static final void showResultDialog(Context context, String msg, + String title) { + if(msg == null) return; + String rmsg = msg.replace(",", "\n"); + Log.d("Util", rmsg); + new AlertDialog.Builder(context).setTitle(title).setMessage(rmsg) + .setNegativeButton("知道了", null).create().show(); + } + + public static final void showProgressDialog(Context context, String title, + String message) { + dismissDialog(); + if (TextUtils.isEmpty(title)) { + title = "请稍候"; + } + if (TextUtils.isEmpty(message)) { + message = "正在加载..."; + } + 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(); + dlg.setCanceledOnTouchOutside(false); + dlg.show(); + return dlg; + } + + public static final void dismissDialog() { + if (mProgressDialog != null) { + mProgressDialog.dismiss(); + mProgressDialog = null; + } + } + + /** + * 打印消息并且用Toast显示消息 + * + * @param activity + * @param message + * @param logLevel + * 填d, w, e分别代表debug, warn, error; 默认是debug + */ + public static final void toastMessage(final Activity activity, + final String message, String logLevel) { + if ("w".equals(logLevel)) { + Log.w("sdkDemo", message); + } else if ("e".equals(logLevel)) { + Log.e("sdkDemo", message); + } else { + Log.d("sdkDemo", message); + } + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + // TODO Auto-generated method stub + if (mToast != null) { + mToast.cancel(); + mToast = null; + } + mToast = Toast.makeText(activity, message, Toast.LENGTH_SHORT); + mToast.show(); + } + }); + } + + /** + * 打印消息并且用Toast显示消息 + * + * @param activity + * @param message + * @param logLevel + * 填d, w, e分别代表debug, warn, error; 默认是debug + */ + public static final void toastMessage(final Activity activity, + final String message) { + toastMessage(activity, message, null); + } + + /** + * 根据一个网络连接(String)获取bitmap图像 + * + * @param imageUri + * @return + * @throws MalformedURLException + */ + public static Bitmap getbitmap(String imageUri) { + Log.v(TAG, "getbitmap:" + imageUri); + // 显示网络上的图片 + Bitmap bitmap = null; + try { + URL myFileUrl = new URL(imageUri); + HttpURLConnection conn = (HttpURLConnection) myFileUrl + .openConnection(); + conn.setDoInput(true); + conn.connect(); + InputStream is = conn.getInputStream(); + bitmap = BitmapFactory.decodeStream(is); + is.close(); + + Log.v(TAG, "image download finished." + imageUri); + } catch (OutOfMemoryError e) { + e.printStackTrace(); + bitmap = null; + } catch (IOException e) { + e.printStackTrace(); + Log.v(TAG, "getbitmap bmp fail---"); + bitmap = null; + } + return bitmap; + } + + public static void release() { + mProgressDialog = null; + mToast = null; + } + + // ========= + // =通过URI获取本地图片的path + // =兼容android 5.0 + // ========== + + public static String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT"; + public static int Build_VERSION_KITKAT = 19; + public static String getPath(final Context context, final Uri uri) { + + final boolean isKitKat = Build.VERSION.SDK_INT >= 19; + + // DocumentProvider + if (isKitKat && isDocumentUri(context, uri)) { + // ExternalStorageProvider + if (isExternalStorageDocument(uri)) { + final String docId = getDocumentId(uri); + final String[] split = docId.split(":"); + final String type = split[0]; + + if ("primary".equalsIgnoreCase(type)) { + return Environment.getExternalStorageDirectory() + "/" + split[1]; + } + + } + // DownloadsProvider + else if (isDownloadsDocument(uri)) { + + final String id = getDocumentId(uri); + final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), + Long.valueOf(id)); + + return getDataColumn(context, contentUri, null, null); + } + // MediaProvider + else if (isMediaDocument(uri)) { + final String docId = getDocumentId(uri); + final String[] split = docId.split(":"); + final String type = split[0]; + + Uri contentUri = null; + if ("image".equals(type)) { + contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; + } else if ("video".equals(type)) { + contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; + } else if ("audio".equals(type)) { + contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; + } + + final String selection = "_id=?"; + final String[] selectionArgs = new String[] { split[1] }; + + return getDataColumn(context, contentUri, selection, selectionArgs); + } + } + // MediaStore (and general) + else if ("content".equalsIgnoreCase(uri.getScheme())) { + + // Return the remote address + if (isGooglePhotosUri(uri)) + return uri.getLastPathSegment(); + + return getDataColumn(context, uri, null, null); + } + // File + else if ("file".equalsIgnoreCase(uri.getScheme())) { + return uri.getPath(); + } + + return null; + } + + private static final String PATH_DOCUMENT = "document"; + + /** + * Test if the given URI represents a {@link Document} backed by a + * {@link DocumentsProvider}. + */ + private static boolean isDocumentUri(Context context, Uri uri) { + final List paths = uri.getPathSegments(); + if (paths.size() < 2) { + return false; + } + if (!PATH_DOCUMENT.equals(paths.get(0))) { + return false; + } + + return true; + } + + private static String getDocumentId(Uri documentUri) { + final List paths = documentUri.getPathSegments(); + if (paths.size() < 2) { + throw new IllegalArgumentException("Not a document: " + documentUri); + } + if (!PATH_DOCUMENT.equals(paths.get(0))) { + throw new IllegalArgumentException("Not a document: " + documentUri); + } + return paths.get(1); + } + + /** + * Get the value of the data column for this Uri. This is useful for + * MediaStore Uris, and other file-based ContentProviders. + * + * @param context + * The context. + * @param uri + * The Uri to query. + * @param selection + * (Optional) Filter used in the query. + * @param selectionArgs + * (Optional) Selection arguments used in the query. + * [url=home.php?mod=space&uid=7300]@return[/url] The value of + * the _data column, which is typically a file path. + */ + public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { + + Cursor cursor = null; + final String column = "_data"; + final String[] projection = { column }; + + try { + cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); + if (cursor != null && cursor.moveToFirst()) { + final int index = cursor.getColumnIndexOrThrow(column); + return cursor.getString(index); + } + } finally { + if (cursor != null) + cursor.close(); + } + return null; + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is ExternalStorageProvider. + */ + public static boolean isExternalStorageDocument(Uri uri) { + return "com.android.externalstorage.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is DownloadsProvider. + */ + public static boolean isDownloadsDocument(Uri uri) { + return "com.android.providers.downloads.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is MediaProvider. + */ + public static boolean isMediaDocument(Uri uri) { + return "com.android.providers.media.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is Google Photos. + */ + public static boolean isGooglePhotosUri(Uri uri) { + return "com.google.android.apps.photos.content".equals(uri.getAuthority()); + } +} diff --git a/qinnb.txt b/qinnb.txt deleted file mode 100644 index d7883f5..0000000 --- a/qinnb.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/readme.txt b/readme.txt deleted file mode 100644 index 897744d..0000000 --- a/readme.txt +++ /dev/null @@ -1,14 +0,0 @@ -1. bmob_test_pull̨´1 -2. Shop С -3. ĵУĵprojectproject - 19:41 2016/8/18 -4. bmob_test_pullƶʾ1ɹ - 13:16 2016/8/19 -5. ĵ£޸ģͼ - 8:38 2016/8/20 -6. Shop£ӡѧУ֪ͨܣͬѧ - ͼݴ룬ֳͻͼݣѧУ֪ͨ - ̵꣬Ʒƶ - 18:33 2016/8/22 -7. ޸ͼϵṹͼ - 9:06 2016/8/23 diff --git a/test.txt b/test.txt deleted file mode 100644 index 47af198..0000000 --- a/test.txt +++ /dev/null @@ -1,9 +0,0 @@ -11:17 2016/8/1711:17 2016/8/17 -11:17 2016/8/17 -11:18 2016/8/17 - -1. ڱΪԹĵһļcommit -2. commitֻύ -3. ͬļϽpush - -4.change!8:20 2016/8/18 diff --git a/个人任务分工表_之前那个传错了.png b/个人任务分工表_之前那个传错了.png deleted file mode 100644 index 338edc1..0000000 Binary files a/个人任务分工表_之前那个传错了.png and /dev/null differ diff --git a/代码/在这里3.0/.classpath b/代码/在这里3.0/.classpath index 0461652..54cc208 100644 --- a/代码/在这里3.0/.classpath +++ b/代码/在这里3.0/.classpath @@ -3,6 +3,7 @@ + diff --git a/代码/在这里3.0/bin/Shop.apk b/代码/在这里3.0/bin/Shop.apk index d0596b5..c093775 100644 Binary files a/代码/在这里3.0/bin/Shop.apk and b/代码/在这里3.0/bin/Shop.apk differ diff --git a/代码/在这里3.0/bin/classes.dex b/代码/在这里3.0/bin/classes.dex index 9071149..1bd6188 100644 Binary files a/代码/在这里3.0/bin/classes.dex and b/代码/在这里3.0/bin/classes.dex differ diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/adapter/MineListAdapter.class b/代码/在这里3.0/bin/classes/com/stone/shop/adapter/MineListAdapter.class index 02a159c..07cfae2 100644 Binary files a/代码/在这里3.0/bin/classes/com/stone/shop/adapter/MineListAdapter.class and b/代码/在这里3.0/bin/classes/com/stone/shop/adapter/MineListAdapter.class differ diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/BXTNews.java~remotes_origin_zhaozaichun b/代码/在这里3.0/bin/classes/com/stone/shop/model/BXTNews.java~remotes_origin_zhaozaichun new file mode 100644 index 0000000..fb8f926 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/BXTNews.java~remotes_origin_zhaozaichun @@ -0,0 +1,78 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 博学堂讲座实体类 + * @date 2014-5-10 + * @author Stone + */ +public class BXTNews extends BmobObject{ + + //private String id; + + private String title; //标题 + private String topic; //讲座主题 + private String speaker; //主 讲 人 + private String time; //讲座时间 + private String location; //讲座地点 + private String holder1; //主办单位 + private String holder2; //承办单位 + private String points; //主讲内容提要 + private String speakerinfo; //主讲人简介 + + public String getTitle() { + return title; + } + public String getTopic() { + return topic; + } + public String getSpeaker() { + return speaker; + } + public String getTime() { + return time; + } + public String getLocation() { + return location; + } + public String getHolder1() { + return holder1; + } + public String getHolder2() { + return holder2; + } + public String getPoints() { + return points; + } + public String getSpeakerinfo() { + return speakerinfo; + } + public void setTitle(String title) { + this.title = title; + } + public void setTopic(String topic) { + this.topic = topic; + } + public void setSpeaker(String speaker) { + this.speaker = speaker; + } + public void setTime(String time) { + this.time = time; + } + public void setLocation(String location) { + this.location = location; + } + public void setHolder1(String holder1) { + this.holder1 = holder1; + } + public void setHolder2(String holder2) { + this.holder2 = holder2; + } + public void setPoints(String points) { + this.points = points; + } + public void setSpeakerinfo(String speakerinfo) { + this.speakerinfo = speakerinfo; + } +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/BXTNews.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f b/代码/在这里3.0/bin/classes/com/stone/shop/model/BXTNews.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f new file mode 100644 index 0000000..fb8f926 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/BXTNews.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f @@ -0,0 +1,78 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 博学堂讲座实体类 + * @date 2014-5-10 + * @author Stone + */ +public class BXTNews extends BmobObject{ + + //private String id; + + private String title; //标题 + private String topic; //讲座主题 + private String speaker; //主 讲 人 + private String time; //讲座时间 + private String location; //讲座地点 + private String holder1; //主办单位 + private String holder2; //承办单位 + private String points; //主讲内容提要 + private String speakerinfo; //主讲人简介 + + public String getTitle() { + return title; + } + public String getTopic() { + return topic; + } + public String getSpeaker() { + return speaker; + } + public String getTime() { + return time; + } + public String getLocation() { + return location; + } + public String getHolder1() { + return holder1; + } + public String getHolder2() { + return holder2; + } + public String getPoints() { + return points; + } + public String getSpeakerinfo() { + return speakerinfo; + } + public void setTitle(String title) { + this.title = title; + } + public void setTopic(String topic) { + this.topic = topic; + } + public void setSpeaker(String speaker) { + this.speaker = speaker; + } + public void setTime(String time) { + this.time = time; + } + public void setLocation(String location) { + this.location = location; + } + public void setHolder1(String holder1) { + this.holder1 = holder1; + } + public void setHolder2(String holder2) { + this.holder2 = holder2; + } + public void setPoints(String points) { + this.points = points; + } + public void setSpeakerinfo(String speakerinfo) { + this.speakerinfo = speakerinfo; + } +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/BXTNews.java~remotes_origin_zhaozaichun~HEAD b/代码/在这里3.0/bin/classes/com/stone/shop/model/BXTNews.java~remotes_origin_zhaozaichun~HEAD new file mode 100644 index 0000000..fb8f926 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/BXTNews.java~remotes_origin_zhaozaichun~HEAD @@ -0,0 +1,78 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 博学堂讲座实体类 + * @date 2014-5-10 + * @author Stone + */ +public class BXTNews extends BmobObject{ + + //private String id; + + private String title; //标题 + private String topic; //讲座主题 + private String speaker; //主 讲 人 + private String time; //讲座时间 + private String location; //讲座地点 + private String holder1; //主办单位 + private String holder2; //承办单位 + private String points; //主讲内容提要 + private String speakerinfo; //主讲人简介 + + public String getTitle() { + return title; + } + public String getTopic() { + return topic; + } + public String getSpeaker() { + return speaker; + } + public String getTime() { + return time; + } + public String getLocation() { + return location; + } + public String getHolder1() { + return holder1; + } + public String getHolder2() { + return holder2; + } + public String getPoints() { + return points; + } + public String getSpeakerinfo() { + return speakerinfo; + } + public void setTitle(String title) { + this.title = title; + } + public void setTopic(String topic) { + this.topic = topic; + } + public void setSpeaker(String speaker) { + this.speaker = speaker; + } + public void setTime(String time) { + this.time = time; + } + public void setLocation(String location) { + this.location = location; + } + public void setHolder1(String holder1) { + this.holder1 = holder1; + } + public void setHolder2(String holder2) { + this.holder2 = holder2; + } + public void setPoints(String points) { + this.points = points; + } + public void setSpeakerinfo(String speakerinfo) { + this.speakerinfo = speakerinfo; + } +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/Good.java~remotes_origin_zhaozaichun b/代码/在这里3.0/bin/classes/com/stone/shop/model/Good.java~remotes_origin_zhaozaichun new file mode 100644 index 0000000..b0a9ac8 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/Good.java~remotes_origin_zhaozaichun @@ -0,0 +1,63 @@ +package com.stone.shop.model; + +import java.io.Serializable; + +import cn.bmob.v3.BmobObject; +import cn.bmob.v3.datatype.BmobFile; + +/** + * 商品实体类 + * @date 2014-4-24 + * @author Stone + */ +public class Good extends BmobObject implements Serializable{ + + private static final long serialVersionUID = -3248168273019127389L; + + //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; + this.price = price; + } + + public String getShopID() { + return shopID; + } + + public void setShopID(String shopID) { + this.shopID = shopID; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/Good.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f b/代码/在这里3.0/bin/classes/com/stone/shop/model/Good.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f new file mode 100644 index 0000000..b0a9ac8 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/Good.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f @@ -0,0 +1,63 @@ +package com.stone.shop.model; + +import java.io.Serializable; + +import cn.bmob.v3.BmobObject; +import cn.bmob.v3.datatype.BmobFile; + +/** + * 商品实体类 + * @date 2014-4-24 + * @author Stone + */ +public class Good extends BmobObject implements Serializable{ + + private static final long serialVersionUID = -3248168273019127389L; + + //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; + this.price = price; + } + + public String getShopID() { + return shopID; + } + + public void setShopID(String shopID) { + this.shopID = shopID; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/Good.java~remotes_origin_zhaozaichun~HEAD b/代码/在这里3.0/bin/classes/com/stone/shop/model/Good.java~remotes_origin_zhaozaichun~HEAD new file mode 100644 index 0000000..b0a9ac8 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/Good.java~remotes_origin_zhaozaichun~HEAD @@ -0,0 +1,63 @@ +package com.stone.shop.model; + +import java.io.Serializable; + +import cn.bmob.v3.BmobObject; +import cn.bmob.v3.datatype.BmobFile; + +/** + * 商品实体类 + * @date 2014-4-24 + * @author Stone + */ +public class Good extends BmobObject implements Serializable{ + + private static final long serialVersionUID = -3248168273019127389L; + + //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; + this.price = price; + } + + public String getShopID() { + return shopID; + } + + public void setShopID(String shopID) { + this.shopID = shopID; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/News.java~remotes_origin_zhaozaichun b/代码/在这里3.0/bin/classes/com/stone/shop/model/News.java~remotes_origin_zhaozaichun new file mode 100644 index 0000000..b169779 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/News.java~remotes_origin_zhaozaichun @@ -0,0 +1,53 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 首页校内新闻实体类 + * + * @date 2014-5-3 + * @author Stone + */ +public class News extends BmobObject { + + // private String id; + // private String time; + + private String type; // 新闻类型 + private String title; // 新闻标题 + private String author; // 新闻作者 + private String content; // 新闻内容 + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/News.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f b/代码/在这里3.0/bin/classes/com/stone/shop/model/News.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f new file mode 100644 index 0000000..b169779 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/News.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f @@ -0,0 +1,53 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 首页校内新闻实体类 + * + * @date 2014-5-3 + * @author Stone + */ +public class News extends BmobObject { + + // private String id; + // private String time; + + private String type; // 新闻类型 + private String title; // 新闻标题 + private String author; // 新闻作者 + private String content; // 新闻内容 + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/News.java~remotes_origin_zhaozaichun~HEAD b/代码/在这里3.0/bin/classes/com/stone/shop/model/News.java~remotes_origin_zhaozaichun~HEAD new file mode 100644 index 0000000..b169779 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/News.java~remotes_origin_zhaozaichun~HEAD @@ -0,0 +1,53 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 首页校内新闻实体类 + * + * @date 2014-5-3 + * @author Stone + */ +public class News extends BmobObject { + + // private String id; + // private String time; + + private String type; // 新闻类型 + private String title; // 新闻标题 + private String author; // 新闻作者 + private String content; // 新闻内容 + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/SComment.java~remotes_origin_zhaozaichun b/代码/在这里3.0/bin/classes/com/stone/shop/model/SComment.java~remotes_origin_zhaozaichun new file mode 100644 index 0000000..7abf4ae --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/SComment.java~remotes_origin_zhaozaichun @@ -0,0 +1,61 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 店铺评论实体类 + * @date 2014-5-3 + * @author Stone + */ +public class SComment extends BmobObject { + + // private String id; + // private String time; + + private String shopID; + private String shopName; + private String userID; + private String userName; + private String content; + + public String getShopID() { + return shopID; + } + + public void setShopID(String shopID) { + this.shopID = shopID; + } + + public String getShopName() { + return shopName; + } + + public void setShopName(String shopName) { + this.shopName = shopName; + } + + public String getUserID() { + return userID; + } + + public void setUserID(String userID) { + this.userID = userID; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/SComment.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f b/代码/在这里3.0/bin/classes/com/stone/shop/model/SComment.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f new file mode 100644 index 0000000..7abf4ae --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/SComment.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f @@ -0,0 +1,61 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 店铺评论实体类 + * @date 2014-5-3 + * @author Stone + */ +public class SComment extends BmobObject { + + // private String id; + // private String time; + + private String shopID; + private String shopName; + private String userID; + private String userName; + private String content; + + public String getShopID() { + return shopID; + } + + public void setShopID(String shopID) { + this.shopID = shopID; + } + + public String getShopName() { + return shopName; + } + + public void setShopName(String shopName) { + this.shopName = shopName; + } + + public String getUserID() { + return userID; + } + + public void setUserID(String userID) { + this.userID = userID; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/SComment.java~remotes_origin_zhaozaichun~HEAD b/代码/在这里3.0/bin/classes/com/stone/shop/model/SComment.java~remotes_origin_zhaozaichun~HEAD new file mode 100644 index 0000000..7abf4ae --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/SComment.java~remotes_origin_zhaozaichun~HEAD @@ -0,0 +1,61 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobObject; + +/** + * 店铺评论实体类 + * @date 2014-5-3 + * @author Stone + */ +public class SComment extends BmobObject { + + // private String id; + // private String time; + + private String shopID; + private String shopName; + private String userID; + private String userName; + private String content; + + public String getShopID() { + return shopID; + } + + public void setShopID(String shopID) { + this.shopID = shopID; + } + + public String getShopName() { + return shopName; + } + + public void setShopName(String shopName) { + this.shopName = shopName; + } + + public String getUserID() { + return userID; + } + + public void setUserID(String userID) { + this.userID = userID; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/Shop.java~remotes_origin_zhaozaichun b/代码/在这里3.0/bin/classes/com/stone/shop/model/Shop.java~remotes_origin_zhaozaichun new file mode 100644 index 0000000..5e22bde --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/Shop.java~remotes_origin_zhaozaichun @@ -0,0 +1,82 @@ +package com.stone.shop.model; + +import java.io.Serializable; + +import cn.bmob.v3.BmobObject; +import cn.bmob.v3.datatype.BmobFile; + +/** + * 店铺实体类, 实现序列化, Activity之间实现传递 + * @date 2014-4-24 + * @author Stone + */ +public class Shop extends BmobObject implements Serializable{ + + private static final long serialVersionUID = -8796635595320697255L; + + private String userID; // 主人 + private String type; // 类型(11代表第一个GridView中的第一个) + private String name; // 店名 + private String location; // 地理位置 + private String phone; // 联系电话 + private String info; // 简介 + private String sale; // 促销信息 + private BmobFile picShop; // 商店主图 + + public String getUserID() { + return userID; + } + + public void setUserID(String userID) { + this.userID = userID; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + + public String getSale() { + return sale; + } + + public void setSale(String sale) { + this.sale = sale; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/Shop.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f b/代码/在这里3.0/bin/classes/com/stone/shop/model/Shop.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f new file mode 100644 index 0000000..5e22bde --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/Shop.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f @@ -0,0 +1,82 @@ +package com.stone.shop.model; + +import java.io.Serializable; + +import cn.bmob.v3.BmobObject; +import cn.bmob.v3.datatype.BmobFile; + +/** + * 店铺实体类, 实现序列化, Activity之间实现传递 + * @date 2014-4-24 + * @author Stone + */ +public class Shop extends BmobObject implements Serializable{ + + private static final long serialVersionUID = -8796635595320697255L; + + private String userID; // 主人 + private String type; // 类型(11代表第一个GridView中的第一个) + private String name; // 店名 + private String location; // 地理位置 + private String phone; // 联系电话 + private String info; // 简介 + private String sale; // 促销信息 + private BmobFile picShop; // 商店主图 + + public String getUserID() { + return userID; + } + + public void setUserID(String userID) { + this.userID = userID; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + + public String getSale() { + return sale; + } + + public void setSale(String sale) { + this.sale = sale; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/Shop.java~remotes_origin_zhaozaichun~HEAD b/代码/在这里3.0/bin/classes/com/stone/shop/model/Shop.java~remotes_origin_zhaozaichun~HEAD new file mode 100644 index 0000000..5e22bde --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/Shop.java~remotes_origin_zhaozaichun~HEAD @@ -0,0 +1,82 @@ +package com.stone.shop.model; + +import java.io.Serializable; + +import cn.bmob.v3.BmobObject; +import cn.bmob.v3.datatype.BmobFile; + +/** + * 店铺实体类, 实现序列化, Activity之间实现传递 + * @date 2014-4-24 + * @author Stone + */ +public class Shop extends BmobObject implements Serializable{ + + private static final long serialVersionUID = -8796635595320697255L; + + private String userID; // 主人 + private String type; // 类型(11代表第一个GridView中的第一个) + private String name; // 店名 + private String location; // 地理位置 + private String phone; // 联系电话 + private String info; // 简介 + private String sale; // 促销信息 + private BmobFile picShop; // 商店主图 + + public String getUserID() { + return userID; + } + + public void setUserID(String userID) { + this.userID = userID; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + + public String getSale() { + return sale; + } + + public void setSale(String sale) { + this.sale = sale; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/User.java~remotes_origin_zhaozaichun b/代码/在这里3.0/bin/classes/com/stone/shop/model/User.java~remotes_origin_zhaozaichun new file mode 100644 index 0000000..511703e --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/User.java~remotes_origin_zhaozaichun @@ -0,0 +1,106 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobUser; +import cn.bmob.v3.datatype.BmobFile; +import cn.bmob.v3.datatype.BmobRelation; + +/** + * 用户实体类 + * @date 2014-4-24 + * @author Stone + */ +public class User extends BmobUser { + + public static String userId; + + // 父类中已经存在的属性 + // private String id; + // private String username; + // private String password; + // private String email; + // private String regTime; + + private String sex; // 性别 + private String phone; // 电话 + private String qq; // QQ + private String school = "湖北工业大学"; // 学校 + private String cademy; // 学院 + private String dorPart; // 校区 + private String dorNum; // 寝室号 + private String state = "未登陆"; // 登录状态 + private String type = "普通用户"; // 用户类型(普通用户、黑名单、中奖者) + //private BmobFile picUser; // 头像 + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getQQ() { + return qq; + } + + public void setQQ(String qq) { + this.qq = qq; + } + + public String getSchool() { + return school; + } + + public void setSchool(String school) { + this.school = school; + } + + public String getCademy() { + return cademy; + } + + public void setCademy(String cademy) { + this.cademy = cademy; + } + + public String getDorPart() { + return dorPart; + } + + public void setDorPart(String dorPart) { + this.dorPart = dorPart; + } + + public String getDorNum() { + return dorNum; + } + + public void setDorNum(String dorNum) { + this.dorNum = dorNum; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/User.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f b/代码/在这里3.0/bin/classes/com/stone/shop/model/User.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f new file mode 100644 index 0000000..511703e --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/User.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f @@ -0,0 +1,106 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobUser; +import cn.bmob.v3.datatype.BmobFile; +import cn.bmob.v3.datatype.BmobRelation; + +/** + * 用户实体类 + * @date 2014-4-24 + * @author Stone + */ +public class User extends BmobUser { + + public static String userId; + + // 父类中已经存在的属性 + // private String id; + // private String username; + // private String password; + // private String email; + // private String regTime; + + private String sex; // 性别 + private String phone; // 电话 + private String qq; // QQ + private String school = "湖北工业大学"; // 学校 + private String cademy; // 学院 + private String dorPart; // 校区 + private String dorNum; // 寝室号 + private String state = "未登陆"; // 登录状态 + private String type = "普通用户"; // 用户类型(普通用户、黑名单、中奖者) + //private BmobFile picUser; // 头像 + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getQQ() { + return qq; + } + + public void setQQ(String qq) { + this.qq = qq; + } + + public String getSchool() { + return school; + } + + public void setSchool(String school) { + this.school = school; + } + + public String getCademy() { + return cademy; + } + + public void setCademy(String cademy) { + this.cademy = cademy; + } + + public String getDorPart() { + return dorPart; + } + + public void setDorPart(String dorPart) { + this.dorPart = dorPart; + } + + public String getDorNum() { + return dorNum; + } + + public void setDorNum(String dorNum) { + this.dorNum = dorNum; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/model/User.java~remotes_origin_zhaozaichun~HEAD b/代码/在这里3.0/bin/classes/com/stone/shop/model/User.java~remotes_origin_zhaozaichun~HEAD new file mode 100644 index 0000000..511703e --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/shop/model/User.java~remotes_origin_zhaozaichun~HEAD @@ -0,0 +1,106 @@ +package com.stone.shop.model; + +import cn.bmob.v3.BmobUser; +import cn.bmob.v3.datatype.BmobFile; +import cn.bmob.v3.datatype.BmobRelation; + +/** + * 用户实体类 + * @date 2014-4-24 + * @author Stone + */ +public class User extends BmobUser { + + public static String userId; + + // 父类中已经存在的属性 + // private String id; + // private String username; + // private String password; + // private String email; + // private String regTime; + + private String sex; // 性别 + private String phone; // 电话 + private String qq; // QQ + private String school = "湖北工业大学"; // 学校 + private String cademy; // 学院 + private String dorPart; // 校区 + private String dorNum; // 寝室号 + private String state = "未登陆"; // 登录状态 + private String type = "普通用户"; // 用户类型(普通用户、黑名单、中奖者) + //private BmobFile picUser; // 头像 + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getQQ() { + return qq; + } + + public void setQQ(String qq) { + this.qq = qq; + } + + public String getSchool() { + return school; + } + + public void setSchool(String school) { + this.school = school; + } + + public String getCademy() { + return cademy; + } + + public void setCademy(String cademy) { + this.cademy = cademy; + } + + public String getDorPart() { + return dorPart; + } + + public void setDorPart(String dorPart) { + this.dorPart = dorPart; + } + + public String getDorNum() { + return dorNum; + } + + public void setDorNum(String dorNum) { + this.dorNum = dorNum; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + +} diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/view/MineActivity.class b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineActivity.class index c6a424b..6da9684 100644 Binary files a/代码/在这里3.0/bin/classes/com/stone/shop/view/MineActivity.class and b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineActivity.class differ diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity$2.class b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity$2.class index 5da86cf..39b4d0a 100644 Binary files a/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity$2.class and b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity$2.class differ diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity$3.class b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity$3.class index 7a6dfe9..ae38e77 100644 Binary files a/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity$3.class and b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity$3.class differ diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity.class b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity.class index 5d91952..538e72b 100644 Binary files a/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity.class and b/代码/在这里3.0/bin/classes/com/stone/shop/view/MineInfoEditActivity.class differ diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/view/MultiViewGroup.class b/代码/在这里3.0/bin/classes/com/stone/shop/view/MultiViewGroup.class index 09c6d31..904337f 100644 Binary files a/代码/在这里3.0/bin/classes/com/stone/shop/view/MultiViewGroup.class and b/代码/在这里3.0/bin/classes/com/stone/shop/view/MultiViewGroup.class differ diff --git a/代码/在这里3.0/bin/classes/com/stone/shop/view/ShopItemActivity.class b/代码/在这里3.0/bin/classes/com/stone/shop/view/ShopItemActivity.class index 451a694..fee7e74 100644 Binary files a/代码/在这里3.0/bin/classes/com/stone/shop/view/ShopItemActivity.class and b/代码/在这里3.0/bin/classes/com/stone/shop/view/ShopItemActivity.class differ diff --git a/代码/在这里3.0/bin/classes/com/stone/util/Util.java~remotes_origin_zhaozaichun b/代码/在这里3.0/bin/classes/com/stone/util/Util.java~remotes_origin_zhaozaichun new file mode 100644 index 0000000..653e1f9 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/util/Util.java~remotes_origin_zhaozaichun @@ -0,0 +1,756 @@ +package com.stone.util; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.RandomAccessFile; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.ContentUris; +import android.content.Context; +import android.content.DialogInterface; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Bitmap.CompressFormat; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.net.Uri; +import android.os.Build; +import android.os.Environment; +import android.provider.MediaStore; +import android.text.TextUtils; +import android.util.Log; +import android.widget.Toast; +import junit.framework.Assert; + +/** + * 工具类 + * + * @date 2014-5-9 + * @author Stone + */ +public class Util { + + /** + * 判断电话号码是否有效 + * + * @param phoneNumber + * @return true 有效 / false 无效 + */ + public static boolean isPhoneNumberValid(String phoneNumber) { + + boolean isValid = false; + + String expression = "((^(13|15|18)[0-9]{9}$)|(^0[1,2]{1}\\d{1}-?\\d{8}$)|(^0[3-9] {1}\\d{2}-?\\d{7,8}$)|(^0[1,2]{1}\\d{1}-?\\d{8}-(\\d{1,4})$)|(^0[3-9]{1}\\d{2}-? \\d{7,8}-(\\d{1,4})$))"; + CharSequence inputStr = phoneNumber; + + Pattern pattern = Pattern.compile(expression); + Matcher matcher = pattern.matcher(inputStr); + + if (matcher.matches()) { + isValid = true; + } + return isValid; + } + + // 判断网络是否连接 + public static boolean isNetworkConnected(Context context) { + if (context != null) { + ConnectivityManager mConnectivityManager = (ConnectivityManager) context + .getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo mNetworkInfo = mConnectivityManager + .getActiveNetworkInfo(); + if (mNetworkInfo != null) { + return mNetworkInfo.isAvailable(); + } + } + return false; + } + +private static final String TAG = "SDK_Sample.Util"; + + private static Dialog mProgressDialog; + private static Toast mToast; + + /* Convert byte[] to hex string.这里我们可以将byte转换成int,然后利用Integer.toHexString(int)来转换成16进制字符串。 + * @param src byte[] data + * @return hex string + */ + public static String bytesToHexString(byte[] src){ + StringBuilder stringBuilder = new StringBuilder(""); + if (src == null || src.length <= 0) { + return null; + } + for (int i = 0; i < src.length; i++) { + int v = src[i] & 0xFF; + String hv = Integer.toHexString(v); + if (hv.length() < 2) { + stringBuilder.append(0); + } + stringBuilder.append(hv); + } + return stringBuilder.toString(); + } + /** + * Convert hex string to byte[] + * @param hexString the hex string + * @return byte[] + */ + public static byte[] hexStringToBytes(String hexString) { + if (hexString == null || hexString.equals("")) { + return null; + } + hexString = hexString.toUpperCase(); + int length = hexString.length() / 2; + char[] hexChars = hexString.toCharArray(); + byte[] d = new byte[length]; + for (int i = 0; i < length; i++) { + int pos = i * 2; + d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); + } + return d; + } + /** + * Convert char to byte + * @param c char + * @return byte + */ + private static byte charToByte(char c) { + return (byte) "0123456789ABCDEF".indexOf(c); + } + + /* + * 16进制数字字符集 + */ + private static String hexString="0123456789ABCDEF"; + /* + * 将字符串编码成16进制数字,适用于所有字符(包括中文) + */ + public static String toHexString(String str) + { +//根据默认编码获取字节数组 + byte[] bytes = null; + try { + bytes = str.getBytes("UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + if (bytes == null) return null; + StringBuilder sb=new StringBuilder(bytes.length*2); +//将字节数组中每个字节拆解成2位16进制整数 + for(int i=0;i>4)); + sb.append(hexString.charAt((bytes[i]&0x0f)>>0)); + } + return sb.toString(); + } + + //转换十六进制编码为字符串 + public static String hexToString(String s) + { + if("0x".equals(s.substring(0, 2))) + { + s =s.substring(2); + } + byte[] baKeyword = new byte[s.length()/2]; + for(int i = 0; i < baKeyword.length; i++) + { + try + { + baKeyword[i] = (byte)(0xff & Integer.parseInt(s.substring(i*2, i*2+2),16)); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + try + { + s = new String(baKeyword, "utf-8");//UTF-16le:Not + } + catch (Exception e1) + { + e1.printStackTrace(); + } + return s; + } + + public static byte[] bmpToByteArray(final Bitmap bmp, final boolean needRecycle) { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + bmp.compress(CompressFormat.PNG, 100, output); + if (needRecycle) { + bmp.recycle(); + } + + byte[] result = output.toByteArray(); + try { + output.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + return result; + } + + public static byte[] getHtmlByteArray(final String url) { + URL htmlUrl = null; + InputStream inStream = null; + try { + htmlUrl = new URL(url); + URLConnection connection = htmlUrl.openConnection(); + HttpURLConnection httpConnection = (HttpURLConnection)connection; + int responseCode = httpConnection.getResponseCode(); + if(responseCode == HttpURLConnection.HTTP_OK){ + inStream = httpConnection.getInputStream(); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + byte[] data = inputStreamToByte(inStream); + + return data; + } + + public static byte[] inputStreamToByte(InputStream is) { + try{ + ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); + int ch; + while ((ch = is.read()) != -1) { + bytestream.write(ch); + } + byte imgdata[] = bytestream.toByteArray(); + bytestream.close(); + return imgdata; + }catch(Exception e){ + e.printStackTrace(); + } + + return null; + } + + public static byte[] readFromFile(String fileName, int offset, int len) { + if (fileName == null) { + return null; + } + + File file = new File(fileName); + if (!file.exists()) { + Log.i(TAG, "readFromFile: file not found"); + return null; + } + + if (len == -1) { + len = (int) file.length(); + } + + Log.d(TAG, "readFromFile : offset = " + offset + " len = " + len + " offset + len = " + (offset + len)); + + if(offset <0){ + Log.e(TAG, "readFromFile invalid offset:" + offset); + return null; + } + if(len <=0 ){ + Log.e(TAG, "readFromFile invalid len:" + len); + return null; + } + if(offset + len > (int) file.length()){ + Log.e(TAG, "readFromFile invalid file len:" + file.length()); + return null; + } + + byte[] b = null; + try { + RandomAccessFile in = new RandomAccessFile(fileName, "r"); + b = new byte[len]; + in.seek(offset); + in.readFully(b); + in.close(); + + } catch (Exception e) { + Log.e(TAG, "readFromFile : errMsg = " + e.getMessage()); + e.printStackTrace(); + } + return b; + } + + public static int computeSampleSize(BitmapFactory.Options options, + + int minSideLength, int maxNumOfPixels) { + + int initialSize = computeInitialSampleSize(options, minSideLength, + + maxNumOfPixels); + + int roundedSize; + + if (initialSize <= 8) { + + roundedSize = 1; + + while (roundedSize < initialSize) { + + roundedSize <<= 1; + + } + + } else { + + roundedSize = (initialSize + 7) / 8 * 8; + + } + + return roundedSize; + } + + 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)); + + if (upperBound < lowerBound) { + + // return the larger one when there is no overlapping zone. + + return lowerBound; + + } + + if ((maxNumOfPixels == -1) && + + (minSideLength == -1)) { + + return 1; + + } else if (minSideLength == -1) { + + return lowerBound; + + } else { + + return upperBound; + + } + } + + /** + * 以最省内存的方式读取图片 + */ + public static Bitmap readBitmap(final String path){ + try{ + FileInputStream stream = new FileInputStream(new File(path+"test.jpg")); + BitmapFactory.Options opts = new BitmapFactory.Options(); + opts.inSampleSize = 8; + opts.inPurgeable=true; + opts.inInputShareable=true; + Bitmap bitmap = BitmapFactory.decodeStream(stream , null, opts); + return bitmap; + } catch (OutOfMemoryError e) { + return null; + } catch (Exception 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); + + BitmapFactory.Options options = new BitmapFactory.Options(); + + try { + options.inJustDecodeBounds = true; + Bitmap tmp = BitmapFactory.decodeFile(path, options); + if (tmp != null) { + 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; + Log.d(TAG, "extractThumbNail: extract beX = " + beX + ", beY = " + beY); + options.inSampleSize = (int) (crop ? (beY > beX ? beX : beY) : (beY < beX ? beX : beY)); + if (options.inSampleSize <= 1) { + options.inSampleSize = 1; + } + + // NOTE: out of memory error + while (options.outHeight * options.outWidth / options.inSampleSize > MAX_DECODE_PICTURE_SIZE) { + options.inSampleSize++; + } + + int newHeight = height; + int newWidth = width; + if (crop) { + if (beY > beX) { + newHeight = (int) (newWidth * 1.0 * options.outHeight / options.outWidth); + } else { + newWidth = (int) (newHeight * 1.0 * options.outWidth / options.outHeight); + } + } else { + if (beY < beX) { + newHeight = (int) (newWidth * 1.0 * options.outHeight / options.outWidth); + } else { + newWidth = (int) (newHeight * 1.0 * options.outWidth / options.outHeight); + } + } + + options.inJustDecodeBounds = false; + + Log.i(TAG, "bitmap required size=" + newWidth + "x" + newHeight + ", orig=" + options.outWidth + "x" + options.outHeight + ", sample=" + options.inSampleSize); + Bitmap bm = BitmapFactory.decodeFile(path, options); + if (bm == null) { + Log.e(TAG, "bitmap decode failed"); + return null; + } + + Log.i(TAG, "bitmap decoded size=" + bm.getWidth() + "x" + bm.getHeight()); + final Bitmap scale = Bitmap.createScaledBitmap(bm, newWidth, newHeight, true); + if (scale != null) { + bm.recycle(); + bm = scale; + } + + if (crop) { + final Bitmap cropped = Bitmap.createBitmap(bm, (bm.getWidth() - width) >> 1, (bm.getHeight() - height) >> 1, width, height); + if (cropped == null) { + return bm; + } + + bm.recycle(); + bm = cropped; + Log.i(TAG, "bitmap croped size=" + bm.getWidth() + "x" + bm.getHeight()); + } + return bm; + + } catch (final OutOfMemoryError e) { + Log.e(TAG, "decode bitmap failed: " + e.getMessage()); + options = null; + } + + return null; + } + + public static final void showResultDialog(Context context, String msg, + String title) { + if(msg == null) return; + String rmsg = msg.replace(",", "\n"); + Log.d("Util", rmsg); + new AlertDialog.Builder(context).setTitle(title).setMessage(rmsg) + .setNegativeButton("知道了", null).create().show(); + } + + public static final void showProgressDialog(Context context, String title, + String message) { + dismissDialog(); + if (TextUtils.isEmpty(title)) { + title = "请稍候"; + } + if (TextUtils.isEmpty(message)) { + message = "正在加载..."; + } + 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(); + dlg.setCanceledOnTouchOutside(false); + dlg.show(); + return dlg; + } + + public static final void dismissDialog() { + if (mProgressDialog != null) { + mProgressDialog.dismiss(); + mProgressDialog = null; + } + } + + /** + * 打印消息并且用Toast显示消息 + * + * @param activity + * @param message + * @param logLevel + * 填d, w, e分别代表debug, warn, error; 默认是debug + */ + public static final void toastMessage(final Activity activity, + final String message, String logLevel) { + if ("w".equals(logLevel)) { + Log.w("sdkDemo", message); + } else if ("e".equals(logLevel)) { + Log.e("sdkDemo", message); + } else { + Log.d("sdkDemo", message); + } + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + // TODO Auto-generated method stub + if (mToast != null) { + mToast.cancel(); + mToast = null; + } + mToast = Toast.makeText(activity, message, Toast.LENGTH_SHORT); + mToast.show(); + } + }); + } + + /** + * 打印消息并且用Toast显示消息 + * + * @param activity + * @param message + * @param logLevel + * 填d, w, e分别代表debug, warn, error; 默认是debug + */ + public static final void toastMessage(final Activity activity, + final String message) { + toastMessage(activity, message, null); + } + + /** + * 根据一个网络连接(String)获取bitmap图像 + * + * @param imageUri + * @return + * @throws MalformedURLException + */ + public static Bitmap getbitmap(String imageUri) { + Log.v(TAG, "getbitmap:" + imageUri); + // 显示网络上的图片 + Bitmap bitmap = null; + try { + URL myFileUrl = new URL(imageUri); + HttpURLConnection conn = (HttpURLConnection) myFileUrl + .openConnection(); + conn.setDoInput(true); + conn.connect(); + InputStream is = conn.getInputStream(); + bitmap = BitmapFactory.decodeStream(is); + is.close(); + + Log.v(TAG, "image download finished." + imageUri); + } catch (OutOfMemoryError e) { + e.printStackTrace(); + bitmap = null; + } catch (IOException e) { + e.printStackTrace(); + Log.v(TAG, "getbitmap bmp fail---"); + bitmap = null; + } + return bitmap; + } + + public static void release() { + mProgressDialog = null; + mToast = null; + } + + // ========= + // =通过URI获取本地图片的path + // =兼容android 5.0 + // ========== + + public static String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT"; + public static int Build_VERSION_KITKAT = 19; + public static String getPath(final Context context, final Uri uri) { + + final boolean isKitKat = Build.VERSION.SDK_INT >= 19; + + // DocumentProvider + if (isKitKat && isDocumentUri(context, uri)) { + // ExternalStorageProvider + if (isExternalStorageDocument(uri)) { + final String docId = getDocumentId(uri); + final String[] split = docId.split(":"); + final String type = split[0]; + + if ("primary".equalsIgnoreCase(type)) { + return Environment.getExternalStorageDirectory() + "/" + split[1]; + } + + } + // DownloadsProvider + else if (isDownloadsDocument(uri)) { + + final String id = getDocumentId(uri); + final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), + Long.valueOf(id)); + + return getDataColumn(context, contentUri, null, null); + } + // MediaProvider + else if (isMediaDocument(uri)) { + final String docId = getDocumentId(uri); + final String[] split = docId.split(":"); + final String type = split[0]; + + Uri contentUri = null; + if ("image".equals(type)) { + contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; + } else if ("video".equals(type)) { + contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; + } else if ("audio".equals(type)) { + contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; + } + + final String selection = "_id=?"; + final String[] selectionArgs = new String[] { split[1] }; + + return getDataColumn(context, contentUri, selection, selectionArgs); + } + } + // MediaStore (and general) + else if ("content".equalsIgnoreCase(uri.getScheme())) { + + // Return the remote address + if (isGooglePhotosUri(uri)) + return uri.getLastPathSegment(); + + return getDataColumn(context, uri, null, null); + } + // File + else if ("file".equalsIgnoreCase(uri.getScheme())) { + return uri.getPath(); + } + + return null; + } + + private static final String PATH_DOCUMENT = "document"; + + /** + * Test if the given URI represents a {@link Document} backed by a + * {@link DocumentsProvider}. + */ + private static boolean isDocumentUri(Context context, Uri uri) { + final List paths = uri.getPathSegments(); + if (paths.size() < 2) { + return false; + } + if (!PATH_DOCUMENT.equals(paths.get(0))) { + return false; + } + + return true; + } + + private static String getDocumentId(Uri documentUri) { + final List paths = documentUri.getPathSegments(); + if (paths.size() < 2) { + throw new IllegalArgumentException("Not a document: " + documentUri); + } + if (!PATH_DOCUMENT.equals(paths.get(0))) { + throw new IllegalArgumentException("Not a document: " + documentUri); + } + return paths.get(1); + } + + /** + * Get the value of the data column for this Uri. This is useful for + * MediaStore Uris, and other file-based ContentProviders. + * + * @param context + * The context. + * @param uri + * The Uri to query. + * @param selection + * (Optional) Filter used in the query. + * @param selectionArgs + * (Optional) Selection arguments used in the query. + * [url=home.php?mod=space&uid=7300]@return[/url] The value of + * the _data column, which is typically a file path. + */ + public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { + + Cursor cursor = null; + final String column = "_data"; + final String[] projection = { column }; + + try { + cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); + if (cursor != null && cursor.moveToFirst()) { + final int index = cursor.getColumnIndexOrThrow(column); + return cursor.getString(index); + } + } finally { + if (cursor != null) + cursor.close(); + } + return null; + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is ExternalStorageProvider. + */ + public static boolean isExternalStorageDocument(Uri uri) { + return "com.android.externalstorage.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is DownloadsProvider. + */ + public static boolean isDownloadsDocument(Uri uri) { + return "com.android.providers.downloads.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is MediaProvider. + */ + public static boolean isMediaDocument(Uri uri) { + return "com.android.providers.media.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is Google Photos. + */ + public static boolean isGooglePhotosUri(Uri uri) { + return "com.google.android.apps.photos.content".equals(uri.getAuthority()); + } +} diff --git a/代码/在这里3.0/bin/classes/com/stone/util/Util.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f b/代码/在这里3.0/bin/classes/com/stone/util/Util.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f new file mode 100644 index 0000000..653e1f9 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/util/Util.java~remotes_origin_zhaozaichun~406ede7f366affa65cb8bad5ffc35ac8737ea11f @@ -0,0 +1,756 @@ +package com.stone.util; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.RandomAccessFile; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.ContentUris; +import android.content.Context; +import android.content.DialogInterface; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Bitmap.CompressFormat; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.net.Uri; +import android.os.Build; +import android.os.Environment; +import android.provider.MediaStore; +import android.text.TextUtils; +import android.util.Log; +import android.widget.Toast; +import junit.framework.Assert; + +/** + * 工具类 + * + * @date 2014-5-9 + * @author Stone + */ +public class Util { + + /** + * 判断电话号码是否有效 + * + * @param phoneNumber + * @return true 有效 / false 无效 + */ + public static boolean isPhoneNumberValid(String phoneNumber) { + + boolean isValid = false; + + String expression = "((^(13|15|18)[0-9]{9}$)|(^0[1,2]{1}\\d{1}-?\\d{8}$)|(^0[3-9] {1}\\d{2}-?\\d{7,8}$)|(^0[1,2]{1}\\d{1}-?\\d{8}-(\\d{1,4})$)|(^0[3-9]{1}\\d{2}-? \\d{7,8}-(\\d{1,4})$))"; + CharSequence inputStr = phoneNumber; + + Pattern pattern = Pattern.compile(expression); + Matcher matcher = pattern.matcher(inputStr); + + if (matcher.matches()) { + isValid = true; + } + return isValid; + } + + // 判断网络是否连接 + public static boolean isNetworkConnected(Context context) { + if (context != null) { + ConnectivityManager mConnectivityManager = (ConnectivityManager) context + .getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo mNetworkInfo = mConnectivityManager + .getActiveNetworkInfo(); + if (mNetworkInfo != null) { + return mNetworkInfo.isAvailable(); + } + } + return false; + } + +private static final String TAG = "SDK_Sample.Util"; + + private static Dialog mProgressDialog; + private static Toast mToast; + + /* Convert byte[] to hex string.这里我们可以将byte转换成int,然后利用Integer.toHexString(int)来转换成16进制字符串。 + * @param src byte[] data + * @return hex string + */ + public static String bytesToHexString(byte[] src){ + StringBuilder stringBuilder = new StringBuilder(""); + if (src == null || src.length <= 0) { + return null; + } + for (int i = 0; i < src.length; i++) { + int v = src[i] & 0xFF; + String hv = Integer.toHexString(v); + if (hv.length() < 2) { + stringBuilder.append(0); + } + stringBuilder.append(hv); + } + return stringBuilder.toString(); + } + /** + * Convert hex string to byte[] + * @param hexString the hex string + * @return byte[] + */ + public static byte[] hexStringToBytes(String hexString) { + if (hexString == null || hexString.equals("")) { + return null; + } + hexString = hexString.toUpperCase(); + int length = hexString.length() / 2; + char[] hexChars = hexString.toCharArray(); + byte[] d = new byte[length]; + for (int i = 0; i < length; i++) { + int pos = i * 2; + d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); + } + return d; + } + /** + * Convert char to byte + * @param c char + * @return byte + */ + private static byte charToByte(char c) { + return (byte) "0123456789ABCDEF".indexOf(c); + } + + /* + * 16进制数字字符集 + */ + private static String hexString="0123456789ABCDEF"; + /* + * 将字符串编码成16进制数字,适用于所有字符(包括中文) + */ + public static String toHexString(String str) + { +//根据默认编码获取字节数组 + byte[] bytes = null; + try { + bytes = str.getBytes("UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + if (bytes == null) return null; + StringBuilder sb=new StringBuilder(bytes.length*2); +//将字节数组中每个字节拆解成2位16进制整数 + for(int i=0;i>4)); + sb.append(hexString.charAt((bytes[i]&0x0f)>>0)); + } + return sb.toString(); + } + + //转换十六进制编码为字符串 + public static String hexToString(String s) + { + if("0x".equals(s.substring(0, 2))) + { + s =s.substring(2); + } + byte[] baKeyword = new byte[s.length()/2]; + for(int i = 0; i < baKeyword.length; i++) + { + try + { + baKeyword[i] = (byte)(0xff & Integer.parseInt(s.substring(i*2, i*2+2),16)); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + try + { + s = new String(baKeyword, "utf-8");//UTF-16le:Not + } + catch (Exception e1) + { + e1.printStackTrace(); + } + return s; + } + + public static byte[] bmpToByteArray(final Bitmap bmp, final boolean needRecycle) { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + bmp.compress(CompressFormat.PNG, 100, output); + if (needRecycle) { + bmp.recycle(); + } + + byte[] result = output.toByteArray(); + try { + output.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + return result; + } + + public static byte[] getHtmlByteArray(final String url) { + URL htmlUrl = null; + InputStream inStream = null; + try { + htmlUrl = new URL(url); + URLConnection connection = htmlUrl.openConnection(); + HttpURLConnection httpConnection = (HttpURLConnection)connection; + int responseCode = httpConnection.getResponseCode(); + if(responseCode == HttpURLConnection.HTTP_OK){ + inStream = httpConnection.getInputStream(); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + byte[] data = inputStreamToByte(inStream); + + return data; + } + + public static byte[] inputStreamToByte(InputStream is) { + try{ + ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); + int ch; + while ((ch = is.read()) != -1) { + bytestream.write(ch); + } + byte imgdata[] = bytestream.toByteArray(); + bytestream.close(); + return imgdata; + }catch(Exception e){ + e.printStackTrace(); + } + + return null; + } + + public static byte[] readFromFile(String fileName, int offset, int len) { + if (fileName == null) { + return null; + } + + File file = new File(fileName); + if (!file.exists()) { + Log.i(TAG, "readFromFile: file not found"); + return null; + } + + if (len == -1) { + len = (int) file.length(); + } + + Log.d(TAG, "readFromFile : offset = " + offset + " len = " + len + " offset + len = " + (offset + len)); + + if(offset <0){ + Log.e(TAG, "readFromFile invalid offset:" + offset); + return null; + } + if(len <=0 ){ + Log.e(TAG, "readFromFile invalid len:" + len); + return null; + } + if(offset + len > (int) file.length()){ + Log.e(TAG, "readFromFile invalid file len:" + file.length()); + return null; + } + + byte[] b = null; + try { + RandomAccessFile in = new RandomAccessFile(fileName, "r"); + b = new byte[len]; + in.seek(offset); + in.readFully(b); + in.close(); + + } catch (Exception e) { + Log.e(TAG, "readFromFile : errMsg = " + e.getMessage()); + e.printStackTrace(); + } + return b; + } + + public static int computeSampleSize(BitmapFactory.Options options, + + int minSideLength, int maxNumOfPixels) { + + int initialSize = computeInitialSampleSize(options, minSideLength, + + maxNumOfPixels); + + int roundedSize; + + if (initialSize <= 8) { + + roundedSize = 1; + + while (roundedSize < initialSize) { + + roundedSize <<= 1; + + } + + } else { + + roundedSize = (initialSize + 7) / 8 * 8; + + } + + return roundedSize; + } + + 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)); + + if (upperBound < lowerBound) { + + // return the larger one when there is no overlapping zone. + + return lowerBound; + + } + + if ((maxNumOfPixels == -1) && + + (minSideLength == -1)) { + + return 1; + + } else if (minSideLength == -1) { + + return lowerBound; + + } else { + + return upperBound; + + } + } + + /** + * 以最省内存的方式读取图片 + */ + public static Bitmap readBitmap(final String path){ + try{ + FileInputStream stream = new FileInputStream(new File(path+"test.jpg")); + BitmapFactory.Options opts = new BitmapFactory.Options(); + opts.inSampleSize = 8; + opts.inPurgeable=true; + opts.inInputShareable=true; + Bitmap bitmap = BitmapFactory.decodeStream(stream , null, opts); + return bitmap; + } catch (OutOfMemoryError e) { + return null; + } catch (Exception 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); + + BitmapFactory.Options options = new BitmapFactory.Options(); + + try { + options.inJustDecodeBounds = true; + Bitmap tmp = BitmapFactory.decodeFile(path, options); + if (tmp != null) { + 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; + Log.d(TAG, "extractThumbNail: extract beX = " + beX + ", beY = " + beY); + options.inSampleSize = (int) (crop ? (beY > beX ? beX : beY) : (beY < beX ? beX : beY)); + if (options.inSampleSize <= 1) { + options.inSampleSize = 1; + } + + // NOTE: out of memory error + while (options.outHeight * options.outWidth / options.inSampleSize > MAX_DECODE_PICTURE_SIZE) { + options.inSampleSize++; + } + + int newHeight = height; + int newWidth = width; + if (crop) { + if (beY > beX) { + newHeight = (int) (newWidth * 1.0 * options.outHeight / options.outWidth); + } else { + newWidth = (int) (newHeight * 1.0 * options.outWidth / options.outHeight); + } + } else { + if (beY < beX) { + newHeight = (int) (newWidth * 1.0 * options.outHeight / options.outWidth); + } else { + newWidth = (int) (newHeight * 1.0 * options.outWidth / options.outHeight); + } + } + + options.inJustDecodeBounds = false; + + Log.i(TAG, "bitmap required size=" + newWidth + "x" + newHeight + ", orig=" + options.outWidth + "x" + options.outHeight + ", sample=" + options.inSampleSize); + Bitmap bm = BitmapFactory.decodeFile(path, options); + if (bm == null) { + Log.e(TAG, "bitmap decode failed"); + return null; + } + + Log.i(TAG, "bitmap decoded size=" + bm.getWidth() + "x" + bm.getHeight()); + final Bitmap scale = Bitmap.createScaledBitmap(bm, newWidth, newHeight, true); + if (scale != null) { + bm.recycle(); + bm = scale; + } + + if (crop) { + final Bitmap cropped = Bitmap.createBitmap(bm, (bm.getWidth() - width) >> 1, (bm.getHeight() - height) >> 1, width, height); + if (cropped == null) { + return bm; + } + + bm.recycle(); + bm = cropped; + Log.i(TAG, "bitmap croped size=" + bm.getWidth() + "x" + bm.getHeight()); + } + return bm; + + } catch (final OutOfMemoryError e) { + Log.e(TAG, "decode bitmap failed: " + e.getMessage()); + options = null; + } + + return null; + } + + public static final void showResultDialog(Context context, String msg, + String title) { + if(msg == null) return; + String rmsg = msg.replace(",", "\n"); + Log.d("Util", rmsg); + new AlertDialog.Builder(context).setTitle(title).setMessage(rmsg) + .setNegativeButton("知道了", null).create().show(); + } + + public static final void showProgressDialog(Context context, String title, + String message) { + dismissDialog(); + if (TextUtils.isEmpty(title)) { + title = "请稍候"; + } + if (TextUtils.isEmpty(message)) { + message = "正在加载..."; + } + 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(); + dlg.setCanceledOnTouchOutside(false); + dlg.show(); + return dlg; + } + + public static final void dismissDialog() { + if (mProgressDialog != null) { + mProgressDialog.dismiss(); + mProgressDialog = null; + } + } + + /** + * 打印消息并且用Toast显示消息 + * + * @param activity + * @param message + * @param logLevel + * 填d, w, e分别代表debug, warn, error; 默认是debug + */ + public static final void toastMessage(final Activity activity, + final String message, String logLevel) { + if ("w".equals(logLevel)) { + Log.w("sdkDemo", message); + } else if ("e".equals(logLevel)) { + Log.e("sdkDemo", message); + } else { + Log.d("sdkDemo", message); + } + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + // TODO Auto-generated method stub + if (mToast != null) { + mToast.cancel(); + mToast = null; + } + mToast = Toast.makeText(activity, message, Toast.LENGTH_SHORT); + mToast.show(); + } + }); + } + + /** + * 打印消息并且用Toast显示消息 + * + * @param activity + * @param message + * @param logLevel + * 填d, w, e分别代表debug, warn, error; 默认是debug + */ + public static final void toastMessage(final Activity activity, + final String message) { + toastMessage(activity, message, null); + } + + /** + * 根据一个网络连接(String)获取bitmap图像 + * + * @param imageUri + * @return + * @throws MalformedURLException + */ + public static Bitmap getbitmap(String imageUri) { + Log.v(TAG, "getbitmap:" + imageUri); + // 显示网络上的图片 + Bitmap bitmap = null; + try { + URL myFileUrl = new URL(imageUri); + HttpURLConnection conn = (HttpURLConnection) myFileUrl + .openConnection(); + conn.setDoInput(true); + conn.connect(); + InputStream is = conn.getInputStream(); + bitmap = BitmapFactory.decodeStream(is); + is.close(); + + Log.v(TAG, "image download finished." + imageUri); + } catch (OutOfMemoryError e) { + e.printStackTrace(); + bitmap = null; + } catch (IOException e) { + e.printStackTrace(); + Log.v(TAG, "getbitmap bmp fail---"); + bitmap = null; + } + return bitmap; + } + + public static void release() { + mProgressDialog = null; + mToast = null; + } + + // ========= + // =通过URI获取本地图片的path + // =兼容android 5.0 + // ========== + + public static String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT"; + public static int Build_VERSION_KITKAT = 19; + public static String getPath(final Context context, final Uri uri) { + + final boolean isKitKat = Build.VERSION.SDK_INT >= 19; + + // DocumentProvider + if (isKitKat && isDocumentUri(context, uri)) { + // ExternalStorageProvider + if (isExternalStorageDocument(uri)) { + final String docId = getDocumentId(uri); + final String[] split = docId.split(":"); + final String type = split[0]; + + if ("primary".equalsIgnoreCase(type)) { + return Environment.getExternalStorageDirectory() + "/" + split[1]; + } + + } + // DownloadsProvider + else if (isDownloadsDocument(uri)) { + + final String id = getDocumentId(uri); + final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), + Long.valueOf(id)); + + return getDataColumn(context, contentUri, null, null); + } + // MediaProvider + else if (isMediaDocument(uri)) { + final String docId = getDocumentId(uri); + final String[] split = docId.split(":"); + final String type = split[0]; + + Uri contentUri = null; + if ("image".equals(type)) { + contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; + } else if ("video".equals(type)) { + contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; + } else if ("audio".equals(type)) { + contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; + } + + final String selection = "_id=?"; + final String[] selectionArgs = new String[] { split[1] }; + + return getDataColumn(context, contentUri, selection, selectionArgs); + } + } + // MediaStore (and general) + else if ("content".equalsIgnoreCase(uri.getScheme())) { + + // Return the remote address + if (isGooglePhotosUri(uri)) + return uri.getLastPathSegment(); + + return getDataColumn(context, uri, null, null); + } + // File + else if ("file".equalsIgnoreCase(uri.getScheme())) { + return uri.getPath(); + } + + return null; + } + + private static final String PATH_DOCUMENT = "document"; + + /** + * Test if the given URI represents a {@link Document} backed by a + * {@link DocumentsProvider}. + */ + private static boolean isDocumentUri(Context context, Uri uri) { + final List paths = uri.getPathSegments(); + if (paths.size() < 2) { + return false; + } + if (!PATH_DOCUMENT.equals(paths.get(0))) { + return false; + } + + return true; + } + + private static String getDocumentId(Uri documentUri) { + final List paths = documentUri.getPathSegments(); + if (paths.size() < 2) { + throw new IllegalArgumentException("Not a document: " + documentUri); + } + if (!PATH_DOCUMENT.equals(paths.get(0))) { + throw new IllegalArgumentException("Not a document: " + documentUri); + } + return paths.get(1); + } + + /** + * Get the value of the data column for this Uri. This is useful for + * MediaStore Uris, and other file-based ContentProviders. + * + * @param context + * The context. + * @param uri + * The Uri to query. + * @param selection + * (Optional) Filter used in the query. + * @param selectionArgs + * (Optional) Selection arguments used in the query. + * [url=home.php?mod=space&uid=7300]@return[/url] The value of + * the _data column, which is typically a file path. + */ + public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { + + Cursor cursor = null; + final String column = "_data"; + final String[] projection = { column }; + + try { + cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); + if (cursor != null && cursor.moveToFirst()) { + final int index = cursor.getColumnIndexOrThrow(column); + return cursor.getString(index); + } + } finally { + if (cursor != null) + cursor.close(); + } + return null; + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is ExternalStorageProvider. + */ + public static boolean isExternalStorageDocument(Uri uri) { + return "com.android.externalstorage.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is DownloadsProvider. + */ + public static boolean isDownloadsDocument(Uri uri) { + return "com.android.providers.downloads.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is MediaProvider. + */ + public static boolean isMediaDocument(Uri uri) { + return "com.android.providers.media.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is Google Photos. + */ + public static boolean isGooglePhotosUri(Uri uri) { + return "com.google.android.apps.photos.content".equals(uri.getAuthority()); + } +} diff --git a/代码/在这里3.0/bin/classes/com/stone/util/Util.java~remotes_origin_zhaozaichun~HEAD b/代码/在这里3.0/bin/classes/com/stone/util/Util.java~remotes_origin_zhaozaichun~HEAD new file mode 100644 index 0000000..653e1f9 --- /dev/null +++ b/代码/在这里3.0/bin/classes/com/stone/util/Util.java~remotes_origin_zhaozaichun~HEAD @@ -0,0 +1,756 @@ +package com.stone.util; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.RandomAccessFile; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.ContentUris; +import android.content.Context; +import android.content.DialogInterface; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Bitmap.CompressFormat; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.net.Uri; +import android.os.Build; +import android.os.Environment; +import android.provider.MediaStore; +import android.text.TextUtils; +import android.util.Log; +import android.widget.Toast; +import junit.framework.Assert; + +/** + * 工具类 + * + * @date 2014-5-9 + * @author Stone + */ +public class Util { + + /** + * 判断电话号码是否有效 + * + * @param phoneNumber + * @return true 有效 / false 无效 + */ + public static boolean isPhoneNumberValid(String phoneNumber) { + + boolean isValid = false; + + String expression = "((^(13|15|18)[0-9]{9}$)|(^0[1,2]{1}\\d{1}-?\\d{8}$)|(^0[3-9] {1}\\d{2}-?\\d{7,8}$)|(^0[1,2]{1}\\d{1}-?\\d{8}-(\\d{1,4})$)|(^0[3-9]{1}\\d{2}-? \\d{7,8}-(\\d{1,4})$))"; + CharSequence inputStr = phoneNumber; + + Pattern pattern = Pattern.compile(expression); + Matcher matcher = pattern.matcher(inputStr); + + if (matcher.matches()) { + isValid = true; + } + return isValid; + } + + // 判断网络是否连接 + public static boolean isNetworkConnected(Context context) { + if (context != null) { + ConnectivityManager mConnectivityManager = (ConnectivityManager) context + .getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo mNetworkInfo = mConnectivityManager + .getActiveNetworkInfo(); + if (mNetworkInfo != null) { + return mNetworkInfo.isAvailable(); + } + } + return false; + } + +private static final String TAG = "SDK_Sample.Util"; + + private static Dialog mProgressDialog; + private static Toast mToast; + + /* Convert byte[] to hex string.这里我们可以将byte转换成int,然后利用Integer.toHexString(int)来转换成16进制字符串。 + * @param src byte[] data + * @return hex string + */ + public static String bytesToHexString(byte[] src){ + StringBuilder stringBuilder = new StringBuilder(""); + if (src == null || src.length <= 0) { + return null; + } + for (int i = 0; i < src.length; i++) { + int v = src[i] & 0xFF; + String hv = Integer.toHexString(v); + if (hv.length() < 2) { + stringBuilder.append(0); + } + stringBuilder.append(hv); + } + return stringBuilder.toString(); + } + /** + * Convert hex string to byte[] + * @param hexString the hex string + * @return byte[] + */ + public static byte[] hexStringToBytes(String hexString) { + if (hexString == null || hexString.equals("")) { + return null; + } + hexString = hexString.toUpperCase(); + int length = hexString.length() / 2; + char[] hexChars = hexString.toCharArray(); + byte[] d = new byte[length]; + for (int i = 0; i < length; i++) { + int pos = i * 2; + d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); + } + return d; + } + /** + * Convert char to byte + * @param c char + * @return byte + */ + private static byte charToByte(char c) { + return (byte) "0123456789ABCDEF".indexOf(c); + } + + /* + * 16进制数字字符集 + */ + private static String hexString="0123456789ABCDEF"; + /* + * 将字符串编码成16进制数字,适用于所有字符(包括中文) + */ + public static String toHexString(String str) + { +//根据默认编码获取字节数组 + byte[] bytes = null; + try { + bytes = str.getBytes("UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + if (bytes == null) return null; + StringBuilder sb=new StringBuilder(bytes.length*2); +//将字节数组中每个字节拆解成2位16进制整数 + for(int i=0;i>4)); + sb.append(hexString.charAt((bytes[i]&0x0f)>>0)); + } + return sb.toString(); + } + + //转换十六进制编码为字符串 + public static String hexToString(String s) + { + if("0x".equals(s.substring(0, 2))) + { + s =s.substring(2); + } + byte[] baKeyword = new byte[s.length()/2]; + for(int i = 0; i < baKeyword.length; i++) + { + try + { + baKeyword[i] = (byte)(0xff & Integer.parseInt(s.substring(i*2, i*2+2),16)); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + + try + { + s = new String(baKeyword, "utf-8");//UTF-16le:Not + } + catch (Exception e1) + { + e1.printStackTrace(); + } + return s; + } + + public static byte[] bmpToByteArray(final Bitmap bmp, final boolean needRecycle) { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + bmp.compress(CompressFormat.PNG, 100, output); + if (needRecycle) { + bmp.recycle(); + } + + byte[] result = output.toByteArray(); + try { + output.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + return result; + } + + public static byte[] getHtmlByteArray(final String url) { + URL htmlUrl = null; + InputStream inStream = null; + try { + htmlUrl = new URL(url); + URLConnection connection = htmlUrl.openConnection(); + HttpURLConnection httpConnection = (HttpURLConnection)connection; + int responseCode = httpConnection.getResponseCode(); + if(responseCode == HttpURLConnection.HTTP_OK){ + inStream = httpConnection.getInputStream(); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + byte[] data = inputStreamToByte(inStream); + + return data; + } + + public static byte[] inputStreamToByte(InputStream is) { + try{ + ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); + int ch; + while ((ch = is.read()) != -1) { + bytestream.write(ch); + } + byte imgdata[] = bytestream.toByteArray(); + bytestream.close(); + return imgdata; + }catch(Exception e){ + e.printStackTrace(); + } + + return null; + } + + public static byte[] readFromFile(String fileName, int offset, int len) { + if (fileName == null) { + return null; + } + + File file = new File(fileName); + if (!file.exists()) { + Log.i(TAG, "readFromFile: file not found"); + return null; + } + + if (len == -1) { + len = (int) file.length(); + } + + Log.d(TAG, "readFromFile : offset = " + offset + " len = " + len + " offset + len = " + (offset + len)); + + if(offset <0){ + Log.e(TAG, "readFromFile invalid offset:" + offset); + return null; + } + if(len <=0 ){ + Log.e(TAG, "readFromFile invalid len:" + len); + return null; + } + if(offset + len > (int) file.length()){ + Log.e(TAG, "readFromFile invalid file len:" + file.length()); + return null; + } + + byte[] b = null; + try { + RandomAccessFile in = new RandomAccessFile(fileName, "r"); + b = new byte[len]; + in.seek(offset); + in.readFully(b); + in.close(); + + } catch (Exception e) { + Log.e(TAG, "readFromFile : errMsg = " + e.getMessage()); + e.printStackTrace(); + } + return b; + } + + public static int computeSampleSize(BitmapFactory.Options options, + + int minSideLength, int maxNumOfPixels) { + + int initialSize = computeInitialSampleSize(options, minSideLength, + + maxNumOfPixels); + + int roundedSize; + + if (initialSize <= 8) { + + roundedSize = 1; + + while (roundedSize < initialSize) { + + roundedSize <<= 1; + + } + + } else { + + roundedSize = (initialSize + 7) / 8 * 8; + + } + + return roundedSize; + } + + 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)); + + if (upperBound < lowerBound) { + + // return the larger one when there is no overlapping zone. + + return lowerBound; + + } + + if ((maxNumOfPixels == -1) && + + (minSideLength == -1)) { + + return 1; + + } else if (minSideLength == -1) { + + return lowerBound; + + } else { + + return upperBound; + + } + } + + /** + * 以最省内存的方式读取图片 + */ + public static Bitmap readBitmap(final String path){ + try{ + FileInputStream stream = new FileInputStream(new File(path+"test.jpg")); + BitmapFactory.Options opts = new BitmapFactory.Options(); + opts.inSampleSize = 8; + opts.inPurgeable=true; + opts.inInputShareable=true; + Bitmap bitmap = BitmapFactory.decodeStream(stream , null, opts); + return bitmap; + } catch (OutOfMemoryError e) { + return null; + } catch (Exception 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); + + BitmapFactory.Options options = new BitmapFactory.Options(); + + try { + options.inJustDecodeBounds = true; + Bitmap tmp = BitmapFactory.decodeFile(path, options); + if (tmp != null) { + 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; + Log.d(TAG, "extractThumbNail: extract beX = " + beX + ", beY = " + beY); + options.inSampleSize = (int) (crop ? (beY > beX ? beX : beY) : (beY < beX ? beX : beY)); + if (options.inSampleSize <= 1) { + options.inSampleSize = 1; + } + + // NOTE: out of memory error + while (options.outHeight * options.outWidth / options.inSampleSize > MAX_DECODE_PICTURE_SIZE) { + options.inSampleSize++; + } + + int newHeight = height; + int newWidth = width; + if (crop) { + if (beY > beX) { + newHeight = (int) (newWidth * 1.0 * options.outHeight / options.outWidth); + } else { + newWidth = (int) (newHeight * 1.0 * options.outWidth / options.outHeight); + } + } else { + if (beY < beX) { + newHeight = (int) (newWidth * 1.0 * options.outHeight / options.outWidth); + } else { + newWidth = (int) (newHeight * 1.0 * options.outWidth / options.outHeight); + } + } + + options.inJustDecodeBounds = false; + + Log.i(TAG, "bitmap required size=" + newWidth + "x" + newHeight + ", orig=" + options.outWidth + "x" + options.outHeight + ", sample=" + options.inSampleSize); + Bitmap bm = BitmapFactory.decodeFile(path, options); + if (bm == null) { + Log.e(TAG, "bitmap decode failed"); + return null; + } + + Log.i(TAG, "bitmap decoded size=" + bm.getWidth() + "x" + bm.getHeight()); + final Bitmap scale = Bitmap.createScaledBitmap(bm, newWidth, newHeight, true); + if (scale != null) { + bm.recycle(); + bm = scale; + } + + if (crop) { + final Bitmap cropped = Bitmap.createBitmap(bm, (bm.getWidth() - width) >> 1, (bm.getHeight() - height) >> 1, width, height); + if (cropped == null) { + return bm; + } + + bm.recycle(); + bm = cropped; + Log.i(TAG, "bitmap croped size=" + bm.getWidth() + "x" + bm.getHeight()); + } + return bm; + + } catch (final OutOfMemoryError e) { + Log.e(TAG, "decode bitmap failed: " + e.getMessage()); + options = null; + } + + return null; + } + + public static final void showResultDialog(Context context, String msg, + String title) { + if(msg == null) return; + String rmsg = msg.replace(",", "\n"); + Log.d("Util", rmsg); + new AlertDialog.Builder(context).setTitle(title).setMessage(rmsg) + .setNegativeButton("知道了", null).create().show(); + } + + public static final void showProgressDialog(Context context, String title, + String message) { + dismissDialog(); + if (TextUtils.isEmpty(title)) { + title = "请稍候"; + } + if (TextUtils.isEmpty(message)) { + message = "正在加载..."; + } + 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(); + dlg.setCanceledOnTouchOutside(false); + dlg.show(); + return dlg; + } + + public static final void dismissDialog() { + if (mProgressDialog != null) { + mProgressDialog.dismiss(); + mProgressDialog = null; + } + } + + /** + * 打印消息并且用Toast显示消息 + * + * @param activity + * @param message + * @param logLevel + * 填d, w, e分别代表debug, warn, error; 默认是debug + */ + public static final void toastMessage(final Activity activity, + final String message, String logLevel) { + if ("w".equals(logLevel)) { + Log.w("sdkDemo", message); + } else if ("e".equals(logLevel)) { + Log.e("sdkDemo", message); + } else { + Log.d("sdkDemo", message); + } + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + // TODO Auto-generated method stub + if (mToast != null) { + mToast.cancel(); + mToast = null; + } + mToast = Toast.makeText(activity, message, Toast.LENGTH_SHORT); + mToast.show(); + } + }); + } + + /** + * 打印消息并且用Toast显示消息 + * + * @param activity + * @param message + * @param logLevel + * 填d, w, e分别代表debug, warn, error; 默认是debug + */ + public static final void toastMessage(final Activity activity, + final String message) { + toastMessage(activity, message, null); + } + + /** + * 根据一个网络连接(String)获取bitmap图像 + * + * @param imageUri + * @return + * @throws MalformedURLException + */ + public static Bitmap getbitmap(String imageUri) { + Log.v(TAG, "getbitmap:" + imageUri); + // 显示网络上的图片 + Bitmap bitmap = null; + try { + URL myFileUrl = new URL(imageUri); + HttpURLConnection conn = (HttpURLConnection) myFileUrl + .openConnection(); + conn.setDoInput(true); + conn.connect(); + InputStream is = conn.getInputStream(); + bitmap = BitmapFactory.decodeStream(is); + is.close(); + + Log.v(TAG, "image download finished." + imageUri); + } catch (OutOfMemoryError e) { + e.printStackTrace(); + bitmap = null; + } catch (IOException e) { + e.printStackTrace(); + Log.v(TAG, "getbitmap bmp fail---"); + bitmap = null; + } + return bitmap; + } + + public static void release() { + mProgressDialog = null; + mToast = null; + } + + // ========= + // =通过URI获取本地图片的path + // =兼容android 5.0 + // ========== + + public static String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT"; + public static int Build_VERSION_KITKAT = 19; + public static String getPath(final Context context, final Uri uri) { + + final boolean isKitKat = Build.VERSION.SDK_INT >= 19; + + // DocumentProvider + if (isKitKat && isDocumentUri(context, uri)) { + // ExternalStorageProvider + if (isExternalStorageDocument(uri)) { + final String docId = getDocumentId(uri); + final String[] split = docId.split(":"); + final String type = split[0]; + + if ("primary".equalsIgnoreCase(type)) { + return Environment.getExternalStorageDirectory() + "/" + split[1]; + } + + } + // DownloadsProvider + else if (isDownloadsDocument(uri)) { + + final String id = getDocumentId(uri); + final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), + Long.valueOf(id)); + + return getDataColumn(context, contentUri, null, null); + } + // MediaProvider + else if (isMediaDocument(uri)) { + final String docId = getDocumentId(uri); + final String[] split = docId.split(":"); + final String type = split[0]; + + Uri contentUri = null; + if ("image".equals(type)) { + contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; + } else if ("video".equals(type)) { + contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; + } else if ("audio".equals(type)) { + contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; + } + + final String selection = "_id=?"; + final String[] selectionArgs = new String[] { split[1] }; + + return getDataColumn(context, contentUri, selection, selectionArgs); + } + } + // MediaStore (and general) + else if ("content".equalsIgnoreCase(uri.getScheme())) { + + // Return the remote address + if (isGooglePhotosUri(uri)) + return uri.getLastPathSegment(); + + return getDataColumn(context, uri, null, null); + } + // File + else if ("file".equalsIgnoreCase(uri.getScheme())) { + return uri.getPath(); + } + + return null; + } + + private static final String PATH_DOCUMENT = "document"; + + /** + * Test if the given URI represents a {@link Document} backed by a + * {@link DocumentsProvider}. + */ + private static boolean isDocumentUri(Context context, Uri uri) { + final List paths = uri.getPathSegments(); + if (paths.size() < 2) { + return false; + } + if (!PATH_DOCUMENT.equals(paths.get(0))) { + return false; + } + + return true; + } + + private static String getDocumentId(Uri documentUri) { + final List paths = documentUri.getPathSegments(); + if (paths.size() < 2) { + throw new IllegalArgumentException("Not a document: " + documentUri); + } + if (!PATH_DOCUMENT.equals(paths.get(0))) { + throw new IllegalArgumentException("Not a document: " + documentUri); + } + return paths.get(1); + } + + /** + * Get the value of the data column for this Uri. This is useful for + * MediaStore Uris, and other file-based ContentProviders. + * + * @param context + * The context. + * @param uri + * The Uri to query. + * @param selection + * (Optional) Filter used in the query. + * @param selectionArgs + * (Optional) Selection arguments used in the query. + * [url=home.php?mod=space&uid=7300]@return[/url] The value of + * the _data column, which is typically a file path. + */ + public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { + + Cursor cursor = null; + final String column = "_data"; + final String[] projection = { column }; + + try { + cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); + if (cursor != null && cursor.moveToFirst()) { + final int index = cursor.getColumnIndexOrThrow(column); + return cursor.getString(index); + } + } finally { + if (cursor != null) + cursor.close(); + } + return null; + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is ExternalStorageProvider. + */ + public static boolean isExternalStorageDocument(Uri uri) { + return "com.android.externalstorage.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is DownloadsProvider. + */ + public static boolean isDownloadsDocument(Uri uri) { + return "com.android.providers.downloads.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is MediaProvider. + */ + public static boolean isMediaDocument(Uri uri) { + return "com.android.providers.media.documents".equals(uri.getAuthority()); + } + + /** + * @param uri + * The Uri to check. + * @return Whether the Uri authority is Google Photos. + */ + public static boolean isGooglePhotosUri(Uri uri) { + return "com.google.android.apps.photos.content".equals(uri.getAuthority()); + } +} diff --git a/代码/在这里3.0/bin/dexedLibs/BmobSDK_V3.3.4_0310-959d491faede09877edd4bca7e87b2f3.jar b/代码/在这里3.0/bin/dexedLibs/BmobSDK_V3.3.4_0310-959d491faede09877edd4bca7e87b2f3.jar index 0318bb4..9df0fc2 100644 Binary files a/代码/在这里3.0/bin/dexedLibs/BmobSDK_V3.3.4_0310-959d491faede09877edd4bca7e87b2f3.jar and b/代码/在这里3.0/bin/dexedLibs/BmobSDK_V3.3.4_0310-959d491faede09877edd4bca7e87b2f3.jar differ diff --git a/代码/在这里3.0/bin/dexedLibs/android-support-v4-8aa32c063ffa95f41612c8459081d1bc.jar b/代码/在这里3.0/bin/dexedLibs/android-support-v4-8aa32c063ffa95f41612c8459081d1bc.jar index 420ac4e..832bf5c 100644 Binary files a/代码/在这里3.0/bin/dexedLibs/android-support-v4-8aa32c063ffa95f41612c8459081d1bc.jar and b/代码/在这里3.0/bin/dexedLibs/android-support-v4-8aa32c063ffa95f41612c8459081d1bc.jar differ diff --git a/代码/在这里3.0/bin/dexedLibs/bmobPush_0.1beta-58692f8f0e90f48a557b18c38e886d35.jar b/代码/在这里3.0/bin/dexedLibs/bmobPush_0.1beta-58692f8f0e90f48a557b18c38e886d35.jar index d08da4a..399f231 100644 Binary files a/代码/在这里3.0/bin/dexedLibs/bmobPush_0.1beta-58692f8f0e90f48a557b18c38e886d35.jar and b/代码/在这里3.0/bin/dexedLibs/bmobPush_0.1beta-58692f8f0e90f48a557b18c38e886d35.jar differ diff --git a/代码/在这里3.0/bin/dexedLibs/mta-sdk-1.6.2-f81962e36934419d90510c8fe39a2ebc.jar b/代码/在这里3.0/bin/dexedLibs/mta-sdk-1.6.2-f81962e36934419d90510c8fe39a2ebc.jar new file mode 100644 index 0000000..99e4863 Binary files /dev/null and b/代码/在这里3.0/bin/dexedLibs/mta-sdk-1.6.2-f81962e36934419d90510c8fe39a2ebc.jar differ diff --git a/代码/在这里3.0/bin/dexedLibs/open_sdk_r5756-66959d2f52ef990d4727d4580369efa1.jar b/代码/在这里3.0/bin/dexedLibs/open_sdk_r5756-66959d2f52ef990d4727d4580369efa1.jar index 254199d..0514f7f 100644 Binary files a/代码/在这里3.0/bin/dexedLibs/open_sdk_r5756-66959d2f52ef990d4727d4580369efa1.jar and b/代码/在这里3.0/bin/dexedLibs/open_sdk_r5756-66959d2f52ef990d4727d4580369efa1.jar differ diff --git a/代码/在这里3.0/bin/res/crunch/drawable/ic_search.png b/代码/在这里3.0/bin/res/crunch/drawable/ic_search.png index 8ff6204..2294af5 100644 Binary files a/代码/在这里3.0/bin/res/crunch/drawable/ic_search.png and b/代码/在这里3.0/bin/res/crunch/drawable/ic_search.png differ diff --git a/代码/在这里3.0/bin/resources.ap_ b/代码/在这里3.0/bin/resources.ap_ index e4a84dd..7c00116 100644 Binary files a/代码/在这里3.0/bin/resources.ap_ and b/代码/在这里3.0/bin/resources.ap_ differ diff --git a/代码/在这里3.0/gen/com/stone/shop/R.java b/代码/在这里3.0/gen/com/stone/shop/R.java index f0c63af..1173b78 100644 --- a/代码/在这里3.0/gen/com/stone/shop/R.java +++ b/代码/在这里3.0/gen/com/stone/shop/R.java @@ -150,146 +150,147 @@ public final class R { public static final int selector_load_more=0x7f02006e; public static final int selector_logout=0x7f02006f; public static final int sgbf=0x7f020070; - public static final int shap_divider=0x7f020071; - public static final int shape_color_frame=0x7f020072; - public static final int shape_grid_item=0x7f020073; - public static final int shape_left_radius_color_square=0x7f020074; - public static final int shape_radius=0x7f020075; - public static final int shape_radius_color_square=0x7f020076; - public static final int shape_radius_square=0x7f020077; - public static final int splash=0x7f020078; - public static final int tab_bg_selector=0x7f020079; - public static final int user_icon_default=0x7f02007a; - public static final int user_icon_default_main=0x7f02007b; - public static final int w01=0x7f02007c; - public static final int w02=0x7f02007d; - public static final int w03=0x7f02007e; - public static final int w04=0x7f02007f; - public static final int w05=0x7f020080; - public static final int welcome_background=0x7f020081; + public static final int shap_circle=0x7f020071; + public static final int shap_divider=0x7f020072; + public static final int shape_color_frame=0x7f020073; + public static final int shape_grid_item=0x7f020074; + public static final int shape_left_radius_color_square=0x7f020075; + public static final int shape_radius=0x7f020076; + public static final int shape_radius_color_square=0x7f020077; + public static final int shape_radius_square=0x7f020078; + public static final int splash=0x7f020079; + public static final int tab_bg_selector=0x7f02007a; + public static final int user_icon_default=0x7f02007b; + public static final int user_icon_default_main=0x7f02007c; + public static final int w01=0x7f02007d; + public static final int w02=0x7f02007e; + public static final int w03=0x7f02007f; + public static final int w04=0x7f020080; + public static final int w05=0x7f020081; + public static final int welcome_background=0x7f020082; } public static final class id { - public static final int action_settings=0x7f0a00c6; + public static final int action_settings=0x7f0a00c9; public static final int actionbar_comment=0x7f0a000f; public static final int area_commit=0x7f0a0014; - public static final int bt_scrollLeft=0x7f0a00a4; - public static final int bt_scrollRight=0x7f0a00a5; - public static final int btn_about=0x7f0a0056; - public static final int btn_add=0x7f0a009b; - public static final int btn_add_good=0x7f0a007d; - public static final int btn_add_news=0x7f0a007e; - public static final int btn_add_shop=0x7f0a007c; - public static final int btn_buy_good=0x7f0a0098; - public static final int btn_commit=0x7f0a00c5; - public static final int btn_contact=0x7f0a0057; - public static final int btn_dlg_ok=0x7f0a0094; + public static final int bt_scrollLeft=0x7f0a00a7; + public static final int bt_scrollRight=0x7f0a00a8; + public static final int btn_about=0x7f0a0057; + public static final int btn_add=0x7f0a009e; + public static final int btn_add_good=0x7f0a0080; + public static final int btn_add_news=0x7f0a0081; + public static final int btn_add_shop=0x7f0a007f; + public static final int btn_buy_good=0x7f0a009b; + public static final int btn_commit=0x7f0a00c8; + public static final int btn_contact=0x7f0a0058; + public static final int btn_dlg_ok=0x7f0a0097; public static final int btn_feedback_submit=0x7f0a001b; public static final int btn_hide_ads=0x7f0a0022; - public static final int btn_login=0x7f0a003c; - public static final int btn_look_goods=0x7f0a007a; - public static final int btn_look_news=0x7f0a007b; - public static final int btn_look_shops=0x7f0a0079; - public static final int btn_look_users=0x7f0a0078; - public static final int btn_order_count_less=0x7f0a005f; - public static final int btn_order_count_more=0x7f0a0061; - public static final int btn_order_submit=0x7f0a0066; + public static final int btn_login=0x7f0a0036; + public static final int btn_look_goods=0x7f0a007d; + public static final int btn_look_news=0x7f0a007e; + public static final int btn_look_shops=0x7f0a007c; + public static final int btn_look_users=0x7f0a007b; + public static final int btn_order_count_less=0x7f0a0060; + public static final int btn_order_count_more=0x7f0a0062; + public static final int btn_order_submit=0x7f0a0067; public static final int btn_publish=0x7f0a0017; - public static final int btn_qq=0x7f0a0035; - public static final int btn_reg_now=0x7f0a006d; - public static final int btn_register=0x7f0a0033; - public static final int btn_set_time=0x7f0a0063; - public static final int btn_share=0x7f0a0058; - public static final int cancel=0x7f0a00c8; - public static final int cb_rem_psd=0x7f0a0034; + public static final int btn_qq=0x7f0a003a; + public static final int btn_reg_now=0x7f0a0070; + public static final int btn_register=0x7f0a0039; + public static final int btn_set_time=0x7f0a0064; + public static final int btn_share=0x7f0a0059; + public static final int cancel=0x7f0a00cb; + public static final int cb_rem_psd=0x7f0a0038; public static final int comment_commit=0x7f0a0016; public static final int comment_content=0x7f0a0015; public static final int comment_item=0x7f0a0011; public static final int comment_list=0x7f0a0012; public static final int commit_scroll=0x7f0a0010; - public static final int content_comment=0x7f0a008d; - public static final int content_image=0x7f0a0085; - public static final int content_text=0x7f0a0084; - public static final int datepicker=0x7f0a0092; + public static final int content_comment=0x7f0a0090; + public static final int content_image=0x7f0a0088; + public static final int content_text=0x7f0a0087; + public static final int datepicker=0x7f0a0095; public static final int edit_content=0x7f0a0019; public static final int edit_title=0x7f0a0018; - public static final int et_comfirm_psd=0x7f0a0069; - public static final int et_commit=0x7f0a00c4; + public static final int et_comfirm_psd=0x7f0a006b; + public static final int et_commit=0x7f0a00c7; public static final int et_feedback_content=0x7f0a001a; - public static final int et_mineinfo_cademy=0x7f0a0049; - public static final int et_mineinfo_dornum=0x7f0a004b; - public static final int et_mineinfo_dorpart=0x7f0a004a; - public static final int et_mineinfo_phone=0x7f0a004c; - public static final int et_mineinfo_qq=0x7f0a004d; - public static final int et_mineinfo_school=0x7f0a0048; - public static final int et_mineinfo_username=0x7f0a0047; - public static final int et_order_phone=0x7f0a0064; - public static final int et_order_words=0x7f0a0065; - public static final int et_password=0x7f0a003b; - public static final int et_phone=0x7f0a006b; - public static final int et_username=0x7f0a003a; + public static final int et_mineinfo_cademy=0x7f0a004b; + public static final int et_mineinfo_dornum=0x7f0a004d; + public static final int et_mineinfo_dorpart=0x7f0a004c; + public static final int et_mineinfo_phone=0x7f0a004e; + public static final int et_mineinfo_qq=0x7f0a004f; + public static final int et_mineinfo_school=0x7f0a004a; + public static final int et_mineinfo_username=0x7f0a0049; + public static final int et_order_phone=0x7f0a0065; + public static final int et_order_words=0x7f0a0066; + public static final int et_password=0x7f0a0034; + public static final int et_phone=0x7f0a006e; + public static final int et_username=0x7f0a0031; public static final int fl_image_ads=0x7f0a0020; public static final int gv_classroom=0x7f0a000e; - public static final int gv_food_class=0x7f0a0070; - public static final int gv_gift_class=0x7f0a006f; + public static final int gv_food_class=0x7f0a0073; + public static final int gv_gift_class=0x7f0a0072; public static final int gv_library=0x7f0a002e; - public static final int gv_out_class=0x7f0a0071; - public static final int gv_school_class=0x7f0a006e; - public static final int header_shop_all=0x7f0a0072; - public static final int imageview=0x7f0a00b8; - public static final int img_call=0x7f0a00bf; - public static final int img_chooseImage=0x7f0a00b7; + public static final int gv_out_class=0x7f0a0074; + public static final int gv_school_class=0x7f0a0071; + public static final int header_shop_all=0x7f0a0075; + public static final int imageview=0x7f0a00bb; + public static final int img_call=0x7f0a00c2; + public static final int img_chooseImage=0x7f0a00ba; public static final int img_date=0x7f0a001d; - public static final int img_item=0x7f0a00a6; - public static final int img_search=0x7f0a009f; - public static final int img_shop=0x7f0a00b0; + public static final int img_item=0x7f0a00a9; + public static final int img_search=0x7f0a00a2; + public static final int img_shop=0x7f0a00b3; public static final int img_welcome=0x7f0a0001; - public static final int index_comment=0x7f0a008c; - public static final int item_action_comment=0x7f0a0086; - public static final int item_action_hate=0x7f0a0088; - public static final int item_action_love=0x7f0a0089; - public static final int item_action_share=0x7f0a0087; + public static final int index_comment=0x7f0a008f; + public static final int item_action_comment=0x7f0a0089; + public static final int item_action_hate=0x7f0a008b; + public static final int item_action_love=0x7f0a008c; + public static final int item_action_share=0x7f0a008a; public static final int listScrollView=0x7f0a001c; - public static final int ll_commit_parent_view=0x7f0a00c3; - public static final int ll_commit_son_view=0x7f0a008f; + public static final int ll_commit_parent_view=0x7f0a00c6; + public static final int ll_commit_son_view=0x7f0a0092; public static final int ll_row1=0x7f0a002f; - public static final int ll_row2=0x7f0a0030; - public static final int ll_row3=0x7f0a0031; - public static final int ll_row4=0x7f0a006a; - public static final int ll_row6=0x7f0a006c; + public static final int ll_row2=0x7f0a0032; + public static final int ll_row3=0x7f0a0035; + public static final int ll_row4=0x7f0a006c; + public static final int ll_row6=0x7f0a006f; public static final int loadmore=0x7f0a0013; public static final int lv_bxt_news=0x7f0a0003; - public static final int lv_goods_list=0x7f0a00ba; + public static final int lv_goods_list=0x7f0a00bd; public static final int lv_information=0x7f0a002d; - public static final int lv_mine_about=0x7f0a003f; - public static final int lv_mine_order=0x7f0a003e; - public static final int lv_mine_soft=0x7f0a0076; - public static final int lv_mine_user=0x7f0a003d; + public static final int lv_mine_about=0x7f0a0041; + public static final int lv_mine_order=0x7f0a0040; + public static final int lv_mine_soft=0x7f0a0079; + public static final int lv_mine_user=0x7f0a003f; public static final int lv_news=0x7f0a0023; - public static final int lv_order_info=0x7f0a0067; - public static final int lv_shop_all=0x7f0a0073; - public static final int modify=0x7f0a00c7; - public static final int mymultiViewGroup=0x7f0a00a9; - public static final int new_login_btn=0x7f0a0036; - public static final int pagertab=0x7f0a0075; + public static final int lv_order_info=0x7f0a0068; + public static final int lv_shop_all=0x7f0a0076; + public static final int modify=0x7f0a00ca; + public static final int mymultiViewGroup=0x7f0a00ac; + public static final int new_login_btn=0x7f0a003b; + public static final int pagertab=0x7f0a0078; public static final int pull_refresh_list=0x7f0a0002; - public static final int ratingBar1=0x7f0a00bc; - public static final int rb_rate=0x7f0a00b6; - public static final int relaGrid=0x7f0a0099; - public static final int rl_last=0x7f0a0032; - public static final int rl_splash=0x7f0a0077; + public static final int ratingBar1=0x7f0a00bf; + public static final int rb_rate=0x7f0a00b9; + public static final int relaGrid=0x7f0a009c; + public static final int rl_last=0x7f0a0037; + public static final int rl_splash=0x7f0a007a; public static final int rl_welcome=0x7f0a0000; - public static final int sp_bxt_header=0x7f0a009c; - public static final int textView1=0x7f0a00a0; - public static final int textview=0x7f0a00b9; - public static final int time_comment=0x7f0a008e; - public static final int time_text=0x7f0a0082; - public static final int timepicker=0x7f0a0093; - public static final int title_text=0x7f0a0083; - public static final int tp_dlg_time=0x7f0a0095; - public static final int tv_bowl=0x7f0a0050; + public static final int sp_bxt_header=0x7f0a009f; + public static final int textView1=0x7f0a00a3; + public static final int textview=0x7f0a00bc; + public static final int time_comment=0x7f0a0091; + public static final int time_text=0x7f0a0085; + public static final int timepicker=0x7f0a0096; + public static final int title_text=0x7f0a0086; + public static final int tp_dlg_time=0x7f0a0098; + public static final int tv_bowl=0x7f0a0051; public static final int tv_bxt_news_holder1=0x7f0a0009; public static final int tv_bxt_news_holder2=0x7f0a000a; - public static final int tv_bxt_news_item_title=0x7f0a008a; + public static final int tv_bxt_news_item_title=0x7f0a008d; public static final int tv_bxt_news_loc=0x7f0a0008; public static final int tv_bxt_news_point=0x7f0a000b; public static final int tv_bxt_news_speaker=0x7f0a0006; @@ -297,18 +298,19 @@ public final class R { public static final int tv_bxt_news_time=0x7f0a0007; public static final int tv_bxt_news_title=0x7f0a0004; public static final int tv_bxt_news_topic=0x7f0a0005; - public static final int tv_cademy=0x7f0a0053; - public static final int tv_chooseText=0x7f0a009a; - public static final int tv_commit_content=0x7f0a0091; - public static final int tv_commit_title=0x7f0a00c2; - public static final int tv_commit_user=0x7f0a0090; + public static final int tv_cademy=0x7f0a0054; + public static final int tv_chooseText=0x7f0a009d; + public static final int tv_comfirm_psd=0x7f0a006a; + public static final int tv_commit_content=0x7f0a0094; + public static final int tv_commit_title=0x7f0a00c5; + public static final int tv_commit_user=0x7f0a0093; public static final int tv_day=0x7f0a001f; - public static final int tv_dorNum=0x7f0a0055; - public static final int tv_dorPart=0x7f0a0054; - public static final int tv_edit=0x7f0a009e; - public static final int tv_good_name=0x7f0a0096; - public static final int tv_good_price=0x7f0a0097; - public static final int tv_hello_world=0x7f0a00a2; + public static final int tv_dorNum=0x7f0a0056; + public static final int tv_dorPart=0x7f0a0055; + public static final int tv_edit=0x7f0a00a1; + public static final int tv_good_name=0x7f0a0099; + public static final int tv_good_price=0x7f0a009a; + public static final int tv_hello_world=0x7f0a00a5; public static final int tv_info_item_content=0x7f0a002c; public static final int tv_info_item_holder=0x7f0a0029; public static final int tv_info_item_holder2=0x7f0a002a; @@ -318,57 +320,59 @@ public final class R { public static final int tv_info_item_time=0x7f0a0027; public static final int tv_info_item_title=0x7f0a0024; public static final int tv_info_item_topic=0x7f0a0025; - public static final int tv_info_title=0x7f0a009d; - public static final int tv_item_content=0x7f0a00a8; - public static final int tv_item_name=0x7f0a00a7; - public static final int tv_me=0x7f0a004f; - public static final int tv_mineinfo_cademy=0x7f0a0042; - public static final int tv_mineinfo_dornum=0x7f0a0044; - public static final int tv_mineinfo_dorpart=0x7f0a0043; - public static final int tv_mineinfo_phone=0x7f0a0045; - public static final int tv_mineinfo_qq=0x7f0a0046; - public static final int tv_mineinfo_school=0x7f0a0041; - public static final int tv_mineinfo_username=0x7f0a0040; - public static final int tv_news_author=0x7f0a005a; - public static final int tv_news_content=0x7f0a005c; - public static final int tv_news_date=0x7f0a00ab; - public static final int tv_news_time=0x7f0a005b; - public static final int tv_news_title=0x7f0a0059; - public static final int tv_news_type=0x7f0a00aa; - public static final int tv_order_count=0x7f0a0060; - public static final int tv_order_good=0x7f0a005e; - public static final int tv_order_info_good_name=0x7f0a00ac; - public static final int tv_order_info_price=0x7f0a00ae; - public static final int tv_order_info_shop_name=0x7f0a00ad; - public static final int tv_order_info_state=0x7f0a00af; - public static final int tv_order_shop=0x7f0a005d; - public static final int tv_order_time=0x7f0a0062; - public static final int tv_reg_title=0x7f0a0068; - public static final int tv_res=0x7f0a0080; - public static final int tv_room=0x7f0a00a1; - public static final int tv_school=0x7f0a0052; - public static final int tv_scroll=0x7f0a00a3; - public static final int tv_shop_discount=0x7f0a00b3; - public static final int tv_shop_introduce=0x7f0a00c0; - public static final int tv_shop_loc=0x7f0a00b5; - public static final int tv_shop_location=0x7f0a00bd; - public static final int tv_shop_name=0x7f0a00b1; - public static final int tv_shop_paper=0x7f0a00b2; - public static final int tv_shop_phone=0x7f0a00be; - public static final int tv_shop_promotion=0x7f0a00c1; - public static final int tv_shop_title=0x7f0a00bb; - public static final int tv_shop_type=0x7f0a00b4; - public static final int tv_title=0x7f0a007f; - public static final int tv_username=0x7f0a004e; + public static final int tv_info_title=0x7f0a00a0; + public static final int tv_item_content=0x7f0a00ab; + public static final int tv_item_name=0x7f0a00aa; + public static final int tv_me=0x7f0a0050; + public static final int tv_mineinfo_cademy=0x7f0a0044; + public static final int tv_mineinfo_dornum=0x7f0a0046; + public static final int tv_mineinfo_dorpart=0x7f0a0045; + public static final int tv_mineinfo_phone=0x7f0a0047; + public static final int tv_mineinfo_qq=0x7f0a0048; + public static final int tv_mineinfo_school=0x7f0a0043; + public static final int tv_mineinfo_username=0x7f0a0042; + public static final int tv_news_author=0x7f0a005b; + public static final int tv_news_content=0x7f0a005d; + public static final int tv_news_date=0x7f0a00ae; + public static final int tv_news_time=0x7f0a005c; + public static final int tv_news_title=0x7f0a005a; + public static final int tv_news_type=0x7f0a00ad; + public static final int tv_order_count=0x7f0a0061; + public static final int tv_order_good=0x7f0a005f; + public static final int tv_order_info_good_name=0x7f0a00af; + public static final int tv_order_info_price=0x7f0a00b1; + public static final int tv_order_info_shop_name=0x7f0a00b0; + public static final int tv_order_info_state=0x7f0a00b2; + public static final int tv_order_shop=0x7f0a005e; + public static final int tv_order_time=0x7f0a0063; + public static final int tv_password=0x7f0a0033; + public static final int tv_phone=0x7f0a006d; + public static final int tv_reg_title=0x7f0a0069; + public static final int tv_res=0x7f0a0083; + public static final int tv_room=0x7f0a00a4; + public static final int tv_school=0x7f0a0053; + public static final int tv_scroll=0x7f0a00a6; + public static final int tv_shop_discount=0x7f0a00b6; + public static final int tv_shop_introduce=0x7f0a00c3; + public static final int tv_shop_loc=0x7f0a00b8; + public static final int tv_shop_location=0x7f0a00c0; + public static final int tv_shop_name=0x7f0a00b4; + public static final int tv_shop_paper=0x7f0a00b5; + public static final int tv_shop_phone=0x7f0a00c1; + public static final int tv_shop_promotion=0x7f0a00c4; + public static final int tv_shop_title=0x7f0a00be; + public static final int tv_shop_type=0x7f0a00b7; + public static final int tv_title=0x7f0a0082; + public static final int tv_username=0x7f0a0030; public static final int tv_week=0x7f0a001e; - public static final int tv_xiaocai=0x7f0a0051; - public static final int userName_comment=0x7f0a008b; - public static final int user_callback=0x7f0a0039; - public static final int user_logo=0x7f0a0038; - public static final int user_name=0x7f0a0081; - public static final int user_nickname=0x7f0a0037; + public static final int tv_xiaocai=0x7f0a0052; + public static final int userName_comment=0x7f0a008e; + public static final int user_callback=0x7f0a003e; + public static final int user_logo=0x7f0a003d; + public static final int user_name=0x7f0a0084; + public static final int user_nickname=0x7f0a003c; public static final int view_pager=0x7f0a0021; - public static final int viewpager=0x7f0a0074; + public static final int viewpager=0x7f0a0077; public static final int wv_wsq=0x7f0a000d; } public static final class layout { diff --git a/代码/在这里3.0/res/layout/header_mine_info.xml~remotes_origin_zhaozaichun b/代码/在这里3.0/res/layout/header_mine_info.xml~remotes_origin_zhaozaichun deleted file mode 100644 index 49c899d..0000000 --- a/代码/在这里3.0/res/layout/header_mine_info.xml~remotes_origin_zhaozaichun +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/代码/在这里3.0/res/layout/header_mine_info_edit.xml~remotes_origin_zhaozaichun b/代码/在这里3.0/res/layout/header_mine_info_edit.xml~remotes_origin_zhaozaichun deleted file mode 100644 index 6193ea2..0000000 --- a/代码/在这里3.0/res/layout/header_mine_info_edit.xml~remotes_origin_zhaozaichun +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/代码/在这里3.0/res/layout/header_news.xml~remotes_origin_zhaozaichun b/代码/在这里3.0/res/layout/header_news.xml~remotes_origin_zhaozaichun deleted file mode 100644 index 85d3643..0000000 --- a/代码/在这里3.0/res/layout/header_news.xml~remotes_origin_zhaozaichun +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/代码/在这里3.0/res/layout/header_order.xml~remotes_origin_zhaozaichun b/代码/在这里3.0/res/layout/header_order.xml~remotes_origin_zhaozaichun deleted file mode 100644 index 5160ab5..0000000 --- a/代码/在这里3.0/res/layout/header_order.xml~remotes_origin_zhaozaichun +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/代码/在这里3.0/res/layout/header_order_info.xml~remotes_origin_zhaozaichun b/代码/在这里3.0/res/layout/header_order_info.xml~remotes_origin_zhaozaichun deleted file mode 100644 index df60d23..0000000 --- a/代码/在这里3.0/res/layout/header_order_info.xml~remotes_origin_zhaozaichun +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/代码/在这里3.0/res/layout/header_shop_all.xml~remotes_origin_zhaozaichun b/代码/在这里3.0/res/layout/header_shop_all.xml~remotes_origin_zhaozaichun deleted file mode 100644 index 53476e5..0000000 --- a/代码/在这里3.0/res/layout/header_shop_all.xml~remotes_origin_zhaozaichun +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/代码/在这里3.0/res/layout/header_soft.xml~remotes_origin_zhaozaichun b/代码/在这里3.0/res/layout/header_soft.xml~remotes_origin_zhaozaichun deleted file mode 100644 index 3fe4545..0000000 --- a/代码/在这里3.0/res/layout/header_soft.xml~remotes_origin_zhaozaichun +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/代码/在这里3.0/res/layout/layout_reservation.xml~remotes_origin_zhaozaichun b/代码/在这里3.0/res/layout/layout_reservation.xml~remotes_origin_zhaozaichun deleted file mode 100644 index 730ea67..0000000 --- a/代码/在这里3.0/res/layout/layout_reservation.xml~remotes_origin_zhaozaichun +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - -