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
... | ... | @@ -10,6 +10,8 @@ import android.provider.MediaStore; |
10 | 10 | import android.support.annotation.NonNull; |
11 | 11 | import android.support.v4.content.FileProvider; |
12 | 12 | import android.support.v7.app.AppCompatActivity; |
13 | +import android.text.TextUtils; | |
14 | +import android.util.Log; | |
13 | 15 | import android.view.Gravity; |
14 | 16 | import android.view.View; |
15 | 17 | import android.widget.AdapterView; |
... | ... | @@ -25,9 +27,14 @@ import com.facebook.drawee.generic.RoundingParams; |
25 | 27 | import com.facebook.drawee.interfaces.DraweeController; |
26 | 28 | import com.facebook.drawee.view.SimpleDraweeView; |
27 | 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 | 34 | import com.hjx.personalcenter.util.CropUtils; |
29 | 35 | import com.hjx.personalcenter.util.DialogPermission; |
30 | 36 | import com.hjx.personalcenter.util.FileUtil; |
37 | +import com.hjx.personalcenter.util.GetDate; | |
31 | 38 | import com.hjx.personalcenter.util.PermissionUtil; |
32 | 39 | import com.hjx.personalcenter.util.SharedPreferenceMark; |
33 | 40 | import com.mylhyl.circledialog.CircleDialog; |
... | ... | @@ -37,13 +44,15 @@ import com.mylhyl.circledialog.params.ButtonParams; |
37 | 44 | import com.mylhyl.circledialog.params.DialogParams; |
38 | 45 | |
39 | 46 | import java.io.File; |
47 | +import java.util.ArrayList; | |
48 | +import java.util.List; | |
40 | 49 | |
41 | 50 | /** |
42 | 51 | * Created by h on 2017/8/11. |
43 | 52 | */ |
44 | 53 | |
45 | 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 | 56 | private EditText content, phone; |
48 | 57 | private TextView tv_sub; |
49 | 58 | private static final int REQUEST_CODE_TAKE_PHOTO = 1; |
... | ... | @@ -52,6 +61,7 @@ public class FeedBackActivity extends AppCompatActivity implements View.OnClickL |
52 | 61 | SimpleDraweeView mSimpleDraweeView; |
53 | 62 | private File file; |
54 | 63 | private Uri uri; |
64 | + | |
55 | 65 | @Override |
56 | 66 | protected void onCreate(Bundle savedInstanceState) { |
57 | 67 | super.onCreate(savedInstanceState); |
... | ... | @@ -66,8 +76,8 @@ public class FeedBackActivity extends AppCompatActivity implements View.OnClickL |
66 | 76 | iv_cance = (ImageView) findViewById(R.id.cancel); |
67 | 77 | mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.show_iv); |
68 | 78 | iv_take = (ImageView) findViewById(R.id.iv_take); |
69 | - content = (EditText) findViewById(R.id.feedback_content); | |
70 | - phone = (EditText) findViewById(R.id.feedback_phone); | |
79 | + content = (EditText) findViewById(R.id.feedback_content); | |
80 | + phone = (EditText) findViewById(R.id.feedback_phone); | |
71 | 81 | tv_sub = (TextView) findViewById(R.id.feedback_sub); |
72 | 82 | |
73 | 83 | } |
... | ... | @@ -93,7 +103,9 @@ public class FeedBackActivity extends AppCompatActivity implements View.OnClickL |
93 | 103 | |
94 | 104 | @Override |
95 | 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 | 109 | case R.id.cancel: |
98 | 110 | finish(); |
99 | 111 | break; |
... | ... | @@ -101,6 +113,33 @@ public class FeedBackActivity extends AppCompatActivity implements View.OnClickL |
101 | 113 | choiceAvatar(); |
102 | 114 | break; |
103 | 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 | 143 | break; |
105 | 144 | case R.id.show_iv: |
106 | 145 | |
... | ... | @@ -125,7 +164,7 @@ public class FeedBackActivity extends AppCompatActivity implements View.OnClickL |
125 | 164 | @Override |
126 | 165 | public void onItemClick(AdapterView<?> parent, View view, int |
127 | 166 | position, long id) { |
128 | - switch (position){ | |
167 | + switch (position) { | |
129 | 168 | case 0: |
130 | 169 | if (PermissionUtil.hasCameraPermission(FeedBackActivity.this)) { |
131 | 170 | uploadAvatarFromPhotoRequest(); |
... | ... | @@ -150,6 +189,7 @@ public class FeedBackActivity extends AppCompatActivity implements View.OnClickL |
150 | 189 | |
151 | 190 | |
152 | 191 | } |
192 | + | |
153 | 193 | //照相 |
154 | 194 | private void uploadAvatarFromPhotoRequest() { |
155 | 195 | Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); |
... | ... | @@ -165,6 +205,7 @@ public class FeedBackActivity extends AppCompatActivity implements View.OnClickL |
165 | 205 | photoPickerIntent.setType("image/*"); |
166 | 206 | startActivityForResult(photoPickerIntent, REQUEST_CODE_ALBUM); |
167 | 207 | } |
208 | + | |
168 | 209 | //回掉 |
169 | 210 | @Override |
170 | 211 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
... | ... | @@ -180,12 +221,14 @@ public class FeedBackActivity extends AppCompatActivity implements View.OnClickL |
180 | 221 | newUri = data.getData(); |
181 | 222 | } |
182 | 223 | if (newUri != null) { |
183 | - startPhotoZoom(newUri); | |
224 | + uploadAvatarFromPhoto(); | |
225 | + //裁剪图片 | |
226 | + //startPhotoZoom(newUri); | |
184 | 227 | } else { |
185 | 228 | Toast.makeText(this, "没有得到相册图片", Toast.LENGTH_LONG).show(); |
186 | 229 | } |
187 | 230 | } else if (requestCode == REQUEST_CODE_TAKE_PHOTO) { |
188 | - startPhotoZoom(uri); | |
231 | + uploadAvatarFromPhoto(); | |
189 | 232 | } else if (requestCode == REQUEST_CODE_CROUP_PHOTO) { |
190 | 233 | uploadAvatarFromPhoto(); |
191 | 234 | } |
... | ... | @@ -195,6 +238,7 @@ public class FeedBackActivity extends AppCompatActivity implements View.OnClickL |
195 | 238 | compressAndUploadAvatar(file.getPath()); |
196 | 239 | |
197 | 240 | } |
241 | + | |
198 | 242 | private void compressAndUploadAvatar(String fileSrc) { |
199 | 243 | |
200 | 244 | |
... | ... | @@ -231,10 +275,10 @@ public class FeedBackActivity extends AppCompatActivity implements View.OnClickL |
231 | 275 | intent.setDataAndType(uri, "image/*"); |
232 | 276 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
233 | 277 | intent.putExtra("crop", "true");// crop=true 有这句才能出来最后的裁剪页面. |
234 | -// intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | |
235 | -// intent.putExtra("aspectY", 1);// x:y=1:1 | |
236 | - intent.putExtra("outputX", 400);//图片输出大小 | |
237 | - intent.putExtra("outputY", 400); | |
278 | + intent.putExtra("aspectX", 1);// 这两项为裁剪框的比例. | |
279 | + intent.putExtra("aspectY", 1);// x:y=1:1 | |
280 | +// intent.putExtra("outputX", 400);//图片输出大小 | |
281 | +// intent.putExtra("outputY", 400); | |
238 | 282 | intent.putExtra("output", Uri.fromFile(file)); |
239 | 283 | intent.putExtra("outputFormat", "JPEG");// 返回格式 |
240 | 284 | startActivityForResult(intent, REQUEST_CODE_CROUP_PHOTO); | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/MainActivity.java
... | ... | @@ -182,7 +182,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
182 | 182 | |
183 | 183 | //初始化图片 |
184 | 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 | 186 | uri = Uri.fromFile(file); |
187 | 187 | } else { |
188 | 188 | //通过FileProvider创建一个content类型的Uri(android 7.0需要这样的方法跨应用访问) |
... | ... | @@ -333,11 +333,25 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
333 | 333 | |
334 | 334 | //回调头像监听 |
335 | 335 | @Override |
336 | - public void heard(Context context, View v) { | |
336 | + public void heard(Context context, View v,int headpitiaon) { | |
337 | 337 | switch (v.getId()){ |
338 | 338 | //选择默认图片 |
339 | 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 | 355 | break; |
342 | 356 | case R.id.canceltakephone: |
343 | 357 | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/RegisterInfoActivity.java
... | ... | @@ -92,7 +92,7 @@ public class RegisterInfoActivity extends AppCompatActivity implements View.OnCl |
92 | 92 | |
93 | 93 | break; |
94 | 94 | case R.id.btn_ok: |
95 | - if (TextUtils.isEmpty(register1)||TextUtils.isEmpty(register4) || | |
95 | + if (TextUtils.isEmpty(register1) || | |
96 | 96 | TextUtils.isEmpty(register2) || TextUtils.isEmpty(register3)){ |
97 | 97 | AlertUtils.showToast(RegisterInfoActivity.this, "请将必填项填写完整"); |
98 | 98 | return; | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/HeadDialog.java
... | ... | @@ -8,6 +8,7 @@ import android.view.LayoutInflater; |
8 | 8 | import android.view.View; |
9 | 9 | import android.view.ViewGroup; |
10 | 10 | import android.widget.LinearLayout; |
11 | +import android.widget.RadioButton; | |
11 | 12 | import android.widget.TextView; |
12 | 13 | |
13 | 14 | import com.hjx.personalcenter.R; |
... | ... | @@ -24,6 +25,8 @@ public class HeadDialog extends BaseCircleDialog implements View.OnClickListener |
24 | 25 | private TextView oktakephone, cancetakephone; |
25 | 26 | private LinearLayout take_pic,xiangce; |
26 | 27 | private DialogCallBack.CallBackView mCallBack; |
28 | + //默认头像选择 | |
29 | + RadioButton radio_head1,radio_head2,radio_head3,radio_head4; | |
27 | 30 | |
28 | 31 | public HeadDialog(DialogCallBack.CallBackView callBack) { |
29 | 32 | this.mCallBack = callBack; |
... | ... | @@ -32,7 +35,7 @@ public class HeadDialog extends BaseCircleDialog implements View.OnClickListener |
32 | 35 | public static HeadDialog getInstance(DialogCallBack.CallBackView callBackview) { |
33 | 36 | HeadDialog dialogFragment = new HeadDialog(callBackview); |
34 | 37 | dialogFragment.setCanceledBack(true); |
35 | - dialogFragment.setCanceledOnTouchOutside(true); | |
38 | + dialogFragment.setCanceledOnTouchOutside(false); | |
36 | 39 | dialogFragment.setRadius(CircleDimen.RADIUS); |
37 | 40 | dialogFragment.setWidth(0.4f); |
38 | 41 | dialogFragment.setGravity(Gravity.CENTER); |
... | ... | @@ -56,6 +59,10 @@ public class HeadDialog extends BaseCircleDialog implements View.OnClickListener |
56 | 59 | cancetakephone = (TextView) mView.findViewById(R.id.canceltakephone); |
57 | 60 | take_pic = (LinearLayout) mView.findViewById(R.id.take_pic); |
58 | 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 | 66 | oktakephone.setOnClickListener(this); |
60 | 67 | cancetakephone.setOnClickListener(this); |
61 | 68 | take_pic.setOnClickListener(this); |
... | ... | @@ -66,7 +73,19 @@ public class HeadDialog extends BaseCircleDialog implements View.OnClickListener |
66 | 73 | |
67 | 74 | @Override |
68 | 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 | 89 | dismiss(); |
71 | 90 | } |
72 | 91 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/PresonInfoFragment.java
... | ... | @@ -176,7 +176,7 @@ public class PresonInfoFragment extends Fragment implements View.OnClickListener |
176 | 176 | case R.id.presonal_sub: |
177 | 177 | if (TextUtils.isEmpty(presonal1) || |
178 | 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 | 180 | TextUtils.isEmpty(presonal8)) { |
181 | 181 | AlertUtils.showToast(getActivity(), "请将信息填写完整!"); |
182 | 182 | return; | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
... | ... | @@ -973,6 +973,67 @@ public class HttpManager { |
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 | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpUrl.java
... | ... | @@ -30,6 +30,7 @@ public class HttpUrl { |
30 | 30 | public static String getpresonalinfo=GetDomain()+"/personal/get";//修改个人信息 |
31 | 31 | public static String signature=GetDomain()+"/signature/addOrUpdateSignature";//修改个性签名 |
32 | 32 | public static String getsignature=GetDomain()+"/signature/info";//获取个性签名 |
33 | + public static String feedbackURL=GetDomain()+"/feedback/add";//用户反馈 | |
33 | 34 | |
34 | 35 | |
35 | 36 | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/interfaces/DialogCallBack.java
... | ... | @@ -2,7 +2,6 @@ package com.hjx.personalcenter.interfaces; |
2 | 2 | |
3 | 3 | import android.content.Context; |
4 | 4 | import android.view.View; |
5 | -import android.widget.AdapterView; | |
6 | 5 | |
7 | 6 | import com.hjx.personalcenter.model.CityInfo; |
8 | 7 | import com.hjx.personalcenter.model.CountyInfo; |
... | ... | @@ -35,6 +34,6 @@ public class DialogCallBack { |
35 | 34 | } |
36 | 35 | //头像回调 |
37 | 36 | public interface CallBackView{ |
38 | - void heard(Context context,View v); | |
37 | + void heard(Context context,View v,int headpitiaon); | |
39 | 38 | } |
40 | 39 | } | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/FeedBackInfo.java
... | ... | @@ -0,0 +1,90 @@ |
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 | +} | ... | ... |
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/GetDate.java
... | ... | @@ -0,0 +1,306 @@ |
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 | +} | ... | ... |
PersonalCenter/app/src/main/res/drawable/radio_button.xml
... | ... | @@ -0,0 +1,10 @@ |
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> | |
0 | 11 | \ No newline at end of file | ... | ... |
PersonalCenter/app/src/main/res/drawable/xuanzhong.png
475 Bytes
PersonalCenter/app/src/main/res/layout/activity_main.xml
PersonalCenter/app/src/main/res/layout/custom_adilog_lhead.xml
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | </RelativeLayout> |
23 | 23 | <LinearLayout |
24 | 24 | android:layout_width="match_parent" |
25 | - android:layout_height="230dp" | |
25 | + android:layout_height="260dp" | |
26 | 26 | android:layout_margin="20dp" |
27 | 27 | android:orientation="vertical"> |
28 | 28 | <TextView |
... | ... | @@ -31,34 +31,43 @@ |
31 | 31 | android:layout_marginLeft="50dp" |
32 | 32 | android:textSize="18sp" |
33 | 33 | android:text="默认头像"/> |
34 | - <LinearLayout | |
34 | + <RadioGroup | |
35 | + android:id="@+id/radiogroup_head" | |
35 | 36 | android:layout_width="match_parent" |
36 | 37 | android:layout_height="wrap_content" |
37 | 38 | android:gravity="center" |
38 | 39 | android:layout_marginTop="10dp" |
39 | 40 | android:orientation="horizontal"> |
40 | - <ImageView | |
41 | + <RadioButton | |
42 | + android:id="@+id/radio_head1" | |
41 | 43 | android:layout_width="wrap_content" |
42 | 44 | android:layout_height="wrap_content" |
43 | - android:layout_margin="10dp" | |
44 | - android:src="@mipmap/ic_launcher"/> | |
45 | - <ImageView | |
45 | + android:layout_margin="20dp" | |
46 | + android:button="@drawable/radio_button" | |
47 | + android:background="@mipmap/default_avatar1" /> | |
48 | + <RadioButton | |
49 | + android:id="@+id/radio_head2" | |
46 | 50 | android:layout_width="wrap_content" |
47 | 51 | android:layout_height="wrap_content" |
48 | - android:layout_margin="10dp" | |
49 | - android:src="@mipmap/ic_launcher"/> | |
50 | - <ImageView | |
52 | + android:layout_margin="20dp" | |
53 | + android:button="@drawable/radio_button" | |
54 | + android:background="@mipmap/default_avatar2"/> | |
55 | + <RadioButton | |
56 | + android:id="@+id/radio_head3" | |
51 | 57 | android:layout_width="wrap_content" |
52 | 58 | android:layout_height="wrap_content" |
53 | - android:layout_margin="10dp" | |
54 | - android:src="@mipmap/ic_launcher"/> | |
55 | - <ImageView | |
59 | + android:layout_margin="20dp" | |
60 | + android:button="@drawable/radio_button" | |
61 | + android:background="@mipmap/default_avatar3"/> | |
62 | + <RadioButton | |
63 | + android:id="@+id/radio_head4" | |
56 | 64 | android:layout_width="wrap_content" |
57 | 65 | android:layout_height="wrap_content" |
58 | - android:layout_margin="10dp" | |
59 | - android:src="@mipmap/ic_launcher"/> | |
66 | + android:layout_margin="20dp" | |
67 | + android:button="@drawable/radio_button" | |
68 | + android:background="@mipmap/default_avatar4"/> | |
60 | 69 | |
61 | - </LinearLayout> | |
70 | + </RadioGroup> | |
62 | 71 | <LinearLayout |
63 | 72 | android:layout_width="match_parent" |
64 | 73 | android:layout_height="wrap_content" |
... | ... | @@ -116,7 +125,7 @@ |
116 | 125 | </View> |
117 | 126 | <LinearLayout |
118 | 127 | android:layout_width="match_parent" |
119 | - android:layout_height="wrap_content" | |
128 | + android:layout_height="50dp" | |
120 | 129 | android:gravity="center" |
121 | 130 | android:orientation="horizontal"> |
122 | 131 | ... | ... |
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