- Moved playspeed into options menu
This commit is contained in:
parent
a4be7d8869
commit
d266ed4383
@ -245,11 +245,6 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
|||||||
ImageButton moreButton = findViewById(R.id.moreButton);
|
ImageButton moreButton = findViewById(R.id.moreButton);
|
||||||
ImageButton videoOptions = findViewById(R.id.exo_more);
|
ImageButton videoOptions = findViewById(R.id.exo_more);
|
||||||
|
|
||||||
//Playback speed buttons
|
|
||||||
Button speed05 = findViewById(R.id.speed05);
|
|
||||||
Button speed10 = findViewById(R.id.speed10);
|
|
||||||
Button speed15 = findViewById(R.id.speed15);
|
|
||||||
Button speed20 = findViewById(R.id.speed20);
|
|
||||||
|
|
||||||
Video video = response.body();
|
Video video = response.body();
|
||||||
|
|
||||||
@ -296,50 +291,17 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
|||||||
popup.show();
|
popup.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// video player options
|
||||||
videoOptions.setOnClickListener(v -> {
|
videoOptions.setOnClickListener(v -> {
|
||||||
|
|
||||||
VideoOptionsFragment videoOptionsFragment =
|
VideoOptionsFragment videoOptionsFragment =
|
||||||
VideoOptionsFragment.newInstance();
|
VideoOptionsFragment.newInstance(mService);
|
||||||
videoOptionsFragment.show(getSupportFragmentManager(),
|
videoOptionsFragment.show(getSupportFragmentManager(),
|
||||||
"video_options_fragment");
|
"video_options_fragment");
|
||||||
});
|
});
|
||||||
|
|
||||||
mService.setCurrentStreamUrl(video.getFiles().get(0).getFileUrl());
|
mService.setCurrentStreamUrl(video.getFiles().get(0).getFileUrl());
|
||||||
|
|
||||||
//Playback speed controls
|
|
||||||
speed05.setOnClickListener(view -> {
|
|
||||||
mService.setPlayBackSpeed(0.5f);
|
|
||||||
speed05.setTextColor(getResources().getColor(R.color.primaryColorRed));
|
|
||||||
|
|
||||||
speed10.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
speed15.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
speed20.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
|
|
||||||
});
|
|
||||||
speed10.setOnClickListener(view -> {
|
|
||||||
mService.setPlayBackSpeed(1.0f);
|
|
||||||
speed10.setTextColor(getResources().getColor(R.color.primaryColorRed));
|
|
||||||
|
|
||||||
speed05.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
speed15.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
speed20.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
});
|
|
||||||
speed15.setOnClickListener(view -> {
|
|
||||||
mService.setPlayBackSpeed(1.5f);
|
|
||||||
speed15.setTextColor(getResources().getColor(R.color.primaryColorRed));
|
|
||||||
|
|
||||||
speed05.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
speed10.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
speed20.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
});
|
|
||||||
speed20.setOnClickListener(view -> {
|
|
||||||
mService.setPlayBackSpeed(2.0f);
|
|
||||||
speed20.setTextColor(getResources().getColor(R.color.primaryColorRed));
|
|
||||||
|
|
||||||
speed05.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
speed10.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
speed15.setTextColor(getResources().getColor(R.color.secondaryTextColorRed));
|
|
||||||
});
|
|
||||||
|
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||||
if (sharedPref.getBoolean("pref_torrent_player", false)) {
|
if (sharedPref.getBoolean("pref_torrent_player", false)) {
|
||||||
|
@ -4,16 +4,21 @@ import android.os.Bundle;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||||
|
|
||||||
import net.schueller.peertube.R;
|
import net.schueller.peertube.R;
|
||||||
|
import net.schueller.peertube.service.VideoPlayerService;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
public class VideoOptionsFragment extends BottomSheetDialogFragment {
|
public class VideoOptionsFragment extends BottomSheetDialogFragment {
|
||||||
|
|
||||||
public static VideoOptionsFragment newInstance() {
|
private static VideoPlayerService videoPlayerService;
|
||||||
|
|
||||||
|
public static VideoOptionsFragment newInstance(VideoPlayerService mService) {
|
||||||
|
videoPlayerService = mService;
|
||||||
return new VideoOptionsFragment();
|
return new VideoOptionsFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,6 +33,18 @@ public class VideoOptionsFragment extends BottomSheetDialogFragment {
|
|||||||
|
|
||||||
// get the views and attach the listener
|
// get the views and attach the listener
|
||||||
|
|
||||||
|
//Playback speed buttons
|
||||||
|
TextView speed05 = view.findViewById(R.id.video_speed05);
|
||||||
|
TextView speed10 = view.findViewById(R.id.video_speed10);
|
||||||
|
TextView speed15 = view.findViewById(R.id.video_speed15);
|
||||||
|
TextView speed20 = view.findViewById(R.id.video_speed20);
|
||||||
|
|
||||||
|
//Playback speed controls
|
||||||
|
speed05.setOnClickListener(v -> videoPlayerService.setPlayBackSpeed(0.5f));
|
||||||
|
speed10.setOnClickListener(v -> videoPlayerService.setPlayBackSpeed(1.0f));
|
||||||
|
speed15.setOnClickListener(v -> videoPlayerService.setPlayBackSpeed(1.5f));
|
||||||
|
speed20.setOnClickListener(v -> videoPlayerService.setPlayBackSpeed(2.0f));
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -109,50 +109,6 @@
|
|||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1" />
|
android:textAppearance="@style/Base.TextAppearance.AppCompat.Body1" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/playback_speed_label"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/description"
|
|
||||||
android:text="Playback Speed"
|
|
||||||
android:layout_marginTop="16dp"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/speed05"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/playback_speed_label"
|
|
||||||
android:text="0.5x"
|
|
||||||
android:textAllCaps="false"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/speed10"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/playback_speed_label"
|
|
||||||
android:layout_toRightOf="@id/speed05"
|
|
||||||
android:text="1.0x"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:textColor="@color/primaryColorRed"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/speed15"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/playback_speed_label"
|
|
||||||
android:layout_toRightOf="@id/speed10"
|
|
||||||
android:text="1.5x"
|
|
||||||
android:textAllCaps="false"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/speed20"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/playback_speed_label"
|
|
||||||
android:layout_toRightOf="@id/speed15"
|
|
||||||
android:text="2.0x"
|
|
||||||
android:textAllCaps="false"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
@ -1,24 +1,65 @@
|
|||||||
<LinearLayout
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
android:background="@color/videoBackgroundColor"
|
android:background="@color/videoBackgroundColor"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_bottom_sheet_heading"
|
android:id="@+id/video_speed05"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:gravity="center"
|
|
||||||
android:text="Option 1"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:layout_height="56dp"
|
android:layout_height="56dp"
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:gravity="center"
|
||||||
android:textColor="#ffffff"
|
android:textColor="#ffffff"
|
||||||
|
android:textSize="16sp"
|
||||||
|
|
||||||
|
android:text="@string/video_speed_05"
|
||||||
|
android:textAllCaps="false"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_speed10"
|
||||||
|
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textSize="16sp"
|
||||||
|
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:text="@string/video_speed_10"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_speed15"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textSize="16sp"
|
||||||
|
|
||||||
|
android:text="@string/video_speed_15"
|
||||||
|
android:textAllCaps="false" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/video_speed20"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textSize="16sp"
|
||||||
|
|
||||||
|
android:text="@string/video_speed_20"
|
||||||
|
android:textAllCaps="false" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -84,5 +84,9 @@
|
|||||||
<string name="brown">Brown</string>
|
<string name="brown">Brown</string>
|
||||||
<string name="gray">Gray</string>
|
<string name="gray">Gray</string>
|
||||||
<string name="bluegray">Bluegray</string>
|
<string name="bluegray">Bluegray</string>
|
||||||
|
<string name="video_speed_05">0.5x</string>
|
||||||
|
<string name="video_speed_10">Normal</string>
|
||||||
|
<string name="video_speed_15">1.5x</string>
|
||||||
|
<string name="video_speed_20">2x</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user