|
@ -26,6 +26,7 @@ import android.support.v4.app.ActivityCompat;
|
26
|
26
|
import android.support.v7.app.AlertDialog;
|
27
|
27
|
import android.telephony.TelephonyManager;
|
28
|
28
|
import android.text.Editable;
|
|
29
|
import android.text.Html;
|
29
|
30
|
import android.text.TextUtils;
|
30
|
31
|
import android.text.TextWatcher;
|
31
|
32
|
import android.util.Log;
|
|
@ -257,14 +258,13 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
257
|
258
|
// ToastUtil.showToast(getApplicationContext(), "输入字数不能超过500", Toast.LENGTH_SHORT);
|
258
|
259
|
// return;
|
259
|
260
|
// }
|
260
|
|
if (!s.trim().isEmpty() && s.length() > 0 && null != Bimp.tempSelectBitmap && Bimp.tempSelectBitmap.size() > 0) {
|
261
|
|
tv_right.setEnabled(true);
|
262
|
|
// tv_right.setTextColor(getResources().getColor(R.color.lvse));
|
263
|
|
tv_right.setBackgroundColor(Color.parseColor("#02b637"));
|
264
|
|
} else {
|
265
|
|
tv_right.setEnabled(false);
|
266
|
|
tv_right.setBackgroundColor(Color.parseColor("#9ed3ae"));
|
267
|
|
}
|
|
261
|
// if (!s.trim().isEmpty() && s.length() > 0 && null != Bimp.tempSelectBitmap && Bimp.tempSelectBitmap.size() > 0) {
|
|
262
|
// tv_right.setEnabled(true);
|
|
263
|
// tv_right.setBackgroundColor(Color.parseColor("#02b637"));
|
|
264
|
// } else {
|
|
265
|
// tv_right.setEnabled(false);
|
|
266
|
// tv_right.setBackgroundColor(Color.parseColor("#9ed3ae"));
|
|
267
|
// }
|
268
|
268
|
|
269
|
269
|
if (TextUtils.isEmpty(s))
|
270
|
270
|
publishtopic_word_num.setText("0");
|
|
@ -324,7 +324,6 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
324
|
324
|
ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_SHORT);
|
325
|
325
|
} else {
|
326
|
326
|
uploadDialog.dismiss();
|
327
|
|
uploadDialog.cancel();
|
328
|
327
|
ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_SHORT);
|
329
|
328
|
}
|
330
|
329
|
}
|
|
@ -339,12 +338,12 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
339
|
338
|
@Override
|
340
|
339
|
public void onClick(View v) {
|
341
|
340
|
switch (v.getId()) {
|
342
|
|
case R.id.publishtopic_choose_topic_de:
|
|
341
|
case R.id.publishtopic_choose_topic_de: // 取消选择的话题
|
343
|
342
|
mPublishtopicChooseTopic.setText("# 选择话题");
|
344
|
343
|
mPublishTopicDe.setVisibility(View.GONE);
|
345
|
|
talkRecommendBean = null;
|
|
344
|
chatRecommendBean = null;
|
346
|
345
|
break;
|
347
|
|
case R.id.publishtopic_choose_topic:
|
|
346
|
case R.id.publishtopic_choose_topic: // 选择话题
|
348
|
347
|
startActivityForResult(new Intent(this, TopicActivity.class), reqTopic);
|
349
|
348
|
break;
|
350
|
349
|
case R.id.iv_back:
|
|
@ -355,13 +354,11 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
355
|
354
|
}
|
356
|
355
|
}
|
357
|
356
|
showDialogToExit();
|
358
|
|
// finish();
|
359
|
357
|
break;
|
360
|
358
|
}
|
361
|
359
|
}
|
362
|
360
|
|
363
|
|
TalkRecommendBean talkRecommendBean = null;
|
364
|
|
|
|
361
|
ChatRecommendBean chatRecommendBean = null;
|
365
|
362
|
|
366
|
363
|
@Override
|
367
|
364
|
protected void onPause() {
|
|
@ -504,11 +501,10 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
504
|
501
|
@Override
|
505
|
502
|
protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
|
506
|
503
|
super.onActivityResult(requestCode, resultCode, data);
|
507
|
|
if (requestCode == 100 && resultCode == -100) {
|
508
|
|
talkRecommendBean = (TalkRecommendBean) data.getSerializableExtra("topic");
|
509
|
|
if (talkRecommendBean != null) {
|
510
|
|
mPublishtopicChooseTopic.setText("# " + talkRecommendBean.topicName);
|
511
|
|
topicId = talkRecommendBean.topicId + "";
|
|
504
|
if (requestCode == reqTopic && resultCode == -100) {
|
|
505
|
chatRecommendBean = (ChatRecommendBean) data.getSerializableExtra("topic");
|
|
506
|
if (chatRecommendBean != null) {
|
|
507
|
mPublishtopicChooseTopic.setText(Html.fromHtml(chatRecommendBean.name));
|
512
|
508
|
mPublishTopicDe.setVisibility(View.VISIBLE);
|
513
|
509
|
}
|
514
|
510
|
}
|
|
@ -550,13 +546,7 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
550
|
546
|
subscriber.onNext(imagePath);
|
551
|
547
|
}
|
552
|
548
|
subscriber.onComplete();
|
553
|
|
if (null != photos && photos.size() > 0 && !TextUtils.isEmpty(et_context.getText().toString().trim())) {
|
554
|
|
tv_right.setEnabled(true);
|
555
|
|
tv_right.setBackgroundColor(Color.parseColor("#02b637"));
|
556
|
|
} else {
|
557
|
|
tv_right.setEnabled(false);
|
558
|
|
tv_right.setBackgroundColor(Color.parseColor("#9ed3ae"));
|
559
|
|
}
|
|
549
|
|
560
|
550
|
} catch (Exception e) {
|
561
|
551
|
e.printStackTrace();
|
562
|
552
|
subscriber.onError(e);
|
|
@ -698,6 +688,13 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
698
|
688
|
public void handleMessage(Message msg) {
|
699
|
689
|
switch (msg.what) {
|
700
|
690
|
case 1:
|
|
691
|
if (null != Bimp.tempSelectBitmap && Bimp.tempSelectBitmap.size() > 0) {
|
|
692
|
tv_right.setEnabled(true);
|
|
693
|
tv_right.setBackgroundColor(Color.parseColor("#02b637"));
|
|
694
|
} else {
|
|
695
|
tv_right.setEnabled(false);
|
|
696
|
tv_right.setBackgroundColor(Color.parseColor("#9ed3ae"));
|
|
697
|
}
|
701
|
698
|
adapter.notifyDataSetChanged();
|
702
|
699
|
break;
|
703
|
700
|
}
|
|
@ -902,10 +899,11 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
902
|
899
|
Map<String, String> map = new HashMap<>();
|
903
|
900
|
map.put("content", et_context.getText().toString());
|
904
|
901
|
map.put("urls", urls);
|
905
|
|
map.put("topicId", topicId);
|
906
|
|
map.put("targetType", "24");
|
|
902
|
if (chatRecommendBean != null) {
|
|
903
|
map.put("topicId", chatRecommendBean.targetId + "");
|
|
904
|
}
|
|
905
|
map.put("targetType", ChatRecommendBean.TARGET_TYPE_IMAGE_TEXT + "");
|
907
|
906
|
map.put("coverImgUrl", "");
|
908
|
|
map.put("appToken", ProfileManager.getInstance().getKeyMessageToken(getApplicationContext()));
|
909
|
907
|
CommonParams.addCommonParams(map);
|
910
|
908
|
|
911
|
909
|
OkHttpUtils.post().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
|
|
@ -928,6 +926,7 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
|
928
|
926
|
String desc = JsonUtils.getKeyResult(response, "desc");
|
929
|
927
|
if ("1000".equals(code)) {
|
930
|
928
|
ToastUtil.showToast(getApplicationContext(), "发布成功", Toast.LENGTH_SHORT);
|
|
929
|
startActivity(new Intent(getApplicationContext(), ChatActivity.class));
|
931
|
930
|
} else {
|
932
|
931
|
ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_SHORT);
|
933
|
932
|
}
|