//                                        }
576
//                                    }).setNegativeButton("取消", new View.OnClickListener() {
577
//                                @Override
578
//                                public void onClick(View v) {
579
//
580
//
581
//                                }
582
//                            }).show();
583
//
584
//                        }
585
//                    });
586
//                    historyList.setAdapter(adapter3);
587
//                    historyList.setVisibility(View.VISIBLE);
588
//                    lvContent.setVisibility(View.GONE);
589
//                ll_menu.setVisibility(View.GONE);
590

591 389
                break;
592
            //按地点搜索
593
//            case R.id.ll_address:
594
//                searchInPoi();
595
//                ll_menu.setVisibility(View.GONE);
596
//                imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
597
//                break;
598
//            //按站点搜索
599
//            case R.id.ll_zhan:
600
//                getSearchZhan();
601
//                ll_menu.setVisibility(View.GONE);
602
//                imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
603
//                break;
604 390
        }
605 391
    }
606 392

@ -626,9 +412,7 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
626 412
                    poiResult = result;
627 413
                    // 取得搜索到的poiitems有多少页
628 414
                    List<PoiItem> mList = poiResult.getPois();// 取得第一页的poiitem数据,页数从数字0开始
629
//                    List<PoiItem> mList = result.getAllPoi();
630
                    List<SuggestionCity> suggestionCities = poiResult
631
                            .getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
415
                    List<SuggestionCity> suggestionCities = poiResult.getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
632 416

633 417
                    if (mList != null && mList.size() > 0) {
634 418
                        list.clear();
@ -647,48 +431,26 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
647 431
                                list.add(map);
648 432
                            }
649 433
                            if (list != null && list.size() > 0) {
650

651

652 434
                                runOnUiThread(new Runnable() {
653 435
                                    @Override
654 436
                                    public void run() {
655 437
                                        adapter.notifyDataSetChanged();
656 438
                                    }
657 439
                                });
658

659

660 440
                            }
661 441

662 442
                        } catch (Exception e) {
663 443
                            e.printStackTrace();
664 444
                        }
665 445
                    } else {
666
                        Toast.makeText(SearchActivity.this, "抱歉,未找到结果", Toast.LENGTH_SHORT)
667
                                .show();
446
                        Toast.makeText(SearchActivity.this, "抱歉,未找到结果", Toast.LENGTH_SHORT).show();
668 447
                        list.clear();
669 448
                        adapter.notifyDataSetChanged();
670 449
                    }
671

672
//                    if (poiItems != null && poiItems.size() > 0) {
673
////                        aMap.clear();// 清理之前的图标
674
//                        PoiOverlay poiOverlay = new PoiOverlay(aMap, poiItems);
675
//                        poiOverlay.removeFromMap();
676
//                        poiOverlay.addToMap();
677
//                        poiOverlay.zoomToSpan();
678
//                    } else if (suggestionCities != null
679
//                            && suggestionCities.size() > 0) {
680
//                        showSuggestCity(suggestionCities);
681
//                    } else {
682
////                        ToastUtil.show(PoiKeywordSearchActivity.this,
683
////                                R.string.no_result);
684
//                    }
685 450
                }
686 451
            } else {
687
//                ToastUtil.show(PoiKeywordSearchActivity.this,
688
//                        R.string.no_result);
689 452
            }
690 453
        } else {
691
//            ToastUtil.showerror(this, rCode);
692 454
        }
693 455
    }
694 456

