dxh 5 years ago
parent
commit
4826f7edb6

+ 0 - 1
app/build.gradle

32
        targetSdkVersion 26
32
        targetSdkVersion 26
33
33
34
        multiDexEnabled true
34
        multiDexEnabled true
35
//        multiDexKeepProguard file('multiDexKeep.pro')
36
35
37
        ndk {
36
        ndk {
38
            abiFilters "armeabi"
37
            abiFilters "armeabi"

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

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

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

40
40
41
import java.util.HashMap;
41
import java.util.HashMap;
42
import java.util.List;
42
import java.util.List;
43
import java.util.Locale;
43
import java.util.Map;
44
import java.util.Map;
44
45
45
import okhttp3.Call;
46
import okhttp3.Call;
47
import tv.danmaku.ijk.media.player.IMediaPlayer;
46
48
47
public class SvVideoShowView implements View.OnClickListener {
49
public class SvVideoShowView implements View.OnClickListener {
48
50
79
            if (targetType == 23) {
81
            if (targetType == 23) {
80
                view = LayoutInflater.from(activity).inflate(R.layout.view_show_view, null);
82
                view = LayoutInflater.from(activity).inflate(R.layout.view_show_view, null);
81
                initPlayer(view);
83
                initPlayer(view);
84
                initBottom(view);
85
                viewGroup.addView(view);
86
87
                setData();
88
82
            } else if (targetType == 24) {
89
            } else if (targetType == 24) {
83
                view = LayoutInflater.from(activity).inflate(R.layout.view_show_zoom, null);
90
                view = LayoutInflater.from(activity).inflate(R.layout.view_show_zoom, null);
84
                initZoomPhoto(view);
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
                });
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
    private void setData() {
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
        sv_show_tvcon.setText(talkRecommendBean.content);
160
        sv_show_tvcon.setText(talkRecommendBean.content);
142
        sv_show_tvcon.setText(talkRecommendBean.title);
161
        sv_show_tvcon.setText(talkRecommendBean.title);
143
        sv_show_user_name.setText(talkRecommendBean.nickName);
162
        sv_show_user_name.setText(talkRecommendBean.nickName);
174
            // sv_show_like_img  not like
193
            // sv_show_like_img  not like
175
        }
194
        }
176
        int length = sv_show_tvcon.length();
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
            sv_show_tvcon_more.setVisibility(View.VISIBLE);
198
            sv_show_tvcon_more.setVisibility(View.VISIBLE);
180
        } else {
199
        } else {
181
            sv_show_tvcon_more.setVisibility(View.GONE);
200
            sv_show_tvcon_more.setVisibility(View.GONE);
262
    private void initPlayer(View view) {
281
    private void initPlayer(View view) {
263
        playIcon = view.findViewById(R.id.view_show_icon);
282
        playIcon = view.findViewById(R.id.view_show_icon);
264
        upVideoView2 = view.findViewById(R.id.view_show_video);
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
        upVideoView2.setOnTouchListener(new View.OnTouchListener() {
296
        upVideoView2.setOnTouchListener(new View.OnTouchListener() {
266
            @Override
297
            @Override
267
            public boolean onTouch(View view, MotionEvent motionEvent) {
298
            public boolean onTouch(View view, MotionEvent motionEvent) {
365
            case NETWORK_2G:
396
            case NETWORK_2G:
366
            case NETWORK_3G:
397
            case NETWORK_3G:
367
            case NETWORK_4G:
398
            case NETWORK_4G:
399
400
                playIcon.setVisibility(View.VISIBLE);
368
                new AlertDialog(activity)
401
                new AlertDialog(activity)
369
                        .builder()
402
                        .builder()
370
                        .setMsg("您当前使用的是流量,是否播放视频?")
403
                        .setMsg("您当前使用的是流量,是否播放视频?")
371
                        .setPositiveButton("确定", new View.OnClickListener() {
404
                        .setPositiveButton("确定", new View.OnClickListener() {
372
                            @Override
405
                            @Override
373
                            public void onClick(View view) {
406
                            public void onClick(View view) {
407
                                playIcon.setVisibility(View.GONE);
374
                                upVideoView2.start();
408
                                upVideoView2.start();
375
                            }
409
                            }
376
                        })
410
                        })
377
                        .setNegativeButton("取消", null);
411
                        .setNegativeButton("取消", null);
412
378
                break;
413
                break;
379
            default:
414
            default:
415
                playIcon.setVisibility(View.GONE);
380
                upVideoView2.start();
416
                upVideoView2.start();
381
                break;
417
                break;
382
        }
418
        }
453
489
454
    public void onResume(String url) {
490
    public void onResume(String url) {
455
        if (upVideoView2 != null) {
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
            upVideoView2.start();
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
2
3
import android.app.Dialog;
3
import android.app.Dialog;
4
import android.content.Context;
4
import android.content.Context;
5
import android.content.Intent;
5
import android.graphics.Color;
6
import android.graphics.Color;
6
import android.os.Bundle;
7
import android.os.Bundle;
7
import android.support.v7.widget.LinearLayoutManager;
8
import android.support.v7.widget.LinearLayoutManager;
21
import android.widget.Toast;
22
import android.widget.Toast;
22
23
23
import com.electric.chargingpile.R;
24
import com.electric.chargingpile.R;
25
import com.electric.chargingpile.activity.LoginActivity;
24
import com.electric.chargingpile.adapter.VideoCommentAdapter;
26
import com.electric.chargingpile.adapter.VideoCommentAdapter;
25
import com.electric.chargingpile.application.MainApplication;
27
import com.electric.chargingpile.application.MainApplication;
26
import com.electric.chargingpile.data.TalkRecommendBean;
28
import com.electric.chargingpile.data.TalkRecommendBean;
181
                dismiss();
183
                dismiss();
182
                break;
184
                break;
183
            case R.id.show_comment_publish:
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
                break;
199
                break;
192
            case R.id.show_comment_network_retry:
200
            case R.id.show_comment_network_retry:
193
                show_comment_progress_ll.setVisibility(View.VISIBLE);
201
                show_comment_progress_ll.setVisibility(View.VISIBLE);

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

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