|
@ -120,24 +120,7 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
120
|
120
|
LoadingDialog dialog;
|
121
|
121
|
private ProgressDialog insertDialog;
|
122
|
122
|
private static final int RC_ALBUM_PERM = 123;
|
123
|
|
private Handler handler = new Handler() {
|
124
|
|
// 主线程通过这个方法处理消息
|
125
|
|
@Override
|
126
|
|
public void handleMessage(Message msg) {
|
127
|
|
switch (msg.what) {
|
128
|
|
case 2:
|
129
|
|
Log.e(TAG, "handleMessage: msg=" + msg.obj.toString());
|
130
|
|
String code = JsonUtils.getKeyResult(msg.obj.toString(), "code");
|
131
|
|
if (code.equals("200")) {
|
132
|
|
String rtnMsg = JsonUtils.getKeyResult(msg.obj.toString(), "rtnMsg");
|
133
|
|
json = JsonUtils.stringToJson(rtnMsg);
|
134
|
|
Log.e(TAG, "uploadFeedbackInfo: json=" + json);
|
135
|
|
uploadFeedbackInfo();
|
136
|
|
}
|
137
|
|
break;
|
138
|
|
}
|
139
|
|
}
|
140
|
|
};
|
|
123
|
|
141
|
124
|
|
142
|
125
|
private TextView publishtopic_choose_topic, mPublishtopicChooseTopic;
|
143
|
126
|
|
|
@ -146,11 +129,7 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
146
|
129
|
private String policy = "";
|
147
|
130
|
private String OPERATER = "d1evvideo01";
|
148
|
131
|
@SuppressLint("SdCardPath")
|
149
|
|
// private static final String SAMPLE_PIC_FILE = "/mnt/sdcard/tdtest.mp4";
|
150
|
132
|
private ParallelUploader parallelUploader;
|
151
|
|
// private SerialUploader serialUploader;
|
152
|
|
private String picSavePath;
|
153
|
|
|
154
|
133
|
|
155
|
134
|
@Override
|
156
|
135
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@ -179,7 +158,6 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
179
|
158
|
//初始化断点续传 (服务端签名可用)
|
180
|
159
|
if (parallelUploader == null) {
|
181
|
160
|
parallelUploader = new ParallelUploader();
|
182
|
|
picSavePath = "/d/file/liaoliao/img/" + SystemTypeUtil.stampToDate(System.currentTimeMillis() + "");
|
183
|
161
|
}
|
184
|
162
|
//图文路径
|
185
|
163
|
// String p = "/d/file/liaoliao/img/" + y + "/" + m + "/" + d;
|
|
@ -211,22 +189,6 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
211
|
189
|
//获取又拍云数据
|
212
|
190
|
getYouPaiData();
|
213
|
191
|
|
214
|
|
// new Thread(new Runnable() {
|
215
|
|
// @Override
|
216
|
|
// public void run() {
|
217
|
|
// if (Bimp.tempSelectBitmap.size() > 0) {
|
218
|
|
// uploadFeedbackPic();
|
219
|
|
//
|
220
|
|
// } else {
|
221
|
|
//
|
222
|
|
// uploadFeedbackInfo();
|
223
|
|
//
|
224
|
|
//
|
225
|
|
// }
|
226
|
|
//
|
227
|
|
// }
|
228
|
|
// }).start();
|
229
|
|
|
230
|
192
|
}
|
231
|
193
|
});
|
232
|
194
|
rl_point = (RelativeLayout) findViewById(R.id.rl_point);
|
|
@ -317,25 +279,16 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
317
|
279
|
ArrayList<AuthSignBean> signBeans = (ArrayList<AuthSignBean>) JsonUtils.parseToObjectList(rtnMsg, AuthSignBean.class);
|
318
|
280
|
|
319
|
281
|
if (null != signBeans && signBeans.size() > 0) {
|
320
|
|
// File tempFile = new File(Bimp.tempSelectBitmap.get(0).getImagePath().trim());
|
321
|
|
// String fileName = tempFile.getName();
|
322
|
|
// //生产policy传的参数
|
323
|
|
// Map<String, Object> map = new HashMap<>();
|
324
|
|
// map.put("bucket", SPACE);
|
325
|
|
// map.put("expiration", (System.currentTimeMillis() + 1800) + "");
|
326
|
|
// map.put("save-key", picSavePath + "/" + tempFile.getName());
|
327
|
|
// policy = UpYunUtils.getPolicy(map);
|
328
|
|
String sign = signBeans.get(0).sign;
|
|
282
|
String sign = signBeans.get(0).sign;
|
|
283
|
policy = signBeans.get(0).policy;
|
329
|
284
|
|
330
|
|
formUpload(Bimp.tempSelectBitmap.get(0).getImagePath(), sign, signBeans.get(0).policy);
|
|
285
|
formUpload(Bimp.tempSelectBitmap.get(0).getImagePath(), sign, policy);
|
331
|
286
|
|
332
|
287
|
|
333
|
288
|
}
|
334
|
289
|
}
|
335
|
290
|
}
|
336
|
291
|
});
|
337
|
|
//
|
338
|
|
|
339
|
292
|
|
340
|
293
|
}
|
341
|
294
|
|
|
@ -442,21 +395,7 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
442
|
395
|
photo();
|
443
|
396
|
} else {
|
444
|
397
|
ToastUtil.showToast(getApplicationContext(), "您当前关闭了调用摄像头权限", Toast.LENGTH_SHORT);
|
445
|
|
// new AlertDialogTwo(FeedbackActivity.this).builder()
|
446
|
|
// .setMsg("您当前关闭了调用摄像头权限,是否去打开?")
|
447
|
|
// .setPositiveButton("去打开", new View.OnClickListener() {
|
448
|
|
// @Override
|
449
|
|
// public void onClick(View v) {
|
450
|
|
// Intent intent = new Intent(Settings.ACTION_SETTINGS);
|
451
|
|
// startActivity(intent);
|
452
|
|
// }
|
453
|
|
// }).setNegativeButton("忽略", new View.OnClickListener() {
|
454
|
|
// @Override
|
455
|
|
// public void onClick(View v) {
|
456
|
|
//
|
457
|
|
// }
|
458
|
|
// }).show();
|
459
|
|
}
|
|
398
|
}
|
460
|
399
|
}
|
461
|
400
|
});
|
462
|
401
|
bt2.setOnClickListener(new OnClickListener() {
|
|
@ -465,7 +404,6 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
465
|
404
|
AlbumActivityFeedback.class);
|
466
|
405
|
startActivity(intent);
|
467
|
406
|
overridePendingTransition(R.anim.activity_translate_in, R.anim.activity_translate_out);
|
468
|
|
// startActivityForResult(intent, 1);
|
469
|
407
|
pop.dismiss();
|
470
|
408
|
ll_popup.clearAnimation();
|
471
|
409
|
}
|
|
@ -766,76 +704,9 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
766
|
704
|
matrix.postScale(scaleWidth, scaleHeight);
|
767
|
705
|
Bitmap bitmap = Bitmap.createBitmap(bgimage, 0, 0, (int) width,
|
768
|
706
|
(int) height, matrix, true);
|
769
|
|
// iv_2.setImageBitmap(bitmap);
|
770
|
|
// tv_2.setText(bitmap.getRowBytes() * bitmap.getHeight() + "");
|
771
|
707
|
return bitmap;
|
772
|
708
|
}
|
773
|
709
|
|
774
|
|
private void uploadFeedbackInfo() {
|
775
|
|
// dialog.show();
|
776
|
|
TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
|
777
|
|
final String imem;
|
778
|
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
|
779
|
|
imem = "";
|
780
|
|
} else {
|
781
|
|
imem = telephonyManager.getDeviceId();
|
782
|
|
}
|
783
|
|
String url;
|
784
|
|
if (null != json) {
|
785
|
|
url = MainApplication.url + "/zhannew/basic/web/index.php/advice/add?user_id=" + MainApplication.userId +
|
786
|
|
"&msg=" + et_context.getText().toString() + "&telephone=" + MainApplication.userPhone + "&imem=" + imem +
|
787
|
|
"&main_id=0&url=" + json;
|
788
|
|
} else {
|
789
|
|
url = MainApplication.url + "/zhannew/basic/web/index.php/advice/add?user_id=" + MainApplication.userId +
|
790
|
|
"&msg=" + et_context.getText().toString() + "&telephone=" + MainApplication.userPhone + "&imem=" + imem +
|
791
|
|
"&main_id=0&url=";
|
792
|
|
}
|
793
|
|
|
794
|
|
Log.e(TAG, "uploadFeedbackInfo: url=" + url);
|
795
|
|
OkHttpUtils.get().url(url).build().execute(new StringCallback() {
|
796
|
|
@Override
|
797
|
|
public void onError(Call call, Exception e) {
|
798
|
|
// dialog.cancel();
|
799
|
|
ToastUtil.showToast(getApplicationContext(), "请检查当前网络", Toast.LENGTH_SHORT);
|
800
|
|
}
|
801
|
|
|
802
|
|
@Override
|
803
|
|
public void onResponse(String response) {
|
804
|
|
Log.e(TAG, "onResponse: response=" + response);
|
805
|
|
// dialog.cancel();
|
806
|
|
String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
|
807
|
|
if (rtnCode.equals("01")) {
|
808
|
|
// ToastUtil.showToast(getApplicationContext(),"感谢您的反馈",Toast.LENGTH_SHORT);
|
809
|
|
String plusScore = JsonUtils.getKeyResult(response, "plusScore");
|
810
|
|
if (!plusScore.equals("")) {
|
811
|
|
tv_point.setText(plusScore);
|
812
|
|
rl_point.setVisibility(View.VISIBLE);
|
813
|
|
rl_point.startAnimation(animation);
|
814
|
|
new Handler().postDelayed(new Runnable() {
|
815
|
|
public void run() {
|
816
|
|
rl_point.setVisibility(View.GONE);
|
817
|
|
}
|
818
|
|
}, 1000);
|
819
|
|
new Handler().postDelayed(new Runnable() {
|
820
|
|
public void run() {
|
821
|
|
finish();
|
822
|
|
}
|
823
|
|
}, 1500);
|
824
|
|
} else {
|
825
|
|
ToastUtil.showToast(getApplicationContext(), "感谢您的反馈", Toast.LENGTH_SHORT);
|
826
|
|
finish();
|
827
|
|
}
|
828
|
|
// finish();
|
829
|
|
} else if (rtnCode.equals("03")) {
|
830
|
|
String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
|
831
|
|
ToastUtil.showToast(getApplicationContext(), rtnMsg, Toast.LENGTH_SHORT);
|
832
|
|
} else {
|
833
|
|
String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
|
834
|
|
ToastUtil.showToast(getApplicationContext(), rtnMsg, Toast.LENGTH_SHORT);
|
835
|
|
}
|
836
|
|
}
|
837
|
|
});
|
838
|
|
}
|
839
|
710
|
|
840
|
711
|
/**
|
841
|
712
|
* 检测是否有emoji表情
|
|
@ -881,11 +752,7 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
881
|
752
|
public void permissionTask() {
|
882
|
753
|
if (isPermissionOK()) {
|
883
|
754
|
callGallery();
|
884
|
|
// Have permission, do the thing!
|
885
|
|
// Toast.makeText(this, "TODO: Camera things", Toast.LENGTH_LONG).show();
|
886
|
|
// ifTimeout();
|
887
|
755
|
} else {
|
888
|
|
// Ask for one permission
|
889
|
756
|
EasyPermissions.requestPermissions(
|
890
|
757
|
this, "充电桩想要获取您的图片读取权限,是否允许?",
|
891
|
758
|
RC_ALBUM_PERM,
|