|
|
75
|
import me.iwf.photopicker.PhotoPicker;
|
|
|
76
|
import okhttp3.Call;
|
|
|
77
|
import pub.devrel.easypermissions.AfterPermissionGranted;
|
|
|
78
|
import pub.devrel.easypermissions.EasyPermissions;
|
|
|
79
|
import rx.Observable;
|
|
|
80
|
import rx.Observer;
|
|
|
81
|
import rx.Subscriber;
|
|
|
82
|
import rx.Subscription;
|
|
|
83
|
import rx.android.schedulers.AndroidSchedulers;
|
|
|
84
|
import rx.schedulers.Schedulers;
|
|
|
85
|
|
|
|
86
|
/**
|
|
|
87
|
*
|
|
|
88
|
* @desc : 发布话题
|
|
|
89
|
*
|
|
|
90
|
* */
|
|
|
91
|
public class PublishPicTopicActivity extends Activity implements OnClickListener ,EasyPermissions.PermissionCallbacks{
|
|
|
92
|
private static final String TAG = "PublishPicTopicActivity";
|
|
|
93
|
private static final int PIC_NUM = 3;
|
|
|
94
|
private ImageView ivBack;
|
|
|
95
|
private TextView tv_right;
|
|
|
96
|
private static String PHOTO_FILE_NAME = "";
|
|
|
97
|
private static final String PHOTO_FILE_PATH = getPath(Environment.getExternalStorageDirectory() + "/" + "cdz");
|
|
|
98
|
private GridView noScrollgridview;
|
|
|
99
|
private PopupWindow pop = null;
|
|
|
100
|
private LinearLayout ll_popup;
|
|
|
101
|
private File tempFile;
|
|
|
102
|
Bitmap bm = null;
|
|
|
103
|
private static final int PHOTO_REQUEST_CAMERA = 1;
|
|
|
104
|
private static final int PHOTO_REQUEST_GALLERY = 2;
|
|
|
105
|
private static final int PHOTO_REQUEST_CUT = 3;
|
|
|
106
|
private GridAdapter adapter;
|
|
|
107
|
private EditText et_context;
|
|
|
108
|
private TextView tvSubmit;
|
|
|
109
|
private ImageView point;
|
|
|
110
|
private ImageView mPublishTopicDe;
|
|
|
111
|
private TextView tv_point;
|
|
|
112
|
private RelativeLayout rl_point;
|
|
|
113
|
private android.view.animation.Animation animation;
|
|
|
114
|
InputMethodManager imm;
|
|
|
115
|
private String userContact;
|
|
|
116
|
private LinearLayout ll_contact;
|
|
|
117
|
List<UploadPic> list;
|
|
|
118
|
String json;
|
|
|
119
|
LoadingDialog dialog;
|
|
|
120
|
private Subscription subsInsert;
|
|
|
121
|
private ProgressDialog insertDialog;
|
|
|
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
|
};
|
|
|
141
|
|
|
|
142
|
private TextView publishtopic_choose_topic, mPublishtopicChooseTopic;
|
|
|
143
|
|
|
|
144
|
@Override
|
|
|
145
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
146
|
super.onCreate(savedInstanceState);
|
|
|
147
|
setContentView(R.layout.activity_publish_picture_content);
|
|
|
148
|
BarColorUtil.initStatusBarColor(PublishPicTopicActivity.this);
|
|
|
149
|
initView();
|
|
|
150
|
Res.init(this);
|
|
|
151
|
PublicWay.activityList.add(this);
|
|
|
152
|
long appTime1 = System.currentTimeMillis() / 1000;
|
|
|
153
|
PHOTO_FILE_NAME = "android" + appTime1 + ".jpg";
|
|
|
154
|
tempFile = getFile(PHOTO_FILE_PATH + "/" + PHOTO_FILE_NAME);
|
|
|
155
|
dialog = new LoadingDialog(this);
|
|
|
156
|
dialog.setCanceledOnTouchOutside(false);
|
|
|
157
|
Init();
|
|
|
158
|
}
|
|
|
159
|
|
|
|
160
|
private void initView() {
|
|
|
161
|
mPublishTopicDe = (ImageView) findViewById(R.id.publishtopic_choose_topic_de);
|
|
|
162
|
mPublishTopicDe.setOnClickListener(this);
|
|
|
163
|
mPublishtopicChooseTopic = (TextView) findViewById(R.id.publishtopic_choose_topic);
|
|
|
164
|
publishtopic_choose_topic = (TextView)findViewById(R.id.publishtopic_choose_topic);
|
|
|
165
|
publishtopic_choose_topic.setOnClickListener(this);
|
|
|
166
|
insertDialog = new ProgressDialog(this);
|
|
|
167
|
insertDialog.setMessage("正在插入图片...");
|
|
|
168
|
insertDialog.setCanceledOnTouchOutside(false);
|
|
|
169
|
tv_right = (TextView) findViewById(R.id.tv_right);
|
|
|
170
|
tv_right.setOnClickListener(new OnClickListener() {
|
|
|
171
|
@Override
|
|
|
172
|
public void onClick(View view) {
|
|
|
173
|
if (imm.isActive()) {
|
|
|
174
|
view = getWindow().peekDecorView();
|
|
|
175
|
if (view != null) {
|
|
|
176
|
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
|
|
177
|
}
|
|
|
178
|
}
|
|
|
179
|
new Thread(new Runnable() {
|
|
|
180
|
@Override
|
|
|
181
|
public void run() {
|
|
|
182
|
if (Bimp.tempSelectBitmap.size() > 0) {
|
|
|
183
|
uploadFeedbackPic();
|
|
|
184
|
|
|
|
185
|
} else {
|
|
|
186
|
|
|
|
187
|
uploadFeedbackInfo();
|
|
|
188
|
|
|
|
189
|
|
|
|
190
|
}
|
|
|
191
|
|
|
|
192
|
}
|
|
|
193
|
}).start();
|
|
|
194
|
|
|
|
195
|
}
|
|
|
196
|
});
|
|
|
197
|
rl_point = (RelativeLayout) findViewById(R.id.rl_point);
|
|
|
198
|
tv_point = (TextView) findViewById(R.id.tv_point);
|
|
|
199
|
animation = AnimationUtils.loadAnimation(PublishPicTopicActivity.this, R.anim.nn);
|
|
|
200
|
point = (ImageView) findViewById(R.id.tv_one);
|
|
|
201
|
ivBack = (ImageView) findViewById(R.id.iv_back);
|
|
|
202
|
ivBack.setOnClickListener(this);
|
|
|
203
|
et_context = (EditText) findViewById(R.id.et_context);
|
|
|
204
|
et_context.addTextChangedListener(new TextWatcher() {
|
|
|
205
|
@Override
|
|
|
206
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
207
|
|
|
|
208
|
}
|
|
|
209
|
|
|
|
210
|
@Override
|
|
|
211
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
212
|
|
|
|
213
|
}
|
|
|
214
|
|
|
|
215
|
@Override
|
|
|
216
|
public void afterTextChanged(Editable editable) {
|
|
|
217
|
String s = editable.toString();
|
|
|
218
|
Log.e(TAG, "afterTextChanged: s=" + s);
|
|
|
219
|
if (containsEmoji(s)) {
|
|
|
220
|
tv_right.setEnabled(false);
|
|
|
221
|
tv_right.setTextColor(getResources().getColor(R.color.ui_68));
|
|
|
222
|
ToastUtil.showToast(getApplicationContext(), "不支持输入表情", Toast.LENGTH_SHORT);
|
|
|
223
|
return;
|
|
|
224
|
}
|
|
|
225
|
if (s.length() > 500) {
|
|
|
226
|
tv_right.setEnabled(false);
|
|
|
227
|
tv_right.setBackgroundColor(Color.parseColor("color_9ed3ae"));
|
|
|
228
|
// tv_right.setTextColor(getResources().getColor(R.color.ui_68));
|
|
|
229
|
ToastUtil.showToast(getApplicationContext(), "输入字数不能超过500", Toast.LENGTH_SHORT);
|
|
|
230
|
return;
|
|
|
231
|
}
|
|
|
232
|
if (!s.trim().isEmpty() && s.length() > 0) {
|
|
|
233
|
tv_right.setEnabled(true);
|
|
|
234
|
// tv_right.setTextColor(getResources().getColor(R.color.lvse));
|
|
|
235
|
tv_right.setBackgroundColor(Color.parseColor("#02b637"));
|
|
|
236
|
}else {
|
|
|
237
|
tv_right.setEnabled(false);
|
|
|
238
|
tv_right.setBackgroundColor(Color.parseColor("color_9ed3ae"));
|
|
|
239
|
}
|
|
|
240
|
}
|
|
|
241
|
});
|
|
|
242
|
|
|
|
243
|
|
|
|
244
|
imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
245
|
|
|
|
246
|
}
|
|
|
247
|
|
|
|
248
|
final int reqTopic = -100;
|
|
|
249
|
@Override
|
|
|
250
|
public void onClick(View v) {
|
|
|
251
|
switch (v.getId()) {
|
|
|
252
|
case R.id.publishtopic_choose_topic:
|
|
|
253
|
startActivityForResult(new Intent(this, TopicActivity.class), reqTopic);
|
|
|
254
|
break;
|
|
|
255
|
case R.id.iv_back:
|
|
|
256
|
if (imm.isActive()) {
|
|
|
257
|
View view = getWindow().peekDecorView();
|
|
|
258
|
if (view != null) {
|
|
|
259
|
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
|
|
260
|
}
|
|
|
261
|
}
|
|
|
262
|
finish();
|
|
|
263
|
break;
|
|
|
264
|
}
|
|
|
265
|
}
|
|
|
266
|
|
|
|
267
|
TalkRecommendBean talkRecommendBean = null;
|
|
|
268
|
|
|
|
269
|
|
|
|
270
|
@Override
|
|
|
271
|
protected void onPause() {
|
|
|
272
|
super.onPause();
|
|
|
273
|
// requestManager.removeOnRequestFinishedListener(this);
|
|
|
274
|
MobclickAgent.onPause(this);
|
|
|
275
|
}
|
|
|
276
|
|
|
|
277
|
@Override
|
|
|
278
|
protected void onResume() {
|
|
|
279
|
super.onResume();
|
|
|
280
|
// requestManager.addOnRequestFinishedListener(this);
|
|
|
281
|
MobclickAgent.onResume(this);
|
|
|
282
|
}
|
|
|
283
|
|
|
|
284
|
private File getFile(String path) {
|
|
|
285
|
File f = new File(path);
|
|
|
286
|
if (!f.exists()) {
|
|
|
287
|
try {
|
|
|
288
|
f.createNewFile();
|
|
|
289
|
} catch (IOException e) {
|
|
|
290
|
e.printStackTrace();
|
|
|
291
|
}
|
|
|
292
|
}
|
|
|
293
|
return f;
|
|
|
294
|
}
|
|
|
295
|
|
|
|
296
|
private static String getPath(String path) {
|
|
|
297
|
File f = new File(path);
|
|
|
298
|
if (!f.exists()) {
|
|
|
299
|
f.mkdirs();
|
|
|
300
|
}
|
|
|
301
|
return f.getAbsolutePath();
|
|
|
302
|
}
|
|
|
303
|
|
|
|
304
|
private boolean hasSdcard() {
|
|
|
305
|
if (Environment.getExternalStorageState().equals(
|
|
|
306
|
Environment.MEDIA_MOUNTED)) {
|
|
|
307
|
return true;
|
|
|
308
|
} else {
|
|
|
309
|
return false;
|
|
|
310
|
}
|
|
|
311
|
}
|
|
|
312
|
|
|
|
313
|
public void Init() {
|
|
|
314
|
pop = new PopupWindow(PublishPicTopicActivity.this);
|
|
|
315
|
View view = getLayoutInflater().inflate(R.layout.item_popupwindows, null);
|
|
|
316
|
ll_popup = (LinearLayout) view.findViewById(R.id.ll_popup);
|
|
|
317
|
|
|
|
318
|
pop.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
|
|
319
|
pop.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
|
320
|
pop.setBackgroundDrawable(new BitmapDrawable());
|
|
|
321
|
pop.setFocusable(true);
|
|
|
322
|
pop.setOutsideTouchable(true);
|
|
|
323
|
pop.setContentView(view);
|
|
|
324
|
|
|
|
325
|
|
|
|
326
|
final RelativeLayout parent = (RelativeLayout) view.findViewById(R.id.parent);
|
|
|
327
|
Button bt1 = (Button) view
|
|
|
328
|
.findViewById(R.id.item_popupwindows_camera);
|
|
|
329
|
Button bt2 = (Button) view
|
|
|
330
|
.findViewById(R.id.item_popupwindows_Photo);
|
|
|
331
|
Button bt3 = (Button) view
|
|
|
332
|
.findViewById(R.id.item_popupwindows_cancel);
|
|
|
333
|
parent.setOnClickListener(new OnClickListener() {
|
|
|
334
|
|
|
|
335
|
@Override
|
|
|
336
|
public void onClick(View v) {
|
|
|
337
|
// TODO Auto-generated method stub
|
|
|
338
|
pop.dismiss();
|
|
|
339
|
ll_popup.clearAnimation();
|
|
|
340
|
}
|
|
|
341
|
});
|
|
|
342
|
bt1.setOnClickListener(new OnClickListener() {
|
|
|
343
|
public void onClick(View v) {
|
|
|
344
|
pop.dismiss();
|
|
|
345
|
ll_popup.clearAnimation();
|
|
|
346
|
if (MainScanActivity.isCameraUseable()) {
|
|
|
347
|
photo();
|
|
|
348
|
} else {
|
|
|
349
|
ToastUtil.showToast(getApplicationContext(), "您当前关闭了调用摄像头权限", Toast.LENGTH_SHORT);
|
|
|
350
|
// new AlertDialogTwo(FeedbackActivity.this).builder()
|
|
|
351
|
// .setMsg("您当前关闭了调用摄像头权限,是否去打开?")
|
|
|
352
|
// .setPositiveButton("去打开", new View.OnClickListener() {
|
|
|
353
|
// @Override
|
|
|
354
|
// public void onClick(View v) {
|
|
|
355
|
// Intent intent = new Intent(Settings.ACTION_SETTINGS);
|
|
|
356
|
// startActivity(intent);
|
|
|
357
|
// }
|
|
|
358
|
// }).setNegativeButton("忽略", new View.OnClickListener() {
|
|
|
359
|
// @Override
|
|
|
360
|
// public void onClick(View v) {
|
|
|
361
|
//
|
|
|
362
|
// }
|
|
|
363
|
// }).show();
|
|
|
364
|
}
|
|
|
365
|
}
|
|
|
366
|
});
|
|
|
367
|
bt2.setOnClickListener(new OnClickListener() {
|
|
|
368
|
public void onClick(View v) {
|
|
|
369
|
Intent intent = new Intent(PublishPicTopicActivity.this,
|
|
|
370
|
AlbumActivityFeedback.class);
|
|
|
371
|
startActivity(intent);
|
|
|
372
|
overridePendingTransition(R.anim.activity_translate_in, R.anim.activity_translate_out);
|
|
|
373
|
// startActivityForResult(intent, 1);
|
|
|
374
|
pop.dismiss();
|
|
|
375
|
ll_popup.clearAnimation();
|
|
|
376
|
}
|
|
|
377
|
});
|
|
|
378
|
bt3.setOnClickListener(new OnClickListener() {
|
|
|
379
|
public void onClick(View v) {
|
|
|
380
|
pop.dismiss();
|
|
|
381
|
ll_popup.clearAnimation();
|
|
|
382
|
}
|
|
|
383
|
});
|
|
|
384
|
|
|
|
385
|
noScrollgridview = (GridView) findViewById(R.id.noScrollgridview);
|
|
|
386
|
noScrollgridview.setSelector(new ColorDrawable(Color.TRANSPARENT));
|
|
|
387
|
adapter = new GridAdapter(this);
|
|
|
388
|
adapter.update();
|
|
|
389
|
noScrollgridview.setAdapter(adapter);
|
|
|
390
|
noScrollgridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
391
|
|
|
|
392
|
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
|
|
|
393
|
long arg3) {
|
|
|
394
|
imm.hideSoftInputFromWindow(arg1.getWindowToken(), 0);
|
|
|
395
|
if (arg2 == Bimp.tempSelectBitmap.size()) {
|
|
|
396
|
permissionTask();
|
|
|
397
|
} else {
|
|
|
398
|
Intent intent = new Intent(PublishPicTopicActivity.this,
|
|
|
399
|
GalleryActivityFeedback.class);
|
|
|
400
|
intent.putExtra("position", "1");
|
|
|
401
|
intent.putExtra("ID", arg2);
|
|
|
402
|
startActivity(intent);
|
|
|
403
|
}
|
|
|
404
|
}
|
|
|
405
|
});
|
|
|
406
|
}
|
|
|
407
|
|
|
|
408
|
/**
|
|
|
409
|
* 调用图库选择
|
|
|
410
|
*/
|
|
|
411
|
private void callGallery() {
|
|
|
412
|
Log.e(TAG, "callGallery: " + (Bimp.max - Bimp.tempSelectBitmap.size()));
|
|
|
413
|
//调用第三方图库选择
|
|
|
414
|
PhotoPicker.builder()
|
|
|
415
|
.setPhotoCount(PIC_NUM - Bimp.tempSelectBitmap.size())//可选择图片数量
|
|
|
416
|
.setShowCamera(true)//是否显示拍照按钮
|
|
|
417
|
.setShowGif(true)//是否显示动态图
|
|
|
418
|
.setPreviewEnabled(true)//是否可以预览
|
|
|
419
|
.start(this, PhotoPicker.REQUEST_CODE);
|
|
|
420
|
|
|
|
421
|
|
|
|
422
|
}
|
|
|
423
|
|
|
|
424
|
@Override
|
|
|
425
|
protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
|
|
|
426
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
427
|
if (requestCode == -100 && resultCode == -100) {
|
|
|
428
|
talkRecommendBean = (TalkRecommendBean) data.getSerializableExtra("topic");
|
|
|
429
|
if (talkRecommendBean != null) {
|
|
|
430
|
mPublishtopicChooseTopic.setText("# " + talkRecommendBean.name);
|
|
|
431
|
mPublishTopicDe.setVisibility(View.VISIBLE);
|
|
|
432
|
}
|
|
|
433
|
}
|
|
|
434
|
|
|
|
435
|
if (resultCode == RESULT_OK) {
|
|
|
436
|
if (data != null) {
|
|
|
437
|
if (requestCode == 1) {
|
|
|
438
|
//处理调用系统图库
|
|
|
439
|
} else if (requestCode == PhotoPicker.REQUEST_CODE) {
|
|
|
440
|
//异步方式插入图片
|
|
|
441
|
insertImagesSync(data);
|
|
|
442
|
}
|
|
|
443
|
}
|
|
|
444
|
}
|
|
|
445
|
}
|
|
|
446
|
|
|
|
447
|
/**
|
|
|
448
|
* 异步方式插入图片
|
|
|
449
|
* @param data
|
|
|
450
|
*/
|
|
|
451
|
private void insertImagesSync(final Intent data) {
|
|
|
452
|
insertDialog.show();
|
|
|
453
|
|
|
|
454
|
subsInsert = Observable.create(new Observable.OnSubscribe<String>() {
|
|
|
455
|
@Override
|
|
|
456
|
public void call(Subscriber<? super String> subscriber) {
|
|
|
457
|
try {
|
|
|
458
|
int width = ScreenUtils.getScreenWidth(PublishPicTopicActivity.this);
|
|
|
459
|
int height = ScreenUtils.getScreenHeight(PublishPicTopicActivity.this);
|
|
|
460
|
ArrayList<String> photos = data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS);
|
|
|
461
|
// PhotoPreview.builder()
|
|
|
462
|
// .setPhotos(photos)
|
|
|
463
|
// .setCurrentItem(2)
|
|
|
464
|
// .start(ShareTwoActivity.this);
|
|
|
465
|
//可以同时插入多张图片
|
|
|
466
|
for (String imagePath : photos) {
|
|
|
467
|
|
|
|
468
|
Log.e(TAG, "call: imagePath " + imagePath);
|
|
|
469
|
Bitmap bitmap = BitmapFactory.decodeFile(imagePath);//压缩图片
|
|
|
470
|
bitmap = imageZoom(bitmap);
|
|
|
471
|
ImageItem takePhoto = new ImageItem();
|
|
|
472
|
takePhoto.setBitmap(bitmap);
|
|
|
473
|
takePhoto.setImagePath(imagePath);
|
|
|
474
|
Bimp.tempSelectBitmap.add(takePhoto);
|
|
|
475
|
//
|
|
|
476
|
// Log.e(TAG, "call: "+imagePath );
|
|
|
477
|
subscriber.onNext(imagePath);
|
|
|
478
|
}
|
|
|
479
|
subscriber.onCompleted();
|
|
|
480
|
} catch (Exception e) {
|
|
|
481
|
e.printStackTrace();
|
|
|
482
|
subscriber.onError(e);
|
|
|
483
|
}
|
|
|
484
|
}
|
|
|
485
|
})
|
|
|
486
|
.onBackpressureBuffer()
|
|
|
487
|
.subscribeOn(Schedulers.io())//生产事件在io
|
|
|
488
|
.observeOn(AndroidSchedulers.mainThread())//消费事件在UI线程
|
|
|
489
|
.subscribe(new Observer<String>() {
|
|
|
490
|
@Override
|
|
|
491
|
public void onCompleted() {
|
|
|
492
|
Log.e(TAG, "onCompleted: -------------");
|
|
|
493
|
insertDialog.dismiss();
|
|
|
494
|
adapter.update();
|
|
|
495
|
|
|
|
496
|
}
|
|
|
497
|
|
|
|
498
|
@Override
|
|
|
499
|
public void onError(Throwable e) {
|
|
|
500
|
insertDialog.dismiss();
|
|
|
501
|
Log.e(TAG, "onError: " + "图片插入失败:" + e.getMessage());
|
|
|
502
|
ToastUtil.showToast(getApplicationContext(), "图片插入失败", Toast.LENGTH_SHORT);
|
|
|
503
|
}
|
|
|
504
|
|
|
|
505
|
@Override
|
|
|
506
|
public void onNext(String imagePath) {
|
|
|
507
|
|
|
|
508
|
}
|
|
|
509
|
});
|
|
|
510
|
}
|
|
|
511
|
|
|
|
512
|
public class GridAdapter extends BaseAdapter {
|
|
|
513
|
private LayoutInflater inflater;
|
|
|
514
|
private int selectedPosition = -1;
|
|
|
515
|
private boolean shape;
|
|
|
516
|
|
|
|
517
|
public boolean isShape() {
|
|
|
518
|
return shape;
|
|
|
519
|
}
|
|
|
520
|
|
|
|
521
|
public void setShape(boolean shape) {
|
|
|
522
|
this.shape = shape;
|
|
|
523
|
}
|
|
|
524
|
|
|
|
525
|
public GridAdapter(Context context) {
|
|
|
526
|
inflater = LayoutInflater.from(context);
|
|
|
527
|
}
|
|
|
528
|
|
|
|
529
|
public void update() {
|
|
|
530
|
loading();
|
|
|
531
|
}
|
|
|
532
|
|
|
|
533
|
public int getCount() {
|
|
|
534
|
if (Bimp.tempSelectBitmap.size() == 3) {
|
|
|
535
|
return 3;
|
|
|
536
|
}
|
|
|
537
|
return (Bimp.tempSelectBitmap.size() + 1);
|
|
|
538
|
}
|
|
|
539
|
|
|
|
540
|
public Object getItem(int arg0) {
|
|
|
541
|
return null;
|
|
|
542
|
}
|
|
|
543
|
|
|
|
544
|
public long getItemId(int arg0) {
|
|
|
545
|
return 0;
|
|
|
546
|
}
|
|
|
547
|
|
|
|
548
|
public void setSelectedPosition(int position) {
|
|
|
549
|
selectedPosition = position;
|
|
|
550
|
}
|
|
|
551
|
|
|
|
552
|
public int getSelectedPosition() {
|
|
|
553
|
return selectedPosition;
|
|
|
554
|
}
|
|
|
555
|
|
|
|
556
|
public View getView(int position, View convertView, ViewGroup parent) {
|
|
|
557
|
GridAdapter.ViewHolder holder = null;
|
|
|
558
|
if (convertView == null) {
|
|
|
559
|
convertView = inflater.inflate(R.layout.item_feedback_gridview,
|
|
|
560
|
parent, false);
|
|
|
561
|
holder = new GridAdapter.ViewHolder();
|
|
|
562
|
holder.image = (ImageView) convertView
|
|
|
563
|
.findViewById(R.id.item_grida_image);
|
|
|
564
|
convertView.setTag(holder);
|
|
|
565
|
} else {
|
|
|
566
|
holder = (GridAdapter.ViewHolder) convertView.getTag();
|
|
|
567
|
}
|
|
|
568
|
|
|
|
569
|
if (position == Bimp.tempSelectBitmap.size()) {
|
|
|
570
|
holder.image.setImageBitmap(BitmapFactory.decodeResource(
|
|
|
571
|
getResources(), R.drawable.icon_feedback_upload));
|
|
|
572
|
if (position == 3) {
|
|
|
573
|
holder.image.setVisibility(View.GONE);
|
|
|
574
|
}
|
|
|
575
|
} else {
|
|
|
576
|
holder.image.setImageBitmap(Bimp.tempSelectBitmap.get(position).getBitmap());
|
|
|
577
|
}
|
|
|
578
|
|
|
|
579
|
return convertView;
|
|
|
580
|
}
|
|
|
581
|
|
|
|
582
|
public class ViewHolder {
|
|
|
583
|
public ImageView image;
|
|
|
584
|
}
|
|
|
585
|
|
|
|
586
|
Handler handler = new Handler() {
|
|
|
587
|
public void handleMessage(Message msg) {
|
|
|
588
|
switch (msg.what) {
|
|
|
589
|
case 1:
|
|
|
590
|
adapter.notifyDataSetChanged();
|
|
|
591
|
break;
|
|
|
592
|
}
|
|
|
593
|
super.handleMessage(msg);
|
|
|
594
|
}
|
|
|
595
|
};
|
|
|
596
|
|
|
|
597
|
public void loading() {
|
|
|
598
|
new Thread(new Runnable() {
|
|
|
599
|
public void run() {
|
|
|
600
|
while (true) {
|
|
|
601
|
if (Bimp.max == Bimp.tempSelectBitmap.size()) {
|
|
|
602
|
Message message = new Message();
|
|
|
603
|
message.what = 1;
|
|
|
604
|
handler.sendMessage(message);
|
|
|
605
|
break;
|
|
|
606
|
} else {
|
|
|
607
|
Bimp.max += 1;
|
|
|
608
|
Message message = new Message();
|
|
|
609
|
message.what = 1;
|
|
|
610
|
handler.sendMessage(message);
|
|
|
611
|
}
|
|
|
612
|
}
|
|
|
613
|
}
|
|
|
614
|
}).start();
|
|
|
615
|
}
|
|
|
616
|
}
|
|
|
617
|
|
|
|
618
|
public void photo() {
|
|
|
619
|
if (hasSdcard()) {
|
|
|
620
|
int currentapiVersion = Build.VERSION.SDK_INT;
|
|
|
621
|
Log.e("currentapiVersion", "currentapiVersion====>" + currentapiVersion);
|
|
|
622
|
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);//���������
|
|
|
623
|
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(tempFile));
|
|
|
624
|
startActivityForResult(intent, PHOTO_REQUEST_CAMERA);
|
|
|
625
|
}
|
|
|
626
|
}
|
|
|
627
|
|
|
|
628
|
public static Uri getImageContentUri(Context context, File imageFile) {
|
|
|
629
|
String filePath = imageFile.getAbsolutePath();
|
|
|
630
|
Cursor cursor = context.getContentResolver().query(
|
|
|
631
|
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
|
|
632
|
new String[]{MediaStore.Images.Media._ID},
|
|
|
633
|
MediaStore.Images.Media.DATA + "=? ",
|
|
|
634
|
new String[]{filePath}, null);
|
|
|
635
|
|
|
|
636
|
if (cursor != null && cursor.moveToFirst()) {
|
|
|
637
|
int id = cursor.getInt(cursor
|
|
|
638
|
.getColumnIndex(MediaStore.MediaColumns._ID));
|
|
|
639
|
Uri baseUri = Uri.parse("content://media/external/images/media");
|
|
|
640
|
return Uri.withAppendedPath(baseUri, "" + id);
|
|
|
641
|
} else {
|
|
|
642
|
if (imageFile.exists()) {
|
|
|
643
|
ContentValues values = new ContentValues();
|
|
|
644
|
values.put(MediaStore.Images.Media.DATA, filePath);
|
|
|
645
|
return context.getContentResolver().insert(
|
|
|
646
|
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
|
|
|
647
|
} else {
|
|
|
648
|
return null;
|
|
|
649
|
}
|
|
|
650
|
}
|
|
|
651
|
}
|
|
|
652
|
|
|
|
653
|
private void crop(Uri uri, Uri cutImgUri) {
|
|
|
654
|
// �ü�ͼƬ��ͼ
|
|
|
655
|
Intent intent = new Intent("com.android.camera.action.CROP");
|
|
|
656
|
intent.setDataAndType(getImageContentUri(this, tempFile), "image/*");
|
|
|
657
|
|
|
|
658
|
intent.putExtra("crop", "true");
|
|
|
659
|
// �ü���ı�����1��1
|
|
|
660
|
// intent.putExtra("aspectX", 16);
|
|
|
661
|
// intent.putExtra("aspectY", 9);
|
|
|
662
|
// // �ü������ͼƬ�ijߴ��С
|
|
|
663
|
// intent.putExtra("outputX", 900);
|
|
|
664
|
// intent.putExtra("outputY", 540);
|
|
|
665
|
// intent.putExtra("scale", false);
|
|
|
666
|
|
|
|
667
|
// ͼƬ��ʽ
|
|
|
668
|
intent.putExtra("outputFormat", "JPEG");
|
|
|
669
|
intent.putExtra("noFaceDetection", true);// ȡ������ʶ��
|
|
|
670
|
intent.putExtra("return-data", false);// true:������uri��false������uri
|
|
|
671
|
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(tempFile));//д���ȡ��ͼƬ
|
|
|
672
|
startActivityForResult(intent, PHOTO_REQUEST_CUT);
|
|
|
673
|
}
|
|
|
674
|
|
|
|
675
|
public Bitmap decodeUriAsBitmap(Uri uri) {
|
|
|
676
|
Bitmap bitmap = null;
|
|
|
677
|
try {
|
|
|
678
|
bitmap = BitmapFactory.decodeStream(this.getContentResolver().openInputStream(uri));
|
|
|
679
|
} catch (FileNotFoundException e) {
|
|
|
680
|
e.printStackTrace();
|
|
|
681
|
return null;
|
|
|
682
|
}
|
|
|
683
|
return bitmap;
|
|
|
684
|
}
|
|
|
685
|
|
|
|
686
|
|
|
|
687
|
protected void onRestart() {
|
|
|
688
|
adapter.update();
|
|
|
689
|
super.onRestart();
|
|
|
690
|
}
|
|
|
691
|
|
|
|
692
|
@Override
|
|
|
693
|
protected void onDestroy() {
|
|
|
694
|
super.onDestroy();
|
|
|
695
|
Bimp.tempSelectBitmap.clear();
|
|
|
696
|
Bimp.max = 0;
|
|
|
697
|
}
|
|
|
698
|
|
|
|
699
|
private void uploadFeedbackPic() {
|
|
|
700
|
Map<String, String> par = new HashMap<String, String>();
|
|
|
701
|
String file;
|
|
|
702
|
for (int i = 0; i < Bimp.tempSelectBitmap.size(); i++) {
|
|
|
703
|
try {
|
|
|
704
|
bm = imageZoom(Bimp.tempSelectBitmap.get(i).getBitmap());
|
|
|
705
|
file = bitmapToBase64(bm);
|
|
|
706
|
par.put("file" + (i + 1), file);
|
|
|
707
|
Log.i("file--------" + (i + 1), file);
|
|
|
708
|
par.put("filename" + (i + 1), "androidapp.jpg");
|
|
|
709
|
} catch (Exception e) {
|
|
|
710
|
e.printStackTrace();
|
|
|
711
|
}
|
|
|
712
|
|
|
|
713
|
}
|
|
|
714
|
try {
|
|
|
715
|
String u = UploadUtil.post(
|
|
|
716
|
MainApplication.url + "/zhannew/basic/web/index.php/fileupload/multi-upload",
|
|
|
717
|
// "http://123.57.6.131/zhannew/basic/web/index.php/zhanlist/add",
|
|
|
718
|
// "http://59.110.68.162"+"/zhannew/fileupload/multi-upload",
|
|
|
719
|
par, null);
|
|
|
720
|
System.err.println(u);
|
|
|
721
|
// submit(u);
|
|
|
722
|
Message msg = new Message();
|
|
|
723
|
msg.obj = u;
|
|
|
724
|
msg.what = 2;
|
|
|
725
|
handler.sendMessage(msg);
|
|
|
726
|
} catch (IOException e) {
|
|
|
727
|
e.printStackTrace();
|
|
|
728
|
}
|
|
|
729
|
}
|
|
|
730
|
|
|
|
731
|
private String bitmapToBase64(Bitmap bitmap) {
|
|
|
732
|
|
|
|
733
|
String result = null;
|
|
|
734
|
ByteArrayOutputStream baos = null;
|
|
|
735
|
try {
|
|
|
736
|
if (bitmap != null) {
|
|
|
737
|
baos = new ByteArrayOutputStream();
|
|
|
738
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
|
|
|
739
|
baos.flush();
|
|
|
740
|
baos.close();
|
|
|
741
|
byte[] bitmapBytes = baos.toByteArray();
|
|
|
742
|
result = Base64.encodeToString(bitmapBytes, Base64.DEFAULT);
|
|
|
743
|
}
|
|
|
744
|
} catch (IOException e) {
|
|
|
745
|
e.printStackTrace();
|
|
|
746
|
} finally {
|
|
|
747
|
try {
|
|
|
748
|
if (baos != null) {
|
|
|
749
|
baos.flush();
|
|
|
750
|
baos.close();
|
|
|
751
|
}
|
|
|
752
|
} catch (IOException e) {
|
|
|
753
|
e.printStackTrace();
|
|
|
754
|
}
|
|
|
755
|
}
|
|
|
756
|
return result;
|
|
|
757
|
}
|
|
|
758
|
|
|
|
759
|
private Bitmap imageZoom(Bitmap bm) {
|
|
|
760
|
// 图片允许最大空间 单位:KB
|
|
|
761
|
double maxSize = 200.00;
|
|
|
762
|
// 将bitmap放至数组中,意在bitmap的大小(与实际读取的原文件要大)
|
|
|
763
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
764
|
bm.compress(Bitmap.CompressFormat.JPEG, 100, baos);
|
|
|
765
|
byte[] b = baos.toByteArray();
|
|
|
766
|
// 将字节换成KB
|
|
|
767
|
double mid = b.length / 1024;
|
|
|
768
|
// 判断bitmap占用空间是否大于允许最大空间 如果大于则压缩 小于则不压缩
|
|
|
769
|
if (mid > maxSize) {
|
|
|
770
|
// 获取bitmap大小 是允许最大大小的多少倍
|
|
|
771
|
double i = mid / maxSize;
|
|
|
772
|
// 开始压缩 此处用到平方根 将宽带和高度压缩掉对应的平方根倍
|
|
|
773
|
// (1.保持刻度和高度和原bitmap比率一致,压缩后也达到了最大大小占用空间的大小)
|
|
|
774
|
bm = zoomImage(bm, bm.getWidth() / Math.sqrt(i), bm.getHeight()
|
|
|
775
|
/ Math.sqrt(i));
|
|
|
776
|
}
|
|
|
777
|
|
|
|
778
|
return bm;
|
|
|
779
|
}
|
|
|
780
|
|
|
|
781
|
public Bitmap zoomImage(Bitmap bgimage, double newWidth, double newHeight) {
|
|
|
782
|
// 获取这个图片的宽和高
|
|
|
783
|
float width = bgimage.getWidth();
|
|
|
784
|
float height = bgimage.getHeight();
|
|
|
785
|
// 创建操作图片用的matrix对象
|
|
|
786
|
Matrix matrix = new Matrix();
|
|
|
787
|
// 计算宽高缩放率
|
|
|
788
|
float scaleWidth = ((float) newWidth) / width;
|
|
|
789
|
float scaleHeight = ((float) newHeight) / height;
|
|
|
790
|
// 缩放图片动作
|
|
|
791
|
matrix.postScale(scaleWidth, scaleHeight);
|
|
|
792
|
Bitmap bitmap = Bitmap.createBitmap(bgimage, 0, 0, (int) width,
|
|
|
793
|
(int) height, matrix, true);
|
|
|
794
|
// iv_2.setImageBitmap(bitmap);
|
|
|
795
|
// tv_2.setText(bitmap.getRowBytes() * bitmap.getHeight() + "");
|
|
|
796
|
return bitmap;
|
|
|
797
|
}
|
|
|
798
|
|
|
|
799
|
private void uploadFeedbackInfo() {
|
|
|
800
|
// dialog.show();
|
|
|
801
|
TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
|
|
|
802
|
final String imem;
|
|
|
803
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
|
|
|
804
|
// TODO: Consider calling
|
|
|
805
|
// ActivityCompat#requestPermissions
|
|
|
806
|
// here to request the missing permissions, and then overriding
|
|
|
807
|
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
|
|
808
|
// int[] grantResults)
|
|
|
809
|
// to handle the case where the user grants the permission. See the documentation
|
|
|
810
|
// for ActivityCompat#requestPermissions for more details.
|
|
|
811
|
imem = "";
|
|
|
812
|
}else {
|
|
|
813
|
imem = telephonyManager.getDeviceId();
|
|
|
814
|
}
|
|
|
815
|
String url;
|
|
|
816
|
if (null != json){
|
|
|
817
|
url = MainApplication.url+"/zhannew/basic/web/index.php/advice/add?user_id="+MainApplication.userId+
|
|
|
818
|
"&msg="+et_context.getText().toString()+"&telephone="+MainApplication.userPhone+"&imem="+imem+
|
|
|
819
|
"&main_id=0&url="+json;
|
|
|
820
|
}else {
|
|
|
821
|
url = MainApplication.url+"/zhannew/basic/web/index.php/advice/add?user_id="+MainApplication.userId+
|
|
|
822
|
"&msg="+et_context.getText().toString()+"&telephone="+MainApplication.userPhone+"&imem="+imem+
|
|
|
823
|
"&main_id=0&url=";
|
|
|
824
|
}
|
|
|
825
|
|
|
|
826
|
Log.e(TAG, "uploadFeedbackInfo: url="+url );
|
|
|
827
|
OkHttpUtils.get().url(url).build().execute(new StringCallback() {
|
|
|
828
|
@Override
|
|
|
829
|
public void onError(Call call, Exception e) {
|
|
|
830
|
// dialog.cancel();
|
|
|
831
|
ToastUtil.showToast(getApplicationContext(),"请检查当前网络",Toast.LENGTH_SHORT);
|
|
|
832
|
}
|
|
|
833
|
|
|
|
834
|
@Override
|
|
|
835
|
public void onResponse(String response) {
|
|
|
836
|
Log.e(TAG, "onResponse: response="+response );
|
|
|
837
|
// dialog.cancel();
|
|
|
838
|
String rtnCode = JsonUtils.getKeyResult(response,"rtnCode");
|
|
|
839
|
if (rtnCode.equals("01")){
|
|
|
840
|
// ToastUtil.showToast(getApplicationContext(),"感谢您的反馈",Toast.LENGTH_SHORT);
|
|
|
841
|
String plusScore = JsonUtils.getKeyResult(response,"plusScore");
|
|
|
842
|
if (!plusScore.equals("")){
|
|
|
843
|
tv_point.setText(plusScore);
|
|
|
844
|
rl_point.setVisibility(View.VISIBLE);
|
|
|
845
|
rl_point.startAnimation(animation);
|
|
|
846
|
new Handler().postDelayed(new Runnable() {
|
|
|
847
|
public void run() {
|
|
|
848
|
rl_point.setVisibility(View.GONE);
|
|
|
849
|
}
|
|
|
850
|
}, 1000);
|
|
|
851
|
new Handler().postDelayed(new Runnable() {
|
|
|
852
|
public void run() {
|
|
|
853
|
finish();
|
|
|
854
|
}
|
|
|
855
|
}, 1500);
|
|
|
856
|
}else {
|
|
|
857
|
ToastUtil.showToast(getApplicationContext(),"感谢您的反馈",Toast.LENGTH_SHORT);
|
|
|
858
|
finish();
|
|
|
859
|
}
|
|
|
860
|
// finish();
|
|
|
861
|
}else if (rtnCode.equals("03")){
|
|
|
862
|
String rtnMsg = JsonUtils.getKeyResult(response,"rtnMsg");
|
|
|
863
|
ToastUtil.showToast(getApplicationContext(),rtnMsg,Toast.LENGTH_SHORT);
|
|
|
864
|
}else {
|
|
|
865
|
String rtnMsg = JsonUtils.getKeyResult(response,"rtnMsg");
|
|
|
866
|
ToastUtil.showToast(getApplicationContext(),rtnMsg,Toast.LENGTH_SHORT);
|
|
|
867
|
}
|
|
|
868
|
}
|
|
|
869
|
});
|
|
|
870
|
}
|
|
|
871
|
|
|
|
872
|
/**
|
|
|
873
|
* 检测是否有emoji表情
|
|
|
874
|
*
|
|
|
875
|
* @param source
|
|
|
876
|
* @return
|
|
|
877
|
*/
|
|
|
878
|
public static boolean containsEmoji(String source) {
|
|
|
879
|
int len = source.length();
|
|
|
880
|
for (int i = 0; i < len; i++) {
|
|
|
881
|
char codePoint = source.charAt(i);
|
|
|
882
|
if (!isEmojiCharacter(codePoint)) { //如果不能匹配,则该字符是Emoji表情
|
|
|
883
|
return true;
|
|
|
884
|
}
|
|
|
885
|
}
|
|
|
886
|
return false;
|
|
|
887
|
}
|
|
|
888
|
|
|
|
889
|
/**
|
|
|
890
|
* 判断是否是Emoji
|
|
|
891
|
*
|
|
|
892
|
* @param codePoint 比较的单个字符
|
|
|
893
|
* @return
|
|
|
894
|
*/
|
|
|
895
|
private static boolean isEmojiCharacter(char codePoint) {
|
|
|
896
|
return (codePoint == 0x0) || (codePoint == 0x9) || (codePoint == 0xA) ||
|
|
|
897
|
(codePoint == 0xD) || ((codePoint >= 0x20) && (codePoint <= 0xD7FF)) ||
|
|
|
898
|
((codePoint >= 0xE000) && (codePoint <= 0xFFFD)) || ((codePoint >= 0x10000)
|
|
|
899
|
&& (codePoint <= 0x10FFFF));
|
|
|
900
|
}
|
|
|
901
|
|
|
|
902
|
@Override
|
|
|
903
|
public void onPermissionsGranted(int requestCode, List<String> perms) {
|
|
|
904
|
|
|
|
905
|
}
|
|
|
906
|
|
|
|
907
|
@Override
|
|
|
908
|
public void onPermissionsDenied(int requestCode, List<String> perms) {
|
|
|
909
|
|
|
|
910
|
}
|
|
|
911
|
|
|
|
912
|
@AfterPermissionGranted(RC_ALBUM_PERM)
|
|
|
913
|
public void permissionTask() {
|
|
|
914
|
if (isPermissionOK()) {
|
|
|
915
|
callGallery();
|
|
|
916
|
// Have permission, do the thing!
|
|
|
917
|
// Toast.makeText(this, "TODO: Camera things", Toast.LENGTH_LONG).show();
|
|
|
918
|
// ifTimeout();
|
|
|
919
|
} else {
|
|
|
920
|
// Ask for one permission
|
|
|
921
|
EasyPermissions.requestPermissions(
|
|
|
922
|
this,"充电桩想要获取您的图片读取权限,是否允许?",
|
|
|
923
|
RC_ALBUM_PERM,
|
|
|
924
|
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
|
|
925
|
Manifest.permission.READ_EXTERNAL_STORAGE);
|
|
|
926
|
}
|
|
|
927
|
}
|
|
|
928
|
|
|
|
929
|
private boolean isPermissionOK() {
|
|
|
930
|
return EasyPermissions.hasPermissions(this,
|
|
|
931
|
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
|
|
932
|
Manifest.permission.READ_EXTERNAL_STORAGE
|
|
|
933
|
);
|
|
|
934
|
}
|
|
|
935
|
|
|
|
936
|
|
|
|
937
|
|
|
|
938
|
|
|
|
939
|
}
|
|
|
@ -0,0 +1,225 @@
|
|
|
1
|
package com.electric.chargingpile.activity;
|
|
|
2
|
|
|
|
3
|
import android.os.Bundle;
|
|
|
4
|
import android.support.v7.app.AppCompatActivity;
|
|
|
5
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
6
|
import android.support.v7.widget.RecyclerView;
|
|
|
7
|
import android.text.Editable;
|
|
|
8
|
import android.text.TextWatcher;
|
|
|
9
|
import android.util.Log;
|
|
|
10
|
import android.view.KeyEvent;
|
|
|
11
|
import android.view.View;
|
|
|
12
|
import android.view.inputmethod.EditorInfo;
|
|
|
13
|
import android.widget.EditText;
|
|
|
14
|
import android.widget.ImageView;
|
|
|
15
|
import android.widget.TextView;
|
|
|
16
|
import android.widget.Toast;
|
|
|
17
|
|
|
|
18
|
import com.andview.refreshview.XRefreshView;
|
|
|
19
|
import com.electric.chargingpile.R;
|
|
|
20
|
import com.electric.chargingpile.adapter.SearchQuestionAdapter;
|
|
|
21
|
import com.electric.chargingpile.adapter.SearchTopicListAdapter;
|
|
|
22
|
import com.electric.chargingpile.application.MainApplication;
|
|
|
23
|
import com.electric.chargingpile.data.HomePageBean;
|
|
|
24
|
import com.electric.chargingpile.data.MyQSearch;
|
|
|
25
|
import com.electric.chargingpile.data.QAData;
|
|
|
26
|
import com.electric.chargingpile.data.TextSearch;
|
|
|
27
|
import com.electric.chargingpile.data.TopicSearchBean;
|
|
|
28
|
import com.electric.chargingpile.util.BarColorUtil;
|
|
|
29
|
import com.electric.chargingpile.util.JsonUtils;
|
|
|
30
|
import com.electric.chargingpile.util.NetUtil;
|
|
|
31
|
import com.electric.chargingpile.util.SoftInputUtil;
|
|
|
32
|
import com.electric.chargingpile.util.ToastUtil;
|
|
|
33
|
import com.google.gson.Gson;
|
|
|
34
|
import com.google.gson.reflect.TypeToken;
|
|
|
35
|
import com.zhy.http.okhttp.OkHttpUtils;
|
|
|
36
|
import com.zhy.http.okhttp.callback.StringCallback;
|
|
|
37
|
|
|
|
38
|
import java.util.ArrayList;
|
|
|
39
|
import java.util.HashMap;
|
|
|
40
|
import java.util.List;
|
|
|
41
|
import java.util.Map;
|
|
|
42
|
|
|
|
43
|
import okhttp3.Call;
|
|
|
44
|
|
|
|
45
|
/**
|
|
|
46
|
*
|
|
|
47
|
* @desc 话题搜索列表
|
|
|
48
|
*
|
|
|
49
|
*
|
|
|
50
|
* */
|
|
|
51
|
public class TopicSearchListsActivity extends AppCompatActivity implements View.OnClickListener {
|
|
|
52
|
|
|
|
53
|
private EditText et_search;
|
|
|
54
|
private ImageView iv_clear;
|
|
|
55
|
private XRefreshView xRefreshView;
|
|
|
56
|
RecyclerView recyclerView;
|
|
|
57
|
private int page = 1;
|
|
|
58
|
private TextView banquan;
|
|
|
59
|
private SearchTopicListAdapter activeListAdapter;
|
|
|
60
|
|
|
|
61
|
@Override
|
|
|
62
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
63
|
super.onCreate(savedInstanceState);
|
|
|
64
|
setContentView(R.layout.activity_topic_search_page);
|
|
|
65
|
BarColorUtil.initStatusBarColor(TopicSearchListsActivity.this);
|
|
|
66
|
initView();
|
|
|
67
|
initListener();
|
|
|
68
|
}
|
|
|
69
|
|
|
|
70
|
private void initListener() {
|
|
|
71
|
findViewById(R.id.iv_back).setOnClickListener(this);
|
|
|
72
|
findViewById(R.id.search_icon).setOnClickListener(this);
|
|
|
73
|
iv_clear.setOnClickListener(this);
|
|
|
74
|
|
|
|
75
|
et_search.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
76
|
@Override
|
|
|
77
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
|
78
|
if(actionId == EditorInfo.IME_ACTION_SEARCH){
|
|
|
79
|
String text = et_search.getText().toString().trim();
|
|
|
80
|
if (text.equals("") || text.contains("'")){
|
|
|
81
|
ToastUtil.showToast(getApplicationContext(),"请输入要搜索的内容", Toast.LENGTH_SHORT);
|
|
|
82
|
}else {
|
|
|
83
|
getSearchData(text);
|
|
|
84
|
}
|
|
|
85
|
return true;
|
|
|
86
|
}
|
|
|
87
|
return false;
|
|
|
88
|
}
|
|
|
89
|
});
|
|
|
90
|
et_search.addTextChangedListener(new TextWatcher() {
|
|
|
91
|
@Override
|
|
|
92
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
93
|
}
|
|
|
94
|
@Override
|
|
|
95
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
96
|
}
|
|
|
97
|
@Override
|
|
|
98
|
public void afterTextChanged(Editable s) {
|
|
|
99
|
String text = s.toString().trim();
|
|
|
100
|
if (text.length() == 0){
|
|
|
101
|
iv_clear.setVisibility(View.INVISIBLE);
|
|
|
102
|
}else {
|
|
|
103
|
iv_clear.setVisibility(View.VISIBLE);
|
|
|
104
|
}
|
|
|
105
|
}
|
|
|
106
|
});
|
|
|
107
|
}
|
|
|
108
|
|
|
|
109
|
private void initView() {
|
|
|
110
|
et_search = (EditText)findViewById(R.id.et_search);
|
|
|
111
|
SoftInputUtil.showSoftInputFromWindow(TopicSearchListsActivity.this,et_search);
|
|
|
112
|
iv_clear = (ImageView) findViewById(R.id.iv_clear);
|
|
|
113
|
banquan = (TextView)findViewById(R.id.banquan);
|
|
|
114
|
|
|
|
115
|
xRefreshView = (XRefreshView) findViewById(R.id.xrefreshview);
|
|
|
116
|
xRefreshView.setPullLoadEnable(true);
|
|
|
117
|
recyclerView = (RecyclerView) findViewById(R.id.recycler_view_test_rv);
|
|
|
118
|
|
|
|
119
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
|
|
120
|
recyclerView.setLayoutManager(linearLayoutManager);
|
|
|
121
|
recyclerView.setHasFixedSize(true);
|
|
|
122
|
|
|
|
123
|
activeListAdapter = new SearchTopicListAdapter(this);
|
|
|
124
|
recyclerView.setAdapter(activeListAdapter);
|
|
|
125
|
|
|
|
126
|
xRefreshView.setPinnedTime(1000);
|
|
|
127
|
xRefreshView.setMoveForHorizontal(true);
|
|
|
128
|
|
|
|
129
|
xRefreshView.setXRefreshViewListener(new XRefreshView.SimpleXRefreshListener() {
|
|
|
130
|
|
|
|
131
|
@Override
|
|
|
132
|
public void onRefresh(boolean isPullDown) {
|
|
|
133
|
page=1;
|
|
|
134
|
requestData();
|
|
|
135
|
}
|
|
|
136
|
|
|
|
137
|
@Override
|
|
|
138
|
public void onLoadMore(boolean isSilence) {
|
|
|
139
|
page++;
|
|
|
140
|
requestData();
|
|
|
141
|
}
|
|
|
142
|
});
|
|
|
143
|
}
|
|
|
144
|
|
|
|
145
|
private void getSearchData(final String key){
|
|
|
146
|
String url = MainApplication.urlNew+"/topic/search.do";
|
|
|
147
|
Map<String, String> map = new HashMap<>();
|
|
|
148
|
map.put("page", page + "");
|
|
|
149
|
map.put("limit", "20");
|
|
|
150
|
map.put("key", key);
|
|
|
151
|
OkHttpUtils.get().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
|
|
|
152
|
@Override
|
|
|
153
|
public void onError(Call call, Exception e) {
|
|
|
154
|
if (page == 1)
|
|
|
155
|
xRefreshView.stopRefresh();
|
|
|
156
|
else
|
|
|
157
|
xRefreshView.setLoadComplete(true);
|
|
|
158
|
ToastUtil.showToast(getApplicationContext(), "加载失败,请重试", Toast.LENGTH_SHORT);
|
|
|
159
|
}
|
|
|
160
|
|
|
|
161
|
@Override
|
|
|
162
|
public void onResponse(String response) {
|
|
|
163
|
if (page == 1)
|
|
|
164
|
xRefreshView.stopRefresh();
|
|
|
165
|
else
|
|
|
166
|
xRefreshView.setLoadComplete(true);
|
|
|
167
|
|
|
|
168
|
String rtnCode = JsonUtils.getKeyResult(response, "code");
|
|
|
169
|
if ("1000".equals(rtnCode)) {
|
|
|
170
|
String rtnMsg = JsonUtils.getKeyResult(response, "data");
|
|
|
171
|
ArrayList <TopicSearchBean> qadata = (ArrayList<TopicSearchBean>) JsonUtils.parseToObjectList(rtnMsg,TopicSearchBean.class);
|
|
|
172
|
|
|
|
173
|
if (page == 1)
|
|
|
174
|
activeListAdapter.setData(qadata);
|
|
|
175
|
else
|
|
|
176
|
activeListAdapter.addData(qadata);
|
|
|
177
|
|
|
|
178
|
if((page == 1 && null == qadata) || (page == 1 && qadata.size() == 0)){
|
|
|
179
|
|
|
|
180
|
findViewById(R.id.no_net_view).setVisibility(View.VISIBLE);
|
|
|
181
|
findViewById(R.id.request_refresh).setVisibility(View.GONE);
|
|
|
182
|
banquan.setText("还没有任何内容哦," +
|
|
|
183
|
"快来抢沙发~");
|
|
|
184
|
}else {
|
|
|
185
|
findViewById(R.id.no_net_view).setVisibility(View.GONE);
|
|
|
186
|
}
|
|
|
187
|
} else if ("02".equals(rtnCode)) {
|
|
|
188
|
ToastUtil.showToast(getApplicationContext(), "已经全部加载完毕", Toast.LENGTH_SHORT);
|
|
|
189
|
}
|
|
|
190
|
}
|
|
|
191
|
});
|
|
|
192
|
}
|
|
|
193
|
|
|
|
194
|
@Override
|
|
|
195
|
public void onClick(View v) {
|
|
|
196
|
switch (v.getId()) {
|
|
|
197
|
case R.id.request_refresh:
|
|
|
198
|
case R.id.search_icon:
|
|
|
199
|
requestData();
|
|
|
200
|
break;
|
|
|
201
|
case R.id.iv_clear:
|
|
|
202
|
et_search.setText("");
|
|
|
203
|
break;
|
|
|
204
|
case R.id.iv_back:
|
|
|
205
|
finish();
|
|
|
206
|
break;
|
|
|
207
|
}
|
|
|
208
|
}
|
|
|
209
|
|
|
|
210
|
private void requestData() {
|
|
|
211
|
|
|
|
212
|
String text = et_search.getText().toString().trim();
|
|
|
213
|
if (text.equals("") || text.contains("'")){
|
|
|
214
|
ToastUtil.showToast(getApplicationContext(),"请输入要搜索的内容", Toast.LENGTH_SHORT);
|
|
|
215
|
}else {
|
|
|
216
|
|
|
|
217
|
if(NetUtil.CheckNetwork(this)){
|
|
|
218
|
getSearchData(text);
|
|
|
219
|
}else {
|
|
|
220
|
findViewById(R.id.no_net_view).setVisibility(View.VISIBLE);
|
|
|
221
|
findViewById(R.id.request_refresh).setOnClickListener(this);
|
|
|
222
|
}
|
|
|
223
|
}
|
|
|
224
|
}
|
|
|
225
|
}
|
|
|
@ -0,0 +1,107 @@
|
|
|
1
|
package com.electric.chargingpile.adapter;
|
|
|
2
|
|
|
|
3
|
import android.content.Context;
|
|
|
4
|
import android.support.v7.widget.RecyclerView;
|
|
|
5
|
import android.text.Html;
|
|
|
6
|
import android.text.TextUtils;
|
|
|
7
|
import android.view.LayoutInflater;
|
|
|
8
|
import android.view.View;
|
|
|
9
|
import android.view.ViewGroup;
|
|
|
10
|
import android.widget.ImageView;
|
|
|
11
|
import android.widget.RelativeLayout;
|
|
|
12
|
import android.widget.TextView;
|
|
|
13
|
|
|
|
14
|
import com.aspsine.irecyclerview.IViewHolder;
|
|
|
15
|
import com.electric.chargingpile.R;
|
|
|
16
|
import com.electric.chargingpile.data.TopicSearchBean;
|
|
|
17
|
import com.electric.chargingpile.iview.RecyclerItemClickListener;
|
|
|
18
|
import com.electric.chargingpile.util.ImageDisplayUtils;
|
|
|
19
|
|
|
|
20
|
import java.text.ParseException;
|
|
|
21
|
import java.text.SimpleDateFormat;
|
|
|
22
|
import java.util.ArrayList;
|
|
|
23
|
import java.util.Calendar;
|
|
|
24
|
import java.util.Date;
|
|
|
25
|
|
|
|
26
|
/**
|
|
|
27
|
* Created by dxh
|
|
|
28
|
*/
|
|
|
29
|
public class SearchTopicListAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
|
30
|
|
|
|
31
|
private Context context;
|
|
|
32
|
private LayoutInflater layoutInflater;
|
|
|
33
|
private RecyclerItemClickListener onRecyclerItemClickListener;
|
|
|
34
|
private ArrayList<TopicSearchBean> userLableBeans;
|
|
|
35
|
|
|
|
36
|
int screenWidth;
|
|
|
37
|
|
|
|
38
|
public SearchTopicListAdapter(Context context) {
|
|
|
39
|
this.context = context;
|
|
|
40
|
layoutInflater = LayoutInflater.from(context);
|
|
|
41
|
userLableBeans = new ArrayList<>();
|
|
|
42
|
}
|
|
|
43
|
|
|
|
44
|
public void setData(ArrayList<TopicSearchBean> datas) {
|
|
|
45
|
this.userLableBeans = datas;
|
|
|
46
|
notifyDataSetChanged();
|
|
|
47
|
}
|
|
|
48
|
|
|
|
49
|
public void addData(ArrayList<TopicSearchBean> datas) {
|
|
|
50
|
userLableBeans.addAll(datas);
|
|
|
51
|
notifyDataSetChanged();
|
|
|
52
|
}
|
|
|
53
|
|
|
|
54
|
public ArrayList<TopicSearchBean> getCurrentDatas() {
|
|
|
55
|
return userLableBeans;
|
|
|
56
|
}
|
|
|
57
|
|
|
|
58
|
public void setOnRecyclerItemClickListener(RecyclerItemClickListener onRecyclerItemClickListener) {
|
|
|
59
|
this.onRecyclerItemClickListener = onRecyclerItemClickListener;
|
|
|
60
|
}
|
|
|
61
|
|
|
|
62
|
|
|
|
63
|
@Override
|
|
|
64
|
public IViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
|
65
|
View view = layoutInflater.inflate(R.layout.activity_search_result_topic_item, parent, false);
|
|
|
66
|
return new HeaderCommentViewHolder(view);
|
|
|
67
|
}
|
|
|
68
|
|
|
|
69
|
@Override
|
|
|
70
|
public void onBindViewHolder(IViewHolder holder, int position) {
|
|
|
71
|
setArticlePageerHolder(holder, position);
|
|
|
72
|
}
|
|
|
73
|
|
|
|
74
|
private void setArticlePageerHolder(IViewHolder holder, int position) {
|
|
|
75
|
HeaderCommentViewHolder headerCommentViewHolder = (HeaderCommentViewHolder) holder;
|
|
|
76
|
TopicSearchBean carArticlesBean = userLableBeans.get(position);
|
|
|
77
|
|
|
|
78
|
headerCommentViewHolder.banquan.setText(Html.fromHtml(carArticlesBean.name));
|
|
|
79
|
ImageDisplayUtils.dispalyImg(context, carArticlesBean.coverImgUrl, headerCommentViewHolder.icon_scan);
|
|
|
80
|
}
|
|
|
81
|
|
|
|
82
|
@Override
|
|
|
83
|
public int getItemCount() {
|
|
|
84
|
return userLableBeans.size();
|
|
|
85
|
}
|
|
|
86
|
|
|
|
87
|
|
|
|
88
|
class HeaderCommentViewHolder extends IViewHolder {
|
|
|
89
|
private ImageView icon_scan;
|
|
|
90
|
private TextView banquan;
|
|
|
91
|
|
|
|
92
|
public HeaderCommentViewHolder(View itemView) {
|
|
|
93
|
super(itemView);
|
|
|
94
|
icon_scan = (ImageView) itemView.findViewById(R.id.icon_scan);
|
|
|
95
|
banquan = (TextView) itemView.findViewById(R.id.banquan);
|
|
|
96
|
itemView.setOnClickListener(new View.OnClickListener() {
|
|
|
97
|
@Override
|
|
|
98
|
public void onClick(View view) {
|
|
|
99
|
if (onRecyclerItemClickListener != null) {
|
|
|
100
|
onRecyclerItemClickListener.onItemClickListener(getLayoutPosition());
|
|
|
101
|
}
|
|
|
102
|
}
|
|
|
103
|
});
|
|
|
104
|
}
|
|
|
105
|
}
|
|
|
106
|
|
|
|
107
|
}
|
|
|
@ -0,0 +1,12 @@
|
|
|
1
|
package com.electric.chargingpile.data;
|
|
|
2
|
|
|
|
3
|
public class TopicSearchBean {
|
|
|
4
|
|
|
|
5
|
public long topicId;
|
|
|
6
|
public String name;
|
|
|
7
|
public String coverImgUrl;
|
|
|
8
|
public int coinNums;
|
|
|
9
|
public int joinNums;
|
|
|
10
|
public int visitNums;
|
|
|
11
|
public int isRecommend;
|
|
|
12
|
}
|
|
|
@ -0,0 +1,20 @@
|
|
|
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
2
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
|
3
|
<!-- 连框颜色值 -->
|
|
|
4
|
<!--<item>-->
|
|
|
5
|
<!--<shape>-->
|
|
|
6
|
<!--<solid android:color="#000000" />-->
|
|
|
7
|
<!--</shape>-->
|
|
|
8
|
<!--</item>-->
|
|
|
9
|
<!-- 主体背景颜色值 -->
|
|
|
10
|
<item>
|
|
|
11
|
<shape>
|
|
|
12
|
<solid android:color="#e8e8e8" /><!--填充色-->
|
|
|
13
|
<!--<stroke-->
|
|
|
14
|
<!--android:width="0.5dp"-->
|
|
|
15
|
<!--android:color="#cccccc" /> <!–边框颜色–>-->
|
|
|
16
|
<corners
|
|
|
17
|
android:radius="35dp"/>
|
|
|
18
|
</shape>
|
|
|
19
|
</item>
|
|
|
20
|
</layer-list>
|
|
|
@ -28,7 +28,7 @@
|
|
28
|
28
|
android:layout_height="28dp"
|
|
29
|
29
|
android:layout_above="@+id/rule_publish"
|
|
30
|
30
|
android:layout_centerHorizontal="true"
|
|
31
|
|
android:background="@color/color_d1d1d1"/>
|
|
|
31
|
android:background="@drawable/app_publish_item_cancel"/>
|
|
32
|
32
|
|
|
33
|
33
|
<LinearLayout
|
|
34
|
34
|
android:id="@+id/publish_picture"
|
|
|
@ -44,12 +44,12 @@
|
|
44
|
44
|
<ImageView
|
|
45
|
45
|
android:layout_width="50dp"
|
|
46
|
46
|
android:layout_height="50dp"
|
|
47
|
|
android:background="#999999"/>
|
|
|
47
|
android:background="@drawable/app_publish_item_pic"/>
|
|
48
|
48
|
<TextView
|
|
49
|
49
|
android:layout_width="wrap_content"
|
|
50
|
50
|
android:layout_height="wrap_content"
|
|
51
|
51
|
android:layout_marginTop="10dp"
|
|
52
|
|
android:text="视频"
|
|
|
52
|
android:text="图文"
|
|
53
|
53
|
android:textSize="15sp"
|
|
54
|
54
|
android:textColor="@color/color_222222" />
|
|
55
|
55
|
</LinearLayout>
|
|
|
@ -69,12 +69,12 @@
|
|
69
|
69
|
<ImageView
|
|
70
|
70
|
android:layout_width="50dp"
|
|
71
|
71
|
android:layout_height="50dp"
|
|
72
|
|
android:background="#999999"/>
|
|
|
72
|
android:background="@drawable/app_publish_item_video"/>
|
|
73
|
73
|
<TextView
|
|
74
|
74
|
android:layout_width="wrap_content"
|
|
75
|
75
|
android:layout_height="wrap_content"
|
|
76
|
76
|
android:layout_marginTop="10dp"
|
|
77
|
|
android:text="图文"
|
|
|
77
|
android:text="视频"
|
|
78
|
78
|
android:textSize="15sp"
|
|
79
|
79
|
android:textColor="@color/color_222222" />
|
|
80
|
80
|
</LinearLayout>
|
|
|
@ -94,7 +94,7 @@
|
|
94
|
94
|
<ImageView
|
|
95
|
95
|
android:layout_width="50dp"
|
|
96
|
96
|
android:layout_height="50dp"
|
|
97
|
|
android:background="#999999"/>
|
|
|
97
|
android:background="@drawable/app_publish_item_qa"/>
|
|
98
|
98
|
<TextView
|
|
99
|
99
|
android:layout_width="wrap_content"
|
|
100
|
100
|
android:layout_height="wrap_content"
|
|
|
@ -107,8 +107,7 @@
|
|
107
|
107
|
|
|
108
|
108
|
<RelativeLayout
|
|
109
|
109
|
android:layout_width="match_parent"
|
|
110
|
|
android:layout_height="wrap_content"
|
|
111
|
|
android:background="@color/color_fafafa">
|
|
|
110
|
android:layout_height="wrap_content">
|
|
112
|
111
|
|
|
113
|
112
|
<ImageView
|
|
114
|
113
|
android:id="@+id/share_scan_icon"
|
|
|
@ -116,7 +115,7 @@
|
|
116
|
115
|
android:layout_height="160dp"
|
|
117
|
116
|
android:layout_marginTop="90dp"
|
|
118
|
117
|
android:layout_centerHorizontal="true"
|
|
119
|
|
android:background="@color/color_d1d1d1"/>
|
|
|
118
|
android:background="@drawable/app_publish_items_bg"/>
|
|
120
|
119
|
|
|
121
|
120
|
<TextView
|
|
122
|
121
|
android:id="@+id/share_scan_icon_info"
|
|
|
@ -93,6 +93,7 @@
|
|
93
|
93
|
android:layout_width="match_parent"
|
|
94
|
94
|
android:layout_height="wrap_content"
|
|
95
|
95
|
android:layout_below="@+id/et_context"
|
|
|
96
|
android:layout_marginBottom="50dp"
|
|
96
|
97
|
android:layout_marginLeft="15dp"
|
|
97
|
98
|
android:layout_marginRight="70dp"
|
|
98
|
99
|
android:numColumns="3"
|
|
|
@ -182,6 +183,70 @@
|
|
182
|
183
|
|
|
183
|
184
|
|
|
184
|
185
|
|
|
|
186
|
<LinearLayout
|
|
|
187
|
android:layout_width="wrap_content"
|
|
|
188
|
android:layout_height="30dp"
|
|
|
189
|
android:layout_alignParentBottom="true"
|
|
|
190
|
android:layout_marginStart="15dp"
|
|
|
191
|
android:layout_marginBottom="10dp"
|
|
|
192
|
android:background="#f5f5f5"
|
|
|
193
|
android:gravity="center_vertical"
|
|
|
194
|
android:orientation="horizontal">
|
|
|
195
|
|
|
|
196
|
|
|
|
197
|
<TextView
|
|
|
198
|
android:id="@+id/publishtopic_choose_topic"
|
|
|
199
|
android:layout_width="wrap_content"
|
|
|
200
|
android:layout_height="wrap_content"
|
|
|
201
|
android:ellipsize="end"
|
|
|
202
|
android:lines="1"
|
|
|
203
|
android:maxWidth="180dp"
|
|
|
204
|
android:paddingStart="@dimen/ui_10_dip"
|
|
|
205
|
android:paddingEnd="@dimen/ui_10_dip"
|
|
|
206
|
android:text="# 选择话题"
|
|
|
207
|
android:textColor="#555"
|
|
|
208
|
android:textSize="14sp" />
|
|
|
209
|
|
|
|
210
|
<ImageView
|
|
|
211
|
android:id="@+id/publishtopic_choose_topic_de"
|
|
|
212
|
android:layout_width="30dp"
|
|
|
213
|
android:layout_height="30dp"
|
|
|
214
|
android:padding="3dp"
|
|
|
215
|
android:src="@drawable/icon_close"
|
|
|
216
|
android:visibility="gone" />
|
|
|
217
|
|
|
|
218
|
</LinearLayout>
|
|
|
219
|
|
|
|
220
|
<TextView
|
|
|
221
|
android:id="@+id/publishtopic_choose_preview"
|
|
|
222
|
android:layout_width="wrap_content"
|
|
|
223
|
android:layout_height="49dp"
|
|
|
224
|
android:layout_alignParentEnd="true"
|
|
|
225
|
android:layout_alignParentBottom="true"
|
|
|
226
|
android:layout_marginStart="11dp"
|
|
|
227
|
android:gravity="center_vertical"
|
|
|
228
|
android:orientation="horizontal"
|
|
|
229
|
android:paddingStart="@dimen/ui_10_dip"
|
|
|
230
|
android:paddingEnd="15dp"
|
|
|
231
|
android:text="预览"
|
|
|
232
|
android:textColor="#b2b2b2"
|
|
|
233
|
android:textSize="14sp" />
|
|
185
|
234
|
|
|
|
235
|
<TextView
|
|
|
236
|
android:id="@+id/publishtopic_word_num"
|
|
|
237
|
android:layout_width="wrap_content"
|
|
|
238
|
android:layout_height="49dp"
|
|
|
239
|
android:layout_alignParentBottom="true"
|
|
|
240
|
android:layout_toStartOf="@+id/publishtopic_choose_preview"
|
|
|
241
|
android:gravity="center_vertical"
|
|
|
242
|
android:text="0/500"
|
|
|
243
|
android:textSize="14sp" />
|
|
|
244
|
|
|
|
245
|
|
|
|
246
|
<View
|
|
|
247
|
android:layout_width="match_parent"
|
|
|
248
|
android:layout_height="1dp"
|
|
|
249
|
android:layout_above="@+id/publishtopic_choose_preview"
|
|
|
250
|
android:background="#ddd" />
|
|
186
|
251
|
|
|
187
|
252
|
</RelativeLayout>
|
|
|
@ -0,0 +1,44 @@
|
|
|
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
2
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
3
|
android:layout_width="match_parent"
|
|
|
4
|
android:layout_height="wrap_content"
|
|
|
5
|
android:minHeight="70.5dp"
|
|
|
6
|
android:orientation="vertical"
|
|
|
7
|
>
|
|
|
8
|
|
|
|
9
|
<LinearLayout
|
|
|
10
|
android:layout_width="match_parent"
|
|
|
11
|
android:layout_height="wrap_content"
|
|
|
12
|
android:minHeight="70dp"
|
|
|
13
|
android:gravity="center_vertical"
|
|
|
14
|
android:orientation="horizontal"
|
|
|
15
|
>
|
|
|
16
|
|
|
|
17
|
<ImageView
|
|
|
18
|
android:id="@+id/icon_scan"
|
|
|
19
|
android:layout_width="50dp"
|
|
|
20
|
android:layout_height="43dp"
|
|
|
21
|
android:layout_marginLeft="15dp"
|
|
|
22
|
android:src="@drawable/icon_about_scan"/>
|
|
|
23
|
|
|
|
24
|
<TextView
|
|
|
25
|
android:id="@+id/banquan"
|
|
|
26
|
android:layout_width="match_parent"
|
|
|
27
|
android:layout_height="wrap_content"
|
|
|
28
|
android:layout_marginLeft="10dp"
|
|
|
29
|
android:layout_marginRight="15dp"
|
|
|
30
|
android:maxLines="2"
|
|
|
31
|
android:ellipsize="end"
|
|
|
32
|
android:text="电动未来,版权所有"
|
|
|
33
|
android:textSize="20sp"
|
|
|
34
|
android:textColor="#444444" />
|
|
|
35
|
<!--</LinearLayout>-->
|
|
|
36
|
</LinearLayout>
|
|
|
37
|
|
|
|
38
|
<View
|
|
|
39
|
android:layout_width="match_parent"
|
|
|
40
|
android:layout_height="0.5dp"
|
|
|
41
|
android:layout_marginLeft="15dp"
|
|
|
42
|
android:background="@color/title_line"/>
|
|
|
43
|
|
|
|
44
|
</LinearLayout>
|
|
|
@ -0,0 +1,113 @@
|
|
|
1
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
2
|
xmlns:tools="http://schemas.android.com/tools"
|
|
|
3
|
android:layout_width="match_parent"
|
|
|
4
|
android:layout_height="match_parent"
|
|
|
5
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
|
6
|
android:orientation="vertical"
|
|
|
7
|
android:background="@color/white">
|
|
|
8
|
|
|
|
9
|
<RelativeLayout
|
|
|
10
|
android:id="@+id/rl_title"
|
|
|
11
|
android:layout_width="fill_parent"
|
|
|
12
|
android:layout_height="44dp">
|
|
|
13
|
|
|
|
14
|
<ImageView
|
|
|
15
|
android:id="@+id/iv_back"
|
|
|
16
|
android:layout_width="wrap_content"
|
|
|
17
|
android:layout_height="match_parent"
|
|
|
18
|
android:layout_alignParentLeft="true"
|
|
|
19
|
android:layout_centerVertical="true"
|
|
|
20
|
android:contentDescription="@null"
|
|
|
21
|
android:paddingLeft="15dp"
|
|
|
22
|
android:paddingRight="15dp"
|
|
|
23
|
android:src="@drawable/icon_lvback1119" />
|
|
|
24
|
|
|
|
25
|
<TextView
|
|
|
26
|
android:id="@+id/tv_webview_title"
|
|
|
27
|
android:layout_width="wrap_content"
|
|
|
28
|
android:layout_height="wrap_content"
|
|
|
29
|
android:layout_centerInParent="true"
|
|
|
30
|
android:text="话题"
|
|
|
31
|
android:singleLine="true"
|
|
|
32
|
android:maxEms="8"
|
|
|
33
|
android:ellipsize="end"
|
|
|
34
|
android:textColor="@color/ui_62"
|
|
|
35
|
android:textSize="18sp"/>
|
|
|
36
|
|
|
|
37
|
<View
|
|
|
38
|
android:layout_width="match_parent"
|
|
|
39
|
android:layout_height="0.5dp"
|
|
|
40
|
android:background="@color/title_line"
|
|
|
41
|
android:layout_alignParentBottom="true"/>
|
|
|
42
|
|
|
|
43
|
</RelativeLayout>
|
|
|
44
|
|
|
|
45
|
|
|
|
46
|
<LinearLayout
|
|
|
47
|
android:layout_width="match_parent"
|
|
|
48
|
android:layout_height="60dp"
|
|
|
49
|
android:orientation="vertical">
|
|
|
50
|
<RelativeLayout
|
|
|
51
|
android:layout_width="match_parent"
|
|
|
52
|
android:layout_height="match_parent"
|
|
|
53
|
android:layout_margin="15dp"
|
|
|
54
|
android:background="@drawable/bg_yuanjiao_search">
|
|
|
55
|
|
|
|
56
|
<ImageView
|
|
|
57
|
android:id="@+id/search_icon"
|
|
|
58
|
android:layout_width="14dp"
|
|
|
59
|
android:layout_height="14dp"
|
|
|
60
|
android:layout_marginLeft="8dp"
|
|
|
61
|
android:layout_centerVertical="true"
|
|
|
62
|
android:src="@drawable/icon_search1118"/>
|
|
|
63
|
|
|
|
64
|
<EditText
|
|
|
65
|
android:id="@+id/et_search"
|
|
|
66
|
android:layout_width="match_parent"
|
|
|
67
|
android:layout_height="match_parent"
|
|
|
68
|
android:layout_toLeftOf="@+id/iv_clear"
|
|
|
69
|
android:layout_toRightOf="@+id/iv_search"
|
|
|
70
|
android:layout_marginLeft="4dp"
|
|
|
71
|
android:layout_marginRight="4dp"
|
|
|
72
|
android:singleLine="true"
|
|
|
73
|
android:background="#f1f1f1"
|
|
|
74
|
android:textColor="#222222"
|
|
|
75
|
android:hint="请输入搜索内容"
|
|
|
76
|
android:textColorHint="@color/ui_68"
|
|
|
77
|
android:textSize="13sp"
|
|
|
78
|
android:imeOptions="actionSearch"/>
|
|
|
79
|
|
|
|
80
|
<ImageView
|
|
|
81
|
android:id="@+id/iv_clear"
|
|
|
82
|
android:layout_width="14dp"
|
|
|
83
|
android:layout_height="14dp"
|
|
|
84
|
android:layout_marginRight="8dp"
|
|
|
85
|
android:layout_centerVertical="true"
|
|
|
86
|
android:layout_alignParentRight="true"
|
|
|
87
|
android:src="@drawable/app_topic_search_clear"/>
|
|
|
88
|
|
|
|
89
|
</RelativeLayout>
|
|
|
90
|
</LinearLayout>
|
|
|
91
|
|
|
|
92
|
<View
|
|
|
93
|
android:layout_width="match_parent"
|
|
|
94
|
android:layout_height="10dp"
|
|
|
95
|
android:background="#f4f4f4"/>
|
|
|
96
|
|
|
|
97
|
<include layout="@layout/activity_no_net"
|
|
|
98
|
android:visibility="gone"/>
|
|
|
99
|
|
|
|
100
|
<com.andview.refreshview.XRefreshView
|
|
|
101
|
android:id="@+id/xrefreshview"
|
|
|
102
|
android:layout_width="match_parent"
|
|
|
103
|
android:layout_height="match_parent"
|
|
|
104
|
android:background="#fff">
|
|
|
105
|
|
|
|
106
|
<android.support.v7.widget.RecyclerView
|
|
|
107
|
android:id="@+id/recycler_view_test_rv"
|
|
|
108
|
android:layout_width="match_parent"
|
|
|
109
|
android:layout_height="match_parent"
|
|
|
110
|
android:scrollbars="vertical" />
|
|
|
111
|
</com.andview.refreshview.XRefreshView>
|
|
|
112
|
|
|
|
113
|
</LinearLayout>
|