Commit 3cc452267b28235b3ba45472d87f70c5fd3e6604
1 parent
ff014aa0ba
Exists in
master
意见反馈,头像处理
Showing
18 changed files
with
590 additions
and
37 deletions
Show diff stats
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/FeedBackActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.content.pm.PackageManager; | 4 | import android.content.pm.PackageManager; |
| 5 | import android.graphics.Color; | 5 | import android.graphics.Color; |
| 6 | import android.net.Uri; | 6 | import android.net.Uri; |
| 7 | import android.os.Build; | 7 | import android.os.Build; |
| 8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
| 9 | import android.provider.MediaStore; | 9 | import android.provider.MediaStore; |
| 10 | import android.support.annotation.NonNull; | 10 | import android.support.annotation.NonNull; |
| 11 | import android.support.v4.content.FileProvider; | 11 | import android.support.v4.content.FileProvider; |
| 12 | import android.support.v7.app.AppCompatActivity; | 12 | import android.support.v7.app.AppCompatActivity; |
| 13 | import android.text.TextUtils; | ||
| 14 | import android.util.Log; | ||
| 13 | import android.view.Gravity; | 15 | import android.view.Gravity; |
| 14 | import android.view.View; | 16 | import android.view.View; |
| 15 | import android.widget.AdapterView; | 17 | import android.widget.AdapterView; |
| 16 | import android.widget.EditText; | 18 | import android.widget.EditText; |
| 17 | import android.widget.ImageView; | 19 | import android.widget.ImageView; |
| 18 | import android.widget.TextView; | 20 | import android.widget.TextView; |
| 19 | import android.widget.Toast; | 21 | import android.widget.Toast; |
| 20 | 22 | ||
| 21 | import com.facebook.drawee.backends.pipeline.Fresco; | 23 | import com.facebook.drawee.backends.pipeline.Fresco; |
| 22 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 24 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
| 23 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 25 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
| 24 | import com.facebook.drawee.generic.RoundingParams; | 26 | import com.facebook.drawee.generic.RoundingParams; |
| 25 | import com.facebook.drawee.interfaces.DraweeController; | 27 | import com.facebook.drawee.interfaces.DraweeController; |
| 26 | import com.facebook.drawee.view.SimpleDraweeView; | 28 | import com.facebook.drawee.view.SimpleDraweeView; |
| 27 | import com.hjx.personalcenter.R; | 29 | import com.hjx.personalcenter.R; |
| 30 | import com.hjx.personalcenter.db.SaveParam; | ||
| 31 | import com.hjx.personalcenter.http.HttpManager; | ||
| 32 | import com.hjx.personalcenter.model.FeedBackInfo; | ||
| 33 | import com.hjx.personalcenter.util.AlertUtils; | ||
| 28 | import com.hjx.personalcenter.util.CropUtils; | 34 | import com.hjx.personalcenter.util.CropUtils; |
| 29 | import com.hjx.personalcenter.util.DialogPermission; | 35 | import com.hjx.personalcenter.util.DialogPermission; |
| 30 | import com.hjx.personalcenter.util.FileUtil; | 36 | import com.hjx.personalcenter.util.FileUtil; |
| 37 | import com.hjx.personalcenter.util.GetDate; | ||
| 31 | import com.hjx.personalcenter.util.PermissionUtil; | 38 | import com.hjx.personalcenter.util.PermissionUtil; |
| 32 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 39 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
| 33 | import com.mylhyl.circledialog.CircleDialog; | 40 | import com.mylhyl.circledialog.CircleDialog; |
| 34 | import com.mylhyl.circledialog.callback.ConfigButton; | 41 | import com.mylhyl.circledialog.callback.ConfigButton; |
| 35 | import com.mylhyl.circledialog.callback.ConfigDialog; | 42 | import com.mylhyl.circledialog.callback.ConfigDialog; |
| 36 | import com.mylhyl.circledialog.params.ButtonParams; | 43 | import com.mylhyl.circledialog.params.ButtonParams; |
| 37 | import com.mylhyl.circledialog.params.DialogParams; | 44 | import com.mylhyl.circledialog.params.DialogParams; |
| 38 | 45 | ||
| 39 | import java.io.File; | 46 | import java.io.File; |
| 47 | import java.util.ArrayList; | ||
| 48 | import java.util.List; | ||
| 40 | 49 | ||
| 41 | /** | 50 | /** |
| 42 | * Created by h on 2017/8/11. | 51 | * Created by h on 2017/8/11. |
| 43 | */ | 52 | */ |
| 44 | 53 | ||
| 45 | public class FeedBackActivity extends AppCompatActivity implements View.OnClickListener { | 54 | public class FeedBackActivity extends AppCompatActivity implements View.OnClickListener { |
| 46 | private ImageView iv_cance,iv_show,iv_take; | 55 | private ImageView iv_cance, iv_show, iv_take; |
| 47 | private EditText content, phone; | 56 | private EditText content, phone; |
| 48 | private TextView tv_sub; | 57 | private TextView tv_sub; |
| 49 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 58 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
| 50 | private static final int REQUEST_CODE_ALBUM = 2; | 59 | private static final int REQUEST_CODE_ALBUM = 2; |
| 51 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 60 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
| 52 | SimpleDraweeView mSimpleDraweeView; | 61 | SimpleDraweeView mSimpleDraweeView; |
| 53 | private File file; | 62 | private File file; |
| 54 | private Uri uri; | 63 | private Uri uri; |
| 64 | |||
| 55 | @Override | 65 | @Override |
| 56 | protected void onCreate(Bundle savedInstanceState) { | 66 | protected void onCreate(Bundle savedInstanceState) { |
| 57 | super.onCreate(savedInstanceState); | 67 | super.onCreate(savedInstanceState); |
| 58 | Fresco.initialize(this); | 68 | Fresco.initialize(this); |
| 59 | setContentView(R.layout.activity_feedback); | 69 | setContentView(R.layout.activity_feedback); |
| 60 | initView(); | 70 | initView(); |
| 61 | initData(); | 71 | initData(); |
| 62 | initLister(); | 72 | initLister(); |
| 63 | } | 73 | } |
| 64 | 74 | ||
| 65 | private void initView() { | 75 | private void initView() { |
| 66 | iv_cance = (ImageView) findViewById(R.id.cancel); | 76 | iv_cance = (ImageView) findViewById(R.id.cancel); |
| 67 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.show_iv); | 77 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.show_iv); |
| 68 | iv_take = (ImageView) findViewById(R.id.iv_take); | 78 | iv_take = (ImageView) findViewById(R.id.iv_take); |
| 69 | content = (EditText) findViewById(R.id.feedback_content); | 79 | content = (EditText) findViewById(R.id.feedback_content); |
| 70 | phone = (EditText) findViewById(R.id.feedback_phone); | 80 | phone = (EditText) findViewById(R.id.feedback_phone); |
| 71 | tv_sub = (TextView) findViewById(R.id.feedback_sub); | 81 | tv_sub = (TextView) findViewById(R.id.feedback_sub); |
| 72 | 82 | ||
| 73 | } | 83 | } |
| 74 | 84 | ||
| 75 | private void initData() { | 85 | private void initData() { |
| 76 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 86 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
| 77 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 87 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 78 | uri = Uri.fromFile(file); | 88 | uri = Uri.fromFile(file); |
| 79 | } else { | 89 | } else { |
| 80 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 90 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
| 81 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 91 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
| 82 | } | 92 | } |
| 83 | 93 | ||
| 84 | } | 94 | } |
| 85 | 95 | ||
| 86 | private void initLister() { | 96 | private void initLister() { |
| 87 | iv_cance.setOnClickListener(this); | 97 | iv_cance.setOnClickListener(this); |
| 88 | iv_take.setOnClickListener(this); | 98 | iv_take.setOnClickListener(this); |
| 89 | tv_sub.setOnClickListener(this); | 99 | tv_sub.setOnClickListener(this); |
| 90 | mSimpleDraweeView.setOnClickListener(this); | 100 | mSimpleDraweeView.setOnClickListener(this); |
| 91 | 101 | ||
| 92 | } | 102 | } |
| 93 | 103 | ||
| 94 | @Override | 104 | @Override |
| 95 | public void onClick(View v) { | 105 | public void onClick(View v) { |
| 96 | switch (v.getId()){ | 106 | String contents = content.getText().toString().trim(); |
| 107 | String contants = phone.getText().toString().trim(); | ||
| 108 | switch (v.getId()) { | ||
| 97 | case R.id.cancel: | 109 | case R.id.cancel: |
| 98 | finish(); | 110 | finish(); |
| 99 | break; | 111 | break; |
| 100 | case R.id.iv_take: | 112 | case R.id.iv_take: |
| 101 | choiceAvatar(); | 113 | choiceAvatar(); |
| 102 | break; | 114 | break; |
| 103 | case R.id.feedback_sub: | 115 | case R.id.feedback_sub: |
| 116 | //提交用户反馈 | ||
| 117 | if (TextUtils.isEmpty(contents)) { | ||
| 118 | AlertUtils.showToast(FeedBackActivity.this, "请将必填项填写完整"); | ||
| 119 | return; | ||
| 120 | } | ||
| 121 | long auserID = 0; | ||
| 122 | GetDate date = new GetDate(); | ||
| 123 | String userID = SaveParam.getInstance().getLoginParam(this, "userId"); | ||
| 124 | try { | ||
| 125 | auserID = Long.parseLong(userID); | ||
| 126 | |||
| 127 | FeedBackInfo feedBackInfo = new FeedBackInfo(); | ||
| 128 | feedBackInfo.setUserId(auserID); | ||
| 129 | feedBackInfo.setContact(contants); | ||
| 130 | feedBackInfo.setContent(contents); | ||
| 131 | feedBackInfo.setFeedBackDate(date.getYMD().toString()); | ||
| 132 | feedBackInfo.setFeedtype("个人中心"); | ||
| 133 | List<FeedBackInfo.ImgUrlBean> feedbackBean = new ArrayList<>(); | ||
| 134 | FeedBackInfo.ImgUrlBean imgurl = new FeedBackInfo.ImgUrlBean(); | ||
| 135 | imgurl.setImgUrl(file.getPath()); | ||
| 136 | feedbackBean.add(imgurl); | ||
| 137 | feedBackInfo.setImgUrl(feedbackBean); | ||
| 138 | Log.e("test", feedBackInfo.toString()); | ||
| 139 | HttpManager.getInstance().feedback(FeedBackActivity.this, feedBackInfo); | ||
| 140 | } catch (Exception e) { | ||
| 141 | e.printStackTrace(); | ||
| 142 | } | ||
| 104 | break; | 143 | break; |
| 105 | case R.id.show_iv: | 144 | case R.id.show_iv: |
| 106 | 145 | ||
| 107 | break; | 146 | break; |
| 108 | } | 147 | } |
| 109 | } | 148 | } |
| 110 | 149 | ||
| 111 | //拍摄头像 | 150 | //拍摄头像 |
| 112 | private void choiceAvatar() { | 151 | private void choiceAvatar() { |
| 113 | final String[] items = {"拍照", "从相册选择"}; | 152 | final String[] items = {"拍照", "从相册选择"}; |
| 114 | new CircleDialog.Builder(this) | 153 | new CircleDialog.Builder(this) |
| 115 | .configDialog(new ConfigDialog() { | 154 | .configDialog(new ConfigDialog() { |
| 116 | @Override | 155 | @Override |
| 117 | public void onConfig(DialogParams params) { | 156 | public void onConfig(DialogParams params) { |
| 118 | //增加弹出动画 | 157 | //增加弹出动画 |
| 119 | params.gravity = Gravity.CENTER; | 158 | params.gravity = Gravity.CENTER; |
| 120 | } | 159 | } |
| 121 | }) | 160 | }) |
| 122 | .setTitle("请选择图片来源") | 161 | .setTitle("请选择图片来源") |
| 123 | .setWidth(0.5f) | 162 | .setWidth(0.5f) |
| 124 | .setItems(items, new AdapterView.OnItemClickListener() { | 163 | .setItems(items, new AdapterView.OnItemClickListener() { |
| 125 | @Override | 164 | @Override |
| 126 | public void onItemClick(AdapterView<?> parent, View view, int | 165 | public void onItemClick(AdapterView<?> parent, View view, int |
| 127 | position, long id) { | 166 | position, long id) { |
| 128 | switch (position){ | 167 | switch (position) { |
| 129 | case 0: | 168 | case 0: |
| 130 | if (PermissionUtil.hasCameraPermission(FeedBackActivity.this)) { | 169 | if (PermissionUtil.hasCameraPermission(FeedBackActivity.this)) { |
| 131 | uploadAvatarFromPhotoRequest(); | 170 | uploadAvatarFromPhotoRequest(); |
| 132 | } | 171 | } |
| 133 | break; | 172 | break; |
| 134 | case 1: | 173 | case 1: |
| 135 | uploadAvatarFromAlbumRequest(); | 174 | uploadAvatarFromAlbumRequest(); |
| 136 | break; | 175 | break; |
| 137 | } | 176 | } |
| 138 | 177 | ||
| 139 | } | 178 | } |
| 140 | }) | 179 | }) |
| 141 | .setNegative("取消", null) | 180 | .setNegative("取消", null) |
| 142 | .configNegative(new ConfigButton() { | 181 | .configNegative(new ConfigButton() { |
| 143 | @Override | 182 | @Override |
| 144 | public void onConfig(ButtonParams params) { | 183 | public void onConfig(ButtonParams params) { |
| 145 | //取消按钮字体颜色 | 184 | //取消按钮字体颜色 |
| 146 | params.textColor = Color.RED; | 185 | params.textColor = Color.RED; |
| 147 | } | 186 | } |
| 148 | }) | 187 | }) |
| 149 | .show(); | 188 | .show(); |
| 150 | 189 | ||
| 151 | 190 | ||
| 152 | } | 191 | } |
| 192 | |||
| 153 | //照相 | 193 | //照相 |
| 154 | private void uploadAvatarFromPhotoRequest() { | 194 | private void uploadAvatarFromPhotoRequest() { |
| 155 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 195 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
| 156 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 196 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 157 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 197 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
| 158 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 198 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
| 159 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 199 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
| 160 | } | 200 | } |
| 161 | 201 | ||
| 162 | //选择图库 | 202 | //选择图库 |
| 163 | private void uploadAvatarFromAlbumRequest() { | 203 | private void uploadAvatarFromAlbumRequest() { |
| 164 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 204 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
| 165 | photoPickerIntent.setType("image/*"); | 205 | photoPickerIntent.setType("image/*"); |
| 166 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 206 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
| 167 | } | 207 | } |
| 208 | |||
| 168 | //回掉 | 209 | //回掉 |
| 169 | @Override | 210 | @Override |
| 170 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 211 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 171 | super.onActivityResult(requestCode, resultCode, data); | 212 | super.onActivityResult(requestCode, resultCode, data); |
| 172 | if (resultCode != -1) { | 213 | if (resultCode != -1) { |
| 173 | return; | 214 | return; |
| 174 | } | 215 | } |
| 175 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 216 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
| 176 | Uri newUri; | 217 | Uri newUri; |
| 177 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 218 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 178 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 219 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
| 179 | } else { | 220 | } else { |
| 180 | newUri = data.getData(); | 221 | newUri = data.getData(); |
| 181 | } | 222 | } |
| 182 | if (newUri != null) { | 223 | if (newUri != null) { |
| 183 | startPhotoZoom(newUri); | 224 | uploadAvatarFromPhoto(); |
| 225 | //裁剪图片 | ||
| 226 | //startPhotoZoom(newUri); | ||
| 184 | } else { | 227 | } else { |
| 185 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 228 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
| 186 | } | 229 | } |
| 187 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 230 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
| 188 | startPhotoZoom(uri); | 231 | uploadAvatarFromPhoto(); |
| 189 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 232 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
| 190 | uploadAvatarFromPhoto(); | 233 | uploadAvatarFromPhoto(); |
| 191 | } | 234 | } |
| 192 | } | 235 | } |
| 193 | 236 | ||
| 194 | private void uploadAvatarFromPhoto() { | 237 | private void uploadAvatarFromPhoto() { |
| 195 | compressAndUploadAvatar(file.getPath()); | 238 | compressAndUploadAvatar(file.getPath()); |
| 196 | 239 | ||
| 197 | } | 240 | } |
| 241 | |||
| 198 | private void compressAndUploadAvatar(String fileSrc) { | 242 | private void compressAndUploadAvatar(String fileSrc) { |
| 199 | 243 | ||
| 200 | 244 | ||
| 201 | //上传到服务器 | 245 | //上传到服务器 |
| 202 | 246 | ||
| 203 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 247 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
| 204 | String mimeType = "image/*"; | 248 | String mimeType = "image/*"; |
| 205 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 249 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
| 206 | //String fileName = cover.getName(); | 250 | //String fileName = cover.getName(); |
| 207 | //HttpManager.getInstance().header(this, fileSrc); | 251 | //HttpManager.getInstance().header(this, fileSrc); |
| 208 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 252 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
| 209 | //Fresco设置圆形头像 | 253 | //Fresco设置圆形头像 |
| 210 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 254 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
| 211 | GenericDraweeHierarchy hierarchy = builder | 255 | GenericDraweeHierarchy hierarchy = builder |
| 212 | .setDesiredAspectRatio(1f) | 256 | .setDesiredAspectRatio(1f) |
| 213 | .setFailureImage(R.mipmap.blank) | 257 | .setFailureImage(R.mipmap.blank) |
| 214 | //圆形头像 | 258 | //圆形头像 |
| 215 | .setRoundingParams(RoundingParams.fromCornersRadius(0.7f)) | 259 | .setRoundingParams(RoundingParams.fromCornersRadius(0.7f)) |
| 216 | .build(); | 260 | .build(); |
| 217 | 261 | ||
| 218 | //加载本地图片 | 262 | //加载本地图片 |
| 219 | Uri uri = Uri.fromFile(cover); | 263 | Uri uri = Uri.fromFile(cover); |
| 220 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 264 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
| 221 | .setOldController(mSimpleDraweeView.getController()) | 265 | .setOldController(mSimpleDraweeView.getController()) |
| 222 | .setUri(uri) | 266 | .setUri(uri) |
| 223 | .build(); | 267 | .build(); |
| 224 | mSimpleDraweeView.setHierarchy(hierarchy); | 268 | mSimpleDraweeView.setHierarchy(hierarchy); |
| 225 | mSimpleDraweeView.setController(controller); | 269 | mSimpleDraweeView.setController(controller); |
| 226 | 270 | ||
| 227 | } | 271 | } |
| 228 | 272 | ||
| 229 | public void startPhotoZoom(Uri uri) { | 273 | public void startPhotoZoom(Uri uri) { |
| 230 | Intent intent = new Intent("com.android.camera.action.CROP"); | 274 | Intent intent = new Intent("com.android.camera.action.CROP"); |
| 231 | intent.setDataAndType(uri, "image/*"); | 275 | intent.setDataAndType(uri, "image/*"); |
| 232 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 276 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 233 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 277 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
| 234 | // intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 278 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
| 235 | // intent.putExtra("aspectY", 1);// x:y=1:1 | 279 | intent.putExtra("aspectY", 1);// x:y=1:1 |
| 236 | intent.putExtra("outputX", 400);//图片输出大小 | 280 | // intent.putExtra("outputX", 400);//图片输出大小 |
| 237 | intent.putExtra("outputY", 400); | 281 | // intent.putExtra("outputY", 400); |
| 238 | intent.putExtra("output", Uri.fromFile(file)); | 282 | intent.putExtra("output", Uri.fromFile(file)); |
| 239 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 283 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
| 240 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 284 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
| 241 | } | 285 | } |
| 242 | 286 | ||
| 243 | @Override | 287 | @Override |
| 244 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 288 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
| 245 | switch (requestCode) { | 289 | switch (requestCode) { |
| 246 | 290 | ||
| 247 | case PermissionUtil.REQUEST_SHOWCAMERA: | 291 | case PermissionUtil.REQUEST_SHOWCAMERA: |
| 248 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 292 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
| 249 | // Permission Granted | 293 | // Permission Granted |
| 250 | uploadAvatarFromPhotoRequest(); | 294 | uploadAvatarFromPhotoRequest(); |
| 251 | 295 | ||
| 252 | } else { | 296 | } else { |
| 253 | if (!SharedPreferenceMark.getHasShowCamera()) { | 297 | if (!SharedPreferenceMark.getHasShowCamera()) { |
| 254 | SharedPreferenceMark.setHasShowCamera(true); | 298 | SharedPreferenceMark.setHasShowCamera(true); |
| 255 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 299 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
| 256 | 300 | ||
| 257 | } else { | 301 | } else { |
| 258 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 302 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
| 259 | .show(); | 303 | .show(); |
| 260 | } | 304 | } |
| 261 | } | 305 | } |
| 262 | break; | 306 | break; |
| 263 | default: | 307 | default: |
| 264 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 308 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 265 | } | 309 | } |
| 266 | } | 310 | } |
| 267 | } | 311 | } |
| 268 | 312 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.content.Intent; | 4 | import android.content.Intent; |
| 5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; |
| 6 | import android.net.Uri; | 6 | import android.net.Uri; |
| 7 | import android.os.Build; | 7 | import android.os.Build; |
| 8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
| 9 | import android.os.Handler; | 9 | import android.os.Handler; |
| 10 | import android.os.Message; | 10 | import android.os.Message; |
| 11 | import android.provider.MediaStore; | 11 | import android.provider.MediaStore; |
| 12 | import android.support.annotation.NonNull; | 12 | import android.support.annotation.NonNull; |
| 13 | import android.support.v4.content.FileProvider; | 13 | import android.support.v4.content.FileProvider; |
| 14 | import android.support.v7.app.AppCompatActivity; | 14 | import android.support.v7.app.AppCompatActivity; |
| 15 | import android.support.v7.widget.LinearLayoutManager; | 15 | import android.support.v7.widget.LinearLayoutManager; |
| 16 | import android.support.v7.widget.RecyclerView; | 16 | import android.support.v7.widget.RecyclerView; |
| 17 | import android.view.View; | 17 | import android.view.View; |
| 18 | import android.widget.ImageView; | 18 | import android.widget.ImageView; |
| 19 | import android.widget.LinearLayout; | 19 | import android.widget.LinearLayout; |
| 20 | import android.widget.TextView; | 20 | import android.widget.TextView; |
| 21 | import android.widget.Toast; | 21 | import android.widget.Toast; |
| 22 | 22 | ||
| 23 | import com.facebook.drawee.backends.pipeline.Fresco; | 23 | import com.facebook.drawee.backends.pipeline.Fresco; |
| 24 | import com.facebook.drawee.generic.GenericDraweeHierarchy; | 24 | import com.facebook.drawee.generic.GenericDraweeHierarchy; |
| 25 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; | 25 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; |
| 26 | import com.facebook.drawee.generic.RoundingParams; | 26 | import com.facebook.drawee.generic.RoundingParams; |
| 27 | import com.facebook.drawee.interfaces.DraweeController; | 27 | import com.facebook.drawee.interfaces.DraweeController; |
| 28 | import com.facebook.drawee.view.SimpleDraweeView; | 28 | import com.facebook.drawee.view.SimpleDraweeView; |
| 29 | import com.hjx.personalcenter.R; | 29 | import com.hjx.personalcenter.R; |
| 30 | import com.hjx.personalcenter.adapter.RecyclerViewAdapter; | 30 | import com.hjx.personalcenter.adapter.RecyclerViewAdapter; |
| 31 | import com.hjx.personalcenter.customdialog.HeadDialog; | 31 | import com.hjx.personalcenter.customdialog.HeadDialog; |
| 32 | import com.hjx.personalcenter.db.SaveParam; | 32 | import com.hjx.personalcenter.db.SaveParam; |
| 33 | import com.hjx.personalcenter.http.HttpCode; | 33 | import com.hjx.personalcenter.http.HttpCode; |
| 34 | import com.hjx.personalcenter.http.HttpManager; | 34 | import com.hjx.personalcenter.http.HttpManager; |
| 35 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 35 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 36 | import com.hjx.personalcenter.model.PesonalInfo; | 36 | import com.hjx.personalcenter.model.PesonalInfo; |
| 37 | import com.hjx.personalcenter.model.SignInfo; | 37 | import com.hjx.personalcenter.model.SignInfo; |
| 38 | import com.hjx.personalcenter.util.AlertUtils; | 38 | import com.hjx.personalcenter.util.AlertUtils; |
| 39 | import com.hjx.personalcenter.util.CropUtils; | 39 | import com.hjx.personalcenter.util.CropUtils; |
| 40 | import com.hjx.personalcenter.util.DialogPermission; | 40 | import com.hjx.personalcenter.util.DialogPermission; |
| 41 | import com.hjx.personalcenter.util.FileUtil; | 41 | import com.hjx.personalcenter.util.FileUtil; |
| 42 | import com.hjx.personalcenter.util.PermissionUtil; | 42 | import com.hjx.personalcenter.util.PermissionUtil; |
| 43 | import com.hjx.personalcenter.util.SharedPreferenceMark; | 43 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
| 44 | import com.mylhyl.circledialog.CircleDialog; | 44 | import com.mylhyl.circledialog.CircleDialog; |
| 45 | import com.mylhyl.circledialog.callback.ConfigInput; | 45 | import com.mylhyl.circledialog.callback.ConfigInput; |
| 46 | import com.mylhyl.circledialog.params.InputParams; | 46 | import com.mylhyl.circledialog.params.InputParams; |
| 47 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; | 47 | import com.mylhyl.circledialog.view.listener.OnInputClickListener; |
| 48 | import com.zaaach.toprightmenu.MenuItem; | 48 | import com.zaaach.toprightmenu.MenuItem; |
| 49 | import com.zaaach.toprightmenu.TopRightMenu; | 49 | import com.zaaach.toprightmenu.TopRightMenu; |
| 50 | 50 | ||
| 51 | import java.io.File; | 51 | import java.io.File; |
| 52 | import java.util.ArrayList; | 52 | import java.util.ArrayList; |
| 53 | import java.util.List; | 53 | import java.util.List; |
| 54 | 54 | ||
| 55 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { | 55 | public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView { |
| 56 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; | 56 | private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_sex; |
| 57 | private TextView tv_edit_presoninfo, tv_sign, | 57 | private TextView tv_edit_presoninfo, tv_sign, |
| 58 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, | 58 | tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday, |
| 59 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; | 59 | tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender; |
| 60 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; | 60 | private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass; |
| 61 | private TopRightMenu mTopRightMenu; | 61 | private TopRightMenu mTopRightMenu; |
| 62 | //水平滑动 | 62 | //水平滑动 |
| 63 | private RecyclerView mRecyclerView; | 63 | private RecyclerView mRecyclerView; |
| 64 | private RecyclerViewAdapter RecyclerViewadapter; | 64 | private RecyclerViewAdapter RecyclerViewadapter; |
| 65 | private boolean showIcon = true; | 65 | private boolean showIcon = true; |
| 66 | private boolean dimBg = true; | 66 | private boolean dimBg = true; |
| 67 | private boolean needAnim = true; | 67 | private boolean needAnim = true; |
| 68 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; | 68 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
| 69 | private static final int REQUEST_CODE_ALBUM = 2; | 69 | private static final int REQUEST_CODE_ALBUM = 2; |
| 70 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; | 70 | private static final int REQUEST_CODE_CROUP_PHOTO = 3; |
| 71 | SimpleDraweeView mSimpleDraweeView; | 71 | SimpleDraweeView mSimpleDraweeView; |
| 72 | private File file; | 72 | private File file; |
| 73 | private Uri uri; | 73 | private Uri uri; |
| 74 | Handler handler = new Handler(){ | 74 | Handler handler = new Handler(){ |
| 75 | @Override | 75 | @Override |
| 76 | public void handleMessage(Message msg) { | 76 | public void handleMessage(Message msg) { |
| 77 | super.handleMessage(msg); | 77 | super.handleMessage(msg); |
| 78 | switch (msg.what){ | 78 | switch (msg.what){ |
| 79 | case HttpCode.GETINFO: | 79 | case HttpCode.GETINFO: |
| 80 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; | 80 | PesonalInfo.DataBean cardinfoBean =(PesonalInfo.DataBean)msg.obj; |
| 81 | tv_username.setText(cardinfoBean.getNickName()); | 81 | tv_username.setText(cardinfoBean.getNickName()); |
| 82 | tv_username1.setText(cardinfoBean.getNickName()); | 82 | tv_username1.setText(cardinfoBean.getNickName()); |
| 83 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); | 83 | tv_useinfo_adress.setText(cardinfoBean.getRegion().getRegionName()); |
| 84 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); | 84 | tv_useinfo_birthday.setText(cardinfoBean.getBirthday()); |
| 85 | tv_useinfo_qq.setText(cardinfoBean.getQq()); | 85 | tv_useinfo_qq.setText(cardinfoBean.getQq()); |
| 86 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); | 86 | tv_useinfo_school.setText(cardinfoBean.getSchool().getSchoolName()); |
| 87 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); | 87 | tv_useinfo_gender.setText(cardinfoBean.getGrade().getGradeName()); |
| 88 | String sex = cardinfoBean.getGender(); | 88 | String sex = cardinfoBean.getGender(); |
| 89 | if ("0".equals(sex)){ | 89 | if ("0".equals(sex)){ |
| 90 | tv_sex.setText("男"); | 90 | tv_sex.setText("男"); |
| 91 | iv_sex.setImageResource(R.mipmap.men); | 91 | iv_sex.setImageResource(R.mipmap.men); |
| 92 | }else { | 92 | }else { |
| 93 | tv_sex.setText("女"); | 93 | tv_sex.setText("女"); |
| 94 | iv_sex.setImageResource(R.mipmap.women); | 94 | iv_sex.setImageResource(R.mipmap.women); |
| 95 | } | 95 | } |
| 96 | break; | 96 | break; |
| 97 | case HttpCode.SIGN: | 97 | case HttpCode.SIGN: |
| 98 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; | 98 | SignInfo.DataBean dataBean = (SignInfo.DataBean)msg.obj; |
| 99 | if (dataBean.getSignature()==null){ | 99 | if (dataBean.getSignature()==null){ |
| 100 | tv_sign.setText("你还未设置个性签名"); | 100 | tv_sign.setText("你还未设置个性签名"); |
| 101 | }else { | 101 | }else { |
| 102 | tv_sign.setText(dataBean.getSignature()); | 102 | tv_sign.setText(dataBean.getSignature()); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | break; | 105 | break; |
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| 108 | }; | 108 | }; |
| 109 | 109 | ||
| 110 | @Override | 110 | @Override |
| 111 | protected void onCreate(Bundle savedInstanceState) { | 111 | protected void onCreate(Bundle savedInstanceState) { |
| 112 | super.onCreate(savedInstanceState); | 112 | super.onCreate(savedInstanceState); |
| 113 | Fresco.initialize(this); | 113 | Fresco.initialize(this); |
| 114 | setContentView(R.layout.activity_main); | 114 | setContentView(R.layout.activity_main); |
| 115 | initView(); | 115 | initView(); |
| 116 | initData(); | 116 | initData(); |
| 117 | initLister(); | 117 | initLister(); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | private void initView() { | 120 | private void initView() { |
| 121 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); | 121 | iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan); |
| 122 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); | 122 | iv_look_card = (ImageView) findViewById(R.id.iv_look_card); |
| 123 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); | 123 | tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo); |
| 124 | iv_setting = (ImageView) findViewById(R.id.iv_setting); | 124 | iv_setting = (ImageView) findViewById(R.id.iv_setting); |
| 125 | iv_sign = (ImageView) findViewById(R.id.iv_sign); | 125 | iv_sign = (ImageView) findViewById(R.id.iv_sign); |
| 126 | tv_sign = (TextView) findViewById(R.id.tv_sign); | 126 | tv_sign = (TextView) findViewById(R.id.tv_sign); |
| 127 | //头像 | 127 | //头像 |
| 128 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); | 128 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.iv_head); |
| 129 | //初始化个人信息 | 129 | //初始化个人信息 |
| 130 | iv_sex = (ImageView) findViewById(R.id.iv_sex); | 130 | iv_sex = (ImageView) findViewById(R.id.iv_sex); |
| 131 | tv_username = (TextView) findViewById(R.id.tv_username); | 131 | tv_username = (TextView) findViewById(R.id.tv_username); |
| 132 | tv_username1 = (TextView) findViewById(R.id.tv_username1); | 132 | tv_username1 = (TextView) findViewById(R.id.tv_username1); |
| 133 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); | 133 | tv_mygad = (TextView) findViewById(R.id.tv_mygad); |
| 134 | tv_sex = (TextView) findViewById(R.id.tv_sex); | 134 | tv_sex = (TextView) findViewById(R.id.tv_sex); |
| 135 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); | 135 | tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress); |
| 136 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); | 136 | tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday); |
| 137 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); | 137 | tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq); |
| 138 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); | 138 | tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school); |
| 139 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); | 139 | tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender); |
| 140 | //跳转其他应用 | 140 | //跳转其他应用 |
| 141 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); | 141 | linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti); |
| 142 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); | 142 | linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote); |
| 143 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); | 143 | linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege); |
| 144 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); | 144 | linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass); |
| 145 | // | 145 | // |
| 146 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); | 146 | mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal); |
| 147 | 147 | ||
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | private void initData() { | 150 | private void initData() { |
| 151 | //加载最近学习视频 | 151 | //加载最近学习视频 |
| 152 | List<String> datas = new ArrayList<>(); | 152 | List<String> datas = new ArrayList<>(); |
| 153 | datas.add("LiMing"); | 153 | datas.add("LiMing"); |
| 154 | datas.add("XiaoMing"); | 154 | datas.add("XiaoMing"); |
| 155 | datas.add("HanMeiMei"); | 155 | datas.add("HanMeiMei"); |
| 156 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | 156 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); |
| 157 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); | 157 | linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
| 158 | mRecyclerView.setLayoutManager(linearLayoutManager); | 158 | mRecyclerView.setLayoutManager(linearLayoutManager); |
| 159 | RecyclerViewadapter = new RecyclerViewAdapter(this, datas); | 159 | RecyclerViewadapter = new RecyclerViewAdapter(this, datas); |
| 160 | mRecyclerView.setAdapter(RecyclerViewadapter); | 160 | mRecyclerView.setAdapter(RecyclerViewadapter); |
| 161 | //加载个人信息 | 161 | //加载个人信息 |
| 162 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); | 162 | String xiongzuo = SaveParam.getInstance().getLoginParam(this,SaveParam.CONSTELLATION); |
| 163 | if (xiongzuo==null){ | 163 | if (xiongzuo==null){ |
| 164 | tv_mygad.setText(""); | 164 | tv_mygad.setText(""); |
| 165 | }else { | 165 | }else { |
| 166 | tv_mygad.setText(xiongzuo); | 166 | tv_mygad.setText(xiongzuo); |
| 167 | } | 167 | } |
| 168 | //加载版本信息 | 168 | //加载版本信息 |
| 169 | 169 | ||
| 170 | 170 | ||
| 171 | //获取个性签名 | 171 | //获取个性签名 |
| 172 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 172 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
| 173 | try { | 173 | try { |
| 174 | long auserID = Long.parseLong(userID); | 174 | long auserID = Long.parseLong(userID); |
| 175 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,handler); | 175 | HttpManager.getInstance().getsignatures(MainActivity.this,auserID,handler); |
| 176 | 176 | ||
| 177 | } catch (NumberFormatException e) { | 177 | } catch (NumberFormatException e) { |
| 178 | e.printStackTrace(); | 178 | e.printStackTrace(); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | 181 | ||
| 182 | 182 | ||
| 183 | //初始化图片 | 183 | //初始化图片 |
| 184 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); | 184 | file = new File(FileUtil.getCachePath(this), "user-avatar.jpg"); |
| 185 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 185 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 186 | uri = Uri.fromFile(file); | 186 | uri = Uri.fromFile(file); |
| 187 | } else { | 187 | } else { |
| 188 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) | 188 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
| 189 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); | 189 | uri = FileProvider.getUriForFile(MyApplication.getContext(), "com.hjx.personalcenter", file); |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | private void initLister() { | 194 | private void initLister() { |
| 195 | iv_imformatioan.setOnClickListener(this); | 195 | iv_imformatioan.setOnClickListener(this); |
| 196 | iv_look_card.setOnClickListener(this); | 196 | iv_look_card.setOnClickListener(this); |
| 197 | tv_edit_presoninfo.setOnClickListener(this); | 197 | tv_edit_presoninfo.setOnClickListener(this); |
| 198 | iv_setting.setOnClickListener(this); | 198 | iv_setting.setOnClickListener(this); |
| 199 | iv_sign.setOnClickListener(this); | 199 | iv_sign.setOnClickListener(this); |
| 200 | mSimpleDraweeView.setOnClickListener(this); | 200 | mSimpleDraweeView.setOnClickListener(this); |
| 201 | linel_mycuoti.setOnClickListener(this); | 201 | linel_mycuoti.setOnClickListener(this); |
| 202 | linel_mynote.setOnClickListener(this); | 202 | linel_mynote.setOnClickListener(this); |
| 203 | linel_mycollege.setOnClickListener(this); | 203 | linel_mycollege.setOnClickListener(this); |
| 204 | linel_myclass.setOnClickListener(this); | 204 | linel_myclass.setOnClickListener(this); |
| 205 | 205 | ||
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | @Override | 208 | @Override |
| 209 | public void onClick(View v) { | 209 | public void onClick(View v) { |
| 210 | switch (v.getId()) { | 210 | switch (v.getId()) { |
| 211 | case R.id.iv_imformatioan: | 211 | case R.id.iv_imformatioan: |
| 212 | Intent intent = new Intent(); | 212 | Intent intent = new Intent(); |
| 213 | intent.setClass(MainActivity.this, FeedBackActivity.class); | 213 | intent.setClass(MainActivity.this, FeedBackActivity.class); |
| 214 | startActivity(intent); | 214 | startActivity(intent); |
| 215 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 215 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 216 | break; | 216 | break; |
| 217 | case R.id.iv_look_card: | 217 | case R.id.iv_look_card: |
| 218 | Intent lookintent = new Intent(); | 218 | Intent lookintent = new Intent(); |
| 219 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); | 219 | lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class); |
| 220 | startActivity(lookintent); | 220 | startActivity(lookintent); |
| 221 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 221 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 222 | break; | 222 | break; |
| 223 | case R.id.tv_edit_presoninfo: | 223 | case R.id.tv_edit_presoninfo: |
| 224 | Intent editintent = new Intent(); | 224 | Intent editintent = new Intent(); |
| 225 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); | 225 | editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class); |
| 226 | startActivity(editintent); | 226 | startActivity(editintent); |
| 227 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 227 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 228 | break; | 228 | break; |
| 229 | case R.id.iv_head: | 229 | case R.id.iv_head: |
| 230 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); | 230 | HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog"); |
| 231 | break; | 231 | break; |
| 232 | case R.id.iv_setting: | 232 | case R.id.iv_setting: |
| 233 | mTopRightMenu = new TopRightMenu(MainActivity.this); | 233 | mTopRightMenu = new TopRightMenu(MainActivity.this); |
| 234 | List<MenuItem> menuItems = new ArrayList<>(); | 234 | List<MenuItem> menuItems = new ArrayList<>(); |
| 235 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); | 235 | menuItems.add(new MenuItem(R.mipmap.blank, "切换账户")); |
| 236 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); | 236 | menuItems.add(new MenuItem(R.mipmap.blank, "账户管理")); |
| 237 | mTopRightMenu | 237 | mTopRightMenu |
| 238 | .setHeight(150) //默认高度480 | 238 | .setHeight(150) //默认高度480 |
| 239 | .setWidth(320) //默认宽度wrap_content | 239 | .setWidth(320) //默认宽度wrap_content |
| 240 | .showIcon(showIcon) //显示菜单图标,默认为true | 240 | .showIcon(showIcon) //显示菜单图标,默认为true |
| 241 | .dimBackground(dimBg) //背景变暗,默认为true | 241 | .dimBackground(dimBg) //背景变暗,默认为true |
| 242 | .needAnimationStyle(needAnim) //显示动画,默认为true | 242 | .needAnimationStyle(needAnim) //显示动画,默认为true |
| 243 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE | 243 | .setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE |
| 244 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { | 244 | .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() { |
| 245 | @Override | 245 | @Override |
| 246 | public void onMenuItemClick(int position) { | 246 | public void onMenuItemClick(int position) { |
| 247 | switch (position) { | 247 | switch (position) { |
| 248 | case 0: | 248 | case 0: |
| 249 | //清除数据 | 249 | //清除数据 |
| 250 | SaveParam.getInstance().clearData(MainActivity.this); | 250 | SaveParam.getInstance().clearData(MainActivity.this); |
| 251 | Intent settingintent = new Intent(); | 251 | Intent settingintent = new Intent(); |
| 252 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); | 252 | settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class); |
| 253 | startActivity(settingintent); | 253 | startActivity(settingintent); |
| 254 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 254 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 255 | break; | 255 | break; |
| 256 | case 1: | 256 | case 1: |
| 257 | Intent accontMintent = new Intent(); | 257 | Intent accontMintent = new Intent(); |
| 258 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); | 258 | accontMintent.setClass(MainActivity.this, AccountManagementActivity.class); |
| 259 | startActivity(accontMintent); | 259 | startActivity(accontMintent); |
| 260 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 260 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 261 | break; | 261 | break; |
| 262 | } | 262 | } |
| 263 | } | 263 | } |
| 264 | }) | 264 | }) |
| 265 | .addMenuList(menuItems) | 265 | .addMenuList(menuItems) |
| 266 | .showAsDropDown(iv_setting, -250, 0); | 266 | .showAsDropDown(iv_setting, -250, 0); |
| 267 | break; | 267 | break; |
| 268 | case R.id.iv_sign: | 268 | case R.id.iv_sign: |
| 269 | new CircleDialog.Builder(this) | 269 | new CircleDialog.Builder(this) |
| 270 | .setCanceledOnTouchOutside(false) | 270 | .setCanceledOnTouchOutside(false) |
| 271 | .setCancelable(true) | 271 | .setCancelable(true) |
| 272 | .setTitle("个性签名") | 272 | .setTitle("个性签名") |
| 273 | .setInputHint("请输入个性签名") | 273 | .setInputHint("请输入个性签名") |
| 274 | .setWidth(0.5f) | 274 | .setWidth(0.5f) |
| 275 | .configInput(new ConfigInput() { | 275 | .configInput(new ConfigInput() { |
| 276 | @Override | 276 | @Override |
| 277 | public void onConfig(InputParams params) { | 277 | public void onConfig(InputParams params) { |
| 278 | // params.inputBackgroundResourceId = R.drawable.bg_input; | 278 | // params.inputBackgroundResourceId = R.drawable.bg_input; |
| 279 | } | 279 | } |
| 280 | }) | 280 | }) |
| 281 | .setNegative("取消", null) | 281 | .setNegative("取消", null) |
| 282 | .setPositiveInput("确定", new OnInputClickListener() { | 282 | .setPositiveInput("确定", new OnInputClickListener() { |
| 283 | @Override | 283 | @Override |
| 284 | public void onClick(String text, View v) { | 284 | public void onClick(String text, View v) { |
| 285 | if (text.equals("")) { | 285 | if (text.equals("")) { |
| 286 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); | 286 | AlertUtils.showToast(MainActivity.this, "请输入个性签名"); |
| 287 | } else { | 287 | } else { |
| 288 | try { | 288 | try { |
| 289 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); | 289 | String userID = SaveParam.getInstance().getLoginParam(MainActivity.this,"userId"); |
| 290 | long auserID = Long.parseLong(userID); | 290 | long auserID = Long.parseLong(userID); |
| 291 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,text); | 291 | HttpManager.getInstance().changsignature(MainActivity.this,auserID,text); |
| 292 | } catch (NumberFormatException e) { | 292 | } catch (NumberFormatException e) { |
| 293 | e.printStackTrace(); | 293 | e.printStackTrace(); |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | tv_sign.setText(text); | 296 | tv_sign.setText(text); |
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | } | 299 | } |
| 300 | }) | 300 | }) |
| 301 | .show(); | 301 | .show(); |
| 302 | break; | 302 | break; |
| 303 | case R.id.linel_mycuoti: | 303 | case R.id.linel_mycuoti: |
| 304 | AlertUtils.showToast(this, "hhahahah "); | 304 | AlertUtils.showToast(this, "hhahahah "); |
| 305 | break; | 305 | break; |
| 306 | case R.id.linel_mynote: | 306 | case R.id.linel_mynote: |
| 307 | AlertUtils.showToast(this, "hhahahah "); | 307 | AlertUtils.showToast(this, "hhahahah "); |
| 308 | break; | 308 | break; |
| 309 | case R.id.linel_mycollege: | 309 | case R.id.linel_mycollege: |
| 310 | AlertUtils.showToast(this, "hhahahah "); | 310 | AlertUtils.showToast(this, "hhahahah "); |
| 311 | break; | 311 | break; |
| 312 | case R.id.linel_myclass: | 312 | case R.id.linel_myclass: |
| 313 | AlertUtils.showToast(this, "hhahahah "); | 313 | AlertUtils.showToast(this, "hhahahah "); |
| 314 | break; | 314 | break; |
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | @Override | 319 | @Override |
| 320 | protected void onResume() { | 320 | protected void onResume() { |
| 321 | super.onResume(); | 321 | super.onResume(); |
| 322 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); | 322 | String userID = SaveParam.getInstance().getLoginParam(this,"userId"); |
| 323 | try { | 323 | try { |
| 324 | long auserID = Long.parseLong(userID); | 324 | long auserID = Long.parseLong(userID); |
| 325 | //获取个人信息 | 325 | //获取个人信息 |
| 326 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,handler); | 326 | HttpManager.getInstance().getpresonalinfo(MainActivity.this,auserID,handler); |
| 327 | 327 | ||
| 328 | } catch (NumberFormatException e) { | 328 | } catch (NumberFormatException e) { |
| 329 | e.printStackTrace(); | 329 | e.printStackTrace(); |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | //回调头像监听 | 334 | //回调头像监听 |
| 335 | @Override | 335 | @Override |
| 336 | public void heard(Context context, View v) { | 336 | public void heard(Context context, View v,int headpitiaon) { |
| 337 | switch (v.getId()){ | 337 | switch (v.getId()){ |
| 338 | //选择默认图片 | 338 | //选择默认图片 |
| 339 | case R.id.oktakephone: | 339 | case R.id.oktakephone: |
| 340 | AlertUtils.showToast(this, "您选择了默认图片 "); | 340 | if (headpitiaon==1){ |
| 341 | mSimpleDraweeView.setImageDrawable(null); | ||
| 342 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar1); | ||
| 343 | }else if (headpitiaon==2){ | ||
| 344 | mSimpleDraweeView.setImageDrawable(null); | ||
| 345 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar2); | ||
| 346 | }else if (headpitiaon==3){ | ||
| 347 | mSimpleDraweeView.setImageDrawable(null); | ||
| 348 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar3); | ||
| 349 | }else if (headpitiaon==4){ | ||
| 350 | mSimpleDraweeView.setImageDrawable(null); | ||
| 351 | mSimpleDraweeView.setImageResource(R.mipmap.default_avatar4); | ||
| 352 | }else if (headpitiaon==0){ | ||
| 353 | AlertUtils.showToast(this, "你还没有设置头像 "); | ||
| 354 | } | ||
| 341 | break; | 355 | break; |
| 342 | case R.id.canceltakephone: | 356 | case R.id.canceltakephone: |
| 343 | 357 | ||
| 344 | break; | 358 | break; |
| 345 | //拍摄和相册 | 359 | //拍摄和相册 |
| 346 | case R.id.take_pic: | 360 | case R.id.take_pic: |
| 347 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { | 361 | if (PermissionUtil.hasCameraPermission(MainActivity.this)) { |
| 348 | uploadAvatarFromPhotoRequest(); | 362 | uploadAvatarFromPhotoRequest(); |
| 349 | } | 363 | } |
| 350 | 364 | ||
| 351 | break; | 365 | break; |
| 352 | case R.id.xiangce: | 366 | case R.id.xiangce: |
| 353 | uploadAvatarFromAlbumRequest(); | 367 | uploadAvatarFromAlbumRequest(); |
| 354 | break; | 368 | break; |
| 355 | 369 | ||
| 356 | } | 370 | } |
| 357 | 371 | ||
| 358 | } | 372 | } |
| 359 | 373 | ||
| 360 | //照相 | 374 | //照相 |
| 361 | private void uploadAvatarFromPhotoRequest() { | 375 | private void uploadAvatarFromPhotoRequest() { |
| 362 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | 376 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
| 363 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 377 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 364 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); | 378 | intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0); |
| 365 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); | 379 | intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); |
| 366 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); | 380 | startActivityForResult(intent, REQUEST_CODE_TAKE_PHOTO); |
| 367 | } | 381 | } |
| 368 | 382 | ||
| 369 | //选择图库 | 383 | //选择图库 |
| 370 | private void uploadAvatarFromAlbumRequest() { | 384 | private void uploadAvatarFromAlbumRequest() { |
| 371 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); | 385 | Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); |
| 372 | photoPickerIntent.setType("image/*"); | 386 | photoPickerIntent.setType("image/*"); |
| 373 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); | 387 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
| 374 | } | 388 | } |
| 375 | //回掉 | 389 | //回掉 |
| 376 | @Override | 390 | @Override |
| 377 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 391 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 378 | super.onActivityResult(requestCode, resultCode, data); | 392 | super.onActivityResult(requestCode, resultCode, data); |
| 379 | if (resultCode != -1) { | 393 | if (resultCode != -1) { |
| 380 | return; | 394 | return; |
| 381 | } | 395 | } |
| 382 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { | 396 | if (requestCode == REQUEST_CODE_ALBUM && data != null) { |
| 383 | Uri newUri; | 397 | Uri newUri; |
| 384 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { | 398 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
| 385 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); | 399 | newUri = Uri.parse("file:///" + CropUtils.getPath(this, data.getData())); |
| 386 | } else { | 400 | } else { |
| 387 | newUri = data.getData(); | 401 | newUri = data.getData(); |
| 388 | } | 402 | } |
| 389 | if (newUri != null) { | 403 | if (newUri != null) { |
| 390 | startPhotoZoom(newUri); | 404 | startPhotoZoom(newUri); |
| 391 | } else { | 405 | } else { |
| 392 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); | 406 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
| 393 | } | 407 | } |
| 394 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { | 408 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
| 395 | startPhotoZoom(uri); | 409 | startPhotoZoom(uri); |
| 396 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { | 410 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
| 397 | uploadAvatarFromPhoto(); | 411 | uploadAvatarFromPhoto(); |
| 398 | } | 412 | } |
| 399 | } | 413 | } |
| 400 | 414 | ||
| 401 | private void uploadAvatarFromPhoto() { | 415 | private void uploadAvatarFromPhoto() { |
| 402 | compressAndUploadAvatar(file.getPath()); | 416 | compressAndUploadAvatar(file.getPath()); |
| 403 | 417 | ||
| 404 | } | 418 | } |
| 405 | private void compressAndUploadAvatar(String fileSrc) { | 419 | private void compressAndUploadAvatar(String fileSrc) { |
| 406 | 420 | ||
| 407 | 421 | ||
| 408 | //上传到服务器 | 422 | //上传到服务器 |
| 409 | 423 | ||
| 410 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); | 424 | final File cover = FileUtil.getSmallBitmap(this, fileSrc); |
| 411 | String mimeType = "image/*"; | 425 | String mimeType = "image/*"; |
| 412 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); | 426 | //requestBody = RequestBody.create(MediaType.parse(mimeType), file); |
| 413 | //String fileName = cover.getName(); | 427 | //String fileName = cover.getName(); |
| 414 | //HttpManager.getInstance().header(this, fileSrc); | 428 | //HttpManager.getInstance().header(this, fileSrc); |
| 415 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); | 429 | //photo = MultipartBody.Part.createFormData("portrait", fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length()), requestBody); |
| 416 | //Fresco设置圆形头像 | 430 | //Fresco设置圆形头像 |
| 417 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); | 431 | GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources()); |
| 418 | GenericDraweeHierarchy hierarchy = builder | 432 | GenericDraweeHierarchy hierarchy = builder |
| 419 | .setDesiredAspectRatio(1f) | 433 | .setDesiredAspectRatio(1f) |
| 420 | .setFailureImage(R.mipmap.blank) | 434 | .setFailureImage(R.mipmap.blank) |
| 421 | //圆形头像 | 435 | //圆形头像 |
| 422 | .setRoundingParams(RoundingParams.asCircle()) | 436 | .setRoundingParams(RoundingParams.asCircle()) |
| 423 | .build(); | 437 | .build(); |
| 424 | 438 | ||
| 425 | //加载本地图片 | 439 | //加载本地图片 |
| 426 | Uri uri = Uri.fromFile(cover); | 440 | Uri uri = Uri.fromFile(cover); |
| 427 | DraweeController controller = Fresco.newDraweeControllerBuilder() | 441 | DraweeController controller = Fresco.newDraweeControllerBuilder() |
| 428 | .setOldController(mSimpleDraweeView.getController()) | 442 | .setOldController(mSimpleDraweeView.getController()) |
| 429 | .setUri(uri) | 443 | .setUri(uri) |
| 430 | .build(); | 444 | .build(); |
| 431 | mSimpleDraweeView.setHierarchy(hierarchy); | 445 | mSimpleDraweeView.setHierarchy(hierarchy); |
| 432 | mSimpleDraweeView.setController(controller); | 446 | mSimpleDraweeView.setController(controller); |
| 433 | 447 | ||
| 434 | } | 448 | } |
| 435 | 449 | ||
| 436 | public void startPhotoZoom(Uri uri) { | 450 | public void startPhotoZoom(Uri uri) { |
| 437 | Intent intent = new Intent("com.android.camera.action.CROP"); | 451 | Intent intent = new Intent("com.android.camera.action.CROP"); |
| 438 | intent.setDataAndType(uri, "image/*"); | 452 | intent.setDataAndType(uri, "image/*"); |
| 439 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 453 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 440 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. | 454 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
| 441 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | 455 | intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. |
| 442 | intent.putExtra("aspectY", 1);// x:y=1:1 | 456 | intent.putExtra("aspectY", 1);// x:y=1:1 |
| 443 | // intent.putExtra("outputX", 400);//图片输出大小 | 457 | // intent.putExtra("outputX", 400);//图片输出大小 |
| 444 | // intent.putExtra("outputY", 400); | 458 | // intent.putExtra("outputY", 400); |
| 445 | intent.putExtra("output", Uri.fromFile(file)); | 459 | intent.putExtra("output", Uri.fromFile(file)); |
| 446 | intent.putExtra("outputFormat", "JPEG");// 返回格式 | 460 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
| 447 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | 461 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); |
| 448 | } | 462 | } |
| 449 | 463 | ||
| 450 | @Override | 464 | @Override |
| 451 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | 465 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { |
| 452 | switch (requestCode) { | 466 | switch (requestCode) { |
| 453 | 467 | ||
| 454 | case PermissionUtil.REQUEST_SHOWCAMERA: | 468 | case PermissionUtil.REQUEST_SHOWCAMERA: |
| 455 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | 469 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { |
| 456 | // Permission Granted | 470 | // Permission Granted |
| 457 | uploadAvatarFromPhotoRequest(); | 471 | uploadAvatarFromPhotoRequest(); |
| 458 | 472 | ||
| 459 | } else { | 473 | } else { |
| 460 | if (!SharedPreferenceMark.getHasShowCamera()) { | 474 | if (!SharedPreferenceMark.getHasShowCamera()) { |
| 461 | SharedPreferenceMark.setHasShowCamera(true); | 475 | SharedPreferenceMark.setHasShowCamera(true); |
| 462 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); | 476 | new DialogPermission(this, "关闭摄像头权限影响扫描功能"); |
| 463 | 477 | ||
| 464 | } else { | 478 | } else { |
| 465 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) | 479 | Toast.makeText(this, "未获取摄像头权限", Toast.LENGTH_SHORT) |
| 466 | .show(); | 480 | .show(); |
| 467 | } | 481 | } |
| 468 | } | 482 | } |
| 469 | break; | 483 | break; |
| 470 | default: | 484 | default: |
| 471 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 485 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 472 | } | 486 | } |
| 473 | } | 487 | } |
| 474 | } | 488 | } |
| 475 | 489 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.java
| 1 | package com.hjx.personalcenter.activity; | 1 | package com.hjx.personalcenter.activity; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
| 6 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
| 7 | import android.view.KeyEvent; | 7 | import android.view.KeyEvent; |
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.widget.Button; | 9 | import android.widget.Button; |
| 10 | import android.widget.EditText; | 10 | import android.widget.EditText; |
| 11 | import android.widget.TextView; | 11 | import android.widget.TextView; |
| 12 | 12 | ||
| 13 | import com.hjx.personalcenter.R; | 13 | import com.hjx.personalcenter.R; |
| 14 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 14 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
| 15 | import com.hjx.personalcenter.customdialog.CountryDialog; | 15 | import com.hjx.personalcenter.customdialog.CountryDialog; |
| 16 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 16 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
| 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 17 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
| 18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 18 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
| 19 | import com.hjx.personalcenter.db.SaveParam; | 19 | import com.hjx.personalcenter.db.SaveParam; |
| 20 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 20 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 21 | import com.hjx.personalcenter.model.CityInfo; | 21 | import com.hjx.personalcenter.model.CityInfo; |
| 22 | import com.hjx.personalcenter.model.CountyInfo; | 22 | import com.hjx.personalcenter.model.CountyInfo; |
| 23 | import com.hjx.personalcenter.model.GradeInfo; | 23 | import com.hjx.personalcenter.model.GradeInfo; |
| 24 | import com.hjx.personalcenter.model.ProvinceInfo; | 24 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 25 | import com.hjx.personalcenter.model.SchoolInfo; | 25 | import com.hjx.personalcenter.model.SchoolInfo; |
| 26 | import com.hjx.personalcenter.util.AlertUtils; | 26 | import com.hjx.personalcenter.util.AlertUtils; |
| 27 | 27 | ||
| 28 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
| 29 | 29 | ||
| 30 | /**填写注册信息 熊巍 | 30 | /**填写注册信息 熊巍 |
| 31 | * Created by h on 2017/8/9. | 31 | * Created by h on 2017/8/9. |
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener,DialogCallBack.GradeCallBack,DialogCallBack.ProvincesCallBack | 34 | public class RegisterInfoActivity extends AppCompatActivity implements View.OnClickListener,DialogCallBack.GradeCallBack,DialogCallBack.ProvincesCallBack |
| 35 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack,DialogCallBack.SchoolCallBack{ | 35 | ,DialogCallBack.CitysCallBack,DialogCallBack.CountryCallBack,DialogCallBack.SchoolCallBack{ |
| 36 | private EditText et_username; | 36 | private EditText et_username; |
| 37 | private TextView et_region,et_grade,et_school; | 37 | private TextView et_region,et_grade,et_school; |
| 38 | private Button btn_ok; | 38 | private Button btn_ok; |
| 39 | 39 | ||
| 40 | @Override | 40 | @Override |
| 41 | protected void onCreate(Bundle savedInstanceState) { | 41 | protected void onCreate(Bundle savedInstanceState) { |
| 42 | super.onCreate(savedInstanceState); | 42 | super.onCreate(savedInstanceState); |
| 43 | setContentView(R.layout.activity_registerinfo); | 43 | setContentView(R.layout.activity_registerinfo); |
| 44 | initView(); | 44 | initView(); |
| 45 | initData(); | 45 | initData(); |
| 46 | initLister(); | 46 | initLister(); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | private void initView() { | 49 | private void initView() { |
| 50 | et_username = (EditText) findViewById(R.id.et_username); | 50 | et_username = (EditText) findViewById(R.id.et_username); |
| 51 | et_region = (TextView) findViewById(R.id.et_region); | 51 | et_region = (TextView) findViewById(R.id.et_region); |
| 52 | et_grade = (TextView) findViewById(R.id.et_grade); | 52 | et_grade = (TextView) findViewById(R.id.et_grade); |
| 53 | et_school = (TextView) findViewById(R.id.et_school); | 53 | et_school = (TextView) findViewById(R.id.et_school); |
| 54 | btn_ok = (Button) findViewById(R.id.btn_ok); | 54 | btn_ok = (Button) findViewById(R.id.btn_ok); |
| 55 | 55 | ||
| 56 | 56 | ||
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | private void initData() { | 59 | private void initData() { |
| 60 | 60 | ||
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | private void initLister() { | 63 | private void initLister() { |
| 64 | et_region.setOnClickListener(this); | 64 | et_region.setOnClickListener(this); |
| 65 | et_grade.setOnClickListener(this); | 65 | et_grade.setOnClickListener(this); |
| 66 | et_school.setOnClickListener(this); | 66 | et_school.setOnClickListener(this); |
| 67 | btn_ok.setOnClickListener(this); | 67 | btn_ok.setOnClickListener(this); |
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | @Override | 72 | @Override |
| 73 | public void onClick(View v) { | 73 | public void onClick(View v) { |
| 74 | String register1 = et_username.getText().toString().trim(); | 74 | String register1 = et_username.getText().toString().trim(); |
| 75 | String register2 = et_region.getText().toString().trim(); | 75 | String register2 = et_region.getText().toString().trim(); |
| 76 | String register3 = et_grade.getText().toString().trim(); | 76 | String register3 = et_grade.getText().toString().trim(); |
| 77 | String register4 = et_school.getText().toString().trim(); | 77 | String register4 = et_school.getText().toString().trim(); |
| 78 | switch (v.getId()){ | 78 | switch (v.getId()){ |
| 79 | case R.id.et_region: | 79 | case R.id.et_region: |
| 80 | choiseregion(); | 80 | choiseregion(); |
| 81 | break; | 81 | break; |
| 82 | case R.id.et_grade: | 82 | case R.id.et_grade: |
| 83 | choisegrade(); | 83 | choisegrade(); |
| 84 | break; | 84 | break; |
| 85 | case R.id.et_school: | 85 | case R.id.et_school: |
| 86 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ | 86 | if (TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ |
| 87 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); | 87 | AlertUtils.showToast(RegisterInfoActivity.this, "请选择年级和地址"); |
| 88 | return; | 88 | return; |
| 89 | }else { | 89 | }else { |
| 90 | choiseschool(); | 90 | choiseschool(); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | break; | 93 | break; |
| 94 | case R.id.btn_ok: | 94 | case R.id.btn_ok: |
| 95 | if (TextUtils.isEmpty(register1)||TextUtils.isEmpty(register4) || | 95 | if (TextUtils.isEmpty(register1) || |
| 96 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ | 96 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ |
| 97 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); | 97 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); |
| 98 | return; | 98 | return; |
| 99 | }else{ | 99 | }else{ |
| 100 | saveinfo(); | 100 | saveinfo(); |
| 101 | Intent intent = new Intent(); | 101 | Intent intent = new Intent(); |
| 102 | intent.setClass(RegisterInfoActivity.this,ChoiseTextBookActivity.class); | 102 | intent.setClass(RegisterInfoActivity.this,ChoiseTextBookActivity.class); |
| 103 | startActivity(intent); | 103 | startActivity(intent); |
| 104 | overridePendingTransition(R.anim.rightin, R.anim.rightout); | 104 | overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | break; | 107 | break; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | } | 110 | } |
| 111 | //保存个人信息 | 111 | //保存个人信息 |
| 112 | private void saveinfo() { | 112 | private void saveinfo() { |
| 113 | String register1 = et_username.getText().toString().trim(); | 113 | String register1 = et_username.getText().toString().trim(); |
| 114 | String register2 = et_region.getText().toString().trim(); | 114 | String register2 = et_region.getText().toString().trim(); |
| 115 | String register3 = et_grade.getText().toString().trim(); | 115 | String register3 = et_grade.getText().toString().trim(); |
| 116 | String register4 = et_school.getText().toString().trim(); | 116 | String register4 = et_school.getText().toString().trim(); |
| 117 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register1); | 117 | SaveParam.getInstance().saveLoginParam(this,SaveParam.USERNAME,register1); |
| 118 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register2); | 118 | SaveParam.getInstance().saveLoginParam(this,SaveParam.ADRESS,register2); |
| 119 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register3); | 119 | SaveParam.getInstance().saveLoginParam(this,SaveParam.GRADES,register3); |
| 120 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register4); | 120 | SaveParam.getInstance().saveLoginParam(this,SaveParam.SCHOOL,register4); |
| 121 | 121 | ||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | //选择地区 | 124 | //选择地区 |
| 125 | private void choiseregion() { | 125 | private void choiseregion() { |
| 126 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); | 126 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) RegisterInfoActivity.this).show(getSupportFragmentManager(), "ProvinceListDialog"); |
| 127 | 127 | ||
| 128 | } | 128 | } |
| 129 | //选择年级 | 129 | //选择年级 |
| 130 | private void choisegrade() { | 130 | private void choisegrade() { |
| 131 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); | 131 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) this).show(getSupportFragmentManager(), "GradeListDialog"); |
| 132 | 132 | ||
| 133 | } | 133 | } |
| 134 | //选择学校 | 134 | //选择学校 |
| 135 | private void choiseschool() { | 135 | private void choiseschool() { |
| 136 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); | 136 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) this).show(getSupportFragmentManager(), "SchoolListDialog"); |
| 137 | 137 | ||
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | 140 | ||
| 141 | @Override | 141 | @Override |
| 142 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 142 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
| 143 | String regionName = data.get(position).getRegionName(); | 143 | String regionName = data.get(position).getRegionName(); |
| 144 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); | 144 | SaveParam.getInstance().saveLoginParam(this,"sheng",regionName); |
| 145 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); | 145 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) this).show(getSupportFragmentManager(), "CitysListDialog"); |
| 146 | 146 | ||
| 147 | 147 | ||
| 148 | } | 148 | } |
| 149 | @Override | 149 | @Override |
| 150 | public boolean onKeyUp(int keyCode, KeyEvent event) { | 150 | public boolean onKeyUp(int keyCode, KeyEvent event) { |
| 151 | if (keyCode == KeyEvent.KEYCODE_BACK) { | 151 | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| 152 | finish(); | 152 | finish(); |
| 153 | 153 | ||
| 154 | } | 154 | } |
| 155 | return super.onKeyUp(keyCode, event); | 155 | return super.onKeyUp(keyCode, event); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | @Override | 158 | @Override |
| 159 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 159 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
| 160 | String regionName = data.get(position).getName(); | 160 | String regionName = data.get(position).getName(); |
| 161 | et_grade.setText(regionName); | 161 | et_grade.setText(regionName); |
| 162 | 162 | ||
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | @Override | 165 | @Override |
| 166 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 166 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
| 167 | String regionName = data.get(position).getRegionName(); | 167 | String regionName = data.get(position).getRegionName(); |
| 168 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); | 168 | String provice = SaveParam.getInstance().getLoginParam(this,"sheng"); |
| 169 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); | 169 | SaveParam.getInstance().saveLoginParam(this,"shi",regionName); |
| 170 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); | 170 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getSupportFragmentManager(), "CountryDialog"); |
| 171 | et_region.setText(""); | 171 | et_region.setText(""); |
| 172 | et_region.setText(provice+regionName); | 172 | et_region.setText(provice+regionName); |
| 173 | 173 | ||
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | @Override | 176 | @Override |
| 177 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 177 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
| 178 | String regionName = data.get(position).getRegionName(); | 178 | String regionName = data.get(position).getRegionName(); |
| 179 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); | 179 | String provices = SaveParam.getInstance().getLoginParam(this,"sheng"); |
| 180 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); | 180 | String citys = SaveParam.getInstance().getLoginParam(this,"shi"); |
| 181 | et_region.setText(""); | 181 | et_region.setText(""); |
| 182 | et_region.setText(provices+citys+regionName); | 182 | et_region.setText(provices+citys+regionName); |
| 183 | 183 | ||
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | @Override | 186 | @Override |
| 187 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 187 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
| 188 | String regionName = data.get(position).getSchoolName(); | 188 | String regionName = data.get(position).getSchoolName(); |
| 189 | et_school.setText(regionName); | 189 | et_school.setText(regionName); |
| 190 | 190 | ||
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| 193 | 193 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/HeadDialog.java
| 1 | package com.hjx.personalcenter.customdialog; | 1 | package com.hjx.personalcenter.customdialog; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.graphics.Color; | 4 | import android.graphics.Color; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.view.Gravity; | 6 | import android.view.Gravity; |
| 7 | import android.view.LayoutInflater; | 7 | import android.view.LayoutInflater; |
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.view.ViewGroup; | 9 | import android.view.ViewGroup; |
| 10 | import android.widget.LinearLayout; | 10 | import android.widget.LinearLayout; |
| 11 | import android.widget.RadioButton; | ||
| 11 | import android.widget.TextView; | 12 | import android.widget.TextView; |
| 12 | 13 | ||
| 13 | import com.hjx.personalcenter.R; | 14 | import com.hjx.personalcenter.R; |
| 14 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 15 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 15 | import com.mylhyl.circledialog.BaseCircleDialog; | 16 | import com.mylhyl.circledialog.BaseCircleDialog; |
| 16 | import com.mylhyl.circledialog.res.values.CircleDimen; | 17 | import com.mylhyl.circledialog.res.values.CircleDimen; |
| 17 | 18 | ||
| 18 | /** | 19 | /** |
| 19 | * Created by h on 2017/8/20. | 20 | * Created by h on 2017/8/20. |
| 20 | */ | 21 | */ |
| 21 | 22 | ||
| 22 | public class HeadDialog extends BaseCircleDialog implements View.OnClickListener { | 23 | public class HeadDialog extends BaseCircleDialog implements View.OnClickListener { |
| 23 | private View mView; | 24 | private View mView; |
| 24 | private TextView oktakephone, cancetakephone; | 25 | private TextView oktakephone, cancetakephone; |
| 25 | private LinearLayout take_pic,xiangce; | 26 | private LinearLayout take_pic,xiangce; |
| 26 | private DialogCallBack.CallBackView mCallBack; | 27 | private DialogCallBack.CallBackView mCallBack; |
| 28 | //默认头像选择 | ||
| 29 | RadioButton radio_head1,radio_head2,radio_head3,radio_head4; | ||
| 27 | 30 | ||
| 28 | public HeadDialog(DialogCallBack.CallBackView callBack) { | 31 | public HeadDialog(DialogCallBack.CallBackView callBack) { |
| 29 | this.mCallBack = callBack; | 32 | this.mCallBack = callBack; |
| 30 | } | 33 | } |
| 31 | 34 | ||
| 32 | public static HeadDialog getInstance(DialogCallBack.CallBackView callBackview) { | 35 | public static HeadDialog getInstance(DialogCallBack.CallBackView callBackview) { |
| 33 | HeadDialog dialogFragment = new HeadDialog(callBackview); | 36 | HeadDialog dialogFragment = new HeadDialog(callBackview); |
| 34 | dialogFragment.setCanceledBack(true); | 37 | dialogFragment.setCanceledBack(true); |
| 35 | dialogFragment.setCanceledOnTouchOutside(true); | 38 | dialogFragment.setCanceledOnTouchOutside(false); |
| 36 | dialogFragment.setRadius(CircleDimen.RADIUS); | 39 | dialogFragment.setRadius(CircleDimen.RADIUS); |
| 37 | dialogFragment.setWidth(0.4f); | 40 | dialogFragment.setWidth(0.4f); |
| 38 | dialogFragment.setGravity(Gravity.CENTER); | 41 | dialogFragment.setGravity(Gravity.CENTER); |
| 39 | dialogFragment.setBackgroundColor(Color.WHITE); | 42 | dialogFragment.setBackgroundColor(Color.WHITE); |
| 40 | return dialogFragment; | 43 | return dialogFragment; |
| 41 | } | 44 | } |
| 42 | 45 | ||
| 43 | @Override | 46 | @Override |
| 44 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { | 47 | public View createView(Context context, LayoutInflater inflater, ViewGroup container) { |
| 45 | 48 | ||
| 46 | if (mView == null) { | 49 | if (mView == null) { |
| 47 | mView = inflater.inflate(R.layout.custom_adilog_lhead, container, false); | 50 | mView = inflater.inflate(R.layout.custom_adilog_lhead, container, false); |
| 48 | } | 51 | } |
| 49 | return mView; | 52 | return mView; |
| 50 | } | 53 | } |
| 51 | 54 | ||
| 52 | @Override | 55 | @Override |
| 53 | public void onActivityCreated(Bundle savedInstanceState) { | 56 | public void onActivityCreated(Bundle savedInstanceState) { |
| 54 | super.onActivityCreated(savedInstanceState); | 57 | super.onActivityCreated(savedInstanceState); |
| 55 | oktakephone = (TextView) mView.findViewById(R.id.oktakephone); | 58 | oktakephone = (TextView) mView.findViewById(R.id.oktakephone); |
| 56 | cancetakephone = (TextView) mView.findViewById(R.id.canceltakephone); | 59 | cancetakephone = (TextView) mView.findViewById(R.id.canceltakephone); |
| 57 | take_pic = (LinearLayout) mView.findViewById(R.id.take_pic); | 60 | take_pic = (LinearLayout) mView.findViewById(R.id.take_pic); |
| 58 | xiangce = (LinearLayout) mView.findViewById(R.id.xiangce); | 61 | xiangce = (LinearLayout) mView.findViewById(R.id.xiangce); |
| 62 | radio_head1 = (RadioButton)mView .findViewById(R.id.radio_head1); | ||
| 63 | radio_head2 = (RadioButton)mView .findViewById(R.id.radio_head2); | ||
| 64 | radio_head3 = (RadioButton)mView .findViewById(R.id.radio_head3); | ||
| 65 | radio_head4 = (RadioButton)mView .findViewById(R.id.radio_head4); | ||
| 59 | oktakephone.setOnClickListener(this); | 66 | oktakephone.setOnClickListener(this); |
| 60 | cancetakephone.setOnClickListener(this); | 67 | cancetakephone.setOnClickListener(this); |
| 61 | take_pic.setOnClickListener(this); | 68 | take_pic.setOnClickListener(this); |
| 62 | xiangce.setOnClickListener(this); | 69 | xiangce.setOnClickListener(this); |
| 63 | 70 | ||
| 64 | 71 | ||
| 65 | } | 72 | } |
| 66 | 73 | ||
| 67 | @Override | 74 | @Override |
| 68 | public void onClick(View v) { | 75 | public void onClick(View v) { |
| 69 | mCallBack.heard(getActivity(), v); | 76 | int headweizhi; |
| 77 | if (radio_head1.isChecked()){ | ||
| 78 | headweizhi =1; | ||
| 79 | } else if (radio_head2.isChecked()) { | ||
| 80 | headweizhi =2; | ||
| 81 | }else if (radio_head3.isChecked()) { | ||
| 82 | headweizhi =3; | ||
| 83 | }else if (radio_head4.isChecked()) { | ||
| 84 | headweizhi =4; | ||
| 85 | }else { | ||
| 86 | headweizhi =0; | ||
| 87 | } | ||
| 88 | mCallBack.heard(getActivity(), v,headweizhi); | ||
| 70 | dismiss(); | 89 | dismiss(); |
| 71 | } | 90 | } |
| 72 | } | 91 | } |
| 73 | 92 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
| 1 | package com.hjx.personalcenter.fragment; | 1 | package com.hjx.personalcenter.fragment; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.graphics.Color; | 4 | import android.graphics.Color; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 7 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
| 8 | import android.view.Gravity; | 8 | import android.view.Gravity; |
| 9 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
| 10 | import android.view.View; | 10 | import android.view.View; |
| 11 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
| 12 | import android.widget.AdapterView; | 12 | import android.widget.AdapterView; |
| 13 | import android.widget.EditText; | 13 | import android.widget.EditText; |
| 14 | import android.widget.TextView; | 14 | import android.widget.TextView; |
| 15 | 15 | ||
| 16 | import com.bigkoo.pickerview.TimePickerView; | 16 | import com.bigkoo.pickerview.TimePickerView; |
| 17 | import com.hjx.personalcenter.R; | 17 | import com.hjx.personalcenter.R; |
| 18 | import com.hjx.personalcenter.customdialog.CitysListDialog; | 18 | import com.hjx.personalcenter.customdialog.CitysListDialog; |
| 19 | import com.hjx.personalcenter.customdialog.CountryDialog; | 19 | import com.hjx.personalcenter.customdialog.CountryDialog; |
| 20 | import com.hjx.personalcenter.customdialog.GradeListDialog; | 20 | import com.hjx.personalcenter.customdialog.GradeListDialog; |
| 21 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; | 21 | import com.hjx.personalcenter.customdialog.ProvinceListDialog; |
| 22 | import com.hjx.personalcenter.customdialog.SchoolListDialog; | 22 | import com.hjx.personalcenter.customdialog.SchoolListDialog; |
| 23 | import com.hjx.personalcenter.db.SaveParam; | 23 | import com.hjx.personalcenter.db.SaveParam; |
| 24 | import com.hjx.personalcenter.http.HttpManager; | 24 | import com.hjx.personalcenter.http.HttpManager; |
| 25 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 25 | import com.hjx.personalcenter.interfaces.DialogCallBack; |
| 26 | import com.hjx.personalcenter.model.ChangeInfo; | 26 | import com.hjx.personalcenter.model.ChangeInfo; |
| 27 | import com.hjx.personalcenter.model.CityInfo; | 27 | import com.hjx.personalcenter.model.CityInfo; |
| 28 | import com.hjx.personalcenter.model.CountyInfo; | 28 | import com.hjx.personalcenter.model.CountyInfo; |
| 29 | import com.hjx.personalcenter.model.GradeInfo; | 29 | import com.hjx.personalcenter.model.GradeInfo; |
| 30 | import com.hjx.personalcenter.model.ProvinceInfo; | 30 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 31 | import com.hjx.personalcenter.model.SchoolInfo; | 31 | import com.hjx.personalcenter.model.SchoolInfo; |
| 32 | import com.hjx.personalcenter.util.AlertUtils; | 32 | import com.hjx.personalcenter.util.AlertUtils; |
| 33 | import com.hjx.personalcenter.util.BrithdayStar; | 33 | import com.hjx.personalcenter.util.BrithdayStar; |
| 34 | import com.mylhyl.circledialog.CircleDialog; | 34 | import com.mylhyl.circledialog.CircleDialog; |
| 35 | import com.mylhyl.circledialog.callback.ConfigButton; | 35 | import com.mylhyl.circledialog.callback.ConfigButton; |
| 36 | import com.mylhyl.circledialog.callback.ConfigDialog; | 36 | import com.mylhyl.circledialog.callback.ConfigDialog; |
| 37 | import com.mylhyl.circledialog.params.ButtonParams; | 37 | import com.mylhyl.circledialog.params.ButtonParams; |
| 38 | import com.mylhyl.circledialog.params.DialogParams; | 38 | import com.mylhyl.circledialog.params.DialogParams; |
| 39 | 39 | ||
| 40 | import org.apache.http.util.TextUtils; | 40 | import org.apache.http.util.TextUtils; |
| 41 | 41 | ||
| 42 | import java.io.UnsupportedEncodingException; | 42 | import java.io.UnsupportedEncodingException; |
| 43 | import java.text.SimpleDateFormat; | 43 | import java.text.SimpleDateFormat; |
| 44 | import java.util.ArrayList; | 44 | import java.util.ArrayList; |
| 45 | import java.util.Date; | 45 | import java.util.Date; |
| 46 | 46 | ||
| 47 | /** | 47 | /** |
| 48 | * Created by h on 2017/8/12. | 48 | * Created by h on 2017/8/12. |
| 49 | */ | 49 | */ |
| 50 | 50 | ||
| 51 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack | 51 | public class PresonInfoFragment extends Fragment implements View.OnClickListener, DialogCallBack.GradeCallBack, DialogCallBack.ProvincesCallBack |
| 52 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { | 52 | , DialogCallBack.CitysCallBack, DialogCallBack.CountryCallBack, DialogCallBack.SchoolCallBack { |
| 53 | private View mView; | 53 | private View mView; |
| 54 | private int type; | 54 | private int type; |
| 55 | private TimePickerView pvTime; | 55 | private TimePickerView pvTime; |
| 56 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; | 56 | private EditText tv_username1, tv_useinfo_adress1, tv_useinfo_qq; |
| 57 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; | 57 | private TextView tv_sex, tv_useinfo_adress, tv_useinfo_birthday, tv_useinfo_school, tv_useinfo_gender; |
| 58 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 58 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; |
| 59 | 59 | ||
| 60 | public static PresonInfoFragment newInstance(int type) { | 60 | public static PresonInfoFragment newInstance(int type) { |
| 61 | PresonInfoFragment fragment = new PresonInfoFragment(); | 61 | PresonInfoFragment fragment = new PresonInfoFragment(); |
| 62 | Bundle bundle = new Bundle(); | 62 | Bundle bundle = new Bundle(); |
| 63 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); | 63 | bundle.putSerializable(TABLAYOUT_FRAGMENT, type); |
| 64 | fragment.setArguments(bundle); | 64 | fragment.setArguments(bundle); |
| 65 | return fragment; | 65 | return fragment; |
| 66 | 66 | ||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | @Override | 69 | @Override |
| 70 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 70 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 71 | if (mView == null) { | 71 | if (mView == null) { |
| 72 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); | 72 | mView = inflater.inflate(R.layout.fragment_changge_presonal_info, container, false); |
| 73 | initView(mView); | 73 | initView(mView); |
| 74 | initData(); | 74 | initData(); |
| 75 | setLister(); | 75 | setLister(); |
| 76 | initTimePicker(); | 76 | initTimePicker(); |
| 77 | 77 | ||
| 78 | 78 | ||
| 79 | } | 79 | } |
| 80 | return mView; | 80 | return mView; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | //初始化 | 83 | //初始化 |
| 84 | private void initView(View mView) { | 84 | private void initView(View mView) { |
| 85 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); | 85 | tv_username1 = (EditText) mView.findViewById(R.id.tv_username1); |
| 86 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); | 86 | tv_useinfo_adress1 = (EditText) mView.findViewById(R.id.tv_useinfo_adress1); |
| 87 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); | 87 | tv_useinfo_qq = (EditText) mView.findViewById(R.id.tv_useinfo_qq); |
| 88 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); | 88 | tv_sex = (TextView) mView.findViewById(R.id.tv_sex); |
| 89 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); | 89 | tv_useinfo_adress = (TextView) mView.findViewById(R.id.tv_useinfo_adress); |
| 90 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); | 90 | tv_useinfo_birthday = (TextView) mView.findViewById(R.id.tv_useinfo_birthday); |
| 91 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); | 91 | tv_useinfo_school = (TextView) mView.findViewById(R.id.tv_useinfo_school); |
| 92 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); | 92 | tv_useinfo_gender = (TextView) mView.findViewById(R.id.tv_useinfo_gender); |
| 93 | 93 | ||
| 94 | 94 | ||
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | private void initData() { | 97 | private void initData() { |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | private void setLister() { | 100 | private void setLister() { |
| 101 | tv_sex.setOnClickListener(this); | 101 | tv_sex.setOnClickListener(this); |
| 102 | tv_useinfo_adress.setOnClickListener(this); | 102 | tv_useinfo_adress.setOnClickListener(this); |
| 103 | tv_useinfo_birthday.setOnClickListener(this); | 103 | tv_useinfo_birthday.setOnClickListener(this); |
| 104 | tv_useinfo_school.setOnClickListener(this); | 104 | tv_useinfo_school.setOnClickListener(this); |
| 105 | tv_useinfo_gender.setOnClickListener(this); | 105 | tv_useinfo_gender.setOnClickListener(this); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | @Override | 108 | @Override |
| 109 | public void onClick(View v) { | 109 | public void onClick(View v) { |
| 110 | String presonal1 = tv_username1.getText().toString().trim(); | 110 | String presonal1 = tv_username1.getText().toString().trim(); |
| 111 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); | 111 | String presonal2 = tv_useinfo_adress1.getText().toString().trim(); |
| 112 | String presonal3 = tv_sex.getText().toString().trim(); | 112 | String presonal3 = tv_sex.getText().toString().trim(); |
| 113 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); | 113 | String presonal4 = tv_useinfo_adress.getText().toString().trim(); |
| 114 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); | 114 | String presonal5 = tv_useinfo_birthday.getText().toString().trim(); |
| 115 | String presonal6 = tv_useinfo_school.getText().toString().trim(); | 115 | String presonal6 = tv_useinfo_school.getText().toString().trim(); |
| 116 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); | 116 | String presonal7 = tv_useinfo_gender.getText().toString().trim(); |
| 117 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); | 117 | String presonal8 = tv_useinfo_qq.getText().toString().trim(); |
| 118 | switch (v.getId()) { | 118 | switch (v.getId()) { |
| 119 | case R.id.tv_sex: | 119 | case R.id.tv_sex: |
| 120 | final String[] items = {"男", "女"}; | 120 | final String[] items = {"男", "女"}; |
| 121 | new CircleDialog.Builder(getActivity()) | 121 | new CircleDialog.Builder(getActivity()) |
| 122 | .configDialog(new ConfigDialog() { | 122 | .configDialog(new ConfigDialog() { |
| 123 | @Override | 123 | @Override |
| 124 | public void onConfig(DialogParams params) { | 124 | public void onConfig(DialogParams params) { |
| 125 | //增加弹出动画 | 125 | //增加弹出动画 |
| 126 | params.gravity = Gravity.CENTER; | 126 | params.gravity = Gravity.CENTER; |
| 127 | } | 127 | } |
| 128 | }) | 128 | }) |
| 129 | .setTitle("请选择性别") | 129 | .setTitle("请选择性别") |
| 130 | .setWidth(0.5f) | 130 | .setWidth(0.5f) |
| 131 | .setItems(items, new AdapterView.OnItemClickListener() { | 131 | .setItems(items, new AdapterView.OnItemClickListener() { |
| 132 | @Override | 132 | @Override |
| 133 | public void onItemClick(AdapterView<?> parent, View view, int | 133 | public void onItemClick(AdapterView<?> parent, View view, int |
| 134 | position, long id) { | 134 | position, long id) { |
| 135 | switch (position) { | 135 | switch (position) { |
| 136 | case 0: | 136 | case 0: |
| 137 | tv_sex.setText("男"); | 137 | tv_sex.setText("男"); |
| 138 | break; | 138 | break; |
| 139 | case 1: | 139 | case 1: |
| 140 | tv_sex.setText("女"); | 140 | tv_sex.setText("女"); |
| 141 | break; | 141 | break; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | } | 144 | } |
| 145 | }) | 145 | }) |
| 146 | .setNegative("取消", null) | 146 | .setNegative("取消", null) |
| 147 | .configNegative(new ConfigButton() { | 147 | .configNegative(new ConfigButton() { |
| 148 | @Override | 148 | @Override |
| 149 | public void onConfig(ButtonParams params) { | 149 | public void onConfig(ButtonParams params) { |
| 150 | //取消按钮字体颜色 | 150 | //取消按钮字体颜色 |
| 151 | params.textColor = Color.RED; | 151 | params.textColor = Color.RED; |
| 152 | } | 152 | } |
| 153 | }) | 153 | }) |
| 154 | .show(); | 154 | .show(); |
| 155 | break; | 155 | break; |
| 156 | case R.id.tv_useinfo_adress: | 156 | case R.id.tv_useinfo_adress: |
| 157 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); | 157 | ProvinceListDialog.getInstance((DialogCallBack.ProvincesCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "ProvinceListDialog"); |
| 158 | break; | 158 | break; |
| 159 | case R.id.tv_useinfo_birthday: | 159 | case R.id.tv_useinfo_birthday: |
| 160 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view | 160 | pvTime.show(tv_useinfo_birthday);//弹出时间选择器,传递参数过去,回调的时候则可以绑定此view |
| 161 | break; | 161 | break; |
| 162 | case R.id.tv_useinfo_school: | 162 | case R.id.tv_useinfo_school: |
| 163 | if (TextUtils.isEmpty(presonal4) || | 163 | if (TextUtils.isEmpty(presonal4) || |
| 164 | TextUtils.isEmpty(presonal7)) { | 164 | TextUtils.isEmpty(presonal7)) { |
| 165 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); | 165 | AlertUtils.showToast(getActivity(), "请先选择地区和年级!"); |
| 166 | return; | 166 | return; |
| 167 | } else { | 167 | } else { |
| 168 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); | 168 | SchoolListDialog.getInstance((DialogCallBack.SchoolCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "SchoolListDialog"); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | 171 | ||
| 172 | break; | 172 | break; |
| 173 | case R.id.tv_useinfo_gender: | 173 | case R.id.tv_useinfo_gender: |
| 174 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); | 174 | GradeListDialog.getInstance((DialogCallBack.GradeCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "GradeListDialog"); |
| 175 | break; | 175 | break; |
| 176 | case R.id.presonal_sub: | 176 | case R.id.presonal_sub: |
| 177 | if (TextUtils.isEmpty(presonal1) || | 177 | if (TextUtils.isEmpty(presonal1) || |
| 178 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || | 178 | TextUtils.isEmpty(presonal2) || TextUtils.isEmpty(presonal3) || TextUtils.isEmpty(presonal4) || |
| 179 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal6) || TextUtils.isEmpty(presonal7) || | 179 | TextUtils.isEmpty(presonal5) || TextUtils.isEmpty(presonal7) || |
| 180 | TextUtils.isEmpty(presonal8)) { | 180 | TextUtils.isEmpty(presonal8)) { |
| 181 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); | 181 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); |
| 182 | return; | 182 | return; |
| 183 | } else { | 183 | } else { |
| 184 | 184 | ||
| 185 | int a = 0, b = 0; | 185 | int a = 0, b = 0; |
| 186 | long c = 0; | 186 | long c = 0; |
| 187 | //保存星座 | 187 | //保存星座 |
| 188 | BrithdayStar brithdayStar = new BrithdayStar(); | 188 | BrithdayStar brithdayStar = new BrithdayStar(); |
| 189 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); | 189 | String s = brithdayStar.getConstellations(tv_useinfo_birthday.getText().toString()); |
| 190 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); | 190 | SaveParam.getInstance().saveLoginParam(getActivity(), SaveParam.CONSTELLATION, s); |
| 191 | 191 | ||
| 192 | ChangeInfo changeinfo = new ChangeInfo(); | 192 | ChangeInfo changeinfo = new ChangeInfo(); |
| 193 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); | 193 | String regionId = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.COUNTRY); |
| 194 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); | 194 | String regionId1 = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.CITYS); |
| 195 | if (regionId == null) { | 195 | if (regionId == null) { |
| 196 | regionId = regionId1; | 196 | regionId = regionId1; |
| 197 | } | 197 | } |
| 198 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 198 | String grade = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
| 199 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); | 199 | String schoolid = SaveParam.getInstance().getLoginParam(getActivity(), SaveParam.GRADENS); |
| 200 | ChangeInfo.SchoolBean changeinfo2 = new ChangeInfo.SchoolBean(); | 200 | ChangeInfo.SchoolBean changeinfo2 = new ChangeInfo.SchoolBean(); |
| 201 | try { | 201 | try { |
| 202 | a = Integer.parseInt(regionId); | 202 | a = Integer.parseInt(regionId); |
| 203 | b = Integer.parseInt(grade); | 203 | b = Integer.parseInt(grade); |
| 204 | c = Long.parseLong(schoolid); | 204 | c = Long.parseLong(schoolid); |
| 205 | } catch (NumberFormatException e) { | 205 | } catch (NumberFormatException e) { |
| 206 | e.printStackTrace(); | 206 | e.printStackTrace(); |
| 207 | } | 207 | } |
| 208 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); | 208 | String userID = SaveParam.getInstance().getLoginParam(getActivity(), "userId"); |
| 209 | 209 | ||
| 210 | changeinfo.setId(userID); | 210 | changeinfo.setId(userID); |
| 211 | changeinfo.setNickname(presonal1); | 211 | changeinfo.setNickname(presonal1); |
| 212 | changeinfo.setRegionId(a); | 212 | changeinfo.setRegionId(a); |
| 213 | changeinfo.setGradeId(b); | 213 | changeinfo.setGradeId(b); |
| 214 | changeinfo2.setSchoolId(c); | 214 | changeinfo2.setSchoolId(c); |
| 215 | if ("男".equals(presonal3)) { | 215 | if ("男".equals(presonal3)) { |
| 216 | changeinfo.setGender("0"); | 216 | changeinfo.setGender("0"); |
| 217 | } else { | 217 | } else { |
| 218 | changeinfo.setGender("1"); | 218 | changeinfo.setGender("1"); |
| 219 | } | 219 | } |
| 220 | changeinfo.setBirthday(presonal5); | 220 | changeinfo.setBirthday(presonal5); |
| 221 | ChangeInfo.ContactBean changeinfo1 = new ChangeInfo.ContactBean(); | 221 | ChangeInfo.ContactBean changeinfo1 = new ChangeInfo.ContactBean(); |
| 222 | changeinfo1.setQq(presonal8); | 222 | changeinfo1.setQq(presonal8); |
| 223 | changeinfo.setRegionName(presonal4 + presonal2); | 223 | changeinfo.setRegionName(presonal4 + presonal2); |
| 224 | changeinfo.setSchool(changeinfo2); | 224 | changeinfo.setSchool(changeinfo2); |
| 225 | changeinfo.setContact(changeinfo1); | 225 | changeinfo.setContact(changeinfo1); |
| 226 | 226 | ||
| 227 | try { | 227 | try { |
| 228 | //提交个人信息 | 228 | //提交个人信息 |
| 229 | HttpManager.getInstance().changepresonalinfo(getActivity(), changeinfo); | 229 | HttpManager.getInstance().changepresonalinfo(getActivity(), changeinfo); |
| 230 | } catch (UnsupportedEncodingException e) { | 230 | } catch (UnsupportedEncodingException e) { |
| 231 | e.printStackTrace(); | 231 | e.printStackTrace(); |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | 234 | ||
| 235 | break; | 235 | break; |
| 236 | } | 236 | } |
| 237 | } | 237 | } |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | //自定义时间选择器 | 240 | //自定义时间选择器 |
| 241 | private void initTimePicker() { | 241 | private void initTimePicker() { |
| 242 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | 242 | //控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) |
| 243 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | 243 | //因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 |
| 244 | // Calendar selectedDate = Calendar.getInstance(); | 244 | // Calendar selectedDate = Calendar.getInstance(); |
| 245 | // Calendar startDate = Calendar.getInstance(); | 245 | // Calendar startDate = Calendar.getInstance(); |
| 246 | // startDate.set(1900, 1, 1); | 246 | // startDate.set(1900, 1, 1); |
| 247 | // Calendar endDate = Calendar.getInstance(); | 247 | // Calendar endDate = Calendar.getInstance(); |
| 248 | // endDate.set(2100, 1, 1); | 248 | // endDate.set(2100, 1, 1); |
| 249 | //时间选择器 | 249 | //时间选择器 |
| 250 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { | 250 | pvTime = new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() { |
| 251 | @Override | 251 | @Override |
| 252 | public void onTimeSelect(Date date, View v) {//选中事件回调 | 252 | public void onTimeSelect(Date date, View v) {//选中事件回调 |
| 253 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | 253 | // 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null |
| 254 | /*btn_Time.setText(getTime(date));*/ | 254 | /*btn_Time.setText(getTime(date));*/ |
| 255 | TextView btn = (TextView) v; | 255 | TextView btn = (TextView) v; |
| 256 | btn.setText(getTime(date)); | 256 | btn.setText(getTime(date)); |
| 257 | } | 257 | } |
| 258 | }) | 258 | }) |
| 259 | //年月日时分秒 的显示与否,不设置则默认全部显示 | 259 | //年月日时分秒 的显示与否,不设置则默认全部显示 |
| 260 | .setType(new boolean[]{true, true, true, false, false, false}) | 260 | .setType(new boolean[]{true, true, true, false, false, false}) |
| 261 | .setLabel("", "", "", "", "", "") | 261 | .setLabel("", "", "", "", "", "") |
| 262 | .isCenterLabel(false) | 262 | .isCenterLabel(false) |
| 263 | .setDividerColor(Color.DKGRAY) | 263 | .setDividerColor(Color.DKGRAY) |
| 264 | .setContentSize(21) | 264 | .setContentSize(21) |
| 265 | // .setDate(selectedDate) | 265 | // .setDate(selectedDate) |
| 266 | // .setRangDate(startDate, endDate) | 266 | // .setRangDate(startDate, endDate) |
| 267 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 | 267 | .setBackgroundId(0x80000000) //设置外部遮罩颜色 |
| 268 | .setDecorView(null) | 268 | .setDecorView(null) |
| 269 | .setTitleText("购买日期") | 269 | .setTitleText("购买日期") |
| 270 | .setTitleSize(22) | 270 | .setTitleSize(22) |
| 271 | .setCancelColor(Color.GRAY) | 271 | .setCancelColor(Color.GRAY) |
| 272 | .setSubCalSize(22) | 272 | .setSubCalSize(22) |
| 273 | .setDividerColor(Color.GRAY) | 273 | .setDividerColor(Color.GRAY) |
| 274 | .setSubmitColor(Color.GRAY) | 274 | .setSubmitColor(Color.GRAY) |
| 275 | .build(); | 275 | .build(); |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | private String getTime(Date date) {//可根据需要自行截取数据显示 | 278 | private String getTime(Date date) {//可根据需要自行截取数据显示 |
| 279 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | 279 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| 280 | return format.format(date); | 280 | return format.format(date); |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | @Override | 283 | @Override |
| 284 | public void onAttach(Activity activity) { | 284 | public void onAttach(Activity activity) { |
| 285 | super.onAttach(activity); | 285 | super.onAttach(activity); |
| 286 | View rootView = activity.getWindow().getDecorView(); | 286 | View rootView = activity.getWindow().getDecorView(); |
| 287 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); | 287 | TextView sub = (TextView) rootView.findViewById(R.id.presonal_sub); |
| 288 | sub.setOnClickListener(this); | 288 | sub.setOnClickListener(this); |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | @Override | 291 | @Override |
| 292 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { | 292 | public void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type) { |
| 293 | String regionName = data.get(position).getRegionName(); | 293 | String regionName = data.get(position).getRegionName(); |
| 294 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 294 | String provice = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
| 295 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); | 295 | SaveParam.getInstance().saveLoginParam(getActivity(), "shi", regionName); |
| 296 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); | 296 | CountryDialog.getInstance((DialogCallBack.CountryCallBack) this).show(getChildFragmentManager(), "CountryDialog"); |
| 297 | tv_useinfo_adress.setText(""); | 297 | tv_useinfo_adress.setText(""); |
| 298 | tv_useinfo_adress.setText(provice + regionName); | 298 | tv_useinfo_adress.setText(provice + regionName); |
| 299 | 299 | ||
| 300 | 300 | ||
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | @Override | 303 | @Override |
| 304 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { | 304 | public void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type) { |
| 305 | String regionName = data.get(position).getRegionName(); | 305 | String regionName = data.get(position).getRegionName(); |
| 306 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); | 306 | String provices = SaveParam.getInstance().getLoginParam(getActivity(), "sheng"); |
| 307 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); | 307 | String citys = SaveParam.getInstance().getLoginParam(getActivity(), "shi"); |
| 308 | tv_useinfo_adress.setText(""); | 308 | tv_useinfo_adress.setText(""); |
| 309 | tv_useinfo_adress.setText(provices + citys + regionName); | 309 | tv_useinfo_adress.setText(provices + citys + regionName); |
| 310 | 310 | ||
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | @Override | 313 | @Override |
| 314 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { | 314 | public void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type) { |
| 315 | String regionName = data.get(position).getName(); | 315 | String regionName = data.get(position).getName(); |
| 316 | tv_useinfo_gender.setText(regionName); | 316 | tv_useinfo_gender.setText(regionName); |
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | @Override | 319 | @Override |
| 320 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { | 320 | public void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type) { |
| 321 | String regionName = data.get(position).getRegionName(); | 321 | String regionName = data.get(position).getRegionName(); |
| 322 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); | 322 | SaveParam.getInstance().saveLoginParam(getActivity(), "sheng", regionName); |
| 323 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); | 323 | CitysListDialog.getInstance((DialogCallBack.CitysCallBack) PresonInfoFragment.this).show(getChildFragmentManager(), "CitysListDialog"); |
| 324 | 324 | ||
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | @Override | 327 | @Override |
| 328 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { | 328 | public void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type) { |
| 329 | String regionName = data.get(position).getSchoolName(); | 329 | String regionName = data.get(position).getSchoolName(); |
| 330 | tv_useinfo_school.setText(regionName); | 330 | tv_useinfo_school.setText(regionName); |
| 331 | 331 | ||
| 332 | 332 | ||
| 333 | } | 333 | } |
| 334 | } | 334 | } |
| 335 | 335 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
| 1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.app.ProgressDialog; | 4 | import android.app.ProgressDialog; |
| 5 | import android.content.ComponentName; | 5 | import android.content.ComponentName; |
| 6 | import android.content.Context; | 6 | import android.content.Context; |
| 7 | import android.content.Intent; | 7 | import android.content.Intent; |
| 8 | import android.os.Handler; | 8 | import android.os.Handler; |
| 9 | import android.os.Message; | 9 | import android.os.Message; |
| 10 | import android.provider.Settings; | 10 | import android.provider.Settings; |
| 11 | import android.support.v4.app.FragmentActivity; | 11 | import android.support.v4.app.FragmentActivity; |
| 12 | import android.util.Log; | 12 | import android.util.Log; |
| 13 | import android.view.Gravity; | 13 | import android.view.Gravity; |
| 14 | import android.view.View; | 14 | import android.view.View; |
| 15 | import android.widget.Toast; | 15 | import android.widget.Toast; |
| 16 | 16 | ||
| 17 | import com.google.gson.Gson; | 17 | import com.google.gson.Gson; |
| 18 | import com.hjx.personalcenter.R; | 18 | import com.hjx.personalcenter.R; |
| 19 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | 19 | import com.hjx.personalcenter.activity.LoginAndRegisterActivity; |
| 20 | import com.hjx.personalcenter.activity.TheStartPageActivity; | 20 | import com.hjx.personalcenter.activity.TheStartPageActivity; |
| 21 | import com.hjx.personalcenter.db.SaveParam; | 21 | import com.hjx.personalcenter.db.SaveParam; |
| 22 | import com.hjx.personalcenter.gson.GsonTool; | 22 | import com.hjx.personalcenter.gson.GsonTool; |
| 23 | import com.hjx.personalcenter.model.CardInfo; | 23 | import com.hjx.personalcenter.model.CardInfo; |
| 24 | import com.hjx.personalcenter.model.CityInfo; | 24 | import com.hjx.personalcenter.model.CityInfo; |
| 25 | import com.hjx.personalcenter.model.CountyInfo; | 25 | import com.hjx.personalcenter.model.CountyInfo; |
| 26 | import com.hjx.personalcenter.model.GradeInfo; | 26 | import com.hjx.personalcenter.model.GradeInfo; |
| 27 | import com.hjx.personalcenter.model.PesonalInfo; | 27 | import com.hjx.personalcenter.model.PesonalInfo; |
| 28 | import com.hjx.personalcenter.model.ProvinceInfo; | 28 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 29 | import com.hjx.personalcenter.model.SchoolInfo; | 29 | import com.hjx.personalcenter.model.SchoolInfo; |
| 30 | import com.hjx.personalcenter.model.SignInfo; | 30 | import com.hjx.personalcenter.model.SignInfo; |
| 31 | import com.hjx.personalcenter.util.DialogPermission; | 31 | import com.hjx.personalcenter.util.DialogPermission; |
| 32 | import com.loopj.android.http.AsyncHttpResponseHandler; | 32 | import com.loopj.android.http.AsyncHttpResponseHandler; |
| 33 | import com.loopj.android.http.JsonHttpResponseHandler; | 33 | import com.loopj.android.http.JsonHttpResponseHandler; |
| 34 | import com.loopj.android.http.RequestParams; | 34 | import com.loopj.android.http.RequestParams; |
| 35 | import com.mylhyl.circledialog.CircleDialog; | 35 | import com.mylhyl.circledialog.CircleDialog; |
| 36 | import com.mylhyl.circledialog.callback.ConfigText; | 36 | import com.mylhyl.circledialog.callback.ConfigText; |
| 37 | import com.mylhyl.circledialog.params.TextParams; | 37 | import com.mylhyl.circledialog.params.TextParams; |
| 38 | 38 | ||
| 39 | import org.apache.http.Header; | 39 | import org.apache.http.Header; |
| 40 | import org.apache.http.entity.ByteArrayEntity; | 40 | import org.apache.http.entity.ByteArrayEntity; |
| 41 | import org.apache.http.message.BasicHeader; | 41 | import org.apache.http.message.BasicHeader; |
| 42 | import org.apache.http.protocol.HTTP; | 42 | import org.apache.http.protocol.HTTP; |
| 43 | import org.json.JSONException; | 43 | import org.json.JSONException; |
| 44 | import org.json.JSONObject; | 44 | import org.json.JSONObject; |
| 45 | 45 | ||
| 46 | import java.io.UnsupportedEncodingException; | 46 | import java.io.UnsupportedEncodingException; |
| 47 | import java.util.ArrayList; | 47 | import java.util.ArrayList; |
| 48 | import java.util.List; | 48 | import java.util.List; |
| 49 | 49 | ||
| 50 | public class HttpManager { | 50 | public class HttpManager { |
| 51 | private static HttpManager instance; | 51 | private static HttpManager instance; |
| 52 | private ProgressDialog mProgress = null; | 52 | private ProgressDialog mProgress = null; |
| 53 | 53 | ||
| 54 | public static HttpManager getInstance() { | 54 | public static HttpManager getInstance() { |
| 55 | if (instance == null) { | 55 | if (instance == null) { |
| 56 | instance = new HttpManager(); | 56 | instance = new HttpManager(); |
| 57 | } | 57 | } |
| 58 | return instance; | 58 | return instance; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | 61 | ||
| 62 | //登录接口 | 62 | //登录接口 |
| 63 | 63 | ||
| 64 | public void login(final String username, final String password, final Context mContext, final Handler handler) { | 64 | public void login(final String username, final String password, final Context mContext, final Handler handler) { |
| 65 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", | 65 | mProgress = DialogPermission.showProgress(mContext, null, "正在登录...", |
| 66 | false, true, null); | 66 | false, true, null); |
| 67 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 67 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 68 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { | 68 | HttpClient.getInstance().get(HttpUrl.loginUrl + "?username=" + username + "&password=" + password, new AsyncHttpResponseHandler() { |
| 69 | @Override | 69 | @Override |
| 70 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 70 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 71 | closeProgress(); | 71 | closeProgress(); |
| 72 | Message msg = Message.obtain(); | 72 | Message msg = Message.obtain(); |
| 73 | msg.what = HttpCode.LOGIN_SUCESS; | 73 | msg.what = HttpCode.LOGIN_SUCESS; |
| 74 | msg.obj = new String(arg2); | 74 | msg.obj = new String(arg2); |
| 75 | handler.sendMessage(msg); | 75 | handler.sendMessage(msg); |
| 76 | 76 | ||
| 77 | 77 | ||
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | @Override | 80 | @Override |
| 81 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 81 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 82 | closeProgress(); | 82 | closeProgress(); |
| 83 | new CircleDialog.Builder((FragmentActivity) mContext) | 83 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 84 | .setCanceledOnTouchOutside(false) | 84 | .setCanceledOnTouchOutside(false) |
| 85 | .setCancelable(false) | 85 | .setCancelable(false) |
| 86 | .setWidth(0.5f) | 86 | .setWidth(0.5f) |
| 87 | .configText(new ConfigText() { | 87 | .configText(new ConfigText() { |
| 88 | @Override | 88 | @Override |
| 89 | public void onConfig(TextParams params) { | 89 | public void onConfig(TextParams params) { |
| 90 | params.gravity = Gravity.CENTER; | 90 | params.gravity = Gravity.CENTER; |
| 91 | params.padding = new int[]{50, 50, 50, 50}; | 91 | params.padding = new int[]{50, 50, 50, 50}; |
| 92 | } | 92 | } |
| 93 | }) | 93 | }) |
| 94 | .setText("当前无网络,请检查网络设置") | 94 | .setText("当前无网络,请检查网络设置") |
| 95 | .setNegative("继续使用", null) | 95 | .setNegative("继续使用", null) |
| 96 | .setPositive("设置网络", new View.OnClickListener() { | 96 | .setPositive("设置网络", new View.OnClickListener() { |
| 97 | @Override | 97 | @Override |
| 98 | public void onClick(View v) { | 98 | public void onClick(View v) { |
| 99 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 99 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 100 | mContext.startActivity(intent); | 100 | mContext.startActivity(intent); |
| 101 | } | 101 | } |
| 102 | }) | 102 | }) |
| 103 | .show(); | 103 | .show(); |
| 104 | } | 104 | } |
| 105 | }); | 105 | }); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | //注册接口 | 108 | //注册接口 |
| 109 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { | 109 | public void register(final Context context, String username, String password, String smscode, String source, final Handler handler) { |
| 110 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", | 110 | mProgress = DialogPermission.showProgress(context, null, "正在注册...", |
| 111 | false, true, null); | 111 | false, true, null); |
| 112 | JSONObject jsonObject = new JSONObject(); | 112 | JSONObject jsonObject = new JSONObject(); |
| 113 | ByteArrayEntity entity = null; | 113 | ByteArrayEntity entity = null; |
| 114 | try { | 114 | try { |
| 115 | jsonObject.put(HttpKey.USERNAME, username); | 115 | jsonObject.put(HttpKey.USERNAME, username); |
| 116 | jsonObject.put(HttpKey.PASSWORD, password); | 116 | jsonObject.put(HttpKey.PASSWORD, password); |
| 117 | jsonObject.put(HttpKey.SMSCODE, smscode); | 117 | jsonObject.put(HttpKey.SMSCODE, smscode); |
| 118 | jsonObject.put(HttpKey.SOURCE, source); | 118 | jsonObject.put(HttpKey.SOURCE, source); |
| 119 | Log.e("test", "jsonObject" + jsonObject); | 119 | Log.e("test", "jsonObject" + jsonObject); |
| 120 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); | 120 | entity = new ByteArrayEntity(jsonObject.toString().getBytes("UTF-8")); |
| 121 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 121 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
| 122 | } catch (JSONException e) { | 122 | } catch (JSONException e) { |
| 123 | e.printStackTrace(); | 123 | e.printStackTrace(); |
| 124 | } catch (UnsupportedEncodingException e) { | 124 | } catch (UnsupportedEncodingException e) { |
| 125 | e.printStackTrace(); | 125 | e.printStackTrace(); |
| 126 | } | 126 | } |
| 127 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 127 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 128 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { | 128 | HttpClient.getInstance().post(context, HttpUrl.registeredUrl, entity, "application/json", new JsonHttpResponseHandler() { |
| 129 | @Override | 129 | @Override |
| 130 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 130 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 131 | super.onSuccess(statusCode, headers, response); | 131 | super.onSuccess(statusCode, headers, response); |
| 132 | closeProgress(); | 132 | closeProgress(); |
| 133 | Log.e("test", "onSuccess" + response); | 133 | Log.e("test", "onSuccess" + response); |
| 134 | Message msg = Message.obtain(); | 134 | Message msg = Message.obtain(); |
| 135 | msg.what = HttpCode.REGISTERED_SUCESS; | 135 | msg.what = HttpCode.REGISTERED_SUCESS; |
| 136 | msg.obj = response; | 136 | msg.obj = response; |
| 137 | handler.sendMessage(msg); | 137 | handler.sendMessage(msg); |
| 138 | 138 | ||
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | @Override | 141 | @Override |
| 142 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 142 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 143 | super.onFailure(statusCode, headers, throwable, errorResponse); | 143 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 144 | closeProgress(); | 144 | closeProgress(); |
| 145 | Log.e("test", "onFailure" + errorResponse); | 145 | Log.e("test", "onFailure" + errorResponse); |
| 146 | new CircleDialog.Builder((FragmentActivity) context) | 146 | new CircleDialog.Builder((FragmentActivity) context) |
| 147 | .setCanceledOnTouchOutside(false) | 147 | .setCanceledOnTouchOutside(false) |
| 148 | .setCancelable(false) | 148 | .setCancelable(false) |
| 149 | .setWidth(0.5f) | 149 | .setWidth(0.5f) |
| 150 | .configText(new ConfigText() { | 150 | .configText(new ConfigText() { |
| 151 | @Override | 151 | @Override |
| 152 | public void onConfig(TextParams params) { | 152 | public void onConfig(TextParams params) { |
| 153 | params.gravity = Gravity.CENTER; | 153 | params.gravity = Gravity.CENTER; |
| 154 | params.padding = new int[]{50, 50, 50, 50}; | 154 | params.padding = new int[]{50, 50, 50, 50}; |
| 155 | } | 155 | } |
| 156 | }) | 156 | }) |
| 157 | .setText("当前无网络,请检查网络设置") | 157 | .setText("当前无网络,请检查网络设置") |
| 158 | .setNegative("继续使用", null) | 158 | .setNegative("继续使用", null) |
| 159 | .setPositive("设置网络", new View.OnClickListener() { | 159 | .setPositive("设置网络", new View.OnClickListener() { |
| 160 | @Override | 160 | @Override |
| 161 | public void onClick(View v) { | 161 | public void onClick(View v) { |
| 162 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 162 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 163 | context.startActivity(intent); | 163 | context.startActivity(intent); |
| 164 | } | 164 | } |
| 165 | }) | 165 | }) |
| 166 | .show(); | 166 | .show(); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | }); | 169 | }); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | //注册验证码 | 172 | //注册验证码 |
| 173 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { | 173 | public void authCode(final String type, final String mobile, final Handler handler, final Context mContext) { |
| 174 | RequestParams params = new RequestParams(); | 174 | RequestParams params = new RequestParams(); |
| 175 | params.put(HttpKey.TYPE, type); | 175 | params.put(HttpKey.TYPE, type); |
| 176 | params.put(HttpKey.MOBIL, mobile); | 176 | params.put(HttpKey.MOBIL, mobile); |
| 177 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 177 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 178 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { | 178 | HttpClient.getInstance().post(HttpUrl.authCodedUrl, params, new JsonHttpResponseHandler() { |
| 179 | 179 | ||
| 180 | @Override | 180 | @Override |
| 181 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 181 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 182 | Log.e("test", "onSuccess-----" + response); | 182 | Log.e("test", "onSuccess-----" + response); |
| 183 | Message msg = Message.obtain(); | 183 | Message msg = Message.obtain(); |
| 184 | msg.what = HttpCode.AUTHCODE_SUCESS; | 184 | msg.what = HttpCode.AUTHCODE_SUCESS; |
| 185 | msg.obj = response; | 185 | msg.obj = response; |
| 186 | handler.sendMessage(msg); | 186 | handler.sendMessage(msg); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | @Override | 189 | @Override |
| 190 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 190 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 191 | new CircleDialog.Builder((FragmentActivity) mContext) | 191 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 192 | .setCanceledOnTouchOutside(false) | 192 | .setCanceledOnTouchOutside(false) |
| 193 | .setCancelable(false) | 193 | .setCancelable(false) |
| 194 | .setWidth(0.5f) | 194 | .setWidth(0.5f) |
| 195 | .configText(new ConfigText() { | 195 | .configText(new ConfigText() { |
| 196 | @Override | 196 | @Override |
| 197 | public void onConfig(TextParams params) { | 197 | public void onConfig(TextParams params) { |
| 198 | params.gravity = Gravity.CENTER; | 198 | params.gravity = Gravity.CENTER; |
| 199 | params.padding = new int[]{50, 50, 50, 50}; | 199 | params.padding = new int[]{50, 50, 50, 50}; |
| 200 | } | 200 | } |
| 201 | }) | 201 | }) |
| 202 | .setText("当前无网络,请检查网络设置") | 202 | .setText("当前无网络,请检查网络设置") |
| 203 | .setNegative("继续使用", null) | 203 | .setNegative("继续使用", null) |
| 204 | .setPositive("设置网络", new View.OnClickListener() { | 204 | .setPositive("设置网络", new View.OnClickListener() { |
| 205 | @Override | 205 | @Override |
| 206 | public void onClick(View v) { | 206 | public void onClick(View v) { |
| 207 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 207 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 208 | mContext.startActivity(intent); | 208 | mContext.startActivity(intent); |
| 209 | } | 209 | } |
| 210 | }) | 210 | }) |
| 211 | .show(); | 211 | .show(); |
| 212 | } | 212 | } |
| 213 | }); | 213 | }); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | 216 | ||
| 217 | //手机号是否注册 | 217 | //手机号是否注册 |
| 218 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { | 218 | public void isregistered(final String mobile, final Handler handler, final Context mContext) { |
| 219 | RequestParams params = new RequestParams(); | 219 | RequestParams params = new RequestParams(); |
| 220 | params.put(HttpKey.USERNAME, mobile); | 220 | params.put(HttpKey.USERNAME, mobile); |
| 221 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { | 221 | HttpClient.getInstance().get(HttpUrl.isRegiterUrl + "?mobile=" + mobile, new JsonHttpResponseHandler() { |
| 222 | @Override | 222 | @Override |
| 223 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 223 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 224 | Log.e("test", "isregistered" + response.toString()); | 224 | Log.e("test", "isregistered" + response.toString()); |
| 225 | Message msg = Message.obtain(); | 225 | Message msg = Message.obtain(); |
| 226 | msg.what = HttpCode.IS_REFISTER; | 226 | msg.what = HttpCode.IS_REFISTER; |
| 227 | msg.obj = response; | 227 | msg.obj = response; |
| 228 | handler.sendMessage(msg); | 228 | handler.sendMessage(msg); |
| 229 | 229 | ||
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | @Override | 232 | @Override |
| 233 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 233 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 234 | new CircleDialog.Builder((FragmentActivity) mContext) | 234 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 235 | .setCanceledOnTouchOutside(false) | 235 | .setCanceledOnTouchOutside(false) |
| 236 | .setCancelable(false) | 236 | .setCancelable(false) |
| 237 | .setWidth(0.5f) | 237 | .setWidth(0.5f) |
| 238 | .configText(new ConfigText() { | 238 | .configText(new ConfigText() { |
| 239 | @Override | 239 | @Override |
| 240 | public void onConfig(TextParams params) { | 240 | public void onConfig(TextParams params) { |
| 241 | params.gravity = Gravity.CENTER; | 241 | params.gravity = Gravity.CENTER; |
| 242 | params.padding = new int[]{50, 50, 50, 50}; | 242 | params.padding = new int[]{50, 50, 50, 50}; |
| 243 | } | 243 | } |
| 244 | }) | 244 | }) |
| 245 | .setText("当前无网络,请检查网络设置") | 245 | .setText("当前无网络,请检查网络设置") |
| 246 | .setNegative("继续使用", null) | 246 | .setNegative("继续使用", null) |
| 247 | .setPositive("设置网络", new View.OnClickListener() { | 247 | .setPositive("设置网络", new View.OnClickListener() { |
| 248 | @Override | 248 | @Override |
| 249 | public void onClick(View v) { | 249 | public void onClick(View v) { |
| 250 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 250 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 251 | mContext.startActivity(intent); | 251 | mContext.startActivity(intent); |
| 252 | } | 252 | } |
| 253 | }) | 253 | }) |
| 254 | .show(); | 254 | .show(); |
| 255 | 255 | ||
| 256 | } | 256 | } |
| 257 | }); | 257 | }); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | //修改密码 | 260 | //修改密码 |
| 261 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { | 261 | public void changepwd(final Context context, String username, String old_pwd1, String newpassword3) { |
| 262 | RequestParams params = new RequestParams(); | 262 | RequestParams params = new RequestParams(); |
| 263 | params.put(HttpKey.USERNAME, username); | 263 | params.put(HttpKey.USERNAME, username); |
| 264 | params.put(HttpKey.OLDPASS, old_pwd1); | 264 | params.put(HttpKey.OLDPASS, old_pwd1); |
| 265 | params.put(HttpKey.NEWPASS, newpassword3); | 265 | params.put(HttpKey.NEWPASS, newpassword3); |
| 266 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 266 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 267 | HttpClient.getInstance().setTimeout(10 * 1000); | 267 | HttpClient.getInstance().setTimeout(10 * 1000); |
| 268 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { | 268 | HttpClient.getInstance().post(HttpUrl.changepassword, params, new AsyncHttpResponseHandler() { |
| 269 | @Override | 269 | @Override |
| 270 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 270 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 271 | try { | 271 | try { |
| 272 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 272 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 273 | String status = jsonObject.optString("status"); | 273 | String status = jsonObject.optString("status"); |
| 274 | if (status.equals("100")) { | 274 | if (status.equals("100")) { |
| 275 | Log.e("test", "onSuccess" + new String(bytes)); | 275 | Log.e("test", "onSuccess" + new String(bytes)); |
| 276 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 276 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 277 | SaveParam.getInstance().clearData((Activity) context); | 277 | SaveParam.getInstance().clearData((Activity) context); |
| 278 | Intent intent = new Intent(); | 278 | Intent intent = new Intent(); |
| 279 | intent.setClass(context, LoginAndRegisterActivity.class); | 279 | intent.setClass(context, LoginAndRegisterActivity.class); |
| 280 | ((Activity) context).startActivity(intent); | 280 | ((Activity) context).startActivity(intent); |
| 281 | ((Activity) context).finish(); | 281 | ((Activity) context).finish(); |
| 282 | } | 282 | } |
| 283 | } catch (JSONException e) { | 283 | } catch (JSONException e) { |
| 284 | e.printStackTrace(); | 284 | e.printStackTrace(); |
| 285 | } | 285 | } |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | @Override | 288 | @Override |
| 289 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 289 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 290 | Log.e("test", "onFailure" + new String(bytes)); | 290 | Log.e("test", "onFailure" + new String(bytes)); |
| 291 | new CircleDialog.Builder((FragmentActivity) context) | 291 | new CircleDialog.Builder((FragmentActivity) context) |
| 292 | .setCanceledOnTouchOutside(false) | 292 | .setCanceledOnTouchOutside(false) |
| 293 | .setCancelable(false) | 293 | .setCancelable(false) |
| 294 | .setWidth(0.5f) | 294 | .setWidth(0.5f) |
| 295 | .configText(new ConfigText() { | 295 | .configText(new ConfigText() { |
| 296 | @Override | 296 | @Override |
| 297 | public void onConfig(TextParams params) { | 297 | public void onConfig(TextParams params) { |
| 298 | params.gravity = Gravity.CENTER; | 298 | params.gravity = Gravity.CENTER; |
| 299 | params.padding = new int[]{50, 50, 50, 50}; | 299 | params.padding = new int[]{50, 50, 50, 50}; |
| 300 | } | 300 | } |
| 301 | }) | 301 | }) |
| 302 | .setText("当前无网络,请检查网络设置") | 302 | .setText("当前无网络,请检查网络设置") |
| 303 | .setNegative("继续使用", null) | 303 | .setNegative("继续使用", null) |
| 304 | .setPositive("设置网络", new View.OnClickListener() { | 304 | .setPositive("设置网络", new View.OnClickListener() { |
| 305 | @Override | 305 | @Override |
| 306 | public void onClick(View v) { | 306 | public void onClick(View v) { |
| 307 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 307 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 308 | context.startActivity(intent); | 308 | context.startActivity(intent); |
| 309 | } | 309 | } |
| 310 | }) | 310 | }) |
| 311 | .show(); | 311 | .show(); |
| 312 | } | 312 | } |
| 313 | }); | 313 | }); |
| 314 | 314 | ||
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | //忘记密码 | 317 | //忘记密码 |
| 318 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { | 318 | public void forgetpassword(final Context context, String forot_pwd_phone1, String forot_pwd_pwd3, String forot_pwd_anthcode1, Handler handler) { |
| 319 | RequestParams params = new RequestParams(); | 319 | RequestParams params = new RequestParams(); |
| 320 | params.put(HttpKey.USERNAME, forot_pwd_phone1); | 320 | params.put(HttpKey.USERNAME, forot_pwd_phone1); |
| 321 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); | 321 | params.put(HttpKey.PASSWORD, forot_pwd_pwd3); |
| 322 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); | 322 | params.put(HttpKey.AUTHCODE, forot_pwd_anthcode1); |
| 323 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 323 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 324 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { | 324 | HttpClient.getInstance().post(HttpUrl.forgetpassword, params, new AsyncHttpResponseHandler() { |
| 325 | @Override | 325 | @Override |
| 326 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 326 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 327 | try { | 327 | try { |
| 328 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 328 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 329 | String status = jsonObject.optString("status"); | 329 | String status = jsonObject.optString("status"); |
| 330 | if (status.equals("100")) { | 330 | if (status.equals("100")) { |
| 331 | Log.e("test", "onSuccess" + new String(bytes)); | 331 | Log.e("test", "onSuccess" + new String(bytes)); |
| 332 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); | 332 | Toast.makeText(context, "密码修改成功!", Toast.LENGTH_LONG).show(); |
| 333 | ((Activity) context).finish(); | 333 | ((Activity) context).finish(); |
| 334 | } | 334 | } |
| 335 | } catch (JSONException e) { | 335 | } catch (JSONException e) { |
| 336 | e.printStackTrace(); | 336 | e.printStackTrace(); |
| 337 | } | 337 | } |
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | @Override | 340 | @Override |
| 341 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 341 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 342 | Log.e("test", "onFailure" + new String(bytes)); | 342 | Log.e("test", "onFailure" + new String(bytes)); |
| 343 | new CircleDialog.Builder((FragmentActivity) context) | 343 | new CircleDialog.Builder((FragmentActivity) context) |
| 344 | .setCanceledOnTouchOutside(false) | 344 | .setCanceledOnTouchOutside(false) |
| 345 | .setCancelable(false) | 345 | .setCancelable(false) |
| 346 | .setWidth(0.5f) | 346 | .setWidth(0.5f) |
| 347 | .configText(new ConfigText() { | 347 | .configText(new ConfigText() { |
| 348 | @Override | 348 | @Override |
| 349 | public void onConfig(TextParams params) { | 349 | public void onConfig(TextParams params) { |
| 350 | params.gravity = Gravity.CENTER; | 350 | params.gravity = Gravity.CENTER; |
| 351 | params.padding = new int[]{50, 50, 50, 50}; | 351 | params.padding = new int[]{50, 50, 50, 50}; |
| 352 | } | 352 | } |
| 353 | }) | 353 | }) |
| 354 | .setText("当前无网络,请检查网络设置") | 354 | .setText("当前无网络,请检查网络设置") |
| 355 | .setNegative("继续使用", null) | 355 | .setNegative("继续使用", null) |
| 356 | .setPositive("设置网络", new View.OnClickListener() { | 356 | .setPositive("设置网络", new View.OnClickListener() { |
| 357 | @Override | 357 | @Override |
| 358 | public void onClick(View v) { | 358 | public void onClick(View v) { |
| 359 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 359 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 360 | context.startActivity(intent); | 360 | context.startActivity(intent); |
| 361 | } | 361 | } |
| 362 | }) | 362 | }) |
| 363 | .show(); | 363 | .show(); |
| 364 | } | 364 | } |
| 365 | }); | 365 | }); |
| 366 | 366 | ||
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | //保存用户登录信息 | 369 | //保存用户登录信息 |
| 370 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { | 370 | public void saveLoginInfo(Context context, String username, String password, String access_token, String loginStatus, String userId) { |
| 371 | SaveParam.getInstance().saveLoginParam(context, "username", username); | 371 | SaveParam.getInstance().saveLoginParam(context, "username", username); |
| 372 | SaveParam.getInstance().saveLoginParam(context, "password", password); | 372 | SaveParam.getInstance().saveLoginParam(context, "password", password); |
| 373 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); | 373 | SaveParam.getInstance().saveLoginParam(context, "access_token", access_token); |
| 374 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); | 374 | SaveParam.getInstance().saveLoginParam(context, "login", loginStatus); |
| 375 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); | 375 | SaveParam.getInstance().saveLoginParam(context, "userId", userId); |
| 376 | 376 | ||
| 377 | 377 | ||
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | //保存用户登录信息 | 380 | //保存用户登录信息 |
| 381 | public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) { | 381 | public void savePresonInfo(Context context, String lastname, String gender, String mobilePortrait) { |
| 382 | SaveParam.getInstance().saveLoginParam(context, "lastname", lastname); | 382 | SaveParam.getInstance().saveLoginParam(context, "lastname", lastname); |
| 383 | SaveParam.getInstance().saveLoginParam(context, "gender", gender); | 383 | SaveParam.getInstance().saveLoginParam(context, "gender", gender); |
| 384 | SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait); | 384 | SaveParam.getInstance().saveLoginParam(context, "mobilePortrait", mobilePortrait); |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | //提交保卡信息 | 387 | //提交保卡信息 |
| 388 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, | 388 | public void subcardinfo(final Context context, long userId, String customerName, String customerAddress, |
| 389 | String buyAddress, String buyTime, String alterSaleCall, | 389 | String buyAddress, String buyTime, String alterSaleCall, |
| 390 | String productModel, String deviceNumber, String macAddress, | 390 | String productModel, String deviceNumber, String macAddress, |
| 391 | String mobilePhone) { | 391 | String mobilePhone) { |
| 392 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", | 392 | mProgress = DialogPermission.showProgress(context, null, "正在绑定保卡...", |
| 393 | false, true, null); | 393 | false, true, null); |
| 394 | RequestParams params = new RequestParams(); | 394 | RequestParams params = new RequestParams(); |
| 395 | 395 | ||
| 396 | params.put(HttpKey.USEID, userId); | 396 | params.put(HttpKey.USEID, userId); |
| 397 | params.put(HttpKey.CUSTOMENAME, customerName); | 397 | params.put(HttpKey.CUSTOMENAME, customerName); |
| 398 | params.put(HttpKey.CUSTOMADRESS, customerAddress); | 398 | params.put(HttpKey.CUSTOMADRESS, customerAddress); |
| 399 | params.put(HttpKey.BUYADREES, buyAddress); | 399 | params.put(HttpKey.BUYADREES, buyAddress); |
| 400 | params.put(HttpKey.BUYTIME, buyTime); | 400 | params.put(HttpKey.BUYTIME, buyTime); |
| 401 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); | 401 | params.put(HttpKey.ALTERSALECALL, alterSaleCall); |
| 402 | params.put(HttpKey.PRODUCTMODEL, productModel); | 402 | params.put(HttpKey.PRODUCTMODEL, productModel); |
| 403 | params.put(HttpKey.DEVICENUMBER, deviceNumber); | 403 | params.put(HttpKey.DEVICENUMBER, deviceNumber); |
| 404 | params.put(HttpKey.MACADRESS, macAddress); | 404 | params.put(HttpKey.MACADRESS, macAddress); |
| 405 | params.put(HttpKey.MOBILPHONE, mobilePhone); | 405 | params.put(HttpKey.MOBILPHONE, mobilePhone); |
| 406 | 406 | ||
| 407 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 407 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 408 | 408 | ||
| 409 | Log.e("test", "params" + params); | 409 | Log.e("test", "params" + params); |
| 410 | HttpClient.getInstance().setTimeout(5 * 1000); | 410 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 411 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { | 411 | HttpClient.getInstance().post(context, HttpUrl.subcardinfo, params, new AsyncHttpResponseHandler() { |
| 412 | @Override | 412 | @Override |
| 413 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 413 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 414 | JSONObject jsonObject = null; | 414 | JSONObject jsonObject = null; |
| 415 | closeProgress(); | 415 | closeProgress(); |
| 416 | try { | 416 | try { |
| 417 | jsonObject = new JSONObject(new String(bytes)); | 417 | jsonObject = new JSONObject(new String(bytes)); |
| 418 | String status = jsonObject.optString("status"); | 418 | String status = jsonObject.optString("status"); |
| 419 | if (status.equals("1")) { | 419 | if (status.equals("1")) { |
| 420 | Log.e("test", "onSuccess" + jsonObject); | 420 | Log.e("test", "onSuccess" + jsonObject); |
| 421 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); | 421 | Toast.makeText(context, "保卡绑定成功!", Toast.LENGTH_LONG).show(); |
| 422 | Intent intent = new Intent(); | 422 | Intent intent = new Intent(); |
| 423 | intent.setClass((Activity) context, TheStartPageActivity.class); | 423 | intent.setClass((Activity) context, TheStartPageActivity.class); |
| 424 | ((Activity) context).startActivity(intent); | 424 | ((Activity) context).startActivity(intent); |
| 425 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); | 425 | ((Activity) context).overridePendingTransition(R.anim.rightin, R.anim.rightout); |
| 426 | ((Activity) context).finish(); | 426 | ((Activity) context).finish(); |
| 427 | } | 427 | } |
| 428 | } catch (JSONException e) { | 428 | } catch (JSONException e) { |
| 429 | e.printStackTrace(); | 429 | e.printStackTrace(); |
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | 432 | ||
| 433 | } | 433 | } |
| 434 | 434 | ||
| 435 | @Override | 435 | @Override |
| 436 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 436 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 437 | Log.e("test", "onFailure" + (throwable)); | 437 | Log.e("test", "onFailure" + (throwable)); |
| 438 | closeProgress(); | 438 | closeProgress(); |
| 439 | new CircleDialog.Builder((FragmentActivity) context) | 439 | new CircleDialog.Builder((FragmentActivity) context) |
| 440 | .setCanceledOnTouchOutside(false) | 440 | .setCanceledOnTouchOutside(false) |
| 441 | .setCancelable(false) | 441 | .setCancelable(false) |
| 442 | .setWidth(0.5f) | 442 | .setWidth(0.5f) |
| 443 | .configText(new ConfigText() { | 443 | .configText(new ConfigText() { |
| 444 | @Override | 444 | @Override |
| 445 | public void onConfig(TextParams params) { | 445 | public void onConfig(TextParams params) { |
| 446 | params.gravity = Gravity.CENTER; | 446 | params.gravity = Gravity.CENTER; |
| 447 | params.padding = new int[]{50, 50, 50, 50}; | 447 | params.padding = new int[]{50, 50, 50, 50}; |
| 448 | } | 448 | } |
| 449 | }) | 449 | }) |
| 450 | .setText("当前无网络,请检查网络设置") | 450 | .setText("当前无网络,请检查网络设置") |
| 451 | .setNegative("继续使用", null) | 451 | .setNegative("继续使用", null) |
| 452 | .setPositive("设置网络", new View.OnClickListener() { | 452 | .setPositive("设置网络", new View.OnClickListener() { |
| 453 | @Override | 453 | @Override |
| 454 | public void onClick(View v) { | 454 | public void onClick(View v) { |
| 455 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 455 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 456 | context.startActivity(intent); | 456 | context.startActivity(intent); |
| 457 | } | 457 | } |
| 458 | }) | 458 | }) |
| 459 | .show(); | 459 | .show(); |
| 460 | 460 | ||
| 461 | } | 461 | } |
| 462 | }); | 462 | }); |
| 463 | 463 | ||
| 464 | } | 464 | } |
| 465 | //获取保卡信息 | 465 | //获取保卡信息 |
| 466 | public void getcardinfo(final Context mContext, long userId , final Handler handler) { | 466 | public void getcardinfo(final Context mContext, long userId , final Handler handler) { |
| 467 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", | 467 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取保卡信息...", |
| 468 | false, true, null); | 468 | false, true, null); |
| 469 | HttpClient.getInstance().setTimeout(5 * 1000); | 469 | HttpClient.getInstance().setTimeout(5 * 1000); |
| 470 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 470 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 471 | HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() { | 471 | HttpClient.getInstance().get(HttpUrl.getcardinfo+ "?userId=" + userId , new AsyncHttpResponseHandler() { |
| 472 | @Override | 472 | @Override |
| 473 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 473 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 474 | closeProgress(); | 474 | closeProgress(); |
| 475 | Log.e("test", "保卡信息" + new String(arg2)); | 475 | Log.e("test", "保卡信息" + new String(arg2)); |
| 476 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 | 476 | CardInfo cardInfo = GsonTool.getPerson(new String(arg2), CardInfo.class);//解析json数据 |
| 477 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); | 477 | CardInfo.DataBean schoolInfoBeanList = cardInfo.getData(); |
| 478 | Message msg = Message.obtain(); | 478 | Message msg = Message.obtain(); |
| 479 | msg.what = HttpCode.SUCHCARDINFO; | 479 | msg.what = HttpCode.SUCHCARDINFO; |
| 480 | msg.obj = schoolInfoBeanList; | 480 | msg.obj = schoolInfoBeanList; |
| 481 | handler.sendMessage(msg); | 481 | handler.sendMessage(msg); |
| 482 | } | 482 | } |
| 483 | 483 | ||
| 484 | @Override | 484 | @Override |
| 485 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 485 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 486 | closeProgress(); | 486 | closeProgress(); |
| 487 | new CircleDialog.Builder((FragmentActivity) mContext) | 487 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 488 | .setCanceledOnTouchOutside(false) | 488 | .setCanceledOnTouchOutside(false) |
| 489 | .setCancelable(false) | 489 | .setCancelable(false) |
| 490 | .setWidth(0.5f) | 490 | .setWidth(0.5f) |
| 491 | .configText(new ConfigText() { | 491 | .configText(new ConfigText() { |
| 492 | @Override | 492 | @Override |
| 493 | public void onConfig(TextParams params) { | 493 | public void onConfig(TextParams params) { |
| 494 | params.gravity = Gravity.CENTER; | 494 | params.gravity = Gravity.CENTER; |
| 495 | params.padding = new int[]{50, 50, 50, 50}; | 495 | params.padding = new int[]{50, 50, 50, 50}; |
| 496 | } | 496 | } |
| 497 | }) | 497 | }) |
| 498 | .setText("当前无网络,请检查网络设置") | 498 | .setText("当前无网络,请检查网络设置") |
| 499 | .setNegative("继续使用", null) | 499 | .setNegative("继续使用", null) |
| 500 | .setPositive("设置网络", new View.OnClickListener() { | 500 | .setPositive("设置网络", new View.OnClickListener() { |
| 501 | @Override | 501 | @Override |
| 502 | public void onClick(View v) { | 502 | public void onClick(View v) { |
| 503 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 503 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 504 | mContext.startActivity(intent); | 504 | mContext.startActivity(intent); |
| 505 | } | 505 | } |
| 506 | }) | 506 | }) |
| 507 | .show(); | 507 | .show(); |
| 508 | } | 508 | } |
| 509 | }); | 509 | }); |
| 510 | } | 510 | } |
| 511 | //修改保卡信息电话 | 511 | //修改保卡信息电话 |
| 512 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { | 512 | public void changecardinfophone(final Context mContext, long userId, final String customerPhone, String authCode) { |
| 513 | RequestParams params = new RequestParams(); | 513 | RequestParams params = new RequestParams(); |
| 514 | params.put("userId", userId); | 514 | params.put("userId", userId); |
| 515 | params.put("customerPhone", customerPhone); | 515 | params.put("customerPhone", customerPhone); |
| 516 | params.put("authCode", authCode); | 516 | params.put("authCode", authCode); |
| 517 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 517 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 518 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 518 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 519 | @Override | 519 | @Override |
| 520 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 520 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 521 | try { | 521 | try { |
| 522 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 522 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 523 | String status = jsonObject.optString("status"); | 523 | String status = jsonObject.optString("status"); |
| 524 | if (status.equals("1")) { | 524 | if (status.equals("1")) { |
| 525 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 525 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 526 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone); | 526 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.CARDPHONE, customerPhone); |
| 527 | ((Activity) mContext).finish(); | 527 | ((Activity) mContext).finish(); |
| 528 | }else if (status.equals("1001")){ | 528 | }else if (status.equals("1001")){ |
| 529 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); | 529 | Toast.makeText(mContext, "验证码输入错误", Toast.LENGTH_LONG).show(); |
| 530 | } | 530 | } |
| 531 | } catch (JSONException e) { | 531 | } catch (JSONException e) { |
| 532 | e.printStackTrace(); | 532 | e.printStackTrace(); |
| 533 | } | 533 | } |
| 534 | } | 534 | } |
| 535 | 535 | ||
| 536 | @Override | 536 | @Override |
| 537 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 537 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 538 | Log.e("test", "onFailure" + new String(bytes)); | 538 | Log.e("test", "onFailure" + new String(bytes)); |
| 539 | new CircleDialog.Builder((FragmentActivity) mContext) | 539 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 540 | .setCanceledOnTouchOutside(false) | 540 | .setCanceledOnTouchOutside(false) |
| 541 | .setCancelable(false) | 541 | .setCancelable(false) |
| 542 | .setWidth(0.5f) | 542 | .setWidth(0.5f) |
| 543 | .configText(new ConfigText() { | 543 | .configText(new ConfigText() { |
| 544 | @Override | 544 | @Override |
| 545 | public void onConfig(TextParams params) { | 545 | public void onConfig(TextParams params) { |
| 546 | params.gravity = Gravity.CENTER; | 546 | params.gravity = Gravity.CENTER; |
| 547 | params.padding = new int[]{50, 50, 50, 50}; | 547 | params.padding = new int[]{50, 50, 50, 50}; |
| 548 | } | 548 | } |
| 549 | }) | 549 | }) |
| 550 | .setText("当前无网络,请检查网络设置") | 550 | .setText("当前无网络,请检查网络设置") |
| 551 | .setNegative("继续使用", null) | 551 | .setNegative("继续使用", null) |
| 552 | .setPositive("设置网络", new View.OnClickListener() { | 552 | .setPositive("设置网络", new View.OnClickListener() { |
| 553 | @Override | 553 | @Override |
| 554 | public void onClick(View v) { | 554 | public void onClick(View v) { |
| 555 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 555 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 556 | mContext.startActivity(intent); | 556 | mContext.startActivity(intent); |
| 557 | } | 557 | } |
| 558 | }) | 558 | }) |
| 559 | .show(); | 559 | .show(); |
| 560 | } | 560 | } |
| 561 | }); | 561 | }); |
| 562 | } | 562 | } |
| 563 | //修改保卡信息地址 | 563 | //修改保卡信息地址 |
| 564 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { | 564 | public void changecardadressinfo(final Context mContext, long userId, final String customerPhone, String authCode, final String customerAddress) { |
| 565 | RequestParams params = new RequestParams(); | 565 | RequestParams params = new RequestParams(); |
| 566 | params.put("userId", userId); | 566 | params.put("userId", userId); |
| 567 | params.put("customerPhone", customerPhone); | 567 | params.put("customerPhone", customerPhone); |
| 568 | params.put("authCode", authCode); | 568 | params.put("authCode", authCode); |
| 569 | params.put("customerAddress", customerAddress); | 569 | params.put("customerAddress", customerAddress); |
| 570 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 570 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 571 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { | 571 | HttpClient.getInstance().post(HttpUrl.changecardinfo, params, new AsyncHttpResponseHandler() { |
| 572 | @Override | 572 | @Override |
| 573 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 573 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 574 | try { | 574 | try { |
| 575 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 575 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 576 | String status = jsonObject.optString("status"); | 576 | String status = jsonObject.optString("status"); |
| 577 | if (status.equals("1")) { | 577 | if (status.equals("1")) { |
| 578 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | 578 | Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); |
| 579 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress); | 579 | SaveParam.getInstance().saveCustomizeParam(mContext,SaveParam.ADRESSCUNSTEM, customerAddress); |
| 580 | ((Activity) mContext).finish(); | 580 | ((Activity) mContext).finish(); |
| 581 | } | 581 | } |
| 582 | } catch (JSONException e) { | 582 | } catch (JSONException e) { |
| 583 | e.printStackTrace(); | 583 | e.printStackTrace(); |
| 584 | } | 584 | } |
| 585 | } | 585 | } |
| 586 | 586 | ||
| 587 | @Override | 587 | @Override |
| 588 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 588 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 589 | Log.e("test", "onFailure" + new String(bytes)); | 589 | Log.e("test", "onFailure" + new String(bytes)); |
| 590 | new CircleDialog.Builder((FragmentActivity) mContext) | 590 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 591 | .setCanceledOnTouchOutside(false) | 591 | .setCanceledOnTouchOutside(false) |
| 592 | .setCancelable(false) | 592 | .setCancelable(false) |
| 593 | .setWidth(0.5f) | 593 | .setWidth(0.5f) |
| 594 | .configText(new ConfigText() { | 594 | .configText(new ConfigText() { |
| 595 | @Override | 595 | @Override |
| 596 | public void onConfig(TextParams params) { | 596 | public void onConfig(TextParams params) { |
| 597 | params.gravity = Gravity.CENTER; | 597 | params.gravity = Gravity.CENTER; |
| 598 | params.padding = new int[]{50, 50, 50, 50}; | 598 | params.padding = new int[]{50, 50, 50, 50}; |
| 599 | } | 599 | } |
| 600 | }) | 600 | }) |
| 601 | .setText("当前无网络,请检查网络设置") | 601 | .setText("当前无网络,请检查网络设置") |
| 602 | .setNegative("继续使用", null) | 602 | .setNegative("继续使用", null) |
| 603 | .setPositive("设置网络", new View.OnClickListener() { | 603 | .setPositive("设置网络", new View.OnClickListener() { |
| 604 | @Override | 604 | @Override |
| 605 | public void onClick(View v) { | 605 | public void onClick(View v) { |
| 606 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 606 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 607 | mContext.startActivity(intent); | 607 | mContext.startActivity(intent); |
| 608 | } | 608 | } |
| 609 | }) | 609 | }) |
| 610 | .show(); | 610 | .show(); |
| 611 | } | 611 | } |
| 612 | }); | 612 | }); |
| 613 | } | 613 | } |
| 614 | //验证是否保卡信息 | 614 | //验证是否保卡信息 |
| 615 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { | 615 | public void cardinfocheck(final Context mContext, long userId, final Handler handler) { |
| 616 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", | 616 | mProgress = DialogPermission.showProgress(mContext, null, "正在验证保卡信息...", |
| 617 | false, true, null); | 617 | false, true, null); |
| 618 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 618 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 619 | HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() { | 619 | HttpClient.getInstance().get(HttpUrl.cardcheck+ "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 620 | @Override | 620 | @Override |
| 621 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 621 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 622 | Log.e("test", "---" + new String(arg2)); | 622 | Log.e("test", "---" + new String(arg2)); |
| 623 | closeProgress(); | 623 | closeProgress(); |
| 624 | Message msg = Message.obtain(); | 624 | Message msg = Message.obtain(); |
| 625 | msg.what = HttpCode.CHECKCARD; | 625 | msg.what = HttpCode.CHECKCARD; |
| 626 | msg.obj = new String(arg2); | 626 | msg.obj = new String(arg2); |
| 627 | handler.sendMessage(msg); | 627 | handler.sendMessage(msg); |
| 628 | } | 628 | } |
| 629 | 629 | ||
| 630 | @Override | 630 | @Override |
| 631 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 631 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 632 | closeProgress(); | 632 | closeProgress(); |
| 633 | new CircleDialog.Builder((FragmentActivity) mContext) | 633 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 634 | .setCanceledOnTouchOutside(false) | 634 | .setCanceledOnTouchOutside(false) |
| 635 | .setCancelable(false) | 635 | .setCancelable(false) |
| 636 | .configText(new ConfigText() { | 636 | .configText(new ConfigText() { |
| 637 | @Override | 637 | @Override |
| 638 | public void onConfig(TextParams params) { | 638 | public void onConfig(TextParams params) { |
| 639 | params.gravity = Gravity.CENTER; | 639 | params.gravity = Gravity.CENTER; |
| 640 | params.padding = new int[]{250, 50, 250, 50}; | 640 | params.padding = new int[]{250, 50, 250, 50}; |
| 641 | } | 641 | } |
| 642 | }) | 642 | }) |
| 643 | .setText("当前无网络,请检查网络设置") | 643 | .setText("当前无网络,请检查网络设置") |
| 644 | .setNegative("取消", null) | 644 | .setNegative("取消", null) |
| 645 | .setPositive("确定", new View.OnClickListener() { | 645 | .setPositive("确定", new View.OnClickListener() { |
| 646 | @Override | 646 | @Override |
| 647 | public void onClick(View v) { | 647 | public void onClick(View v) { |
| 648 | Intent intent = new Intent("/"); | 648 | Intent intent = new Intent("/"); |
| 649 | ComponentName cm = new ComponentName("com.android.settings","com.android.settings.WirelessSettings"); | 649 | ComponentName cm = new ComponentName("com.android.settings","com.android.settings.WirelessSettings"); |
| 650 | intent.setComponent(cm); | 650 | intent.setComponent(cm); |
| 651 | intent.setAction("android.intent.action.VIEW"); | 651 | intent.setAction("android.intent.action.VIEW"); |
| 652 | ((Activity) mContext).startActivityForResult( intent , 0); | 652 | ((Activity) mContext).startActivityForResult( intent , 0); |
| 653 | } | 653 | } |
| 654 | }) | 654 | }) |
| 655 | .show(); | 655 | .show(); |
| 656 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 656 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); |
| 657 | } | 657 | } |
| 658 | }); | 658 | }); |
| 659 | } | 659 | } |
| 660 | 660 | ||
| 661 | ///获取年级 | 661 | ///获取年级 |
| 662 | public void getgrade(final Context mContext, final Handler handler) { | 662 | public void getgrade(final Context mContext, final Handler handler) { |
| 663 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 663 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 664 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { | 664 | HttpClient.getInstance().get(HttpUrl.gradesUrl, new AsyncHttpResponseHandler() { |
| 665 | @Override | 665 | @Override |
| 666 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 666 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 667 | Log.e("test", "年级" + new String(arg2)); | 667 | Log.e("test", "年级" + new String(arg2)); |
| 668 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 | 668 | GradeInfo gradeInfo = GsonTool.getPerson(new String(arg2), GradeInfo.class);//解析json数据 |
| 669 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); | 669 | List<GradeInfo.DataBean.ChildrenBean> gradeInfoLists = new ArrayList<GradeInfo.DataBean.ChildrenBean>(); |
| 670 | for (int i = 0 ;i<gradeInfo.getData().size()-2;i++) { | 670 | for (int i = 0 ;i<gradeInfo.getData().size()-2;i++) { |
| 671 | String name = gradeInfo.getData().get(i).getName(); | 671 | String name = gradeInfo.getData().get(i).getName(); |
| 672 | int id = gradeInfo.getData().get(i).getId(); | 672 | int id = gradeInfo.getData().get(i).getId(); |
| 673 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); | 673 | List<GradeInfo.DataBean.ChildrenBean> gradeinfoList = gradeInfo.getData().get(i).getChildren(); |
| 674 | for (int j = 0; j < gradeinfoList.size(); j++) { | 674 | for (int j = 0; j < gradeinfoList.size(); j++) { |
| 675 | String secondname = gradeinfoList.get(j).getName(); | 675 | String secondname = gradeinfoList.get(j).getName(); |
| 676 | int secondid = gradeinfoList.get(j).getId(); | 676 | int secondid = gradeinfoList.get(j).getId(); |
| 677 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); | 677 | GradeInfo.DataBean.ChildrenBean dataBean = new GradeInfo.DataBean.ChildrenBean(); |
| 678 | dataBean.setName(secondname); | 678 | dataBean.setName(secondname); |
| 679 | dataBean.setId(secondid); | 679 | dataBean.setId(secondid); |
| 680 | gradeInfoLists.add(dataBean); | 680 | gradeInfoLists.add(dataBean); |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | } | 683 | } |
| 684 | 684 | ||
| 685 | Message message = Message.obtain(); | 685 | Message message = Message.obtain(); |
| 686 | message.what = HttpCode.GRADER; | 686 | message.what = HttpCode.GRADER; |
| 687 | message.obj = gradeInfoLists; | 687 | message.obj = gradeInfoLists; |
| 688 | handler.sendMessage(message); | 688 | handler.sendMessage(message); |
| 689 | 689 | ||
| 690 | 690 | ||
| 691 | } | 691 | } |
| 692 | 692 | ||
| 693 | @Override | 693 | @Override |
| 694 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 694 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 695 | new CircleDialog.Builder((FragmentActivity) mContext) | 695 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 696 | .setCanceledOnTouchOutside(false) | 696 | .setCanceledOnTouchOutside(false) |
| 697 | .setCancelable(false) | 697 | .setCancelable(false) |
| 698 | .setWidth(0.5f) | 698 | .setWidth(0.5f) |
| 699 | .configText(new ConfigText() { | 699 | .configText(new ConfigText() { |
| 700 | @Override | 700 | @Override |
| 701 | public void onConfig(TextParams params) { | 701 | public void onConfig(TextParams params) { |
| 702 | params.gravity = Gravity.CENTER; | 702 | params.gravity = Gravity.CENTER; |
| 703 | params.padding = new int[]{50, 50, 50, 50}; | 703 | params.padding = new int[]{50, 50, 50, 50}; |
| 704 | } | 704 | } |
| 705 | }) | 705 | }) |
| 706 | .setText("当前无网络,请检查网络设置") | 706 | .setText("当前无网络,请检查网络设置") |
| 707 | .setNegative("继续使用", null) | 707 | .setNegative("继续使用", null) |
| 708 | .setPositive("设置网络", new View.OnClickListener() { | 708 | .setPositive("设置网络", new View.OnClickListener() { |
| 709 | @Override | 709 | @Override |
| 710 | public void onClick(View v) { | 710 | public void onClick(View v) { |
| 711 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 711 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 712 | mContext.startActivity(intent); | 712 | mContext.startActivity(intent); |
| 713 | } | 713 | } |
| 714 | }) | 714 | }) |
| 715 | .show(); | 715 | .show(); |
| 716 | } | 716 | } |
| 717 | }); | 717 | }); |
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | /** | 720 | /** |
| 721 | * 获取学校 | 721 | * 获取学校 |
| 722 | * @param mContext | 722 | * @param mContext |
| 723 | * @param regionId | 723 | * @param regionId |
| 724 | * @param gradeId | 724 | * @param gradeId |
| 725 | * @param handler | 725 | * @param handler |
| 726 | */ | 726 | */ |
| 727 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { | 727 | public void getschool(final Context mContext, int regionId, int gradeId, final Handler handler) { |
| 728 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 728 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 729 | HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { | 729 | HttpClient.getInstance().get(HttpUrl.schoolUrl+ "?regionId=" + regionId+ "&gradeId=" + gradeId, new AsyncHttpResponseHandler() { |
| 730 | @Override | 730 | @Override |
| 731 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 731 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 732 | Log.e("test", "学校" + new String(arg2)); | 732 | Log.e("test", "学校" + new String(arg2)); |
| 733 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 | 733 | SchoolInfo schoolInfo = GsonTool.getPerson(new String(arg2), SchoolInfo.class);//解析json数据 |
| 734 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); | 734 | List<SchoolInfo.DataBean> schoolInfoBeanList = schoolInfo.getData(); |
| 735 | Message message = Message.obtain(); | 735 | Message message = Message.obtain(); |
| 736 | message.what = HttpCode.SCHOOL; | 736 | message.what = HttpCode.SCHOOL; |
| 737 | message.obj = schoolInfoBeanList; | 737 | message.obj = schoolInfoBeanList; |
| 738 | handler.sendMessage(message); | 738 | handler.sendMessage(message); |
| 739 | 739 | ||
| 740 | } | 740 | } |
| 741 | 741 | ||
| 742 | @Override | 742 | @Override |
| 743 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 743 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 744 | new CircleDialog.Builder((FragmentActivity) mContext) | 744 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 745 | .setCanceledOnTouchOutside(false) | 745 | .setCanceledOnTouchOutside(false) |
| 746 | .setCancelable(false) | 746 | .setCancelable(false) |
| 747 | .setWidth(0.5f) | 747 | .setWidth(0.5f) |
| 748 | .configText(new ConfigText() { | 748 | .configText(new ConfigText() { |
| 749 | @Override | 749 | @Override |
| 750 | public void onConfig(TextParams params) { | 750 | public void onConfig(TextParams params) { |
| 751 | params.gravity = Gravity.CENTER; | 751 | params.gravity = Gravity.CENTER; |
| 752 | params.padding = new int[]{50, 50, 50, 50}; | 752 | params.padding = new int[]{50, 50, 50, 50}; |
| 753 | } | 753 | } |
| 754 | }) | 754 | }) |
| 755 | .setText("当前无网络,请检查网络设置") | 755 | .setText("当前无网络,请检查网络设置") |
| 756 | .setNegative("继续使用", null) | 756 | .setNegative("继续使用", null) |
| 757 | .setPositive("设置网络", new View.OnClickListener() { | 757 | .setPositive("设置网络", new View.OnClickListener() { |
| 758 | @Override | 758 | @Override |
| 759 | public void onClick(View v) { | 759 | public void onClick(View v) { |
| 760 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 760 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 761 | mContext.startActivity(intent); | 761 | mContext.startActivity(intent); |
| 762 | } | 762 | } |
| 763 | }) | 763 | }) |
| 764 | .show(); | 764 | .show(); |
| 765 | } | 765 | } |
| 766 | }); | 766 | }); |
| 767 | } | 767 | } |
| 768 | 768 | ||
| 769 | 769 | ||
| 770 | 770 | ||
| 771 | /** | 771 | /** |
| 772 | * 获取个人信息 | 772 | * 获取个人信息 |
| 773 | * @param mContext | 773 | * @param mContext |
| 774 | * @param userId | 774 | * @param userId |
| 775 | * @param handler | 775 | * @param handler |
| 776 | */ | 776 | */ |
| 777 | public void getpresonalinfo(final Context mContext, long userId, final Handler handler) { | 777 | public void getpresonalinfo(final Context mContext, long userId, final Handler handler) { |
| 778 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", | 778 | mProgress = DialogPermission.showProgress(mContext, null, "正在获取个人信息...", |
| 779 | false, true, null); | 779 | false, true, null); |
| 780 | HttpClient.getInstance().addHeader("Accept", "application/json"); | 780 | HttpClient.getInstance().addHeader("Accept", "application/json"); |
| 781 | HttpClient.getInstance().setConnectTimeout(5*1000); | 781 | HttpClient.getInstance().setConnectTimeout(5*1000); |
| 782 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo+ "?userId=" + userId, new AsyncHttpResponseHandler() { | 782 | HttpClient.getInstance().get(HttpUrl.getpresonalinfo+ "?userId=" + userId, new AsyncHttpResponseHandler() { |
| 783 | @Override | 783 | @Override |
| 784 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 784 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 785 | closeProgress(); | 785 | closeProgress(); |
| 786 | Log.e("test", "个人信息" + new String(arg2)); | 786 | Log.e("test", "个人信息" + new String(arg2)); |
| 787 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 | 787 | PesonalInfo pesonalInfo = GsonTool.getPerson(new String(arg2), PesonalInfo.class);//解析json数据 |
| 788 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); | 788 | PesonalInfo.DataBean pesonalInfoBeanList = pesonalInfo.getData(); |
| 789 | Message message = Message.obtain(); | 789 | Message message = Message.obtain(); |
| 790 | message.what = HttpCode.GETINFO; | 790 | message.what = HttpCode.GETINFO; |
| 791 | message.obj = pesonalInfoBeanList; | 791 | message.obj = pesonalInfoBeanList; |
| 792 | handler.sendMessage(message); | 792 | handler.sendMessage(message); |
| 793 | 793 | ||
| 794 | } | 794 | } |
| 795 | 795 | ||
| 796 | @Override | 796 | @Override |
| 797 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 797 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 798 | closeProgress(); | 798 | closeProgress(); |
| 799 | new CircleDialog.Builder((FragmentActivity) mContext) | 799 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 800 | .setCanceledOnTouchOutside(false) | 800 | .setCanceledOnTouchOutside(false) |
| 801 | .setCancelable(false) | 801 | .setCancelable(false) |
| 802 | .setWidth(0.5f) | 802 | .setWidth(0.5f) |
| 803 | .configText(new ConfigText() { | 803 | .configText(new ConfigText() { |
| 804 | @Override | 804 | @Override |
| 805 | public void onConfig(TextParams params) { | 805 | public void onConfig(TextParams params) { |
| 806 | params.gravity = Gravity.CENTER; | 806 | params.gravity = Gravity.CENTER; |
| 807 | params.padding = new int[]{50, 50, 50, 50}; | 807 | params.padding = new int[]{50, 50, 50, 50}; |
| 808 | } | 808 | } |
| 809 | }) | 809 | }) |
| 810 | .setText("当前无网络,请检查网络设置") | 810 | .setText("当前无网络,请检查网络设置") |
| 811 | .setNegative("继续使用", null) | 811 | .setNegative("继续使用", null) |
| 812 | .setPositive("设置网络", new View.OnClickListener() { | 812 | .setPositive("设置网络", new View.OnClickListener() { |
| 813 | @Override | 813 | @Override |
| 814 | public void onClick(View v) { | 814 | public void onClick(View v) { |
| 815 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 815 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 816 | mContext.startActivity(intent); | 816 | mContext.startActivity(intent); |
| 817 | } | 817 | } |
| 818 | }) | 818 | }) |
| 819 | .show(); | 819 | .show(); |
| 820 | } | 820 | } |
| 821 | }); | 821 | }); |
| 822 | } | 822 | } |
| 823 | //修改个人信息 | 823 | //修改个人信息 |
| 824 | public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException { | 824 | public void changepresonalinfo(final Context mContext, Object object) throws UnsupportedEncodingException { |
| 825 | Gson gson = new Gson(); | 825 | Gson gson = new Gson(); |
| 826 | String jsonObject = gson.toJson(object); | 826 | String jsonObject = gson.toJson(object); |
| 827 | Log.e("test", "onSuccess" + jsonObject); | 827 | Log.e("test", "onSuccess" + jsonObject); |
| 828 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", | 828 | mProgress = DialogPermission.showProgress(mContext, null, "正在保存个人信息...", |
| 829 | false, true, null); | 829 | false, true, null); |
| 830 | ByteArrayEntity entity = null; | 830 | ByteArrayEntity entity = null; |
| 831 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); | 831 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); |
| 832 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | 832 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); |
| 833 | 833 | ||
| 834 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 834 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 835 | HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() { | 835 | HttpClient.getInstance().put(mContext, HttpUrl.changepresonalinfo, entity, "application/json", new JsonHttpResponseHandler() { |
| 836 | @Override | 836 | @Override |
| 837 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | 837 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { |
| 838 | super.onSuccess(statusCode, headers, response); | 838 | super.onSuccess(statusCode, headers, response); |
| 839 | closeProgress(); | 839 | closeProgress(); |
| 840 | String status = response.optString("status"); | 840 | String status = response.optString("status"); |
| 841 | if (status.equals("1")) { | 841 | if (status.equals("1")) { |
| 842 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); | 842 | Toast.makeText(mContext, "个人信息保存成功", Toast.LENGTH_LONG).show(); |
| 843 | ((Activity) mContext).finish(); | 843 | ((Activity) mContext).finish(); |
| 844 | } | 844 | } |
| 845 | Log.e("test", "onSuccess" + response); | 845 | Log.e("test", "onSuccess" + response); |
| 846 | 846 | ||
| 847 | } | 847 | } |
| 848 | 848 | ||
| 849 | @Override | 849 | @Override |
| 850 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 850 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { |
| 851 | super.onFailure(statusCode, headers, throwable, errorResponse); | 851 | super.onFailure(statusCode, headers, throwable, errorResponse); |
| 852 | closeProgress(); | 852 | closeProgress(); |
| 853 | Log.e("test", "onFailure" + errorResponse); | 853 | Log.e("test", "onFailure" + errorResponse); |
| 854 | new CircleDialog.Builder((FragmentActivity) mContext) | 854 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 855 | .setCanceledOnTouchOutside(false) | 855 | .setCanceledOnTouchOutside(false) |
| 856 | .setCancelable(false) | 856 | .setCancelable(false) |
| 857 | .setWidth(0.5f) | 857 | .setWidth(0.5f) |
| 858 | .configText(new ConfigText() { | 858 | .configText(new ConfigText() { |
| 859 | @Override | 859 | @Override |
| 860 | public void onConfig(TextParams params) { | 860 | public void onConfig(TextParams params) { |
| 861 | params.gravity = Gravity.CENTER; | 861 | params.gravity = Gravity.CENTER; |
| 862 | params.padding = new int[]{50, 50, 50, 50}; | 862 | params.padding = new int[]{50, 50, 50, 50}; |
| 863 | } | 863 | } |
| 864 | }) | 864 | }) |
| 865 | .setText("当前无网络,请检查网络设置") | 865 | .setText("当前无网络,请检查网络设置") |
| 866 | .setNegative("继续使用", null) | 866 | .setNegative("继续使用", null) |
| 867 | .setPositive("设置网络", new View.OnClickListener() { | 867 | .setPositive("设置网络", new View.OnClickListener() { |
| 868 | @Override | 868 | @Override |
| 869 | public void onClick(View v) { | 869 | public void onClick(View v) { |
| 870 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 870 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 871 | mContext.startActivity(intent); | 871 | mContext.startActivity(intent); |
| 872 | } | 872 | } |
| 873 | }) | 873 | }) |
| 874 | .show(); | 874 | .show(); |
| 875 | } | 875 | } |
| 876 | 876 | ||
| 877 | }); | 877 | }); |
| 878 | } | 878 | } |
| 879 | //修改个性签名 | 879 | //修改个性签名 |
| 880 | public void changsignature(final Context mContext, long userId, final String signature) { | 880 | public void changsignature(final Context mContext, long userId, final String signature) { |
| 881 | RequestParams params = new RequestParams(); | 881 | RequestParams params = new RequestParams(); |
| 882 | params.put("userId", userId); | 882 | params.put("userId", userId); |
| 883 | params.put("signature", signature); | 883 | params.put("signature", signature); |
| 884 | HttpClient.getInstance().addHeader("Accept", "*/*"); | 884 | HttpClient.getInstance().addHeader("Accept", "*/*"); |
| 885 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { | 885 | HttpClient.getInstance().post(HttpUrl.signature, params, new AsyncHttpResponseHandler() { |
| 886 | @Override | 886 | @Override |
| 887 | public void onSuccess(int i, Header[] headers, byte[] bytes) { | 887 | public void onSuccess(int i, Header[] headers, byte[] bytes) { |
| 888 | try { | 888 | try { |
| 889 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 889 | JSONObject jsonObject = new JSONObject(new String(bytes)); |
| 890 | String status = jsonObject.optString("status"); | 890 | String status = jsonObject.optString("status"); |
| 891 | if (status.equals("1")) { | 891 | if (status.equals("1")) { |
| 892 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); | 892 | Toast.makeText(mContext, "个性签名修改成功", Toast.LENGTH_LONG).show(); |
| 893 | } | 893 | } |
| 894 | } catch (JSONException e) { | 894 | } catch (JSONException e) { |
| 895 | e.printStackTrace(); | 895 | e.printStackTrace(); |
| 896 | } | 896 | } |
| 897 | } | 897 | } |
| 898 | 898 | ||
| 899 | @Override | 899 | @Override |
| 900 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 900 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { |
| 901 | Log.e("test", "onFailure" + new String(bytes)); | 901 | Log.e("test", "onFailure" + new String(bytes)); |
| 902 | new CircleDialog.Builder((FragmentActivity) mContext) | 902 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 903 | .setCanceledOnTouchOutside(false) | 903 | .setCanceledOnTouchOutside(false) |
| 904 | .setCancelable(false) | 904 | .setCancelable(false) |
| 905 | .setWidth(0.5f) | 905 | .setWidth(0.5f) |
| 906 | .configText(new ConfigText() { | 906 | .configText(new ConfigText() { |
| 907 | @Override | 907 | @Override |
| 908 | public void onConfig(TextParams params) { | 908 | public void onConfig(TextParams params) { |
| 909 | params.gravity = Gravity.CENTER; | 909 | params.gravity = Gravity.CENTER; |
| 910 | params.padding = new int[]{50, 50, 50, 50}; | 910 | params.padding = new int[]{50, 50, 50, 50}; |
| 911 | } | 911 | } |
| 912 | }) | 912 | }) |
| 913 | .setText("当前无网络,请检查网络设置") | 913 | .setText("当前无网络,请检查网络设置") |
| 914 | .setNegative("继续使用", null) | 914 | .setNegative("继续使用", null) |
| 915 | .setPositive("设置网络", new View.OnClickListener() { | 915 | .setPositive("设置网络", new View.OnClickListener() { |
| 916 | @Override | 916 | @Override |
| 917 | public void onClick(View v) { | 917 | public void onClick(View v) { |
| 918 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 918 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 919 | mContext.startActivity(intent); | 919 | mContext.startActivity(intent); |
| 920 | } | 920 | } |
| 921 | }) | 921 | }) |
| 922 | .show(); | 922 | .show(); |
| 923 | } | 923 | } |
| 924 | }); | 924 | }); |
| 925 | } | 925 | } |
| 926 | 926 | ||
| 927 | /** | 927 | /** |
| 928 | * 获取个性签名 | 928 | * 获取个性签名 |
| 929 | * @param mContext | 929 | * @param mContext |
| 930 | * @param userId | 930 | * @param userId |
| 931 | * @param handler | 931 | * @param handler |
| 932 | */ | 932 | */ |
| 933 | public void getsignatures(final Context mContext,long userId , final Handler handler) { | 933 | public void getsignatures(final Context mContext,long userId , final Handler handler) { |
| 934 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 934 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 935 | HttpClient.getInstance().get(HttpUrl.getsignature+"?userId="+userId, new AsyncHttpResponseHandler() { | 935 | HttpClient.getInstance().get(HttpUrl.getsignature+"?userId="+userId, new AsyncHttpResponseHandler() { |
| 936 | @Override | 936 | @Override |
| 937 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 937 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 938 | Log.e("test", "个性签名" + new String(arg2)); | 938 | Log.e("test", "个性签名" + new String(arg2)); |
| 939 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 | 939 | SignInfo signInfo = GsonTool.getPerson(new String(arg2), SignInfo.class);//解析json数据 |
| 940 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); | 940 | SignInfo.DataBean signInfoBeanList = signInfo.getData(); |
| 941 | Message message = Message.obtain(); | 941 | Message message = Message.obtain(); |
| 942 | message.what = HttpCode.SIGN; | 942 | message.what = HttpCode.SIGN; |
| 943 | message.obj = signInfoBeanList; | 943 | message.obj = signInfoBeanList; |
| 944 | handler.sendMessage(message); | 944 | handler.sendMessage(message); |
| 945 | 945 | ||
| 946 | } | 946 | } |
| 947 | 947 | ||
| 948 | @Override | 948 | @Override |
| 949 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 949 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 950 | Log.e("test", "失败原因" + arg3); | 950 | Log.e("test", "失败原因" + arg3); |
| 951 | new CircleDialog.Builder((FragmentActivity) mContext) | 951 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 952 | .setCanceledOnTouchOutside(false) | 952 | .setCanceledOnTouchOutside(false) |
| 953 | .setCancelable(false) | 953 | .setCancelable(false) |
| 954 | .setWidth(0.5f) | 954 | .setWidth(0.5f) |
| 955 | .configText(new ConfigText() { | 955 | .configText(new ConfigText() { |
| 956 | @Override | 956 | @Override |
| 957 | public void onConfig(TextParams params) { | 957 | public void onConfig(TextParams params) { |
| 958 | params.gravity = Gravity.CENTER; | 958 | params.gravity = Gravity.CENTER; |
| 959 | params.padding = new int[]{50, 50, 50, 50}; | 959 | params.padding = new int[]{50, 50, 50, 50}; |
| 960 | } | 960 | } |
| 961 | }) | 961 | }) |
| 962 | .setText("当前无网络,请检查网络设置") | 962 | .setText("当前无网络,请检查网络设置") |
| 963 | .setNegative("继续使用", null) | 963 | .setNegative("继续使用", null) |
| 964 | .setPositive("设置网络", new View.OnClickListener() { | 964 | .setPositive("设置网络", new View.OnClickListener() { |
| 965 | @Override | 965 | @Override |
| 966 | public void onClick(View v) { | 966 | public void onClick(View v) { |
| 967 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 967 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 968 | mContext.startActivity(intent); | 968 | mContext.startActivity(intent); |
| 969 | } | 969 | } |
| 970 | }) | 970 | }) |
| 971 | .show(); | 971 | .show(); |
| 972 | } | 972 | } |
| 973 | }); | 973 | }); |
| 974 | } | 974 | } |
| 975 | 975 | ||
| 976 | /** | ||
| 977 | * 用户反馈 | ||
| 978 | * @param mContext | ||
| 979 | * @param object | ||
| 980 | * @throws UnsupportedEncodingException | ||
| 981 | */ | ||
| 982 | public void feedback(final Context mContext, Object object) throws UnsupportedEncodingException { | ||
| 983 | Gson gson = new Gson(); | ||
| 984 | String jsonObject = gson.toJson(object); | ||
| 985 | Log.e("test", "onSuccess" + jsonObject); | ||
| 986 | mProgress = DialogPermission.showProgress(mContext, null, "正在提交反馈内容...", | ||
| 987 | false, true, null); | ||
| 988 | ByteArrayEntity entity = null; | ||
| 989 | entity = new ByteArrayEntity(jsonObject.getBytes("UTF-8")); | ||
| 990 | entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); | ||
| 991 | |||
| 992 | HttpClient.getInstance().addHeader("Accept", "*/*"); | ||
| 993 | HttpClient.getInstance().post(mContext, HttpUrl.feedbackURL, entity, "application/json", new JsonHttpResponseHandler() { | ||
| 994 | @Override | ||
| 995 | public void onSuccess(int statusCode, Header[] headers, JSONObject response) { | ||
| 996 | super.onSuccess(statusCode, headers, response); | ||
| 997 | closeProgress(); | ||
| 998 | String status = response.optString("status"); | ||
| 999 | if (status.equals("1")) { | ||
| 1000 | Toast.makeText(mContext, "反馈成功,我们会尽快处理", Toast.LENGTH_LONG).show(); | ||
| 1001 | ((Activity) mContext).finish(); | ||
| 1002 | } | ||
| 1003 | Log.e("test", "onSuccess" + response); | ||
| 1004 | |||
| 1005 | } | ||
| 1006 | |||
| 1007 | @Override | ||
| 1008 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | ||
| 1009 | super.onFailure(statusCode, headers, throwable, errorResponse); | ||
| 1010 | closeProgress(); | ||
| 1011 | Log.e("test", "onFailure" + errorResponse); | ||
| 1012 | new CircleDialog.Builder((FragmentActivity) mContext) | ||
| 1013 | .setCanceledOnTouchOutside(false) | ||
| 1014 | .setCancelable(false) | ||
| 1015 | .setWidth(0.5f) | ||
| 1016 | .configText(new ConfigText() { | ||
| 1017 | @Override | ||
| 1018 | public void onConfig(TextParams params) { | ||
| 1019 | params.gravity = Gravity.CENTER; | ||
| 1020 | params.padding = new int[]{50, 50, 50, 50}; | ||
| 1021 | } | ||
| 1022 | }) | ||
| 1023 | .setText("当前无网络,请检查网络设置") | ||
| 1024 | .setNegative("继续使用", null) | ||
| 1025 | .setPositive("设置网络", new View.OnClickListener() { | ||
| 1026 | @Override | ||
| 1027 | public void onClick(View v) { | ||
| 1028 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | ||
| 1029 | mContext.startActivity(intent); | ||
| 1030 | } | ||
| 1031 | }) | ||
| 1032 | .show(); | ||
| 1033 | } | ||
| 1034 | |||
| 1035 | }); | ||
| 1036 | } | ||
| 976 | 1037 | ||
| 977 | 1038 | ||
| 978 | 1039 | ||
| 979 | 1040 | ||
| 980 | ///省级接口 | 1041 | ///省级接口 |
| 981 | public void provices(final Context mContext, final Handler handler) { | 1042 | public void provices(final Context mContext, final Handler handler) { |
| 982 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1043 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 983 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { | 1044 | HttpClient.getInstance().get(HttpUrl.provinceUrl, new AsyncHttpResponseHandler() { |
| 984 | @Override | 1045 | @Override |
| 985 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1046 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 986 | Log.e("test", "省" + new String(arg2)); | 1047 | Log.e("test", "省" + new String(arg2)); |
| 987 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 | 1048 | ProvinceInfo provinceInfo = GsonTool.getPerson(new String(arg2), ProvinceInfo.class);//解析json数据 |
| 988 | Log.e("test", "状态码" + provinceInfo.getStatus()); | 1049 | Log.e("test", "状态码" + provinceInfo.getStatus()); |
| 989 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); | 1050 | List<ProvinceInfo.ProvincesBean> provincesBeanList = provinceInfo.getProvinces(); |
| 990 | Message message = Message.obtain(); | 1051 | Message message = Message.obtain(); |
| 991 | message.what = HttpCode.PROVICES; | 1052 | message.what = HttpCode.PROVICES; |
| 992 | message.obj = provincesBeanList; | 1053 | message.obj = provincesBeanList; |
| 993 | handler.sendMessage(message); | 1054 | handler.sendMessage(message); |
| 994 | 1055 | ||
| 995 | } | 1056 | } |
| 996 | 1057 | ||
| 997 | @Override | 1058 | @Override |
| 998 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1059 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 999 | new CircleDialog.Builder((FragmentActivity) mContext) | 1060 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1000 | .setCanceledOnTouchOutside(false) | 1061 | .setCanceledOnTouchOutside(false) |
| 1001 | .setCancelable(false) | 1062 | .setCancelable(false) |
| 1002 | .setWidth(0.5f) | 1063 | .setWidth(0.5f) |
| 1003 | .configText(new ConfigText() { | 1064 | .configText(new ConfigText() { |
| 1004 | @Override | 1065 | @Override |
| 1005 | public void onConfig(TextParams params) { | 1066 | public void onConfig(TextParams params) { |
| 1006 | params.gravity = Gravity.CENTER; | 1067 | params.gravity = Gravity.CENTER; |
| 1007 | params.padding = new int[]{50, 50, 50, 50}; | 1068 | params.padding = new int[]{50, 50, 50, 50}; |
| 1008 | } | 1069 | } |
| 1009 | }) | 1070 | }) |
| 1010 | .setText("当前无网络,请检查网络设置") | 1071 | .setText("当前无网络,请检查网络设置") |
| 1011 | .setNegative("继续使用", null) | 1072 | .setNegative("继续使用", null) |
| 1012 | .setPositive("设置网络", new View.OnClickListener() { | 1073 | .setPositive("设置网络", new View.OnClickListener() { |
| 1013 | @Override | 1074 | @Override |
| 1014 | public void onClick(View v) { | 1075 | public void onClick(View v) { |
| 1015 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1076 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1016 | mContext.startActivity(intent); | 1077 | mContext.startActivity(intent); |
| 1017 | } | 1078 | } |
| 1018 | }) | 1079 | }) |
| 1019 | .show(); | 1080 | .show(); |
| 1020 | } | 1081 | } |
| 1021 | }); | 1082 | }); |
| 1022 | } | 1083 | } |
| 1023 | 1084 | ||
| 1024 | //市级接口 | 1085 | //市级接口 |
| 1025 | public void cityinfo(final Context mContext, long regionId , final Handler handler) { | 1086 | public void cityinfo(final Context mContext, long regionId , final Handler handler) { |
| 1026 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1087 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1027 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { | 1088 | HttpClient.getInstance().get(HttpUrl.cityUrl + "?regionId=" + regionId, new AsyncHttpResponseHandler() { |
| 1028 | @Override | 1089 | @Override |
| 1029 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1090 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1030 | Log.e("test", "市" + new String(arg2)); | 1091 | Log.e("test", "市" + new String(arg2)); |
| 1031 | Gson gson = new Gson(); | 1092 | Gson gson = new Gson(); |
| 1032 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); | 1093 | CityInfo cityInfo = gson.fromJson(new String(arg2), CityInfo.class); |
| 1033 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); | 1094 | List<CityInfo.CitiesBean> cityInfoBeanList = cityInfo.getCities(); |
| 1034 | Message message = Message.obtain(); | 1095 | Message message = Message.obtain(); |
| 1035 | message.what = HttpCode.CITYS; | 1096 | message.what = HttpCode.CITYS; |
| 1036 | message.obj = cityInfoBeanList; | 1097 | message.obj = cityInfoBeanList; |
| 1037 | handler.sendMessage(message); | 1098 | handler.sendMessage(message); |
| 1038 | 1099 | ||
| 1039 | 1100 | ||
| 1040 | } | 1101 | } |
| 1041 | 1102 | ||
| 1042 | @Override | 1103 | @Override |
| 1043 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1104 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1044 | new CircleDialog.Builder((FragmentActivity) mContext) | 1105 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1045 | .setCanceledOnTouchOutside(false) | 1106 | .setCanceledOnTouchOutside(false) |
| 1046 | .setCancelable(false) | 1107 | .setCancelable(false) |
| 1047 | .setWidth(0.5f) | 1108 | .setWidth(0.5f) |
| 1048 | .configText(new ConfigText() { | 1109 | .configText(new ConfigText() { |
| 1049 | @Override | 1110 | @Override |
| 1050 | public void onConfig(TextParams params) { | 1111 | public void onConfig(TextParams params) { |
| 1051 | params.gravity = Gravity.CENTER; | 1112 | params.gravity = Gravity.CENTER; |
| 1052 | params.padding = new int[]{50, 50, 50, 50}; | 1113 | params.padding = new int[]{50, 50, 50, 50}; |
| 1053 | } | 1114 | } |
| 1054 | }) | 1115 | }) |
| 1055 | .setText("当前无网络,请检查网络设置") | 1116 | .setText("当前无网络,请检查网络设置") |
| 1056 | .setNegative("继续使用", null) | 1117 | .setNegative("继续使用", null) |
| 1057 | .setPositive("设置网络", new View.OnClickListener() { | 1118 | .setPositive("设置网络", new View.OnClickListener() { |
| 1058 | @Override | 1119 | @Override |
| 1059 | public void onClick(View v) { | 1120 | public void onClick(View v) { |
| 1060 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1121 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1061 | mContext.startActivity(intent); | 1122 | mContext.startActivity(intent); |
| 1062 | } | 1123 | } |
| 1063 | }) | 1124 | }) |
| 1064 | .show(); | 1125 | .show(); |
| 1065 | } | 1126 | } |
| 1066 | }); | 1127 | }); |
| 1067 | } | 1128 | } |
| 1068 | 1129 | ||
| 1069 | //区县级接口 | 1130 | //区县级接口 |
| 1070 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { | 1131 | public void countyinfo(final Context mContext, int parentId, final Handler handler) { |
| 1071 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 1132 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); |
| 1072 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { | 1133 | HttpClient.getInstance().get(HttpUrl.countyUrl + "?regionId=" + parentId, new AsyncHttpResponseHandler() { |
| 1073 | @Override | 1134 | @Override |
| 1074 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | 1135 | public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { |
| 1075 | Log.e("test", "区" + new String(arg2)); | 1136 | Log.e("test", "区" + new String(arg2)); |
| 1076 | Gson gson = new Gson(); | 1137 | Gson gson = new Gson(); |
| 1077 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); | 1138 | CountyInfo countyInfo = gson.fromJson(new String(arg2), CountyInfo.class); |
| 1078 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); | 1139 | List<CountyInfo.CountiesBean> countyInfoInfoBeanList = countyInfo.getCounties(); |
| 1079 | Message message = Message.obtain(); | 1140 | Message message = Message.obtain(); |
| 1080 | message.what = HttpCode.COUNTRY; | 1141 | message.what = HttpCode.COUNTRY; |
| 1081 | message.obj = countyInfoInfoBeanList; | 1142 | message.obj = countyInfoInfoBeanList; |
| 1082 | handler.sendMessage(message); | 1143 | handler.sendMessage(message); |
| 1083 | 1144 | ||
| 1084 | 1145 | ||
| 1085 | } | 1146 | } |
| 1086 | 1147 | ||
| 1087 | @Override | 1148 | @Override |
| 1088 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 1149 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { |
| 1089 | new CircleDialog.Builder((FragmentActivity) mContext) | 1150 | new CircleDialog.Builder((FragmentActivity) mContext) |
| 1090 | .setCanceledOnTouchOutside(false) | 1151 | .setCanceledOnTouchOutside(false) |
| 1091 | .setCancelable(false) | 1152 | .setCancelable(false) |
| 1092 | .setWidth(0.5f) | 1153 | .setWidth(0.5f) |
| 1093 | .configText(new ConfigText() { | 1154 | .configText(new ConfigText() { |
| 1094 | @Override | 1155 | @Override |
| 1095 | public void onConfig(TextParams params) { | 1156 | public void onConfig(TextParams params) { |
| 1096 | params.gravity = Gravity.CENTER; | 1157 | params.gravity = Gravity.CENTER; |
| 1097 | params.padding = new int[]{50, 50, 50, 50}; | 1158 | params.padding = new int[]{50, 50, 50, 50}; |
| 1098 | } | 1159 | } |
| 1099 | }) | 1160 | }) |
| 1100 | .setText("当前无网络,请检查网络设置") | 1161 | .setText("当前无网络,请检查网络设置") |
| 1101 | .setNegative("继续使用", null) | 1162 | .setNegative("继续使用", null) |
| 1102 | .setPositive("设置网络", new View.OnClickListener() { | 1163 | .setPositive("设置网络", new View.OnClickListener() { |
| 1103 | @Override | 1164 | @Override |
| 1104 | public void onClick(View v) { | 1165 | public void onClick(View v) { |
| 1105 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | 1166 | Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 |
| 1106 | mContext.startActivity(intent); | 1167 | mContext.startActivity(intent); |
| 1107 | } | 1168 | } |
| 1108 | }) | 1169 | }) |
| 1109 | .show(); | 1170 | .show(); |
| 1110 | } | 1171 | } |
| 1111 | }); | 1172 | }); |
| 1112 | } | 1173 | } |
| 1113 | 1174 | ||
| 1114 | 1175 | ||
| 1115 | private void closeProgress() { | 1176 | private void closeProgress() { |
| 1116 | try { | 1177 | try { |
| 1117 | if (mProgress != null) { | 1178 | if (mProgress != null) { |
| 1118 | mProgress.dismiss(); | 1179 | mProgress.dismiss(); |
| 1119 | mProgress = null; | 1180 | mProgress = null; |
| 1120 | } | 1181 | } |
| 1121 | } catch (Exception e) { | 1182 | } catch (Exception e) { |
| 1122 | e.printStackTrace(); | 1183 | e.printStackTrace(); |
| 1123 | } | 1184 | } |
| 1124 | } | 1185 | } |
| 1125 | 1186 | ||
| 1126 | } | 1187 | } |
| 1127 | 1188 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpUrl.java
| 1 | package com.hjx.personalcenter.http; | 1 | package com.hjx.personalcenter.http; |
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | * Created by h on 2017/8/15. | 4 | * Created by h on 2017/8/15. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | public class HttpUrl { | 7 | public class HttpUrl { |
| 8 | private final static String Enviroment = "DEVELOPMENT"; | 8 | private final static String Enviroment = "DEVELOPMENT"; |
| 9 | 9 | ||
| 10 | public static String GetDomain(){ | 10 | public static String GetDomain(){ |
| 11 | return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; | 11 | return Enviroment.equals("DEVELOPMENT") ? "http://boss.test.hjx.com" : "http://boss.hjx.com"; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 | 14 | public static String loginUrl = GetDomain()+"/user/access_token";//登录 |
| 15 | public static String schoolUrl = GetDomain()+"/school/get";//学校 | 15 | public static String schoolUrl = GetDomain()+"/school/get";//学校 |
| 16 | public static String gradesUrl = GetDomain()+"/grades";//年级 | 16 | public static String gradesUrl = GetDomain()+"/grades";//年级 |
| 17 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 | 17 | public static String provinceUrl = GetDomain()+"/ozing/provinces";//省 |
| 18 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 | 18 | public static String cityUrl = GetDomain()+"/ozing/cities";//市 |
| 19 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 | 19 | public static String countyUrl = GetDomain()+"/ozing/counties";//区县 |
| 20 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ | 20 | public static String forgetpassword=GetDomain()+"/ozing/timer/user/newpassword";//忘记密码/ |
| 21 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 | 21 | public static String registeredUrl=GetDomain()+"/ozing/timer/anking/user";//注册 |
| 22 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 | 22 | public static String authCodedUrl=GetDomain()+"/ozing/timer/user/fetchAuthCode";//验证码 |
| 23 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 | 23 | public static String isRegiterUrl=GetDomain()+"/ozing/timer/user/registered";//手机号是否注册 |
| 24 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 | 24 | public static String changepassword=GetDomain()+"/ozing/timer/user/changepassword";//修改密码 |
| 25 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 | 25 | public static String subcardinfo=GetDomain()+"/electronicCard/addCustomer";//提交保卡信息 |
| 26 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 | 26 | public static String getcardinfo=GetDomain()+"/electronicCard/info";//得到保卡信息 |
| 27 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 | 27 | public static String changecardinfo=GetDomain()+"/electronicCard/updateByUserId";//修改保卡信息 |
| 28 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 | 28 | public static String cardcheck=GetDomain()+"/electronicCard/check";//检查保卡是否填写 |
| 29 | public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 | 29 | public static String changepresonalinfo=GetDomain()+"/personal/update";//修改个人信息 |
| 30 | public static String getpresonalinfo=GetDomain()+"/personal/get";//修改个人信息 | 30 | public static String getpresonalinfo=GetDomain()+"/personal/get";//修改个人信息 |
| 31 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 | 31 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 |
| 32 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 | 32 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 |
| 33 | public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 | ||
| 33 | 34 | ||
| 34 | 35 | ||
| 35 | 36 | ||
| 36 | } | 37 | } |
| 37 | 38 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/interfaces/DialogCallBack.java
| 1 | package com.hjx.personalcenter.interfaces; | 1 | package com.hjx.personalcenter.interfaces; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.view.View; | 4 | import android.view.View; |
| 5 | import android.widget.AdapterView; | ||
| 6 | 5 | ||
| 7 | import com.hjx.personalcenter.model.CityInfo; | 6 | import com.hjx.personalcenter.model.CityInfo; |
| 8 | import com.hjx.personalcenter.model.CountyInfo; | 7 | import com.hjx.personalcenter.model.CountyInfo; |
| 9 | import com.hjx.personalcenter.model.GradeInfo; | 8 | import com.hjx.personalcenter.model.GradeInfo; |
| 10 | import com.hjx.personalcenter.model.ProvinceInfo; | 9 | import com.hjx.personalcenter.model.ProvinceInfo; |
| 11 | import com.hjx.personalcenter.model.SchoolInfo; | 10 | import com.hjx.personalcenter.model.SchoolInfo; |
| 12 | 11 | ||
| 13 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
| 14 | 13 | ||
| 15 | /** | 14 | /** |
| 16 | * Created by wei on 2017/8/17. | 15 | * Created by wei on 2017/8/17. |
| 17 | */ | 16 | */ |
| 18 | 17 | ||
| 19 | public class DialogCallBack { | 18 | public class DialogCallBack { |
| 20 | //对话框回调 | 19 | //对话框回调 |
| 21 | public interface ProvincesCallBack{ | 20 | public interface ProvincesCallBack{ |
| 22 | void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type); | 21 | void provinceOnItemClick(ArrayList<ProvinceInfo.ProvincesBean> data, int position, int type); |
| 23 | } | 22 | } |
| 24 | public interface CitysCallBack{ | 23 | public interface CitysCallBack{ |
| 25 | void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type); | 24 | void province1OnItemClick(ArrayList<CityInfo.CitiesBean> data, int position, int type); |
| 26 | } | 25 | } |
| 27 | public interface CountryCallBack{ | 26 | public interface CountryCallBack{ |
| 28 | void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type); | 27 | void province2OnItemClick(ArrayList<CountyInfo.CountiesBean> data, int position, int type); |
| 29 | } | 28 | } |
| 30 | public interface GradeCallBack{ | 29 | public interface GradeCallBack{ |
| 31 | void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type); | 30 | void province3OnItemClick(ArrayList<GradeInfo.DataBean.ChildrenBean> data, int position, int type); |
| 32 | } | 31 | } |
| 33 | public interface SchoolCallBack{ | 32 | public interface SchoolCallBack{ |
| 34 | void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type); | 33 | void provinceO4nItemClick(ArrayList<SchoolInfo.DataBean> data, int position, int type); |
| 35 | } | 34 | } |
| 36 | //头像回调 | 35 | //头像回调 |
| 37 | public interface CallBackView{ | 36 | public interface CallBackView{ |
| 38 | void heard(Context context,View v); | 37 | void heard(Context context,View v,int headpitiaon); |
| 39 | } | 38 | } |
| 40 | } | 39 | } |
| 41 | 40 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/FeedBackInfo.java
| File was created | 1 | package com.hjx.personalcenter.model; | |
| 2 | |||
| 3 | import java.util.List; | ||
| 4 | |||
| 5 | /** | ||
| 6 | * Created by h on 2017/8/25. | ||
| 7 | */ | ||
| 8 | |||
| 9 | public class FeedBackInfo { | ||
| 10 | |||
| 11 | /** | ||
| 12 | * feedtype : 个人中心 | ||
| 13 | * userId : 230 | ||
| 14 | * content : dasdasde | ||
| 15 | * contact : 13526654520 | ||
| 16 | * feedBackDate : 2013-10-20 | ||
| 17 | * imgUrl : [{"imgUrl":"dess.jpg"},{"imgUrl":"ssss.jpg"},{"imgUrl":"dddd.jpg"}] | ||
| 18 | */ | ||
| 19 | |||
| 20 | private String feedtype; | ||
| 21 | private Long userId; | ||
| 22 | private String content; | ||
| 23 | private String contact; | ||
| 24 | private String feedBackDate; | ||
| 25 | private List<ImgUrlBean> imgUrl; | ||
| 26 | |||
| 27 | public String getFeedtype() { | ||
| 28 | return feedtype; | ||
| 29 | } | ||
| 30 | |||
| 31 | public void setFeedtype(String feedtype) { | ||
| 32 | this.feedtype = feedtype; | ||
| 33 | } | ||
| 34 | |||
| 35 | public Long getUserId() { | ||
| 36 | return userId; | ||
| 37 | } | ||
| 38 | |||
| 39 | public void setUserId(Long userId) { | ||
| 40 | this.userId = userId; | ||
| 41 | } | ||
| 42 | |||
| 43 | public String getContent() { | ||
| 44 | return content; | ||
| 45 | } | ||
| 46 | |||
| 47 | public void setContent(String content) { | ||
| 48 | this.content = content; | ||
| 49 | } | ||
| 50 | |||
| 51 | public String getContact() { | ||
| 52 | return contact; | ||
| 53 | } | ||
| 54 | |||
| 55 | public void setContact(String contact) { | ||
| 56 | this.contact = contact; | ||
| 57 | } | ||
| 58 | |||
| 59 | public String getFeedBackDate() { | ||
| 60 | return feedBackDate; | ||
| 61 | } | ||
| 62 | |||
| 63 | public void setFeedBackDate(String feedBackDate) { | ||
| 64 | this.feedBackDate = feedBackDate; | ||
| 65 | } | ||
| 66 | |||
| 67 | public List<ImgUrlBean> getImgUrl() { | ||
| 68 | return imgUrl; | ||
| 69 | } | ||
| 70 | |||
| 71 | public void setImgUrl(List<ImgUrlBean> imgUrl) { | ||
| 72 | this.imgUrl = imgUrl; | ||
| 73 | } | ||
| 74 | |||
| 75 | public static class ImgUrlBean { | ||
| 76 | /** | ||
| 77 | * imgUrl : dess.jpg | ||
| 78 | */ | ||
| 79 | |||
| 80 | private String imgUrl; | ||
| 81 | |||
| 82 | public String getImgUrl() { | ||
| 83 | return imgUrl; | ||
| 84 | } | ||
| 85 | |||
| 86 | public void setImgUrl(String imgUrl) { | ||
| 87 | this.imgUrl = imgUrl; | ||
| 88 | } | ||
| 89 | } | ||
| 90 | } | ||
| 91 |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/GetDate.java
| File was created | 1 | package com.hjx.personalcenter.util; | |
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | import java.util.Calendar; | ||
| 6 | import java.util.Date; | ||
| 7 | /* | ||
| 8 | * s时间生成累 | ||
| 9 | */ | ||
| 10 | public class GetDate { | ||
| 11 | public StringBuilder getDate() | ||
| 12 | { | ||
| 13 | Calendar c = Calendar.getInstance(); | ||
| 14 | int year = c.get(Calendar.YEAR); | ||
| 15 | int month = c.get(Calendar.MONTH)+1; | ||
| 16 | int day = c.get(Calendar.DAY_OF_MONTH); | ||
| 17 | int hour=c.get(Calendar.HOUR_OF_DAY); | ||
| 18 | int minute=c.get(Calendar.MINUTE); | ||
| 19 | int second=c.get(Calendar.SECOND); | ||
| 20 | StringBuilder strDate=new StringBuilder(); | ||
| 21 | strDate.append(String.valueOf(year)); | ||
| 22 | if(month<10) | ||
| 23 | { | ||
| 24 | strDate.append("-0"+String.valueOf(month)); | ||
| 25 | } | ||
| 26 | else | ||
| 27 | { | ||
| 28 | strDate.append("-"+String.valueOf(month)); | ||
| 29 | } | ||
| 30 | if(day<10) | ||
| 31 | { | ||
| 32 | strDate.append("-0"+String.valueOf(day)); | ||
| 33 | } | ||
| 34 | else | ||
| 35 | { | ||
| 36 | strDate.append("-"+String.valueOf(day)); | ||
| 37 | } | ||
| 38 | if(hour<10) | ||
| 39 | { | ||
| 40 | strDate.append("-0"+String.valueOf(hour)); | ||
| 41 | } | ||
| 42 | else | ||
| 43 | { | ||
| 44 | strDate.append("-"+String.valueOf(hour)); | ||
| 45 | } | ||
| 46 | if(minute<10) | ||
| 47 | { | ||
| 48 | strDate.append("-0"+String.valueOf(minute)); | ||
| 49 | } | ||
| 50 | else | ||
| 51 | { | ||
| 52 | strDate.append("-"+String.valueOf(minute)); | ||
| 53 | } | ||
| 54 | if(second<10) | ||
| 55 | { | ||
| 56 | strDate.append("-0"+String.valueOf(second)); | ||
| 57 | } | ||
| 58 | else | ||
| 59 | { | ||
| 60 | strDate.append("-"+String.valueOf(second)); | ||
| 61 | } | ||
| 62 | return strDate; | ||
| 63 | } | ||
| 64 | public StringBuilder getYMD() | ||
| 65 | { | ||
| 66 | Calendar c = Calendar.getInstance(); | ||
| 67 | int year = c.get(Calendar.YEAR); | ||
| 68 | int month = c.get(Calendar.MONTH)+1; | ||
| 69 | int day = c.get(Calendar.DAY_OF_MONTH); | ||
| 70 | StringBuilder strDate=new StringBuilder(); | ||
| 71 | strDate.append(String.valueOf(year)); | ||
| 72 | if(month<10) | ||
| 73 | { | ||
| 74 | strDate.append("0"+String.valueOf(month)); | ||
| 75 | } | ||
| 76 | else | ||
| 77 | { | ||
| 78 | strDate.append(""+String.valueOf(month)); | ||
| 79 | } | ||
| 80 | if(day<10) | ||
| 81 | { | ||
| 82 | strDate.append("0"+String.valueOf(day)); | ||
| 83 | } | ||
| 84 | else | ||
| 85 | { | ||
| 86 | strDate.append(""+String.valueOf(day)); | ||
| 87 | } | ||
| 88 | return strDate; | ||
| 89 | } | ||
| 90 | public StringBuilder getYM() | ||
| 91 | { | ||
| 92 | Calendar c = Calendar.getInstance(); | ||
| 93 | int year = c.get(Calendar.YEAR); | ||
| 94 | int month = c.get(Calendar.MONTH)+1; | ||
| 95 | StringBuilder strDate=new StringBuilder(); | ||
| 96 | strDate.append(String.valueOf(year)); | ||
| 97 | if(month<10) | ||
| 98 | { | ||
| 99 | strDate.append("-0"+String.valueOf(month)); | ||
| 100 | } | ||
| 101 | else | ||
| 102 | { | ||
| 103 | strDate.append("-"+String.valueOf(month)); | ||
| 104 | } | ||
| 105 | return strDate; | ||
| 106 | } | ||
| 107 | |||
| 108 | public String getMonths(String date,String nowdate)//��-�� | ||
| 109 | { | ||
| 110 | String[]str1=date.trim().split("-"); | ||
| 111 | String[]str2=nowdate.trim().split("-"); | ||
| 112 | int s=(Integer.parseInt(str1[0])-Integer.parseInt(str2[0]))*12+Integer.parseInt(str1[1])-Integer.parseInt(str2[1]); | ||
| 113 | String months=String.valueOf(s); | ||
| 114 | return months; | ||
| 115 | } | ||
| 116 | |||
| 117 | public String dateChange(String date) | ||
| 118 | { | ||
| 119 | StringBuilder sb=new StringBuilder(); | ||
| 120 | String[]dateStr=date.split("-"); | ||
| 121 | for(int i=0;i<dateStr.length;i++) | ||
| 122 | { | ||
| 123 | sb.append(dateStr[i]); | ||
| 124 | } | ||
| 125 | return sb.toString(); | ||
| 126 | } | ||
| 127 | //"-" | ||
| 128 | public String addressChange(String addresss) | ||
| 129 | { | ||
| 130 | char spl = (char)0x1c; | ||
| 131 | // StringBuilder sb=new StringBuilder(); | ||
| 132 | // String[]addressStr=addresss.split(String.valueOf(spl)); | ||
| 133 | String newAddr=addresss.replace(String.valueOf(spl), ""); | ||
| 134 | return newAddr; | ||
| 135 | // for(int i=0;i<addressStr.length;i++) | ||
| 136 | // { | ||
| 137 | //// sb.append(addressStr[i].replace("-","")); | ||
| 138 | // sb.append(addressStr[i].replace("*","")); | ||
| 139 | // } | ||
| 140 | // return sb.toString(); | ||
| 141 | } | ||
| 142 | public static String getYMDHMS(){ | ||
| 143 | String timeStr = null; | ||
| 144 | Calendar c = Calendar.getInstance(); | ||
| 145 | int y = c.get(Calendar.YEAR); | ||
| 146 | int m = c.get(Calendar.MONTH)+1; | ||
| 147 | int d = c.get(Calendar.DAY_OF_MONTH); | ||
| 148 | int h = c.get(Calendar.HOUR_OF_DAY); | ||
| 149 | int min = c.get(Calendar.MINUTE); | ||
| 150 | int s = c.get(Calendar.SECOND); | ||
| 151 | |||
| 152 | String year = null, month = null, day = null, hour = null, minute = null, second = null; | ||
| 153 | |||
| 154 | year = String.valueOf(y); | ||
| 155 | if(m<10){ | ||
| 156 | month = "0"+m; | ||
| 157 | } | ||
| 158 | else{ | ||
| 159 | month = ""+m; | ||
| 160 | } | ||
| 161 | if(d<10){ | ||
| 162 | day = "0"+d; | ||
| 163 | } | ||
| 164 | else{ | ||
| 165 | day = ""+d; | ||
| 166 | } | ||
| 167 | if(h<10){ | ||
| 168 | hour = "0"+h; | ||
| 169 | } | ||
| 170 | else{ | ||
| 171 | hour = ""+h; | ||
| 172 | } | ||
| 173 | if(min<10){ | ||
| 174 | minute = "0"+min; | ||
| 175 | } | ||
| 176 | else{ | ||
| 177 | minute = ""+min; | ||
| 178 | } | ||
| 179 | if(s<10){ | ||
| 180 | second = "0"+s; | ||
| 181 | } | ||
| 182 | else{ | ||
| 183 | second = ""+s; | ||
| 184 | } | ||
| 185 | timeStr = year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second; | ||
| 186 | |||
| 187 | return timeStr; | ||
| 188 | } | ||
| 189 | public static String getYMDHMS1(){ | ||
| 190 | String timeStr = null; | ||
| 191 | Calendar c = Calendar.getInstance(); | ||
| 192 | int y = c.get(Calendar.YEAR); | ||
| 193 | int m = c.get(Calendar.MONTH)+1; | ||
| 194 | int d = c.get(Calendar.DAY_OF_MONTH); | ||
| 195 | int h = c.get(Calendar.HOUR_OF_DAY); | ||
| 196 | int min = c.get(Calendar.MINUTE); | ||
| 197 | int s = c.get(Calendar.SECOND); | ||
| 198 | |||
| 199 | String year = null, month = null, day = null, hour = null, minute = null, second = null; | ||
| 200 | |||
| 201 | year = String.valueOf(y); | ||
| 202 | if(m<10){ | ||
| 203 | month = "0"+m; | ||
| 204 | } | ||
| 205 | else{ | ||
| 206 | month = ""+m; | ||
| 207 | } | ||
| 208 | if(d<10){ | ||
| 209 | day = "0"+d; | ||
| 210 | } | ||
| 211 | else{ | ||
| 212 | day = ""+d; | ||
| 213 | } | ||
| 214 | if(h<10){ | ||
| 215 | hour = "0"+h; | ||
| 216 | } | ||
| 217 | else{ | ||
| 218 | hour = ""+h; | ||
| 219 | } | ||
| 220 | if(min<10){ | ||
| 221 | minute = "0"+min; | ||
| 222 | } | ||
| 223 | else{ | ||
| 224 | minute = ""+min; | ||
| 225 | } | ||
| 226 | if(s<10){ | ||
| 227 | second = "0"+s; | ||
| 228 | } | ||
| 229 | else{ | ||
| 230 | second = ""+s; | ||
| 231 | } | ||
| 232 | timeStr = year+"-"+month+"-"+day+"-"+hour+"-"+minute+"-"+second; | ||
| 233 | |||
| 234 | return timeStr; | ||
| 235 | } | ||
| 236 | |||
| 237 | |||
| 238 | public String getCurrentTime(){ | ||
| 239 | String timeStr = null; | ||
| 240 | Calendar c = Calendar.getInstance(); | ||
| 241 | int y = c.get(Calendar.YEAR); | ||
| 242 | int m = c.get(Calendar.MONTH)+1; | ||
| 243 | int d = c.get(Calendar.DAY_OF_MONTH); | ||
| 244 | int h = c.get(Calendar.HOUR_OF_DAY); | ||
| 245 | int min = c.get(Calendar.MINUTE); | ||
| 246 | int s = c.get(Calendar.SECOND); | ||
| 247 | |||
| 248 | String year = null, month = null, day = null, hour = null, minute = null, second = null; | ||
| 249 | |||
| 250 | year = String.valueOf(y); | ||
| 251 | if(m<10){ | ||
| 252 | month = "0"+m; | ||
| 253 | } | ||
| 254 | else{ | ||
| 255 | month = ""+m; | ||
| 256 | } | ||
| 257 | if(d<10){ | ||
| 258 | day = "0"+d; | ||
| 259 | } | ||
| 260 | else{ | ||
| 261 | day = ""+d; | ||
| 262 | } | ||
| 263 | if(h<10){ | ||
| 264 | hour = "0"+h; | ||
| 265 | } | ||
| 266 | else{ | ||
| 267 | hour = ""+h; | ||
| 268 | } | ||
| 269 | if(min<10){ | ||
| 270 | minute = "0"+min; | ||
| 271 | } | ||
| 272 | else{ | ||
| 273 | minute = ""+min; | ||
| 274 | } | ||
| 275 | if(s<10){ | ||
| 276 | second = "0"+s; | ||
| 277 | } | ||
| 278 | else{ | ||
| 279 | second = ""+s; | ||
| 280 | } | ||
| 281 | timeStr = year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second+".0"; | ||
| 282 | |||
| 283 | return timeStr; | ||
| 284 | } | ||
| 285 | |||
| 286 | |||
| 287 | public Long getDaysBetween(Date startDate, Date endDate) { | ||
| 288 | Calendar fromCalendar = Calendar.getInstance(); | ||
| 289 | fromCalendar.setTime(startDate); | ||
| 290 | fromCalendar.set(Calendar.HOUR_OF_DAY, 0); | ||
| 291 | fromCalendar.set(Calendar.MINUTE, 0); | ||
| 292 | fromCalendar.set(Calendar.SECOND, 0); | ||
| 293 | fromCalendar.set(Calendar.MILLISECOND, 0); | ||
| 294 | |||
| 295 | Calendar toCalendar = Calendar.getInstance(); | ||
| 296 | toCalendar.setTime(endDate); | ||
| 297 | toCalendar.set(Calendar.HOUR_OF_DAY, 0); | ||
| 298 | toCalendar.set(Calendar.MINUTE, 0); | ||
| 299 | toCalendar.set(Calendar.SECOND, 0); | ||
| 300 | toCalendar.set(Calendar.MILLISECOND, 0); | ||
| 301 | |||
| 302 | return 1+(toCalendar.getTime().getTime() - fromCalendar.getTime().getTime()) / (1000 * 60 * 60 * 24); | ||
| 303 | } | ||
| 304 | |||
| 305 | |||
| 306 | } | ||
| 307 |
PersonalCenter/app/src/main/res/drawable/radio_button.xml
| File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | |||
| 4 | <item android:drawable="@drawable/xuanzhong" | ||
| 5 | android:state_checked="true" | ||
| 6 | android:state_enabled="true" | ||
| 7 | /> | ||
| 8 | |||
| 9 | |||
| 10 | </selector> |
PersonalCenter/app/src/main/res/drawable/xuanzhong.png
475 Bytes
PersonalCenter/app/src/main/res/layout/activity_main.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
| 4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
| 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" | 5 | xmlns:fresco="http://schemas.android.com/apk/res-auto" |
| 6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
| 7 | 7 | ||
| 8 | <RelativeLayout | 8 | <RelativeLayout |
| 9 | android:id="@+id/title" | 9 | android:id="@+id/title" |
| 10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
| 11 | android:layout_height="50dp" | 11 | android:layout_height="50dp" |
| 12 | android:background="@color/login_text_blue"> | 12 | android:background="@color/login_text_blue"> |
| 13 | 13 | ||
| 14 | <ImageView | 14 | <ImageView |
| 15 | android:id="@+id/cancel" | 15 | android:id="@+id/cancel" |
| 16 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
| 17 | android:layout_height="match_parent" | 17 | android:layout_height="match_parent" |
| 18 | android:paddingLeft="20dp" | 18 | android:paddingLeft="20dp" |
| 19 | android:paddingRight="20dp" | 19 | android:paddingRight="20dp" |
| 20 | android:visibility="gone" | 20 | android:visibility="gone" |
| 21 | android:src="@mipmap/title_back" /> | 21 | android:src="@mipmap/title_back" /> |
| 22 | 22 | ||
| 23 | <TextView | 23 | <TextView |
| 24 | android:id="@+id/menu_title" | 24 | android:id="@+id/menu_title" |
| 25 | android:layout_width="wrap_content" | 25 | android:layout_width="wrap_content" |
| 26 | android:layout_height="match_parent" | 26 | android:layout_height="match_parent" |
| 27 | android:layout_centerInParent="true" | 27 | android:layout_centerInParent="true" |
| 28 | android:gravity="center_vertical" | 28 | android:gravity="center_vertical" |
| 29 | android:text="@string/titel_preson" | 29 | android:text="@string/titel_preson" |
| 30 | android:textColor="@android:color/white" | 30 | android:textColor="@android:color/white" |
| 31 | android:textSize="22sp" /> | 31 | android:textSize="22sp" /> |
| 32 | 32 | ||
| 33 | <ImageView | 33 | <ImageView |
| 34 | android:id="@+id/iv_setting" | 34 | android:id="@+id/iv_setting" |
| 35 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
| 36 | android:layout_height="match_parent" | 36 | android:layout_height="match_parent" |
| 37 | android:layout_marginRight="10dp" | 37 | android:layout_marginRight="10dp" |
| 38 | android:layout_toLeftOf="@+id/iv_skin" | 38 | android:layout_toLeftOf="@+id/iv_skin" |
| 39 | android:gravity="center_vertical" | 39 | android:gravity="center_vertical" |
| 40 | android:padding="10dp" | 40 | android:padding="10dp" |
| 41 | android:src="@mipmap/shezhi" | 41 | android:src="@mipmap/shezhi" |
| 42 | android:textColor="@android:color/white" | 42 | android:textColor="@android:color/white" |
| 43 | android:textSize="22sp" /> | 43 | android:textSize="22sp" /> |
| 44 | 44 | ||
| 45 | <ImageView | 45 | <ImageView |
| 46 | android:id="@+id/iv_skin" | 46 | android:id="@+id/iv_skin" |
| 47 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
| 48 | android:layout_height="match_parent" | 48 | android:layout_height="match_parent" |
| 49 | android:layout_marginRight="10dp" | 49 | android:layout_marginRight="10dp" |
| 50 | android:layout_toLeftOf="@+id/iv_imformatioan" | 50 | android:layout_toLeftOf="@+id/iv_imformatioan" |
| 51 | android:gravity="center_vertical" | 51 | android:gravity="center_vertical" |
| 52 | android:padding="10dp" | 52 | android:padding="10dp" |
| 53 | android:src="@mipmap/pifu" | 53 | android:src="@mipmap/pifu" |
| 54 | android:textColor="@android:color/white" | 54 | android:textColor="@android:color/white" |
| 55 | android:textSize="22sp" /> | 55 | android:textSize="22sp" /> |
| 56 | 56 | ||
| 57 | <ImageView | 57 | <ImageView |
| 58 | android:id="@+id/iv_imformatioan" | 58 | android:id="@+id/iv_imformatioan" |
| 59 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
| 60 | android:layout_height="match_parent" | 60 | android:layout_height="match_parent" |
| 61 | android:layout_alignParentRight="true" | 61 | android:layout_alignParentRight="true" |
| 62 | android:layout_marginRight="10dp" | 62 | android:layout_marginRight="10dp" |
| 63 | android:gravity="center_vertical" | 63 | android:gravity="center_vertical" |
| 64 | android:padding="10dp" | 64 | android:padding="10dp" |
| 65 | android:src="@mipmap/fankui" | 65 | android:src="@mipmap/fankui" |
| 66 | android:textColor="@android:color/white" | 66 | android:textColor="@android:color/white" |
| 67 | android:textSize="22sp" /> | 67 | android:textSize="22sp" /> |
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | </RelativeLayout> | 70 | </RelativeLayout> |
| 71 | 71 | ||
| 72 | <LinearLayout | 72 | <LinearLayout |
| 73 | android:layout_width="match_parent" | 73 | android:layout_width="match_parent" |
| 74 | android:layout_height="match_parent"> | 74 | android:layout_height="match_parent"> |
| 75 | 75 | ||
| 76 | <LinearLayout | 76 | <LinearLayout |
| 77 | android:layout_width="0dp" | 77 | android:layout_width="0dp" |
| 78 | android:layout_height="match_parent" | 78 | android:layout_height="match_parent" |
| 79 | android:layout_weight="1" | 79 | android:layout_weight="1" |
| 80 | android:orientation="vertical"> | 80 | android:orientation="vertical"> |
| 81 | 81 | ||
| 82 | <LinearLayout | 82 | <LinearLayout |
| 83 | android:layout_width="match_parent" | 83 | android:layout_width="match_parent" |
| 84 | android:layout_height="wrap_content" | 84 | android:layout_height="wrap_content" |
| 85 | android:layout_marginTop="20dp" | 85 | android:layout_marginTop="20dp" |
| 86 | android:orientation="horizontal"> | 86 | android:orientation="horizontal"> |
| 87 | <ImageView | 87 | <ImageView |
| 88 | android:id="@+id/iv_look_card" | 88 | android:id="@+id/iv_look_card" |
| 89 | android:layout_width="wrap_content" | 89 | android:layout_width="wrap_content" |
| 90 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
| 91 | android:padding="10dp" | 91 | android:padding="10dp" |
| 92 | android:layout_marginLeft="20dp" | 92 | android:layout_marginLeft="20dp" |
| 93 | android:src="@mipmap/card_icoc" /> | 93 | android:src="@mipmap/card_icoc" /> |
| 94 | <com.facebook.drawee.view.SimpleDraweeView | 94 | <com.facebook.drawee.view.SimpleDraweeView |
| 95 | android:id="@+id/iv_head" | 95 | android:id="@+id/iv_head" |
| 96 | android:layout_width="60dp" | 96 | android:layout_width="60dp" |
| 97 | android:layout_height="60dp" | 97 | android:layout_height="60dp" |
| 98 | android:layout_marginLeft="60dp" | 98 | android:layout_marginLeft="60dp" |
| 99 | android:layout_gravity="center" | 99 | android:layout_gravity="center" |
| 100 | fresco:placeholderImage="@mipmap/header_default" | 100 | fresco:placeholderImage="@mipmap/header_default" |
| 101 | fresco:roundAsCircle="true" | 101 | fresco:roundAsCircle="true" |
| 102 | fresco:placeholderImageScaleType="fitCenter" /> | 102 | fresco:placeholderImageScaleType="fitCenter" /> |
| 103 | 103 | ||
| 104 | <TextView | 104 | <TextView |
| 105 | android:layout_width="wrap_content" | 105 | android:layout_width="wrap_content" |
| 106 | android:layout_height="wrap_content" | 106 | android:layout_height="wrap_content" |
| 107 | android:layout_marginLeft="18dp" | 107 | android:layout_marginLeft="18dp" |
| 108 | android:layout_marginTop="20dp" | 108 | android:layout_marginTop="20dp" |
| 109 | android:background="@drawable/corcle_blue_bg" | 109 | android:background="@drawable/corcle_blue_bg" |
| 110 | android:paddingLeft="5dp" | 110 | android:paddingLeft="5dp" |
| 111 | android:paddingRight="5dp" | 111 | android:paddingRight="5dp" |
| 112 | android:gravity="center_vertical" | 112 | android:gravity="center_vertical" |
| 113 | android:text="签到" | 113 | android:text="签到" |
| 114 | android:textColor="@color/login_text_blue" | 114 | android:textColor="@color/login_text_blue" |
| 115 | android:textSize="18sp" /> | 115 | android:textSize="18sp" /> |
| 116 | 116 | ||
| 117 | </LinearLayout> | 117 | </LinearLayout> |
| 118 | 118 | ||
| 119 | <LinearLayout | 119 | <LinearLayout |
| 120 | android:layout_width="match_parent" | 120 | android:layout_width="match_parent" |
| 121 | android:layout_height="wrap_content" | 121 | android:layout_height="wrap_content" |
| 122 | android:layout_marginLeft="20dp" | 122 | android:layout_marginLeft="20dp" |
| 123 | android:layout_marginTop="20dp" | 123 | android:layout_marginTop="20dp" |
| 124 | android:orientation="horizontal"> | 124 | android:orientation="horizontal"> |
| 125 | 125 | ||
| 126 | <TextView | 126 | <TextView |
| 127 | android:id="@+id/tv_username" | 127 | android:id="@+id/tv_username" |
| 128 | android:layout_width="wrap_content" | 128 | android:layout_width="wrap_content" |
| 129 | android:layout_height="wrap_content" | 129 | android:layout_height="wrap_content" |
| 130 | android:text="熊巍" | 130 | android:text="姓名" |
| 131 | android:textSize="20dp" /> | 131 | android:textSize="20dp" /> |
| 132 | 132 | ||
| 133 | <ImageView | 133 | <ImageView |
| 134 | android:id="@+id/iv_sex" | 134 | android:id="@+id/iv_sex" |
| 135 | android:layout_width="wrap_content" | 135 | android:layout_width="wrap_content" |
| 136 | android:layout_height="wrap_content" | 136 | android:layout_height="wrap_content" |
| 137 | android:layout_marginLeft="50dp" | 137 | android:layout_marginLeft="50dp" |
| 138 | android:src="@mipmap/men" /> | 138 | android:src="@mipmap/men" /> |
| 139 | 139 | ||
| 140 | </LinearLayout> | 140 | </LinearLayout> |
| 141 | 141 | ||
| 142 | <LinearLayout | 142 | <LinearLayout |
| 143 | android:layout_width="match_parent" | 143 | android:layout_width="match_parent" |
| 144 | android:layout_height="wrap_content" | 144 | android:layout_height="wrap_content" |
| 145 | android:layout_marginLeft="20dp" | 145 | android:layout_marginLeft="20dp" |
| 146 | android:layout_marginTop="20dp" | 146 | android:layout_marginTop="20dp" |
| 147 | android:gravity="center" | 147 | android:gravity="center" |
| 148 | android:orientation="horizontal"> | 148 | android:orientation="horizontal"> |
| 149 | 149 | ||
| 150 | <TextView | 150 | <TextView |
| 151 | android:id="@+id/tv_sign" | 151 | android:id="@+id/tv_sign" |
| 152 | android:layout_width="0dp" | 152 | android:layout_width="0dp" |
| 153 | android:layout_height="wrap_content" | 153 | android:layout_height="wrap_content" |
| 154 | android:layout_weight="5" | 154 | android:layout_weight="5" |
| 155 | android:text="请输入个性签名" | 155 | android:text="请输入个性签名" |
| 156 | android:textSize="18sp" /> | 156 | android:textSize="18sp" /> |
| 157 | 157 | ||
| 158 | <ImageView | 158 | <ImageView |
| 159 | android:id="@+id/iv_sign" | 159 | android:id="@+id/iv_sign" |
| 160 | android:layout_width="0dp" | 160 | android:layout_width="0dp" |
| 161 | android:layout_height="wrap_content" | 161 | android:layout_height="wrap_content" |
| 162 | android:layout_weight="1" | 162 | android:layout_weight="1" |
| 163 | android:padding="10dp" | 163 | android:padding="10dp" |
| 164 | android:src="@mipmap/pencil" /> | 164 | android:src="@mipmap/pencil" /> |
| 165 | 165 | ||
| 166 | 166 | ||
| 167 | </LinearLayout> | 167 | </LinearLayout> |
| 168 | 168 | ||
| 169 | <View | 169 | <View |
| 170 | android:layout_width="match_parent" | 170 | android:layout_width="match_parent" |
| 171 | android:layout_height="0.7dp" | 171 | android:layout_height="0.7dp" |
| 172 | android:layout_marginTop="20dp" | 172 | android:layout_marginTop="20dp" |
| 173 | android:background="@color/cutoff_line"> | 173 | android:background="@color/cutoff_line"> |
| 174 | 174 | ||
| 175 | </View> | 175 | </View> |
| 176 | 176 | ||
| 177 | <LinearLayout | 177 | <LinearLayout |
| 178 | android:id="@+id/linel_mycuoti" | 178 | android:id="@+id/linel_mycuoti" |
| 179 | android:layout_width="match_parent" | 179 | android:layout_width="match_parent" |
| 180 | android:layout_height="wrap_content" | 180 | android:layout_height="wrap_content" |
| 181 | android:layout_marginTop="30dp" | 181 | android:layout_marginTop="30dp" |
| 182 | android:orientation="vertical"> | 182 | android:orientation="vertical"> |
| 183 | 183 | ||
| 184 | <LinearLayout | 184 | <LinearLayout |
| 185 | android:layout_width="match_parent" | 185 | android:layout_width="match_parent" |
| 186 | android:layout_height="wrap_content" | 186 | android:layout_height="wrap_content" |
| 187 | android:gravity="center_vertical" | 187 | android:gravity="center_vertical" |
| 188 | android:orientation="horizontal"> | 188 | android:orientation="horizontal"> |
| 189 | 189 | ||
| 190 | <ImageView | 190 | <ImageView |
| 191 | android:layout_width="0dp" | 191 | android:layout_width="0dp" |
| 192 | android:layout_height="wrap_content" | 192 | android:layout_height="wrap_content" |
| 193 | android:layout_weight="1" | 193 | android:layout_weight="1" |
| 194 | android:src="@mipmap/wodecuoti" /> | 194 | android:src="@mipmap/wodecuoti" /> |
| 195 | 195 | ||
| 196 | <TextView | 196 | <TextView |
| 197 | android:layout_width="0dp" | 197 | android:layout_width="0dp" |
| 198 | android:layout_height="wrap_content" | 198 | android:layout_height="wrap_content" |
| 199 | android:layout_weight="5" | 199 | android:layout_weight="5" |
| 200 | android:text="我的错题" | 200 | android:text="我的错题" |
| 201 | android:textSize="20sp" /> | 201 | android:textSize="20sp" /> |
| 202 | 202 | ||
| 203 | <ImageView | 203 | <ImageView |
| 204 | android:layout_width="0dp" | 204 | android:layout_width="0dp" |
| 205 | android:layout_height="wrap_content" | 205 | android:layout_height="wrap_content" |
| 206 | android:layout_weight="1" | 206 | android:layout_weight="1" |
| 207 | android:src="@mipmap/youjiantou" /> | 207 | android:src="@mipmap/youjiantou" /> |
| 208 | 208 | ||
| 209 | </LinearLayout> | 209 | </LinearLayout> |
| 210 | 210 | ||
| 211 | <LinearLayout | 211 | <LinearLayout |
| 212 | android:id="@+id/linel_mynote" | 212 | android:id="@+id/linel_mynote" |
| 213 | android:layout_width="match_parent" | 213 | android:layout_width="match_parent" |
| 214 | android:layout_height="wrap_content" | 214 | android:layout_height="wrap_content" |
| 215 | android:layout_marginTop="35dp" | 215 | android:layout_marginTop="35dp" |
| 216 | android:gravity="center_vertical" | 216 | android:gravity="center_vertical" |
| 217 | android:orientation="horizontal"> | 217 | android:orientation="horizontal"> |
| 218 | 218 | ||
| 219 | <ImageView | 219 | <ImageView |
| 220 | android:layout_width="0dp" | 220 | android:layout_width="0dp" |
| 221 | android:layout_height="wrap_content" | 221 | android:layout_height="wrap_content" |
| 222 | android:layout_weight="1" | 222 | android:layout_weight="1" |
| 223 | android:src="@mipmap/wodebiji" /> | 223 | android:src="@mipmap/wodebiji" /> |
| 224 | 224 | ||
| 225 | <TextView | 225 | <TextView |
| 226 | android:layout_width="0dp" | 226 | android:layout_width="0dp" |
| 227 | android:layout_height="wrap_content" | 227 | android:layout_height="wrap_content" |
| 228 | android:layout_weight="5" | 228 | android:layout_weight="5" |
| 229 | android:text="我的笔记" | 229 | android:text="我的笔记" |
| 230 | android:textSize="20sp" /> | 230 | android:textSize="20sp" /> |
| 231 | 231 | ||
| 232 | <ImageView | 232 | <ImageView |
| 233 | android:layout_width="0dp" | 233 | android:layout_width="0dp" |
| 234 | android:layout_height="wrap_content" | 234 | android:layout_height="wrap_content" |
| 235 | android:layout_weight="1" | 235 | android:layout_weight="1" |
| 236 | android:src="@mipmap/youjiantou" /> | 236 | android:src="@mipmap/youjiantou" /> |
| 237 | 237 | ||
| 238 | </LinearLayout> | 238 | </LinearLayout> |
| 239 | 239 | ||
| 240 | <LinearLayout | 240 | <LinearLayout |
| 241 | android:id="@+id/linel_mycollege" | 241 | android:id="@+id/linel_mycollege" |
| 242 | android:layout_width="match_parent" | 242 | android:layout_width="match_parent" |
| 243 | android:layout_height="wrap_content" | 243 | android:layout_height="wrap_content" |
| 244 | android:layout_marginTop="35dp" | 244 | android:layout_marginTop="35dp" |
| 245 | android:gravity="center_vertical" | 245 | android:gravity="center_vertical" |
| 246 | android:orientation="horizontal"> | 246 | android:orientation="horizontal"> |
| 247 | 247 | ||
| 248 | <ImageView | 248 | <ImageView |
| 249 | android:layout_width="0dp" | 249 | android:layout_width="0dp" |
| 250 | android:layout_height="wrap_content" | 250 | android:layout_height="wrap_content" |
| 251 | android:layout_weight="1" | 251 | android:layout_weight="1" |
| 252 | android:src="@mipmap/wodeshoucang" /> | 252 | android:src="@mipmap/wodeshoucang" /> |
| 253 | 253 | ||
| 254 | <TextView | 254 | <TextView |
| 255 | android:layout_width="0dp" | 255 | android:layout_width="0dp" |
| 256 | android:layout_height="wrap_content" | 256 | android:layout_height="wrap_content" |
| 257 | android:layout_weight="5" | 257 | android:layout_weight="5" |
| 258 | android:text="我的收藏" | 258 | android:text="我的收藏" |
| 259 | android:textSize="20sp" /> | 259 | android:textSize="20sp" /> |
| 260 | 260 | ||
| 261 | <ImageView | 261 | <ImageView |
| 262 | android:layout_width="0dp" | 262 | android:layout_width="0dp" |
| 263 | android:layout_height="wrap_content" | 263 | android:layout_height="wrap_content" |
| 264 | android:layout_weight="1" | 264 | android:layout_weight="1" |
| 265 | android:src="@mipmap/youjiantou" /> | 265 | android:src="@mipmap/youjiantou" /> |
| 266 | 266 | ||
| 267 | </LinearLayout> | 267 | </LinearLayout> |
| 268 | 268 | ||
| 269 | <LinearLayout | 269 | <LinearLayout |
| 270 | android:id="@+id/linel_myclass" | 270 | android:id="@+id/linel_myclass" |
| 271 | android:layout_width="match_parent" | 271 | android:layout_width="match_parent" |
| 272 | android:layout_height="wrap_content" | 272 | android:layout_height="wrap_content" |
| 273 | android:layout_marginTop="35dp" | 273 | android:layout_marginTop="35dp" |
| 274 | android:gravity="center_vertical" | 274 | android:gravity="center_vertical" |
| 275 | android:orientation="horizontal"> | 275 | android:orientation="horizontal"> |
| 276 | 276 | ||
| 277 | <ImageView | 277 | <ImageView |
| 278 | android:layout_width="0dp" | 278 | android:layout_width="0dp" |
| 279 | android:layout_height="wrap_content" | 279 | android:layout_height="wrap_content" |
| 280 | android:layout_weight="1" | 280 | android:layout_weight="1" |
| 281 | android:src="@mipmap/wodebanji" /> | 281 | android:src="@mipmap/wodebanji" /> |
| 282 | 282 | ||
| 283 | <TextView | 283 | <TextView |
| 284 | android:layout_width="0dp" | 284 | android:layout_width="0dp" |
| 285 | android:layout_height="wrap_content" | 285 | android:layout_height="wrap_content" |
| 286 | android:layout_weight="5" | 286 | android:layout_weight="5" |
| 287 | android:text="我的班级" | 287 | android:text="我的班级" |
| 288 | android:textSize="20sp" /> | 288 | android:textSize="20sp" /> |
| 289 | 289 | ||
| 290 | <ImageView | 290 | <ImageView |
| 291 | android:layout_width="0dp" | 291 | android:layout_width="0dp" |
| 292 | android:layout_height="wrap_content" | 292 | android:layout_height="wrap_content" |
| 293 | android:layout_weight="1" | 293 | android:layout_weight="1" |
| 294 | android:src="@mipmap/youjiantou" /> | 294 | android:src="@mipmap/youjiantou" /> |
| 295 | 295 | ||
| 296 | </LinearLayout> | 296 | </LinearLayout> |
| 297 | 297 | ||
| 298 | 298 | ||
| 299 | </LinearLayout> | 299 | </LinearLayout> |
| 300 | 300 | ||
| 301 | <LinearLayout | 301 | <LinearLayout |
| 302 | android:layout_width="match_parent" | 302 | android:layout_width="match_parent" |
| 303 | android:layout_height="match_parent" | 303 | android:layout_height="match_parent" |
| 304 | android:layout_marginTop="120dp" | 304 | android:layout_marginTop="120dp" |
| 305 | android:background="@mipmap/xiaoguanggao"> | 305 | android:background="@mipmap/xiaoguanggao"> |
| 306 | 306 | ||
| 307 | </LinearLayout> | 307 | </LinearLayout> |
| 308 | 308 | ||
| 309 | 309 | ||
| 310 | </LinearLayout> | 310 | </LinearLayout> |
| 311 | 311 | ||
| 312 | 312 | ||
| 313 | <View | 313 | <View |
| 314 | android:layout_width="0.7dp" | 314 | android:layout_width="0.7dp" |
| 315 | android:layout_height="match_parent" | 315 | android:layout_height="match_parent" |
| 316 | android:background="@color/cutoff_line"> | 316 | android:background="@color/cutoff_line"> |
| 317 | 317 | ||
| 318 | </View> | 318 | </View> |
| 319 | 319 | ||
| 320 | <LinearLayout | 320 | <LinearLayout |
| 321 | android:layout_width="0dp" | 321 | android:layout_width="0dp" |
| 322 | android:layout_height="match_parent" | 322 | android:layout_height="match_parent" |
| 323 | android:layout_weight="2.5" | 323 | android:layout_weight="2.5" |
| 324 | android:orientation="vertical"> | 324 | android:orientation="vertical"> |
| 325 | 325 | ||
| 326 | <LinearLayout | 326 | <LinearLayout |
| 327 | android:layout_width="match_parent" | 327 | android:layout_width="match_parent" |
| 328 | android:layout_height="wrap_content" | 328 | android:layout_height="wrap_content" |
| 329 | android:layout_margin="20dp" | 329 | android:layout_margin="20dp" |
| 330 | android:gravity="center_vertical" | 330 | android:gravity="center_vertical" |
| 331 | android:orientation="horizontal"> | 331 | android:orientation="horizontal"> |
| 332 | 332 | ||
| 333 | <View | 333 | <View |
| 334 | android:layout_width="5dp" | 334 | android:layout_width="5dp" |
| 335 | android:layout_height="20dp" | 335 | android:layout_height="20dp" |
| 336 | android:background="@color/login_text_blue"> | 336 | android:background="@color/login_text_blue"> |
| 337 | 337 | ||
| 338 | </View> | 338 | </View> |
| 339 | 339 | ||
| 340 | <TextView | 340 | <TextView |
| 341 | android:layout_width="wrap_content" | 341 | android:layout_width="wrap_content" |
| 342 | android:layout_height="wrap_content" | 342 | android:layout_height="wrap_content" |
| 343 | android:layout_marginLeft="5dp" | 343 | android:layout_marginLeft="5dp" |
| 344 | android:text="最近学习" | 344 | android:text="最近学习" |
| 345 | android:textSize="22sp" /> | 345 | android:textSize="22sp" /> |
| 346 | 346 | ||
| 347 | </LinearLayout> | 347 | </LinearLayout> |
| 348 | 348 | ||
| 349 | <LinearLayout | 349 | <LinearLayout |
| 350 | android:layout_width="match_parent" | 350 | android:layout_width="match_parent" |
| 351 | android:layout_height="wrap_content"> | 351 | android:layout_height="wrap_content"> |
| 352 | 352 | ||
| 353 | <android.support.v7.widget.RecyclerView | 353 | <android.support.v7.widget.RecyclerView |
| 354 | android:id="@+id/id_recyclerview_horizontal" | 354 | android:id="@+id/id_recyclerview_horizontal" |
| 355 | android:layout_width="match_parent" | 355 | android:layout_width="match_parent" |
| 356 | android:layout_height="wrap_content" | 356 | android:layout_height="wrap_content" |
| 357 | android:layout_centerVertical="true" | 357 | android:layout_centerVertical="true" |
| 358 | android:scrollbars="none" | 358 | android:scrollbars="none" |
| 359 | > | 359 | > |
| 360 | 360 | ||
| 361 | </android.support.v7.widget.RecyclerView> | 361 | </android.support.v7.widget.RecyclerView> |
| 362 | </LinearLayout> | 362 | </LinearLayout> |
| 363 | 363 | ||
| 364 | <View | 364 | <View |
| 365 | android:layout_width="match_parent" | 365 | android:layout_width="match_parent" |
| 366 | android:layout_height="0.7dp" | 366 | android:layout_height="0.7dp" |
| 367 | android:background="@color/cutoff_line"> | 367 | android:background="@color/cutoff_line"> |
| 368 | 368 | ||
| 369 | </View> | 369 | </View> |
| 370 | 370 | ||
| 371 | <LinearLayout | 371 | <LinearLayout |
| 372 | android:layout_width="match_parent" | 372 | android:layout_width="match_parent" |
| 373 | android:layout_height="wrap_content" | 373 | android:layout_height="wrap_content" |
| 374 | android:layout_margin="20dp" | 374 | android:layout_margin="20dp" |
| 375 | android:gravity="center_vertical" | 375 | android:gravity="center_vertical" |
| 376 | android:orientation="horizontal"> | 376 | android:orientation="horizontal"> |
| 377 | 377 | ||
| 378 | <View | 378 | <View |
| 379 | android:layout_width="5dp" | 379 | android:layout_width="5dp" |
| 380 | android:layout_height="20dp" | 380 | android:layout_height="20dp" |
| 381 | android:background="@color/login_text_blue"> | 381 | android:background="@color/login_text_blue"> |
| 382 | 382 | ||
| 383 | </View> | 383 | </View> |
| 384 | 384 | ||
| 385 | <TextView | 385 | <TextView |
| 386 | android:layout_width="0dp" | 386 | android:layout_width="0dp" |
| 387 | android:layout_height="wrap_content" | 387 | android:layout_height="wrap_content" |
| 388 | android:layout_marginLeft="5dp" | 388 | android:layout_marginLeft="5dp" |
| 389 | android:layout_weight="2" | 389 | android:layout_weight="2" |
| 390 | android:text="个人信息" | 390 | android:text="个人信息" |
| 391 | android:textSize="22sp" /> | 391 | android:textSize="22sp" /> |
| 392 | 392 | ||
| 393 | <TextView | 393 | <TextView |
| 394 | android:id="@+id/tv_edit_presoninfo" | 394 | android:id="@+id/tv_edit_presoninfo" |
| 395 | android:padding="5dp" | 395 | android:padding="5dp" |
| 396 | android:layout_width="0dp" | 396 | android:layout_width="0dp" |
| 397 | android:layout_height="wrap_content" | 397 | android:layout_height="wrap_content" |
| 398 | android:layout_marginLeft="10dp" | 398 | android:layout_marginLeft="10dp" |
| 399 | android:layout_weight="0.2" | 399 | android:layout_weight="0.2" |
| 400 | android:text="编辑" | 400 | android:text="编辑" |
| 401 | android:textSize="18sp" /> | 401 | android:textSize="18sp" /> |
| 402 | 402 | ||
| 403 | <ImageView | 403 | <ImageView |
| 404 | android:layout_width="0dp" | 404 | android:layout_width="0dp" |
| 405 | android:layout_height="wrap_content" | 405 | android:layout_height="wrap_content" |
| 406 | android:layout_weight="0.1" | 406 | android:layout_weight="0.1" |
| 407 | 407 | ||
| 408 | android:src="@mipmap/youjiantou" /> | 408 | android:src="@mipmap/youjiantou" /> |
| 409 | 409 | ||
| 410 | 410 | ||
| 411 | </LinearLayout> | 411 | </LinearLayout> |
| 412 | 412 | ||
| 413 | <LinearLayout | 413 | <LinearLayout |
| 414 | android:layout_width="match_parent" | 414 | android:layout_width="match_parent" |
| 415 | android:layout_height="wrap_content" | 415 | android:layout_height="wrap_content" |
| 416 | android:layout_marginLeft="50dp" | 416 | android:layout_marginLeft="50dp" |
| 417 | android:layout_marginTop="10dp" | 417 | android:layout_marginTop="10dp" |
| 418 | android:orientation="vertical"> | 418 | android:orientation="vertical"> |
| 419 | 419 | ||
| 420 | <LinearLayout | 420 | <LinearLayout |
| 421 | android:layout_width="match_parent" | 421 | android:layout_width="match_parent" |
| 422 | android:layout_height="wrap_content" | 422 | android:layout_height="wrap_content" |
| 423 | android:gravity="center_vertical" | 423 | android:gravity="center_vertical" |
| 424 | android:orientation="horizontal"> | 424 | android:orientation="horizontal"> |
| 425 | 425 | ||
| 426 | <TextView | 426 | <TextView |
| 427 | android:layout_width="0dp" | 427 | android:layout_width="0dp" |
| 428 | android:layout_height="wrap_content" | 428 | android:layout_height="wrap_content" |
| 429 | android:layout_weight="1" | 429 | android:layout_weight="1" |
| 430 | android:text="昵称" | 430 | android:text="昵称" |
| 431 | android:textSize="20sp" /> | 431 | android:textSize="20sp" /> |
| 432 | 432 | ||
| 433 | <TextView | 433 | <TextView |
| 434 | android:id="@+id/tv_username1" | 434 | android:id="@+id/tv_username1" |
| 435 | android:layout_width="0dp" | 435 | android:layout_width="0dp" |
| 436 | android:layout_height="wrap_content" | 436 | android:layout_height="wrap_content" |
| 437 | android:layout_weight="2" | 437 | android:layout_weight="2" |
| 438 | android:hint="未填写" | 438 | android:hint="未填写" |
| 439 | android:textSize="20sp" /> | 439 | android:textSize="20sp" /> |
| 440 | 440 | ||
| 441 | <TextView | 441 | <TextView |
| 442 | android:layout_width="1dp" | 442 | android:layout_width="1dp" |
| 443 | android:layout_height="wrap_content" | 443 | android:layout_height="wrap_content" |
| 444 | android:layout_weight="1" | 444 | android:layout_weight="1" |
| 445 | android:text="星座" | 445 | android:text="星座" |
| 446 | android:textSize="20sp" /> | 446 | android:textSize="20sp" /> |
| 447 | 447 | ||
| 448 | <TextView | 448 | <TextView |
| 449 | android:id="@+id/tv_mygad" | 449 | android:id="@+id/tv_mygad" |
| 450 | android:layout_width="0dp" | 450 | android:layout_width="0dp" |
| 451 | android:layout_height="wrap_content" | 451 | android:layout_height="wrap_content" |
| 452 | android:layout_weight="2" | 452 | android:layout_weight="2" |
| 453 | android:hint="未填写" | 453 | android:hint="未填写" |
| 454 | android:textSize="20sp" /> | 454 | android:textSize="20sp" /> |
| 455 | </LinearLayout> | 455 | </LinearLayout> |
| 456 | 456 | ||
| 457 | <LinearLayout | 457 | <LinearLayout |
| 458 | android:layout_width="match_parent" | 458 | android:layout_width="match_parent" |
| 459 | android:layout_height="wrap_content" | 459 | android:layout_height="wrap_content" |
| 460 | android:layout_marginTop="20dp" | 460 | android:layout_marginTop="20dp" |
| 461 | android:gravity="center_vertical" | 461 | android:gravity="center_vertical" |
| 462 | android:orientation="horizontal"> | 462 | android:orientation="horizontal"> |
| 463 | 463 | ||
| 464 | <TextView | 464 | <TextView |
| 465 | android:layout_width="0dp" | 465 | android:layout_width="0dp" |
| 466 | android:layout_height="wrap_content" | 466 | android:layout_height="wrap_content" |
| 467 | android:layout_weight="1" | 467 | android:layout_weight="1" |
| 468 | android:text="性别" | 468 | android:text="性别" |
| 469 | android:textSize="20sp" /> | 469 | android:textSize="20sp" /> |
| 470 | 470 | ||
| 471 | <TextView | 471 | <TextView |
| 472 | android:id="@+id/tv_sex" | 472 | android:id="@+id/tv_sex" |
| 473 | android:layout_width="0dp" | 473 | android:layout_width="0dp" |
| 474 | android:layout_height="wrap_content" | 474 | android:layout_height="wrap_content" |
| 475 | android:layout_weight="2" | 475 | android:layout_weight="2" |
| 476 | android:hint="未填写" | 476 | android:hint="未填写" |
| 477 | android:textSize="20sp" /> | 477 | android:textSize="20sp" /> |
| 478 | 478 | ||
| 479 | <TextView | 479 | <TextView |
| 480 | android:layout_width="1dp" | 480 | android:layout_width="1dp" |
| 481 | android:layout_height="wrap_content" | 481 | android:layout_height="wrap_content" |
| 482 | android:layout_weight="1" | 482 | android:layout_weight="1" |
| 483 | android:text="地区" | 483 | android:text="地区" |
| 484 | android:textSize="20sp" /> | 484 | android:textSize="20sp" /> |
| 485 | 485 | ||
| 486 | <TextView | 486 | <TextView |
| 487 | android:id="@+id/tv_useinfo_adress" | 487 | android:id="@+id/tv_useinfo_adress" |
| 488 | android:layout_width="0dp" | 488 | android:layout_width="0dp" |
| 489 | android:layout_height="wrap_content" | 489 | android:layout_height="wrap_content" |
| 490 | android:layout_weight="2" | 490 | android:layout_weight="2" |
| 491 | android:hint="未填写" | 491 | android:hint="未填写" |
| 492 | android:textSize="20sp" /> | 492 | android:textSize="20sp" /> |
| 493 | </LinearLayout> | 493 | </LinearLayout> |
| 494 | 494 | ||
| 495 | <LinearLayout | 495 | <LinearLayout |
| 496 | android:layout_width="match_parent" | 496 | android:layout_width="match_parent" |
| 497 | android:layout_height="wrap_content" | 497 | android:layout_height="wrap_content" |
| 498 | android:layout_marginTop="20dp" | 498 | android:layout_marginTop="20dp" |
| 499 | android:gravity="center_vertical" | 499 | android:gravity="center_vertical" |
| 500 | android:orientation="horizontal"> | 500 | android:orientation="horizontal"> |
| 501 | 501 | ||
| 502 | <TextView | 502 | <TextView |
| 503 | android:layout_width="0dp" | 503 | android:layout_width="0dp" |
| 504 | android:layout_height="wrap_content" | 504 | android:layout_height="wrap_content" |
| 505 | android:layout_weight="1" | 505 | android:layout_weight="1" |
| 506 | android:text="生日" | 506 | android:text="生日" |
| 507 | android:textSize="20sp" /> | 507 | android:textSize="20sp" /> |
| 508 | 508 | ||
| 509 | <TextView | 509 | <TextView |
| 510 | android:id="@+id/tv_useinfo_birthday" | 510 | android:id="@+id/tv_useinfo_birthday" |
| 511 | android:layout_width="0dp" | 511 | android:layout_width="0dp" |
| 512 | android:layout_height="wrap_content" | 512 | android:layout_height="wrap_content" |
| 513 | android:layout_weight="2" | 513 | android:layout_weight="2" |
| 514 | android:hint="未填写" | 514 | android:hint="未填写" |
| 515 | android:textSize="20sp" /> | 515 | android:textSize="20sp" /> |
| 516 | 516 | ||
| 517 | <TextView | 517 | <TextView |
| 518 | android:layout_width="1dp" | 518 | android:layout_width="1dp" |
| 519 | android:layout_height="wrap_content" | 519 | android:layout_height="wrap_content" |
| 520 | android:layout_weight="1" | 520 | android:layout_weight="1" |
| 521 | android:text="学校" | 521 | android:text="学校" |
| 522 | android:textSize="20sp" /> | 522 | android:textSize="20sp" /> |
| 523 | 523 | ||
| 524 | <TextView | 524 | <TextView |
| 525 | android:id="@+id/tv_useinfo_school" | 525 | android:id="@+id/tv_useinfo_school" |
| 526 | android:layout_width="0dp" | 526 | android:layout_width="0dp" |
| 527 | android:layout_height="wrap_content" | 527 | android:layout_height="wrap_content" |
| 528 | android:layout_weight="2" | 528 | android:layout_weight="2" |
| 529 | android:hint="未填写" | 529 | android:hint="未填写" |
| 530 | android:textSize="20sp" /> | 530 | android:textSize="20sp" /> |
| 531 | </LinearLayout> | 531 | </LinearLayout> |
| 532 | 532 | ||
| 533 | <LinearLayout | 533 | <LinearLayout |
| 534 | android:layout_width="match_parent" | 534 | android:layout_width="match_parent" |
| 535 | android:layout_height="wrap_content" | 535 | android:layout_height="wrap_content" |
| 536 | android:layout_marginTop="20dp" | 536 | android:layout_marginTop="20dp" |
| 537 | android:gravity="center_vertical" | 537 | android:gravity="center_vertical" |
| 538 | android:orientation="horizontal"> | 538 | android:orientation="horizontal"> |
| 539 | 539 | ||
| 540 | <TextView | 540 | <TextView |
| 541 | android:layout_width="0dp" | 541 | android:layout_width="0dp" |
| 542 | android:layout_height="wrap_content" | 542 | android:layout_height="wrap_content" |
| 543 | android:layout_weight="1" | 543 | android:layout_weight="1" |
| 544 | android:text="Q Q" | 544 | android:text="Q Q" |
| 545 | android:textSize="20sp" /> | 545 | android:textSize="20sp" /> |
| 546 | 546 | ||
| 547 | <TextView | 547 | <TextView |
| 548 | android:id="@+id/tv_useinfo_qq" | 548 | android:id="@+id/tv_useinfo_qq" |
| 549 | android:layout_width="0dp" | 549 | android:layout_width="0dp" |
| 550 | android:layout_height="wrap_content" | 550 | android:layout_height="wrap_content" |
| 551 | android:layout_weight="2" | 551 | android:layout_weight="2" |
| 552 | android:hint="未填写" | 552 | android:hint="未填写" |
| 553 | android:textSize="20sp" /> | 553 | android:textSize="20sp" /> |
| 554 | 554 | ||
| 555 | <TextView | 555 | <TextView |
| 556 | android:layout_width="1dp" | 556 | android:layout_width="1dp" |
| 557 | android:layout_height="wrap_content" | 557 | android:layout_height="wrap_content" |
| 558 | android:layout_weight="1" | 558 | android:layout_weight="1" |
| 559 | android:text="年级" | 559 | android:text="年级" |
| 560 | android:textSize="20sp" /> | 560 | android:textSize="20sp" /> |
| 561 | 561 | ||
| 562 | <TextView | 562 | <TextView |
| 563 | android:id="@+id/tv_useinfo_gender" | 563 | android:id="@+id/tv_useinfo_gender" |
| 564 | android:layout_width="0dp" | 564 | android:layout_width="0dp" |
| 565 | android:layout_height="wrap_content" | 565 | android:layout_height="wrap_content" |
| 566 | android:layout_weight="2" | 566 | android:layout_weight="2" |
| 567 | android:hint="未填写" | 567 | android:hint="未填写" |
| 568 | android:textSize="20sp" /> | 568 | android:textSize="20sp" /> |
| 569 | </LinearLayout> | 569 | </LinearLayout> |
| 570 | 570 | ||
| 571 | 571 | ||
| 572 | </LinearLayout> | 572 | </LinearLayout> |
| 573 | <View | 573 | <View |
| 574 | android:layout_width="match_parent" | 574 | android:layout_width="match_parent" |
| 575 | android:layout_height="0.7dp" | 575 | android:layout_height="0.7dp" |
| 576 | android:layout_marginTop="20dp" | 576 | android:layout_marginTop="20dp" |
| 577 | android:background="@color/cutoff_line"> | 577 | android:background="@color/cutoff_line"> |
| 578 | 578 | ||
| 579 | </View> | 579 | </View> |
| 580 | <LinearLayout | 580 | <LinearLayout |
| 581 | android:layout_width="match_parent" | 581 | android:layout_width="match_parent" |
| 582 | android:layout_height="wrap_content" | 582 | android:layout_height="wrap_content" |
| 583 | android:layout_margin="20dp" | 583 | android:layout_margin="20dp" |
| 584 | android:gravity="center_vertical" | 584 | android:gravity="center_vertical" |
| 585 | android:orientation="horizontal"> | 585 | android:orientation="horizontal"> |
| 586 | 586 | ||
| 587 | <View | 587 | <View |
| 588 | android:layout_width="5dp" | 588 | android:layout_width="5dp" |
| 589 | android:layout_height="20dp" | 589 | android:layout_height="20dp" |
| 590 | android:background="@color/login_text_blue"> | 590 | android:background="@color/login_text_blue"> |
| 591 | 591 | ||
| 592 | </View> | 592 | </View> |
| 593 | 593 | ||
| 594 | <TextView | 594 | <TextView |
| 595 | android:layout_width="wrap_content" | 595 | android:layout_width="wrap_content" |
| 596 | android:layout_height="wrap_content" | 596 | android:layout_height="wrap_content" |
| 597 | android:layout_marginLeft="5dp" | 597 | android:layout_marginLeft="5dp" |
| 598 | android:text="版本信息" | 598 | android:text="版本信息" |
| 599 | android:textSize="22sp" /> | 599 | android:textSize="22sp" /> |
| 600 | 600 | ||
| 601 | </LinearLayout> | 601 | </LinearLayout> |
| 602 | 602 | ||
| 603 | <LinearLayout | 603 | <LinearLayout |
| 604 | android:layout_width="match_parent" | 604 | android:layout_width="match_parent" |
| 605 | android:layout_height="wrap_content" | 605 | android:layout_height="wrap_content" |
| 606 | android:layout_marginTop="20dp"> | 606 | android:layout_marginTop="20dp"> |
| 607 | 607 | ||
| 608 | <TextView | 608 | <TextView |
| 609 | android:layout_width="match_parent" | 609 | android:layout_width="match_parent" |
| 610 | android:layout_height="100dp" | 610 | android:layout_height="100dp" |
| 611 | android:layout_marginLeft="20dp" | 611 | android:layout_marginLeft="20dp" |
| 612 | android:layout_marginTop="10dp" | 612 | android:layout_marginTop="10dp" |
| 613 | android:gravity="center" | 613 | android:gravity="center" |
| 614 | android:text="这里需要显示水平滑动的" /> | 614 | android:text="这里需要显示水平滑动的" /> |
| 615 | </LinearLayout> | 615 | </LinearLayout> |
| 616 | 616 | ||
| 617 | 617 | ||
| 618 | </LinearLayout> | 618 | </LinearLayout> |
| 619 | 619 | ||
| 620 | 620 | ||
| 621 | </LinearLayout> | 621 | </LinearLayout> |
| 622 | 622 | ||
| 623 | 623 | ||
| 624 | </LinearLayout> | 624 | </LinearLayout> |
| 625 | 625 |
PersonalCenter/app/src/main/res/layout/custom_adilog_lhead.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
| 4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
| 5 | android:orientation="vertical"> | 5 | android:orientation="vertical"> |
| 6 | 6 | ||
| 7 | <RelativeLayout | 7 | <RelativeLayout |
| 8 | android:id="@+id/title" | 8 | android:id="@+id/title" |
| 9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
| 10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
| 11 | android:minHeight="70dp" > | 11 | android:minHeight="70dp" > |
| 12 | 12 | ||
| 13 | <TextView | 13 | <TextView |
| 14 | android:id="@+id/menu_title" | 14 | android:id="@+id/menu_title" |
| 15 | android:layout_width="wrap_content" | 15 | android:layout_width="wrap_content" |
| 16 | android:layout_height="wrap_content" | 16 | android:layout_height="wrap_content" |
| 17 | android:layout_centerInParent="true" | 17 | android:layout_centerInParent="true" |
| 18 | android:padding="20dp" | 18 | android:padding="20dp" |
| 19 | android:text="个人头像" | 19 | android:text="个人头像" |
| 20 | android:textColor="@android:color/black" | 20 | android:textColor="@android:color/black" |
| 21 | android:textSize="22sp" /> | 21 | android:textSize="22sp" /> |
| 22 | </RelativeLayout> | 22 | </RelativeLayout> |
| 23 | <LinearLayout | 23 | <LinearLayout |
| 24 | android:layout_width="match_parent" | 24 | android:layout_width="match_parent" |
| 25 | android:layout_height="230dp" | 25 | android:layout_height="260dp" |
| 26 | android:layout_margin="20dp" | 26 | android:layout_margin="20dp" |
| 27 | android:orientation="vertical"> | 27 | android:orientation="vertical"> |
| 28 | <TextView | 28 | <TextView |
| 29 | android:layout_width="wrap_content" | 29 | android:layout_width="wrap_content" |
| 30 | android:layout_height="wrap_content" | 30 | android:layout_height="wrap_content" |
| 31 | android:layout_marginLeft="50dp" | 31 | android:layout_marginLeft="50dp" |
| 32 | android:textSize="18sp" | 32 | android:textSize="18sp" |
| 33 | android:text="默认头像"/> | 33 | android:text="默认头像"/> |
| 34 | <LinearLayout | 34 | <RadioGroup |
| 35 | android:id="@+id/radiogroup_head" | ||
| 35 | android:layout_width="match_parent" | 36 | android:layout_width="match_parent" |
| 36 | android:layout_height="wrap_content" | 37 | android:layout_height="wrap_content" |
| 37 | android:gravity="center" | 38 | android:gravity="center" |
| 38 | android:layout_marginTop="10dp" | 39 | android:layout_marginTop="10dp" |
| 39 | android:orientation="horizontal"> | 40 | android:orientation="horizontal"> |
| 40 | <ImageView | 41 | <RadioButton |
| 42 | android:id="@+id/radio_head1" | ||
| 41 | android:layout_width="wrap_content" | 43 | android:layout_width="wrap_content" |
| 42 | android:layout_height="wrap_content" | 44 | android:layout_height="wrap_content" |
| 43 | android:layout_margin="10dp" | 45 | android:layout_margin="20dp" |
| 44 | android:src="@mipmap/ic_launcher"/> | 46 | android:button="@drawable/radio_button" |
| 45 | <ImageView | 47 | android:background="@mipmap/default_avatar1" /> |
| 48 | <RadioButton | ||
| 49 | android:id="@+id/radio_head2" | ||
| 46 | android:layout_width="wrap_content" | 50 | android:layout_width="wrap_content" |
| 47 | android:layout_height="wrap_content" | 51 | android:layout_height="wrap_content" |
| 48 | android:layout_margin="10dp" | 52 | android:layout_margin="20dp" |
| 49 | android:src="@mipmap/ic_launcher"/> | 53 | android:button="@drawable/radio_button" |
| 50 | <ImageView | 54 | android:background="@mipmap/default_avatar2"/> |
| 55 | <RadioButton | ||
| 56 | android:id="@+id/radio_head3" | ||
| 51 | android:layout_width="wrap_content" | 57 | android:layout_width="wrap_content" |
| 52 | android:layout_height="wrap_content" | 58 | android:layout_height="wrap_content" |
| 53 | android:layout_margin="10dp" | 59 | android:layout_margin="20dp" |
| 54 | android:src="@mipmap/ic_launcher"/> | 60 | android:button="@drawable/radio_button" |
| 55 | <ImageView | 61 | android:background="@mipmap/default_avatar3"/> |
| 62 | <RadioButton | ||
| 63 | android:id="@+id/radio_head4" | ||
| 56 | android:layout_width="wrap_content" | 64 | android:layout_width="wrap_content" |
| 57 | android:layout_height="wrap_content" | 65 | android:layout_height="wrap_content" |
| 58 | android:layout_margin="10dp" | 66 | android:layout_margin="20dp" |
| 59 | android:src="@mipmap/ic_launcher"/> | 67 | android:button="@drawable/radio_button" |
| 68 | android:background="@mipmap/default_avatar4"/> | ||
| 60 | 69 | ||
| 61 | </LinearLayout> | 70 | </RadioGroup> |
| 62 | <LinearLayout | 71 | <LinearLayout |
| 63 | android:layout_width="match_parent" | 72 | android:layout_width="match_parent" |
| 64 | android:layout_height="wrap_content" | 73 | android:layout_height="wrap_content" |
| 65 | android:gravity="center" | 74 | android:gravity="center" |
| 66 | android:layout_marginTop="10dp" | 75 | android:layout_marginTop="10dp" |
| 67 | android:orientation="horizontal"> | 76 | android:orientation="horizontal"> |
| 68 | <LinearLayout | 77 | <LinearLayout |
| 69 | android:id="@+id/take_pic" | 78 | android:id="@+id/take_pic" |
| 70 | android:layout_width="0dp" | 79 | android:layout_width="0dp" |
| 71 | android:layout_weight="1" | 80 | android:layout_weight="1" |
| 72 | android:gravity="center" | 81 | android:gravity="center" |
| 73 | android:layout_height="wrap_content"> | 82 | android:layout_height="wrap_content"> |
| 74 | <ImageView | 83 | <ImageView |
| 75 | android:layout_width="wrap_content" | 84 | android:layout_width="wrap_content" |
| 76 | android:layout_height="wrap_content" | 85 | android:layout_height="wrap_content" |
| 77 | android:layout_margin="10dp" | 86 | android:layout_margin="10dp" |
| 78 | android:src="@mipmap/paizhao"/> | 87 | android:src="@mipmap/paizhao"/> |
| 79 | <TextView | 88 | <TextView |
| 80 | android:layout_width="wrap_content" | 89 | android:layout_width="wrap_content" |
| 81 | android:layout_height="wrap_content" | 90 | android:layout_height="wrap_content" |
| 82 | android:layout_gravity="center_vertical" | 91 | android:layout_gravity="center_vertical" |
| 83 | android:textSize="18sp" | 92 | android:textSize="18sp" |
| 84 | android:text="拍一张"/> | 93 | android:text="拍一张"/> |
| 85 | 94 | ||
| 86 | </LinearLayout> | 95 | </LinearLayout> |
| 87 | <LinearLayout | 96 | <LinearLayout |
| 88 | android:id="@+id/xiangce" | 97 | android:id="@+id/xiangce" |
| 89 | android:layout_width="0dp" | 98 | android:layout_width="0dp" |
| 90 | android:layout_weight="1" | 99 | android:layout_weight="1" |
| 91 | android:gravity="center" | 100 | android:gravity="center" |
| 92 | android:layout_height="wrap_content"> | 101 | android:layout_height="wrap_content"> |
| 93 | <ImageView | 102 | <ImageView |
| 94 | android:layout_width="wrap_content" | 103 | android:layout_width="wrap_content" |
| 95 | android:layout_height="wrap_content" | 104 | android:layout_height="wrap_content" |
| 96 | android:layout_margin="10dp" | 105 | android:layout_margin="10dp" |
| 97 | android:src="@mipmap/xiangce"/> | 106 | android:src="@mipmap/xiangce"/> |
| 98 | <TextView | 107 | <TextView |
| 99 | android:layout_width="wrap_content" | 108 | android:layout_width="wrap_content" |
| 100 | android:layout_height="wrap_content" | 109 | android:layout_height="wrap_content" |
| 101 | android:layout_gravity="center_vertical" | 110 | android:layout_gravity="center_vertical" |
| 102 | android:textSize="18sp" | 111 | android:textSize="18sp" |
| 103 | android:text="相册"/> | 112 | android:text="相册"/> |
| 104 | 113 | ||
| 105 | 114 | ||
| 106 | </LinearLayout> | 115 | </LinearLayout> |
| 107 | 116 | ||
| 108 | 117 | ||
| 109 | </LinearLayout> | 118 | </LinearLayout> |
| 110 | <View | 119 | <View |
| 111 | android:layout_marginTop="10dp" | 120 | android:layout_marginTop="10dp" |
| 112 | android:layout_width="match_parent" | 121 | android:layout_width="match_parent" |
| 113 | android:background="@color/cutoff_line" | 122 | android:background="@color/cutoff_line" |
| 114 | android:layout_height="0.7dp"> | 123 | android:layout_height="0.7dp"> |
| 115 | 124 | ||
| 116 | </View> | 125 | </View> |
| 117 | <LinearLayout | 126 | <LinearLayout |
| 118 | android:layout_width="match_parent" | 127 | android:layout_width="match_parent" |
| 119 | android:layout_height="wrap_content" | 128 | android:layout_height="50dp" |
| 120 | android:gravity="center" | 129 | android:gravity="center" |
| 121 | android:orientation="horizontal"> | 130 | android:orientation="horizontal"> |
| 122 | 131 | ||
| 123 | <TextView | 132 | <TextView |
| 124 | android:id="@+id/canceltakephone" | 133 | android:id="@+id/canceltakephone" |
| 125 | android:layout_width="0dp" | 134 | android:layout_width="0dp" |
| 126 | android:layout_weight="1" | 135 | android:layout_weight="1" |
| 127 | android:layout_marginTop="10dp" | 136 | android:layout_marginTop="10dp" |
| 128 | android:layout_height="wrap_content" | 137 | android:layout_height="wrap_content" |
| 129 | android:gravity="center" | 138 | android:gravity="center" |
| 130 | android:textSize="18sp" | 139 | android:textSize="18sp" |
| 131 | android:text="取消"/> | 140 | android:text="取消"/> |
| 132 | <View | 141 | <View |
| 133 | android:layout_width="0.7dp" | 142 | android:layout_width="0.7dp" |
| 134 | android:layout_height="match_parent" | 143 | android:layout_height="match_parent" |
| 135 | android:background="@color/cutoff_line"> | 144 | android:background="@color/cutoff_line"> |
| 136 | 145 | ||
| 137 | </View> | 146 | </View> |
| 138 | 147 | ||
| 139 | <TextView | 148 | <TextView |
| 140 | android:id="@+id/oktakephone" | 149 | android:id="@+id/oktakephone" |
| 141 | android:layout_width="0dp" | 150 | android:layout_width="0dp" |
| 142 | android:layout_weight="1" | 151 | android:layout_weight="1" |
| 143 | android:layout_height="wrap_content" | 152 | android:layout_height="wrap_content" |
| 144 | android:layout_marginTop="10dp" | 153 | android:layout_marginTop="10dp" |
| 145 | android:gravity="center" | 154 | android:gravity="center" |
| 146 | android:textSize="18sp" | 155 | android:textSize="18sp" |
| 147 | android:text="确定"/> | 156 | android:text="确定"/> |
| 148 | 157 | ||
| 149 | </LinearLayout> | 158 | </LinearLayout> |
| 150 | 159 | ||
| 151 | </LinearLayout> | 160 | </LinearLayout> |
| 152 | </LinearLayout> | 161 | </LinearLayout> |
| 153 | 162 |
PersonalCenter/app/src/main/res/mipmap-xhdpi/default_avatar1.png
30.4 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/default_avatar2.png
34.5 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/default_avatar3.png
39.5 KB
PersonalCenter/app/src/main/res/mipmap-xhdpi/default_avatar4.png
38.3 KB