dxh 5 years ago
parent
commit
4826f7edb6

+ 0 - 1
app/build.gradle

@ -32,7 +32,6 @@ android {
32 32
        targetSdkVersion 26
33 33
34 34
        multiDexEnabled true
35
//        multiDexKeepProguard file('multiDexKeep.pro')
36 35
37 36
        ndk {
38 37
            abiFilters "armeabi"

+ 1 - 1
app/src/main/AndroidManifest.xml

@ -2,7 +2,7 @@
2 2
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    package="com.electric.chargingpile"
4 4
    android:versionCode="74"
5
    android:versionName="3.2.2beta">
5
    android:versionName="3.3">
6 6
7 7
    <!-- 极光 -->
8 8
    <permission

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

@ -40,9 +40,11 @@ import com.zhy.http.okhttp.callback.StringCallback;
40 40
41 41
import java.util.HashMap;
42 42
import java.util.List;
43
import java.util.Locale;
43 44
import java.util.Map;
44 45
45 46
import okhttp3.Call;
47
import tv.danmaku.ijk.media.player.IMediaPlayer;
46 48
47 49
public class SvVideoShowView implements View.OnClickListener {
48 50
@ -79,19 +81,20 @@ public class SvVideoShowView implements View.OnClickListener {
79 81
            if (targetType == 23) {
80 82
                view = LayoutInflater.from(activity).inflate(R.layout.view_show_view, null);
81 83
                initPlayer(view);
84
                initBottom(view);
85
                viewGroup.addView(view);
86
87
                setData();
88
82 89
            } else if (targetType == 24) {
83 90
                view = LayoutInflater.from(activity).inflate(R.layout.view_show_zoom, null);
84 91
                initZoomPhoto(view);
92
                initBottom(view);
93
                viewGroup.addView(view);
94
95
                setData();
85 96
            }
86
            initBottom(view);
87
            viewGroup.addView(view);
88 97
        }
89
        getDate();
90
    }
91
92
    public void getDate() {
93
        setData();
94
//            requestHeaderData(talkRecommendBean.targetType, talkRecommendBean.targetId);
95 98
    }
96 99
97 100
@ -135,9 +138,25 @@ public class SvVideoShowView implements View.OnClickListener {
135 138
                });
136 139
    }
137 140
141
    private String num4(int num) {
142
        String re = "";
143
        if (num < 999) {
144
            re = re + num;
145
        } else {
146
            float result = num / 1000;
147
            int sl = num % 1000;
148
            if (sl == 0) {
149
                re = String.format(Locale.CHINESE, "%f", result) + "W";
150
            } else {
151
                re = String.format(Locale.CHINESE, "%.1f", result) + "W";
152
            }
153
        }
154
        return re;
155
    }
