Commit a43d0488 authored by jyx's avatar jyx

代码优化

parent 96fa9a9a
...@@ -3,6 +3,7 @@ package com.mints.helivideo.video.tx; ...@@ -3,6 +3,7 @@ package com.mints.helivideo.video.tx;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
...@@ -13,11 +14,11 @@ import android.view.LayoutInflater; ...@@ -13,11 +14,11 @@ import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import com.mints.helivideo.utils.UIUtils;
import com.tencent.rtmp.TXLiveConstants; import com.tencent.rtmp.TXLiveConstants;
import com.tencent.rtmp.ui.TXCloudVideoView; import com.tencent.rtmp.ui.TXCloudVideoView;
import com.mints.helivideo.R; import com.mints.helivideo.R;
...@@ -31,7 +32,6 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe ...@@ -31,7 +32,6 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
SeekBar.OnSeekBarChangeListener, TXVodPlayerWrapper.OnPlayEventChangedListener { SeekBar.OnSeekBarChangeListener, TXVodPlayerWrapper.OnPlayEventChangedListener {
private static final String TAG = "TXVideoBaseView"; private static final String TAG = "TXVideoBaseView";
private View mRootView; private View mRootView;
private ProgressBar mBgProgress;
private SeekBar mSeekBar; private SeekBar mSeekBar;
private TXCloudVideoView mTXCloudVideoView; private TXCloudVideoView mTXCloudVideoView;
private ImageView mIvCover; private ImageView mIvCover;
...@@ -68,7 +68,6 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe ...@@ -68,7 +68,6 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
private void init(Context context) { private void init(Context context) {
mRootView = LayoutInflater.from(context).inflate(R.layout.player_item_base_view, null); mRootView = LayoutInflater.from(context).inflate(R.layout.player_item_base_view, null);
addView(mRootView); addView(mRootView);
mBgProgress = mRootView.findViewById(R.id.progress_short_video);
mSeekBar = mRootView.findViewById(R.id.seekbar_short_video); mSeekBar = mRootView.findViewById(R.id.seekbar_short_video);
mSeekBar.setOnSeekBarChangeListener(this); mSeekBar.setOnSeekBarChangeListener(this);
mIvCover = mRootView.findViewById(R.id.iv_cover); mIvCover = mRootView.findViewById(R.id.iv_cover);
...@@ -95,30 +94,28 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe ...@@ -95,30 +94,28 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
} }
}); });
mBgProgress.setVisibility(View.GONE); mSeekBar.setVisibility(View.VISIBLE);
// mSeekBar.setVisibility(View.GONE); mProgressTime.setVisibility(View.GONE);
// mProgressTime.setVisibility(View.GONE);
// OnTouchListener listener = new OnTouchListener() {
// OnTouchListener listener = new OnTouchListener() { @Override
// @Override public boolean onTouch(View v, MotionEvent event) {
// public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) {
// switch (event.getAction()) { case MotionEvent.ACTION_DOWN:
// case MotionEvent.ACTION_DOWN: mSeekBar.setThumb(getResources().getDrawable(R.drawable.player_thumb_view));
// mBgProgress.setVisibility(View.GONE); mSeekBar.setProgressDrawable(getResources().getDrawable(R.drawable.player_video_seek_bar));
// mSeekBar.setVisibility(View.VISIBLE); mProgressTime.setVisibility(View.VISIBLE);
// mProgressTime.setVisibility(View.VISIBLE); break;
// break; case MotionEvent.ACTION_UP:
// case MotionEvent.ACTION_UP: mSeekBar.setThumb(getResources().getDrawable(R.drawable.player_thumb_view_small));
// mBgProgress.setVisibility(View.VISIBLE); mSeekBar.setProgressDrawable(getResources().getDrawable(R.drawable.player_video_seek_bar_small));
// mSeekBar.setVisibility(View.GONE); mProgressTime.setVisibility(View.GONE);
// mProgressTime.setVisibility(View.GONE); break;
// break; }
// } return false;
// return false; }
// } };
// }; mSeekBar.setOnTouchListener(listener);
// mBgProgress.setOnTouchListener(listener);
// mSeekBar.setOnTouchListener(listener);
} }
private void handlePlayProgress(Bundle param) { private void handlePlayProgress(Bundle param) {
...@@ -142,8 +139,6 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe ...@@ -142,8 +139,6 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
if (mSeekBar != null) { if (mSeekBar != null) {
mSeekBar.setMax(durationMS); mSeekBar.setMax(durationMS);
mSeekBar.setProgress(progressMS); mSeekBar.setProgress(progressMS);
mBgProgress.setMax(durationMS);
mBgProgress.setProgress(progressMS);
} }
if (mProgressTime != null) { if (mProgressTime != null) {
String tempString = String.format(Locale.CHINA, "%02d:%02d/%02d:%02d", (progress) / 60, progress % 60, (duration) / 60, duration % 60); 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"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <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> <shape>
<corners android:radius="5dp"/> <corners android:radius="6dp" />
<solid android:color="#4CD8D8D8"/> <!-- 颜色--> <solid android:color="#4CD8D8D8" /> <!-- 颜色-->
</shape> </shape>
</item> </item>
<item android:id="@android:id/secondaryProgress" android:height="5dp"> <item
android:id="@android:id/secondaryProgress"
android:height="6dp"
android:left="-2dp">
<clip> <clip>
<shape> <shape>
<corners android:radius="5dp"/> <corners android:radius="6dp" />
<solid android:color="#20B2AA"/> <!-- 颜色--> <solid android:color="#20B2AA" /> <!-- 颜色-->
</shape> </shape>
</clip> </clip>
</item> </item>
<item android:id="@android:id/progress" android:height="5dp"> <item
android:id="@android:id/progress"
android:height="6dp"
android:left="-2dp">
<clip> <clip>
<shape> <shape>
<corners android:radius="5dp"/> <corners android:radius="6dp" />
<solid android:color="#C9C7C7"/> <!-- 颜色--> <solid android:color="#C9C7C7" /> <!-- 颜色-->
</shape> </shape>
</clip> </clip>
</item> </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 @@ ...@@ -31,8 +31,8 @@
android:layout_above="@id/empty_view" android:layout_above="@id/empty_view"
android:maxHeight="6dp" android:maxHeight="6dp"
android:minHeight="6dp" android:minHeight="6dp"
android:progressDrawable="@drawable/player_video_seek_bar" android:progressDrawable="@drawable/player_video_seek_bar_small"
android:thumb="@drawable/player_thumb_view" /> android:thumb="@drawable/player_thumb_view_small" />
<TextView <TextView
android:id="@+id/tv_progress_time" android:id="@+id/tv_progress_time"
...@@ -46,15 +46,6 @@ ...@@ -46,15 +46,6 @@
android:text="00:00/00:00" android:text="00:00/00:00"
android:textSize="16sp" /> 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 <ImageView
android:id="@+id/iv_pause" android:id="@+id/iv_pause"
android:layout_width="80dp" 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