dxh преди 5 години
родител
ревизия
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);