From 34d0e345463ea758fa41b34ac421e49da437cf93 Mon Sep 17 00:00:00 2001 From: zhangnaifu15 <1361423499@qq.com> Date: Wed, 11 Apr 2018 23:43:41 +0800 Subject: [PATCH] src\MyApplication\app\src\main\java\com\example\administrator\myapplication\ui\ChangeBgFragment.java src\MyApplication\app\src\main\java\com\example\administrator\myapplication\ui\RegisterActivity.java src\MyApplication\app\src\main\java\com\example\administrator\myapplication\ui\UserInfoActivity.java src\MyApplication\app\src\main\java\com\example\administrator\myapplication\utils\PhotoUtil.javasrc\MyApplication\app\src\main\java\com\example\administrator\myapplication\utils\SystemUtils.java --- .../myapplication/ui/ChangeBgFragment.java | 1 - .../myapplication/ui/RegisterActivity.java | 6 +- .../myapplication/ui/UserInfoActivity.java | 12 ---- .../myapplication/utils/PhotoUtil.java | 71 ++++--------------- .../myapplication/utils/SystemUtils.java | 7 +- .../sdkdemo/autoupdate/ActAutoUpdate.java | 1 - .../cn/bmob/sdkdemo/push/ActBmobPush.java | 1 + 7 files changed, 17 insertions(+), 82 deletions(-) diff --git a/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/ChangeBgFragment.java b/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/ChangeBgFragment.java index 97b54ce..69c5d8f 100644 --- a/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/ChangeBgFragment.java +++ b/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/ChangeBgFragment.java @@ -73,7 +73,6 @@ public class ChangeBgFragment extends Fragment { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { - // TODO Auto-generated method stub String path = ((BgPicEntity) mBgPicAdapter.getItem(position)).path; systemUtils = new SystemUtils(getActivity()); diff --git a/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/RegisterActivity.java b/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/RegisterActivity.java index 2d69df2..a14adce 100644 --- a/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/RegisterActivity.java +++ b/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/RegisterActivity.java @@ -20,9 +20,7 @@ import butterknife.ButterKnife; import butterknife.OnClick; import cn.bmob.v3.listener.SaveListener; -/** - * Created by htq on 2016/9/4. - */ + public class RegisterActivity extends AppCompatActivity { @BindView(R.id.et_username) @@ -96,7 +94,6 @@ public class RegisterActivity extends AppCompatActivity { @Override public void onSuccess() { - // TODO Auto-generated method stub progress.dismiss(); Snackbar.make(registerBtn,"注册成功", Snackbar.LENGTH_LONG).show(); // 将设备与username进行绑定 @@ -110,7 +107,6 @@ public class RegisterActivity extends AppCompatActivity { } @Override public void onFailure(int arg0, String arg1) { - // TODO Auto-generated method stub Snackbar.make(registerBtn,"注册失败:", Snackbar.LENGTH_LONG).show(); progress.dismiss(); } diff --git a/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/UserInfoActivity.java b/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/UserInfoActivity.java index acd117d..1dd6dba 100644 --- a/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/UserInfoActivity.java +++ b/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/ui/UserInfoActivity.java @@ -49,9 +49,6 @@ import cn.bmob.v3.datatype.BmobFile; import cn.bmob.v3.listener.UpdateListener; import cn.bmob.v3.listener.UploadFileListener; -/** - * Created by htq on 2016/9/4. - */ public class UserInfoActivity extends AppCompatActivity { @@ -218,7 +215,6 @@ public class UserInfoActivity extends AppCompatActivity { @Override public void onClick(View arg0) { - // TODO Auto-generated method stub layout_choose.setBackgroundColor(getResources().getColor( R.color.base_color_text_white)); layout_photo.setBackgroundDrawable(getResources().getDrawable( @@ -243,7 +239,6 @@ public class UserInfoActivity extends AppCompatActivity { @Override public void onClick(View arg0) { - // TODO Auto-generated method stub // ShowLog("点击相册"); layout_photo.setBackgroundColor(getResources().getColor( R.color.base_color_text_white)); @@ -315,7 +310,6 @@ public class UserInfoActivity extends AppCompatActivity { @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case BmobConstants.REQUESTCODE_UPLOADAVATAR_CAMERA:// 拍照修改头像 @@ -358,7 +352,6 @@ public class UserInfoActivity extends AppCompatActivity { break; case BmobConstants.REQUESTCODE_UPLOADAVATAR_CROP:// 裁剪头像返回 - // TODO sent to crop if (avatorPop != null) { avatorPop.dismiss(); } @@ -391,7 +384,6 @@ public class UserInfoActivity extends AppCompatActivity { @Override public void onSuccess() { - // TODO Auto-generated method stub String url = bmobFile.getFileUrl(UserInfoActivity.this); updateUserAvatar(url); AccountUtils.saveUserHeadUrl(UserInfoActivity.this,url); @@ -400,14 +392,12 @@ public class UserInfoActivity extends AppCompatActivity { @Override public void onProgress(Integer arg0) { - // TODO Auto-generated method stub } @Override public void onFailure(int arg0, String msg) { - // TODO Auto-generated method stub Snackbar.make(exitBtn,"头像上传失败:" + msg+ String.valueOf(arg0), Snackbar.LENGTH_LONG).show(); // ShowToast("头像上传失败:" + msg+String.valueOf(arg0)); } @@ -420,7 +410,6 @@ public class UserInfoActivity extends AppCompatActivity { updateUserData(u,new UpdateListener() { @Override public void onSuccess() { - // TODO Auto-generated method stub Snackbar.make(exitBtn,"头像更新成功!", Snackbar.LENGTH_SHORT).show(); //ShowToast(); // 更新头像 @@ -429,7 +418,6 @@ public class UserInfoActivity extends AppCompatActivity { @Override public void onFailure(int code, String msg) { - // TODO Auto-generated method stub Snackbar.make(exitBtn,"头像更新失败:" + msg+ String.valueOf(code), Snackbar.LENGTH_SHORT).show(); //ShowToast(); } diff --git a/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/utils/PhotoUtil.java b/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/utils/PhotoUtil.java index e332e27..c7fd63c 100644 --- a/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/utils/PhotoUtil.java +++ b/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/utils/PhotoUtil.java @@ -20,36 +20,23 @@ import java.io.IOException; public class PhotoUtil { - /** - * �������� recycle - * - * @throws - */ + public static void recycle(Bitmap bitmap) { - // ���ж��Ƿ��Ѿ����� if (bitmap != null && !bitmap.isRecycled()) { - // ���ղ�����Ϊnull bitmap.recycle(); bitmap = null; } System.gc(); } - /** - * ��ȡָ��·���µ�ͼƬ��ָ����С������ͼ getImageThumbnail - * - * @return Bitmap - * @throws - */ public static Bitmap getImageThumbnail(String imagePath, int width, int height) { Bitmap bitmap = null; BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; - // ��ȡ���ͼƬ�Ŀ�͸ߣ�ע��˴���bitmapΪnull + bitmap = BitmapFactory.decodeFile(imagePath, options); - options.inJustDecodeBounds = false; // ��Ϊ false - // �������ű� + options.inJustDecodeBounds = false; int h = options.outHeight; int w = options.outWidth; int beWidth = w / width; @@ -64,9 +51,7 @@ public class PhotoUtil { be = 1; } options.inSampleSize = be; - // ���¶���ͼƬ����ȡ���ź��bitmap��ע�����Ҫ��options.inJustDecodeBounds ��Ϊ false bitmap = BitmapFactory.decodeFile(imagePath, options); - // ����ThumbnailUtils����������ͼ������Ҫָ��Ҫ�����ĸ�Bitmap���� bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); return bitmap; @@ -75,9 +60,9 @@ public class PhotoUtil { /** * saveBitmap * - * @param @param filename---�����·����ʽ-��Ŀ¼�Լ��ļ��� + * @param @param filename * @param @param bitmap - * @param @param isDelete --�Ƿ�ֻ��һ�� + * @param @param isDelete * @return void * @throws */ @@ -89,7 +74,6 @@ public class PhotoUtil { } File file = new File(dirpath, filename); - // �����ڼ�ɾ��-Ĭ��ֻ����һ�� if (isDelete) { if (file.exists()) { file.delete(); @@ -100,7 +84,6 @@ public class PhotoUtil { try { file.createNewFile(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -135,7 +118,6 @@ public class PhotoUtil { } } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); } return file; @@ -153,12 +135,6 @@ public class PhotoUtil { } } - /** - * - * ��ȡͼƬ���ԣ���ת�ĽǶ� - * @param path ͼƬ���·�� - * @return degree��ת�ĽǶ� - */ public static int readPictureDegree(String path) { int degree = 0; @@ -185,30 +161,16 @@ public class PhotoUtil { } - /** ��תͼƬһ���Ƕ� - * rotaingImageView - * @return Bitmap - * @throws - */ + public static Bitmap rotaingImageView(int angle, Bitmap bitmap) { - // ��תͼƬ ���� Matrix matrix = new Matrix(); matrix.postRotate(angle); - // �����µ�ͼƬ Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); return resizedBitmap; } - /** - * ��ͼƬ��ΪԲ�� - * - * @param bitmap - * ԭBitmapͼƬ - * @param pixels - * ͼƬԲ�ǵĻ���(��λ:����(px)) - * @return ����Բ�ǵ�ͼƬ(Bitmap ����) - */ + public static Bitmap toRoundCorner(Bitmap bitmap, int pixels) { Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888); @@ -231,12 +193,7 @@ public class PhotoUtil { return output; } - /** - * ��ͼƬת��ΪԲ��ͷ�� - * - * @Title: toRoundBitmap - * @throws - */ + public static Bitmap toRoundBitmap(Bitmap bitmap) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); @@ -283,16 +240,14 @@ public class PhotoUtil { (int) dst_right, (int) dst_bottom); final RectF rectF = new RectF(dst); - paint.setAntiAlias(true);// ���û����޾�� + paint.setAntiAlias(true); - canvas.drawARGB(0, 0, 0, 0); // ������Canvas + canvas.drawARGB(0, 0, 0, 0); - // ���������ַ�����Բ,drawRounRect��drawCircle - canvas.drawRoundRect(rectF, roundPx, roundPx, paint);// ��Բ�Ǿ��Σ���һ������Ϊͼ����ʾ���򣬵ڶ�������͵��������ֱ���ˮƽԲ�ǰ뾶�ʹ�ֱԲ�ǰ뾶�� - // canvas.drawCircle(roundPx, roundPx, roundPx, paint); + canvas.drawRoundRect(rectF, roundPx, roundPx, paint); - paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));// ��������ͼƬ�ཻʱ��ģʽ,�ο�http://trylovecatch.iteye.com/blog/1189452 - canvas.drawBitmap(bitmap, src, dst, paint); // ��Mode.SRC_INģʽ�ϲ�bitmap���Ѿ�draw�˵�Circle + paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); + canvas.drawBitmap(bitmap, src, dst, paint); return output; } diff --git a/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/utils/SystemUtils.java b/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/utils/SystemUtils.java index a128e5c..6db878c 100644 --- a/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/utils/SystemUtils.java +++ b/src/MyApplication/app/src/main/java/com/example/administrator/myapplication/utils/SystemUtils.java @@ -22,9 +22,7 @@ import java.io.InputStream; import static android.content.Context.MODE_PRIVATE; -/** - * Created by htq on 2016/8/10. - */ + public class SystemUtils { private Context context; @@ -151,7 +149,6 @@ public boolean isTarn() fileOutputStream = mActivity.openFileOutput( "share.jpg", MODE_PRIVATE); } catch (FileNotFoundException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -178,7 +175,7 @@ public boolean isTarn() // fileOutputStream = mActivity.openFileOutput( // "share.jpg", 1); // } catch (FileNotFoundException e) { -// // TODO Auto-generated catch block +// // e.printStackTrace(); // } // diff --git a/src/MyApplication/libs/BmobSDKDemo_v3.6.0/BmobDemo/app/src/main/java/cn/bmob/sdkdemo/autoupdate/ActAutoUpdate.java b/src/MyApplication/libs/BmobSDKDemo_v3.6.0/BmobDemo/app/src/main/java/cn/bmob/sdkdemo/autoupdate/ActAutoUpdate.java index beefd92..411c8c8 100644 --- a/src/MyApplication/libs/BmobSDKDemo_v3.6.0/BmobDemo/app/src/main/java/cn/bmob/sdkdemo/autoupdate/ActAutoUpdate.java +++ b/src/MyApplication/libs/BmobSDKDemo_v3.6.0/BmobDemo/app/src/main/java/cn/bmob/sdkdemo/autoupdate/ActAutoUpdate.java @@ -26,7 +26,6 @@ public class ActAutoUpdate extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { - // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); diff --git a/src/MyApplication/libs/BmobSDKDemo_v3.6.0/BmobDemo/app/src/main/java/cn/bmob/sdkdemo/push/ActBmobPush.java b/src/MyApplication/libs/BmobSDKDemo_v3.6.0/BmobDemo/app/src/main/java/cn/bmob/sdkdemo/push/ActBmobPush.java index 4577db6..f2ba0f8 100644 --- a/src/MyApplication/libs/BmobSDKDemo_v3.6.0/BmobDemo/app/src/main/java/cn/bmob/sdkdemo/push/ActBmobPush.java +++ b/src/MyApplication/libs/BmobSDKDemo_v3.6.0/BmobDemo/app/src/main/java/cn/bmob/sdkdemo/push/ActBmobPush.java @@ -1,3 +1,4 @@ + package cn.bmob.sdkdemo.push; import android.os.Bundle;