@ -725,15 +487,11 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
725 487
        public View getView(int position, View convertView, ViewGroup parent) {
726 488
            ViewHolder viewHolder = null;
727 489
            if (convertView == null) {
728
                convertView = LayoutInflater.from(context).inflate(
729
                        R.layout.item_search, null);
490
                convertView = LayoutInflater.from(context).inflate(R.layout.item_search, null);
730 491
                viewHolder = new ViewHolder();
731
                viewHolder.name = (TextView) convertView
732
                        .findViewById(R.id.search_name);
733
                viewHolder.address = (TextView) convertView
734
                        .findViewById(R.id.search_address);
735
                viewHolder.zhan = (ImageView) convertView
736
                        .findViewById(R.id.search_zhan);
492
                viewHolder.name = (TextView) convertView.findViewById(R.id.search_name);
493
                viewHolder.address = (TextView) convertView.findViewById(R.id.search_address);
494
                viewHolder.zhan = (ImageView) convertView.findViewById(R.id.search_zhan);
737 495
                convertView.setTag(viewHolder);
738 496
            } else {
739 497
                viewHolder = (ViewHolder) convertView.getTag();
@ -746,9 +504,7 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
746 504
            } else {
747 505
                viewHolder.zhan.setVisibility(View.VISIBLE);
748 506
                if (!TextUtils.isEmpty(list.get(position).get("url"))) {
749
                    ImageLoader.getInstance().init(
750
                            ImageLoaderConfiguration
751
                                    .createDefault(SearchActivity.this));
507
                    ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(SearchActivity.this));
752 508
                    DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
753 509
                    builder.cacheInMemory(true);
754 510
                    builder.cacheOnDisc(true);
@ -756,9 +512,7 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
756 512
                    builder.showImageForEmptyUri(R.drawable.image_default);
757 513
                    builder.showImageOnFail(R.drawable.image_default);
758 514
                    builder.displayer(new RoundedBitmapDisplayer(0));
759
                    ImageLoader.getInstance().displayImage(
760
                            list.get(position).get("url"), viewHolder.zhan,
761
                            builder.build());
515
                    ImageLoader.getInstance().displayImage(list.get(position).get("url"), viewHolder.zhan, builder.build());
762 516
                } else {
763 517
                    viewHolder.zhan.setImageResource(R.drawable.image_default);
764 518
                }
@ -772,54 +526,6 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
772 526
        }
773 527
    }
774 528

775
//    @Override
776
//    public void onGetPoiDetailResult(PoiDetailResult result) {
777
//        if (result.error != SearchResult.ERRORNO.NO_ERROR) {
778
//            Toast.makeText(SearchActivity.this, "抱歉,未找到结果", Toast.LENGTH_SHORT)
779
//                    .show();
780
//        }
781
//    }
782

783
//    @Override
784
//    public void onGetPoiResult(PoiResult result) {
785
//        if (result == null
786
//                || result.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) {
787
////            Toast.makeText(SearchActivity.this, "抱歉,没有搜到相关信息\n" +
788
////                    "您可尝试切换城市搜索", Toast.LENGTH_LONG)
789
////                    .show();
790
//            showTextToast("抱歉,没有搜到相关信息\n" +
791
//                    "您可尝试切换城市搜索");
792
//            list.clear();
793
//            adapter.notifyDataSetChanged();
794
//            return;
795
//        }
796
//        if (result.error == SearchResult.ERRORNO.NO_ERROR) {
797
//            List<PoiInfo> mList = result.getAllPoi();
798
//            if (mList != null && mList.size() > 0) {
799
//                list.clear();
800
//                try {
801
//                    for (int i = 0; i < mList.size(); i++) {
802
//                        map = new HashMap<String, String>();
803
//                        map.put("name", mList.get(i).name);
804
//                        map.put("address", mList.get(i).address);
805
//                        map.put("jing", mList.get(i).location.longitude + "");
806
//                        map.put("wei", mList.get(i).location.latitude + "");
807
//                        map.put("url", "");
808
//                        list.add(map);
809
//                    }
810
//                    adapter.notifyDataSetChanged();
811
//                } catch (Exception e) {
812
//                    e.printStackTrace();
813
//                }
814
//            }else {
815
//                Toast.makeText(SearchActivity.this, "抱歉,未找到结果", Toast.LENGTH_LONG)
816
//                        .show();
817
//            }
818
//
819
//            return;
820
//        }
821
//    }
822

823 529
    @Override
824 530
    protected void onPause() {
825 531
        super.onPause();
@ -848,7 +554,6 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
848 554
     * 开始进行poi搜索
849 555
     */
850 556
    protected void doSearchQuery() {
851
//        showProgressDialog();// 显示进度框
852 557
        currentPage = 0;
853 558
        query = new PoiSearch.Query(keyWord, "", MainApplication.atCity);// 第一个参数表示搜索字符串,第二个参数表示poi搜索类型,第三个参数表示poi搜索区域(空字符串代表全国)
854 559
        query.setPageSize(10);// 设置每页最多返回多少条poiitem
@ -858,23 +563,4 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
858 563
        poiSearch.setOnPoiSearchListener(this);
859 564
        poiSearch.searchPOIAsyn();
860 565
    }
861

862

863
//    @Override
864
//    public void onGetInputtips(List<Tip> tipList, int rCode) {
865
//        if (rCode == 1000) {// 正确返回
866
//            List<String> listString = new ArrayList<String>();
867
//            for (int i = 0; i < tipList.size(); i++) {
868
//                listString.add(tipList.get(i).getName());
869
//            }
870
//            ArrayAdapter<String> aAdapter = new ArrayAdapter<String>(
871
//                    getApplicationContext(),
872
//                    R.layout.route_inputs, listString);
873
//            searchText.setAdapter(aAdapter);
874
//            aAdapter.notifyDataSetChanged();
875
//        } else {
876
////            ToastUtil.showerror(this, rCode);
877
//        }
878
//
879
//    }
880 566
}

+ 32 - 54
app/src/main/res/layout/activity_search.xml

@ -1,5 +1,6 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<com.zhy.autolayout.AutoLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:tools="http://schemas.android.com/tools"
3 4
    android:layout_width="match_parent"
4 5
    android:layout_height="match_parent"
5 6
    android:background="@color/activity_bgcolor"
@ -14,11 +15,11 @@
14 15
        <RelativeLayout
15 16
            android:layout_width="0dp"
16 17
            android:layout_height="match_parent"
17
            android:layout_weight="5"
18
            android:layout_marginLeft="16dp"
18 19
            android:layout_marginTop="7dp"
19 20
            android:layout_marginBottom="7dp"
20
            android:background="@drawable/bg"
21
            android:layout_marginLeft="16dp">
21
            android:layout_weight="5"
22
            android:background="@drawable/bg">
22 23

23 24

24 25
            <EditText
@ -26,29 +27,29 @@
26 27
                android:layout_width="fill_parent"
27 28
                android:layout_height="match_parent"
28 29
                android:layout_alignParentTop="true"
29
                android:layout_toRightOf="@+id/iv_sou"
30
                android:background="#f1f1f1"
31 30
                android:layout_marginTop="1dp"
31
                android:layout_marginRight="13dp"
32 32
                android:layout_marginBottom="1dp"
33
                android:hint="请输入要查找的地名"
33
                android:layout_toRightOf="@+id/iv_sou"
34
                android:background="#f1f1f1"
34 35
                android:focusable="true"
36
                android:hint="请输入要查找的地名"
35 37
                android:imeOptions="actionSearch"
36 38
                android:singleLine="true"
37 39
                android:textColorHint="@color/ui_68"
38 40
                android:textCursorDrawable="@drawable/search_biao"
39
                android:textSize="14sp"
40
                android:layout_marginRight="13dp" />
41
                android:textSize="14sp" />
41 42

42 43
            <ImageView
43 44
                android:id="@+id/iv_search_clear"
44 45
                android:layout_width="wrap_content"
45 46
                android:layout_height="wrap_content"
47
                android:layout_alignEnd="@+id/et_search"
48
                android:layout_alignRight="@+id/et_search"
49
                android:layout_centerVertical="true"
46 50
                android:contentDescription="@null"
47 51
                android:padding="5dp"
48
                android:src="@drawable/icon_edit_delete2_0"
49
                android:layout_centerVertical="true"
50
                android:layout_alignRight="@+id/et_search"
51
                android:layout_alignEnd="@+id/et_search" />
52
                android:src="@drawable/icon_edit_delete2_0" />
52 53

53 54
            <ImageView
54 55
                android:id="@+id/iv_sou"
@ -68,19 +69,19 @@
68 69
            android:layout_centerVertical="true"
69 70
            android:contentDescription="@null"
70 71
            android:gravity="center"
71
            android:paddingBottom="5dp"
72 72
            android:paddingLeft="16dp"
73
            android:paddingRight="16dp"
74 73
            android:paddingTop="5dp"
74
            android:paddingRight="16dp"
75
            android:paddingBottom="5dp"
75 76
            android:text="取消"
76 77
            android:textColor="@color/lvse"
77 78
            android:textSize="15sp" />
78 79

79 80
        <LinearLayout
80 81
            android:id="@+id/ll_menu"
81
            android:background="@color/white"
82 82
            android:layout_width="match_parent"
83 83
            android:layout_height="50dp"
84
            android:background="@color/white"
84 85

85 86
            android:orientation="vertical"
86 87
            android:visibility="gone">
@ -90,30 +91,31 @@
90 91
                android:layout_width="match_parent"
91 92
                android:layout_height="0dp"
92 93
                android:layout_weight="1">
94

93 95
                <ImageView
94 96
                    android:layout_width="0dp"
95 97
                    android:layout_height="match_parent"
96
                    android:padding="5dp"
97 98
                    android:layout_weight="1"
98
                    android:src="@drawable/icon_screening"/>
99
                    android:padding="5dp"
100
                    android:src="@drawable/icon_screening" />
99 101

100 102
                <TextView
101 103
                    android:id="@+id/address_search"
102 104
                    android:layout_width="0dp"
103 105
                    android:layout_height="match_parent"
104 106
                    android:layout_weight="6"
105
                    android:text="找地名:"
106 107
                    android:gravity="center_vertical"
107 108
                    android:paddingLeft="5dp"
108
                    android:textSize="18sp"
109
                    android:textColor="@color/text_light_grey"/>
109
                    android:text="找地名:"
110
                    android:textColor="@color/text_light_grey"
111
                    android:textSize="18sp" />
110 112
            </LinearLayout>
111 113

112 114
            <View
113 115
                android:layout_width="match_parent"
114 116
                android:layout_height="0.5dp"
115 117
                android:background="@color/title_line"
116
                android:visibility="gone"/>
118
                android:visibility="gone" />
117 119

118 120
            <LinearLayout
119 121
                android:id="@+id/ll_zhan"
@ -126,27 +128,28 @@
126 128
                    android:layout_height="match_parent"
127 129
                    android:layout_weight="1"
128 130
                    android:padding="5dp"
129
                    android:src="@drawable/icon_screening"/>
131
                    android:src="@drawable/icon_screening" />
132

130 133
                <TextView
131 134
                    android:id="@+id/zhan_search"
132 135
                    android:layout_width="0dp"
133 136
                    android:layout_height="match_parent"
134 137
                    android:layout_weight="6"
135
                    android:text="找电桩:"
136 138
                    android:gravity="center_vertical"
137 139
                    android:paddingLeft="5dp"
138
                    android:textSize="18sp"
139
                    android:textColor="@color/text_light_grey"/>
140

140
                    android:text="找电桩:"
141
                    android:textColor="@color/text_light_grey"
142
                    android:textSize="18sp" />
141 143
            </LinearLayout>
142 144
        </LinearLayout>
143 145

144 146
    </com.zhy.autolayout.AutoLinearLayout>
147

145 148
    <View
146 149
        android:layout_width="match_parent"
147 150
        android:layout_height="0.5dp"
148 151
        android:background="@color/ui_titleline"
149
        android:visibility="visible"/>
152
        android:visibility="visible" />
150 153

151 154
    <ListView
152 155
        android:id="@+id/lv_search_list"
@ -158,7 +161,7 @@
158 161
        android:divider="#dddddd"
159 162
        android:dividerHeight="0.5dp"
160 163
        android:fadingEdge="none"
161
        android:listSelector="@color/transparent"/>
164
        android:listSelector="@color/transparent" />
162 165

163 166
    <ListView
164 167
        android:id="@+id/lv_history_list"
@ -170,30 +173,5 @@
170 173
        android:divider="#dddddd"
171 174
        android:dividerHeight="0.5dp"
172 175
        android:fadingEdge="none"
173
        android:listSelector="@color/transparent"/>
174

175
    <!--<LinearLayout-->
176
    <!--android:id="@+id/ll_clear"-->
177
    <!--android:layout_width="match_parent"-->
178
    <!--android:layout_height="wrap_content"-->
179
    <!--android:orientation="vertical">-->
180

181
    <!--<View-->
182
    <!--android:layout_width="match_parent"-->
183
    <!--android:layout_height="0.5dp"-->
184
    <!--android:background="#dddddd"/>-->
185

186

187
    <!--<TextView-->
188
    <!--android:id="@+id/tv_historyClear"-->
189
    <!--android:layout_width="match_parent"-->
190
    <!--android:layout_height="45dp"-->
191
    <!--android:background="@color/white"-->
192
    <!--android:text="清除历史记录"-->
193
    <!--android:textColor="@color/hintColor"-->
194
    <!--android:gravity="center"-->
195
    <!--android:textSize="15sp"/>-->
196

197
    <!--</LinearLayout>-->
198

176
        android:listSelector="@color/transparent" />
199 177
</com.zhy.autolayout.AutoLinearLayout>

+ 6 - 6
app/src/main/res/layout/item_search.xml

@ -3,23 +3,23 @@
3 3
    android:layout_width="match_parent"
4 4
    android:layout_height="wrap_content"
5 5
    android:background="@color/white"
6
    android:orientation="vertical" >
6
    android:orientation="vertical">
7 7

8 8
    <RelativeLayout
9 9
        android:id="@+id/search_real"
10 10
        android:layout_width="wrap_content"
11
        android:layout_height="wrap_content" >
11
        android:layout_height="wrap_content">
12 12

13 13
        <ImageView
14 14
            android:id="@+id/search_image"
15 15
            android:layout_width="wrap_content"
16 16
            android:layout_height="wrap_content"
17 17
            android:layout_centerVertical="true"
18
            android:layout_marginLeft="16dp"
18 19
            android:contentDescription="@null"
19
            android:paddingRight="14dp"
20 20
            android:paddingTop="20dp"
21
            android:paddingRight="14dp"
21 22
            android:paddingBottom="20dp"
22
            android:layout_marginLeft="16dp"
23 23
            android:src="@drawable/icon_search1117" />
24 24

25 25
        <ImageView
@ -40,9 +40,9 @@
40 40
        android:layout_toRightOf="@id/search_real"
41 41
        android:gravity="center_vertical"
42 42
        android:orientation="vertical"
43
        android:paddingBottom="10dp"
43
        android:paddingTop="10dp"
44 44
        android:paddingRight="10dp"
45
        android:paddingTop="10dp" >
45
        android:paddingBottom="10dp">
46 46

47 47
        <TextView
48 48
            android:id="@+id/search_name"

fix bug · 7c67d39c71 - Gogs: Go Git Service
dxh 6 vuotta sitten
vanhempi
commit
7c67d39c71

+ 14 - 17
app/src/main/java/com/electric/chargingpile/activity/PublishTopicActivity.java

@ -4,11 +4,9 @@ import android.app.Activity;
4 4
import android.content.Context;
5 5
import android.content.DialogInterface;
6 6
import android.content.Intent;
7
import android.graphics.drawable.Drawable;
8 7
import android.net.Uri;
9 8
import android.os.Bundle;
10 9
import android.os.Environment;
11
import android.support.annotation.Nullable;
12 10
import android.support.v7.app.AlertDialog;
13 11
import android.text.Editable;
14 12
import android.text.Html;
@ -26,11 +24,7 @@ import android.widget.Toast;
26 24
27 25
import com.blankj.utilcode.util.ToastUtils;
28 26
import com.bumptech.glide.Glide;
29
import com.bumptech.glide.load.DataSource;
30
import com.bumptech.glide.load.engine.GlideException;
31
import com.bumptech.glide.request.RequestListener;
32 27
import com.bumptech.glide.request.RequestOptions;
33
import com.bumptech.glide.request.target.Target;
34 28
import com.electric.chargingpile.R;
35 29
import com.electric.chargingpile.application.MainApplication;
36 30
import com.electric.chargingpile.data.AuthSignBean;
@ -216,7 +210,7 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
216 210
        Log.e("fileNameDir fileName", fileNames);
217 211
        map.put("targetType", "23");//23视频/24图片
218 212
        String token = ProfileManager.getInstance().getKeyMessageToken(getApplicationContext());
219
        map.put("appToken", token+"");
213
        map.put("appToken", token + "");
220 214
        map.put("userId", MainApplication.userId);
221 215
        OkHttpUtils
222 216
                .post()
@ -244,7 +238,7 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
244 238
                                String policy = signBeans.get(0).policy;
245 239
                                formUpload(media.getPath(), sign, policy);
246 240
                            }
247
                        }else {
241
                        } else {
248 242
                            String desc = JsonUtils.getKeyResult(response, "desc");
249 243
                            ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_SHORT);
250 244
                            loadingDialog.dismiss();
@ -290,9 +284,9 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
290 284
    }
291 285
292 286
    private void requestPublishServer(String urls) {
293
        File file =new File(media.getPath());
294
        long size =0L;
295
        if(file.exists()){
287
        File file = new File(media.getPath());
288
        long size = 0L;
289
        if (file.exists()) {
296 290
            size = file.length();
297 291
        }
298 292
@ -301,11 +295,11 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
301 295
        map.put("content", mPublishtopicCon.getText().toString());
302 296
        map.put("urls", urls);
303 297
        map.put("topicId", talkRecommendBean.targetId + "");
304
        map.put("targetType",  "23");
305
        map.put("coverImgW",media.getWidth()+"");
306
        map.put("coverImgH",media.getHeight()+"");
307
        map.put("duration",media.getDuration()+"");
308
        map.put("size",size+"");
298
        map.put("targetType", "23");
299
        map.put("coverImgW", media.getWidth() + "");
300
        map.put("coverImgH", media.getHeight() + "");
301
        map.put("duration", media.getDuration() + "");
302
        map.put("size", size + "");
309 303
        if (MainApplication.isLogin()) {
310 304
            map.put("userId", MainApplication.userId);
311 305
            map.put("appToken", MainApplication.messageToken);
@ -359,6 +353,9 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
359 353
                    Log.e("yopic", "文件可能不存在了~");
360 354
                    return;
361 355
                }
356
                if (isDestroyed()) {
357
                    return;
358
                }
362 359
363 360
                Glide
364 361
                        .with(this)
@ -405,7 +402,7 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
405 402
        MobclickAgent.onPause(this);
406 403
    }
407 404
408
    private void showDialogToExit(){
405
    private void showDialogToExit() {
409 406
        AlertDialog.Builder builder = new AlertDialog.Builder(PublishTopicActivity.this);
410 407
        builder.setTitle("提示");
411 408
        builder.setMessage("是否离开发布页?");

+ 28 - 31
app/src/main/java/com/electric/chargingpile/activity/TopicDetailsActivity.java

@ -1,29 +1,23 @@
1 1
package com.electric.chargingpile.activity;
2 2
3 3
import android.content.Intent;
4
import android.graphics.Color;
5 4
import android.os.Bundle;
6 5
import android.support.annotation.Nullable;
7 6
import android.support.v4.app.FragmentActivity;
8
import android.support.v7.app.AppCompatActivity;
9 7
import android.support.v7.widget.GridLayoutManager;
10
import android.support.v7.widget.LinearLayoutManager;
11 8
import android.support.v7.widget.StaggeredGridLayoutManager;
12 9
import android.text.TextUtils;
13
import android.util.Log;
14 10
import android.view.View;
15 11
import android.view.ViewTreeObserver;
16 12
import android.widget.FrameLayout;
17 13
import android.widget.ImageView;
18 14
import android.widget.LinearLayout;
19
import android.widget.RelativeLayout;
20 15
import android.widget.TextView;
21 16
import android.widget.Toast;
22 17
23 18
import com.aspsine.irecyclerview.IRecyclerView;
24 19
import com.aspsine.irecyclerview.OnLoadMoreListener;
25 20
import com.blankj.utilcode.util.LogUtils;
26
import com.blankj.utilcode.util.NetworkUtils;
27 21
import com.electric.chargingpile.R;
28 22
import com.electric.chargingpile.adapter.WaterFallAdapter;
29 23
import com.electric.chargingpile.application.MainApplication;
@ -37,7 +31,6 @@ import com.electric.chargingpile.util.NetUtil;
37 31
import com.electric.chargingpile.util.ScreenUtils;
38 32
import com.electric.chargingpile.util.ToastUtil;
39 33
import com.electric.chargingpile.view.PullToZoomScrollView3;
40
import com.electric.chargingpile.view.SortPopWindow;
41 34
import com.electric.chargingpile.view.SortTopicPopWindow;
42 35
import com.electric.chargingpile.view.footer.LoadMoreFooterView;
43 36
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
@ -65,7 +58,7 @@ public class TopicDetailsActivity extends FragmentActivity implements View.OnCli
65 58
    private PullToZoomScrollView3 scrollview;
66 59
    private String topicTitleContent;
67 60
    private int screenWidth, bgHeight, screenHeight;
68
    private TextView textview, topic_title,topic_content, read_data, join_data, sort_text_info;
61
    private TextView textview, topic_title, topic_content, read_data, join_data, sort_text_info;
69 62
    private FrameLayout top_view;
70 63
    private LinearLayout content_view, ll_sort_view;
71 64
    private int page = 1;
@ -86,12 +79,12 @@ public class TopicDetailsActivity extends FragmentActivity implements View.OnCli
86 79
        initListeners();
87 80
        initListeners(findViewById(R.id.make_header_lines));
88 81
89
        if(NetUtil.CheckNetwork(this)){
82
        if (NetUtil.CheckNetwork(this)) {
90 83
            requestData();
91
        }else {
92
findViewById(R.id.no_net_view).setVisibility(View.VISIBLE);
93
findViewById(R.id.iv_back_nonet).setOnClickListener(this);
94
findViewById(R.id.request_refresh).setOnClickListener(this);
84
        } else {
85
            findViewById(R.id.no_net_view).setVisibility(View.VISIBLE);
86
            findViewById(R.id.iv_back_nonet).setOnClickListener(this);
87
            findViewById(R.id.request_refresh).setOnClickListener(this);
95 88
96 89
        }
97 90
//        requestShareData();
@ -152,6 +145,7 @@ findViewById(R.id.request_refresh).setOnClickListener(this);
152 145
    }
153 146
154 147
    ChargingShareBean chargingShareBean = new ChargingShareBean();
148
155 149
    @Override
156 150
    public void onClick(View v) {
157 151
        switch (v.getId()) {
@ -164,17 +158,17 @@ findViewById(R.id.request_refresh).setOnClickListener(this);
164 158
                user_content_more.setVisibility(View.GONE);
165 159
                break;
166 160
            case R.id.textview_share:
167
                if (!MainApplication.isLogin()){
168
                    startActivity(new Intent(this.getApplicationContext(),LoginActivity.class));
169
                    ToastUtil.showToast(this.getApplicationContext(),"请先登录", Toast.LENGTH_SHORT);
161
                if (!MainApplication.isLogin()) {
162
                    startActivity(new Intent(this.getApplicationContext(), LoginActivity.class));
163
                    ToastUtil.showToast(this.getApplicationContext(), "请先登录", Toast.LENGTH_SHORT);
170 164
                    return;
171 165
                }
172
                if(null == chargingShareBean.getUrl() || TextUtils.isEmpty(chargingShareBean.getUrl()))
166
                if (null == chargingShareBean.getUrl() || TextUtils.isEmpty(chargingShareBean.getUrl()))
173 167
                    return;
174 168
                showSimpleBottomSheetGrid(chargingShareBean);
175 169
                break;
176 170
            case R.id.request_refresh:
177
                if(NetUtil.CheckNetwork(this)){
171
                if (NetUtil.CheckNetwork(this)) {
178 172
                    requestData();
179 173
180 174
                }
@ -257,7 +251,7 @@ findViewById(R.id.request_refresh).setOnClickListener(this);
257 251
        String url = MainApplication.urlNew + "/topic/homepage.do";
258 252
        Map<String, String> map = new HashMap<>();
259 253
        map.put("topicId", topicId + "");
260
        map.put("sort", sort+"");//1最新发布/2最后回复/3最热
254
        map.put("sort", sort + "");//1最新发布/2最后回复/3最热
261 255
        map.put("init", "1");//1返回话题名等信息 0只返回话题下内容列表
262 256
        map.put("page", page + "");
263 257
        map.put("limit", "20");
@ -268,7 +262,7 @@ findViewById(R.id.request_refresh).setOnClickListener(this);
268 262
            @Override
269 263
            public void onError(Call call, Exception e) {
270 264
                loadMoreFooterView.setStatus(LoadMoreFooterView.Status.ERROR);
271
                if(page>1)
265
                if (page > 1)
272 266
                    page -= 1;
273 267
            }
274 268
@ -290,18 +284,17 @@ findViewById(R.id.request_refresh).setOnClickListener(this);
290 284
                            chargingShareBean.setText(qadata.list.get(0).title);
291 285
                        }
292 286
                    }
293
                    if (page == 1){
287
                    if (page == 1) {
294 288
                        waterFallAdapter.setData(qadata.list);
295 289
296
                        if(null == qadata.list || qadata.list.size() == 0){
290
                        if (null == qadata.list || qadata.list.size() == 0) {
297 291
                            findViewById(R.id.no_content_view).setVisibility(View.VISIBLE);
298 292
                            comment_data.setVisibility(View.GONE);
299
                        }else {
293
                        } else {
300 294
                            findViewById(R.id.no_content_view).setVisibility(View.GONE);
301 295
                            comment_data.setVisibility(View.VISIBLE);
302 296
                        }
303
                    }
304
                    else
297
                    } else
305 298
                        waterFallAdapter.addData(qadata.list);
306 299
307 300
                    if (qadata.list == null || qadata.list.size() < 20) {
@ -320,20 +313,24 @@ findViewById(R.id.request_refresh).setOnClickListener(this);
320 313
    }
321 314
322 315
    private String contentAll = "";
316
323 317
    private void initHeaderData(ArrayList<TalkRecommendBean> list) {
324
        if(null != list && list.size()>0){
318
        if (null != list && list.size() > 0) {
325 319
            textview.setText(list.get(0).topicName);
326 320
            topic_title.setText(list.get(0).topicName);
327
            read_data.setText(list.get(0).visitNums+"");
328
            join_data.setText(list.get(0).joinNums+"");
321
            read_data.setText(list.get(0).visitNums + "");
322
            join_data.setText(list.get(0).joinNums + "");
329 323
            contentAll = list.get(0).title;
330
            if(!TextUtils.isEmpty(contentAll) && contentAll.length()>80){
324
            if (!TextUtils.isEmpty(contentAll) && contentAll.length() > 80) {
331 325
                topic_content.setText(contentAll.substring(0, 80));
332 326
                user_content_more.setVisibility(View.VISIBLE);
333
            }else {
327
            } else {
334 328
                topic_content.setText(contentAll);
335 329
            }
336
            ImageDisplayUtils.dispalyImg(this, "http://cdz.evcharge.cc/zhannew/uploadfile/"+list.get(0).headImgUrl, user_avater);
330
            if (isDestroyed()) {
331
                return;
332
            }
333
            ImageDisplayUtils.dispalyImg(this, "http://cdz.evcharge.cc/zhannew/uploadfile/" + list.get(0).headImgUrl, user_avater);
337 334
        }
338 335
    }
339 336

+ 2 - 2
app/src/main/java/com/electric/chargingpile/fragment/SvVideoShowView.java

@ -398,7 +398,7 @@ public class SvVideoShowView implements View.OnClickListener {
398 398
    }
399 399
400 400
    public void updateView() {
401
        if(view==null){
401
        if (view == null) {
402 402
            return;
403 403
        }
404 404
        String title = talkRecommendBean.title;
@ -422,7 +422,7 @@ public class SvVideoShowView implements View.OnClickListener {
422 422
423 423
424 424
    public void initAndPlay() {
425
        if (talkRecommendBean.targetType == 24) {
425
        if (talkRecommendBean.targetType == 24 && imageAdapter != null && zoomingViewpager != null) {
426 426
            String s = talkRecommendBean.imgUrls.toString();
427 427
            LogUtils.d("demo 11", s);
428 428
            imageAdapter.addData(talkRecommendBean.imgUrls);