156
138 157
    private void setData() {
139
        sv_show_comment_count_tv.setText(talkRecommendBean.commentNums + "");
140
        sv_show_like_tv.setText(talkRecommendBean.likeNums + "");
158
        sv_show_comment_count_tv.setText(num4(talkRecommendBean.commentNums));
159
        sv_show_like_tv.setText(num4(talkRecommendBean.likeNums));
141 160
        sv_show_tvcon.setText(talkRecommendBean.content);
142 161
        sv_show_tvcon.setText(talkRecommendBean.title);
143 162
        sv_show_user_name.setText(talkRecommendBean.nickName);
@ -174,8 +193,8 @@ public class SvVideoShowView implements View.OnClickListener {
174 193
            // sv_show_like_img  not like
175 194
        }
176 195
        int length = sv_show_tvcon.length();
177
        Log.e("length", "setData: length: "+length);
178
        if (sv_show_tvcon.getLineCount() >= 3 && sv_show_tvcon.getText().length()> 100) {
196
        Log.e("length", "setData: length: " + length);
197
        if (sv_show_tvcon.getLineCount() >= 3 && sv_show_tvcon.getText().length() > 100) {
179 198
            sv_show_tvcon_more.setVisibility(View.VISIBLE);
180 199
        } else {
181 200
            sv_show_tvcon_more.setVisibility(View.GONE);
@ -262,6 +281,18 @@ public class SvVideoShowView implements View.OnClickListener {
262 281
    private void initPlayer(View view) {
263 282
        playIcon = view.findViewById(R.id.view_show_icon);
264 283
        upVideoView2 = view.findViewById(R.id.view_show_video);
284
        upVideoView2.setOnPreparedListener(new IMediaPlayer.OnPreparedListener() {
285
            @Override
286
            public void onPrepared(IMediaPlayer mp) {
287
                int videoWidth = mp.getVideoWidth();
288
                int videoHeight = mp.getVideoHeight();
289
                if (videoHeight > videoWidth) {
290
                    upVideoView2.setAspectRatio(1);
291
                } else {
292
                    upVideoView2.setAspectRatio(0);
293
                }
294
            }
295
        });
265 296
        upVideoView2.setOnTouchListener(new View.OnTouchListener() {
266 297
            @Override
267 298
            public boolean onTouch(View view, MotionEvent motionEvent) {
@ -365,18 +396,23 @@ public class SvVideoShowView implements View.OnClickListener {
365 396
            case NETWORK_2G:
366 397
            case NETWORK_3G:
367 398
            case NETWORK_4G:
399
400
                playIcon.setVisibility(View.VISIBLE);
368 401
                new AlertDialog(activity)
369 402
                        .builder()
370 403
                        .setMsg("您当前使用的是流量,是否播放视频?")
371 404
                        .setPositiveButton("确定", new View.OnClickListener() {
372 405
                            @Override
373 406
                            public void onClick(View view) {
407
                                playIcon.setVisibility(View.GONE);
374 408
                                upVideoView2.start();
375 409
                            }
376 410
                        })
377 411
                        .setNegativeButton("取消", null);
412
378 413
                break;
379 414
            default:
415
                playIcon.setVisibility(View.GONE);
380 416
                upVideoView2.start();
381 417
                break;
382 418
        }
@ -453,18 +489,8 @@ public class SvVideoShowView implements View.OnClickListener {
453 489
454 490
    public void onResume(String url) {
455 491
        if (upVideoView2 != null) {
456
//            pauseTime=0;
457
//            if (status==STATUS_PLAYING) {
458
//                if (isLive) {
459
//                    videoView.seekTo(0);
460
//                } else {
461
//                    if (currentPosition>0) {
462
//                        videoView.seekTo(currentPosition);
463
//                    }
464
//                }
492
            playIcon.setVisibility(View.GONE);
465 493
            upVideoView2.start();
466
//            } else if (status == STATUS_IDLE) {
467
//                play(url);
468 494
        }
469 495
    }
470 496

+ 14 - 6
app/src/main/java/com/electric/chargingpile/view/VideoCommentDialog.java

@ -2,6 +2,7 @@ package com.electric.chargingpile.view;
2 2
3 3
import android.app.Dialog;
4 4
import android.content.Context;
5
import android.content.Intent;
5 6
import android.graphics.Color;
6 7
import android.os.Bundle;
7 8
import android.support.v7.widget.LinearLayoutManager;
@ -21,6 +22,7 @@ import android.widget.TextView;
21 22
import android.widget.Toast;
22 23
23 24
import com.electric.chargingpile.R;
25
import com.electric.chargingpile.activity.LoginActivity;
24 26
import com.electric.chargingpile.adapter.VideoCommentAdapter;
25 27
import com.electric.chargingpile.application.MainApplication;
26 28
import com.electric.chargingpile.data.TalkRecommendBean;
@ -181,13 +183,19 @@ public class VideoCommentDialog extends Dialog implements View.OnClickListener {
181 183
                dismiss();
182 184
                break;
183 185
            case R.id.show_comment_publish:
184
                String commentCon = showCommentEd.getText().toString();
185
                if (TextUtils.isEmpty(commentCon)) {
186
                    Toast.makeText(context, "请输入评论内容!", Toast.LENGTH_SHORT).show();
187
                    return;
186
                if (MainApplication.isLogin()) {
187
                    String commentCon = showCommentEd.getText().toString();
188
                    if (TextUtils.isEmpty(commentCon)) {
189
                        Toast.makeText(context, "请输入评论内容!", Toast.LENGTH_SHORT).show();
190
                        return;
191
                    }
192
                    publishComment(commentCon, talkRecommendBean.targetId, talkRecommendBean.targetType,
193
                            "0", "0", 1, "0");
194
                }else {
195
196
                    Toast.makeText(context, "请登录!", Toast.LENGTH_SHORT).show();
197
                    context.startActivity(new Intent(context, LoginActivity.class));
188 198
                }
189
                publishComment(commentCon, talkRecommendBean.targetId, talkRecommendBean.targetType,
190
                        "0", "0", 1, "0");
191 199
                break;
192 200
            case R.id.show_comment_network_retry:
193 201
                show_comment_progress_ll.setVisibility(View.VISIBLE);

+ 1 - 0
app/src/main/res/layout/item_show_comment.xml

@ -67,6 +67,7 @@
67 67
        android:layout_below="@+id/item_user_time"
68 68
        android:layout_alignStart="@+id/item_user_name"
69 69
        android:layout_marginStart="5dp"
70
        android:layout_marginEnd="37dp"
70 71
        android:layout_marginTop="10dp"
71 72
        android:text="12sp12sp12sp"
72 73
        android:textColor="#fff"