Video Player: Add rewind and fast forward buttons
This commit is contained in:
parent
937feddafa
commit
4f6ba23cbf
|
@ -639,7 +639,8 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
|||
}
|
||||
}
|
||||
checkFavorite();
|
||||
if(controller == null) {
|
||||
if(butPlaybackSpeed != null) {
|
||||
if (controller == null) {
|
||||
butPlaybackSpeed.setVisibility(View.GONE);
|
||||
} else {
|
||||
butPlaybackSpeed.setVisibility(View.VISIBLE);
|
||||
|
@ -650,6 +651,7 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
|||
}
|
||||
}
|
||||
updateButPlaybackSpeed();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -865,7 +867,7 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
|||
}
|
||||
|
||||
private void updateButPlaybackSpeed() {
|
||||
if (controller != null) {
|
||||
if (controller != null && butPlaybackSpeed != null) {
|
||||
butPlaybackSpeed.setText(UserPreferences.getPlaybackSpeed() + "x");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
|||
|
||||
private VideoControlsHider videoControlsHider = new VideoControlsHider(this);
|
||||
|
||||
private LinearLayout controls;
|
||||
private LinearLayout videoOverlay;
|
||||
private AspectRatioVideoView videoview;
|
||||
private ProgressBar progressIndicator;
|
||||
|
@ -116,6 +117,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
|||
protected void setupGUI() {
|
||||
super.setupGUI();
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
controls = (LinearLayout) findViewById(R.id.controls);
|
||||
videoOverlay = (LinearLayout) findViewById(R.id.overlay);
|
||||
videoview = (AspectRatioVideoView) findViewById(R.id.videoview);
|
||||
progressIndicator = (ProgressBar) findViewById(R.id.progressIndicator);
|
||||
|
@ -259,12 +261,11 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
|||
@SuppressLint("NewApi")
|
||||
private void showVideoControls() {
|
||||
videoOverlay.setVisibility(View.VISIBLE);
|
||||
butPlay.setVisibility(View.VISIBLE);
|
||||
final Animation animation = AnimationUtils.loadAnimation(this,
|
||||
R.anim.fade_in);
|
||||
controls.setVisibility(View.VISIBLE);
|
||||
final Animation animation = AnimationUtils.loadAnimation(this, R.anim.fade_in);
|
||||
if (animation != null) {
|
||||
videoOverlay.startAnimation(animation);
|
||||
butPlay.startAnimation(animation);
|
||||
controls.startAnimation(animation);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
videoview.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
|
@ -273,11 +274,10 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
|||
|
||||
@SuppressLint("NewApi")
|
||||
private void hideVideoControls() {
|
||||
final Animation animation = AnimationUtils.loadAnimation(this,
|
||||
R.anim.fade_out);
|
||||
final Animation animation = AnimationUtils.loadAnimation(this, R.anim.fade_out);
|
||||
if (animation != null) {
|
||||
videoOverlay.startAnimation(animation);
|
||||
butPlay.startAnimation(animation);
|
||||
controls.startAnimation(animation);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
int videoviewFlag = (Build.VERSION.SDK_INT >= 16) ? View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION : 0;
|
||||
|
@ -286,7 +286,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
|||
videoOverlay.setFitsSystemWindows(true);
|
||||
}
|
||||
videoOverlay.setVisibility(View.GONE);
|
||||
butPlay.setVisibility(View.GONE);
|
||||
controls.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,15 +19,42 @@
|
|||
android:indeterminateOnly="true"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/controls"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butRev"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:background="@drawable/overlay_button_circle_background"
|
||||
android:contentDescription="@string/pause_label"
|
||||
android:src="@drawable/ic_av_rewind_80dp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butPlay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="8dp"
|
||||
android:background="@drawable/overlay_button_circle_background"
|
||||
android:contentDescription="@string/pause_label"
|
||||
android:src="@drawable/ic_av_pause_circle_outline_80dp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butFF"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:background="@drawable/overlay_button_circle_background"
|
||||
android:contentDescription="@string/pause_label"
|
||||
android:src="@drawable/ic_av_fast_forward_80dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/overlay"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue