Commit a43d0488 authored by jyx's avatar jyx

代码优化

parent 96fa9a9a
......@@ -3,6 +3,7 @@ package com.mints.helivideo.video.tx;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
......@@ -13,11 +14,11 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import com.mints.helivideo.utils.UIUtils;
import com.tencent.rtmp.TXLiveConstants;
import com.tencent.rtmp.ui.TXCloudVideoView;
import com.mints.helivideo.R;
......@@ -31,7 +32,6 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
SeekBar.OnSeekBarChangeListener, TXVodPlayerWrapper.OnPlayEventChangedListener {
private static final String TAG = "TXVideoBaseView";
private View mRootView;
private ProgressBar mBgProgress;
private SeekBar mSeekBar;
private TXCloudVideoView mTXCloudVideoView;
private ImageView mIvCover;
......@@ -68,7 +68,6 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
private void init(Context context) {
mRootView = LayoutInflater.from(context).inflate(R.layout.player_item_base_view, null);
addView(mRootView);
mBgProgress = mRootView.findViewById(R.id.progress_short_video);
mSeekBar = mRootView.findViewById(R.id.seekbar_short_video);
mSeekBar.setOnSeekBarChangeListener(this);
mIvCover = mRootView.findViewById(R.id.iv_cover);
......@@ -95,30 +94,28 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
}
});
mBgProgress.setVisibility(View.GONE);
// mSeekBar.setVisibility(View.GONE);
// mProgressTime.setVisibility(View.GONE);
//
// OnTouchListener listener = new OnTouchListener() {
// @Override
// public boolean onTouch(View v, MotionEvent event) {
// switch (event.getAction()) {
// case MotionEvent.ACTION_DOWN:
// mBgProgress.setVisibility(View.GONE);
// mSeekBar.setVisibility(View.VISIBLE);
// mProgressTime.setVisibility(View.VISIBLE);
// break;
// case MotionEvent.ACTION_UP:
// mBgProgress.setVisibility(View.VISIBLE);
// mSeekBar.setVisibility(View.GONE);
// mProgressTime.setVisibility(View.GONE);
// break;
// }
// return false;
// }
// };
// mBgProgress.setOnTouchListener(listener);
// mSeekBar.setOnTouchListener(listener);
mSeekBar.setVisibility(View.VISIBLE);
mProgressTime.setVisibility(View.GONE);
OnTouchListener listener = new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mSeekBar.setThumb(getResources().getDrawable(R.drawable.player_thumb_view));
mSeekBar.setProgressDrawable(getResources().getDrawable(R.drawable.player_video_seek_bar));
mProgressTime.setVisibility(View.VISIBLE);
break;
case MotionEvent.ACTION_UP:
mSeekBar.setThumb(getResources().getDrawable(R.drawable.player_thumb_view_small));
mSeekBar.setProgressDrawable(getResources().getDrawable(R.drawable.player_video_seek_bar_small));
mProgressTime.setVisibility(View.GONE);
break;
}
return false;
}
};
mSeekBar.setOnTouchListener(listener);
}
private void handlePlayProgress(Bundle param) {
......@@ -142,8 +139,6 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
if (mSeekBar != null) {
mSeekBar.setMax(durationMS);
mSeekBar.setProgress(progressMS);
mBgProgress.setMax(durationMS);
mBgProgress.setProgress(progressMS);
}
if (mProgressTime != null) {
String tempString = String.format(Locale.CHINA, "%02d:%02d/%02d:%02d", (progress) / 60, progress % 60, (duration) / 60, duration % 60);
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<solid android:color="#FFFFFFFF" />
<size android:width="4dp" android:height="4dp" />
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#FFFFFFFF" />
<size android:width="4dp" android:height="4dp" />
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background" android:height="5dp">
<item
android:id="@android:id/background"
android:height="6dp"
android:left="-2dp">
<shape>
<corners android:radius="5dp"/>
<solid android:color="#4CD8D8D8"/> <!-- 颜色-->
<corners android:radius="6dp" />
<solid android:color="#4CD8D8D8" /> <!-- 颜色-->
</shape>
</item>
<item android:id="@android:id/secondaryProgress" android:height="5dp">
<item
android:id="@android:id/secondaryProgress"
android:height="6dp"
android:left="-2dp">
<clip>
<shape>
<corners android:radius="5dp"/>
<solid android:color="#20B2AA"/> <!-- 颜色-->
<corners android:radius="6dp" />
<solid android:color="#20B2AA" /> <!-- 颜色-->
</shape>
</clip>
</item>
<item android:id="@android:id/progress" android:height="5dp">
<item
android:id="@android:id/progress"
android:height="6dp"
android:left="-2dp">
<clip>
<shape>
<corners android:radius="5dp"/>
<solid android:color="#C9C7C7"/> <!-- 颜色-->
<corners android:radius="6dp" />
<solid android:color="#C9C7C7" /> <!-- 颜色-->
</shape>
</clip>
</item>
......
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background"
android:height="2dp"
android:top="1.75dp">
<shape>
<corners android:radius="2dp" />
<solid android:color="#4CD8D8D8" /> <!-- 颜色-->
</shape>
</item>
<item
android:id="@android:id/secondaryProgress"
android:height="2dp"
android:top="1.75dp">
<clip>
<shape>
<corners android:radius="2dp" />
<solid android:color="#20B2AA" /> <!-- 颜色-->
</shape>
</clip>
</item>
<item
android:id="@android:id/progress"
android:height="2dp"
android:top="1.75dp">
<clip>
<shape>
<corners android:radius="2dp" />
<solid android:color="#C9C7C7" /> <!-- 颜色-->
</shape>
</clip>
</item>
</layer-list>
\ No newline at end of file
......@@ -31,8 +31,8 @@
android:layout_above="@id/empty_view"
android:maxHeight="6dp"
android:minHeight="6dp"
android:progressDrawable="@drawable/player_video_seek_bar"
android:thumb="@drawable/player_thumb_view" />
android:progressDrawable="@drawable/player_video_seek_bar_small"
android:thumb="@drawable/player_thumb_view_small" />
<TextView
android:id="@+id/tv_progress_time"
......@@ -46,15 +46,6 @@
android:text="00:00/00:00"
android:textSize="16sp" />
<ProgressBar
android:id="@+id/progress_short_video"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_above="@id/empty_view"
android:max="100"
android:progressDrawable="@drawable/jz_bottom_seek_progress" />
<ImageView
android:id="@+id/iv_pause"
android:layout_width="80dp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment