- Added options menu to video playback
- Changed video background color to black - Changed layout of video OSD
This commit is contained in:
parent
ae3d4bd8c8
commit
37549177f7
@ -39,6 +39,7 @@ import com.google.android.exoplayer2.util.Util;
|
|||||||
import com.google.android.exoplayer2.video.VideoRendererEventListener;
|
import com.google.android.exoplayer2.video.VideoRendererEventListener;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
import net.schueller.peertube.R;
|
import net.schueller.peertube.R;
|
||||||
|
import net.schueller.peertube.fragment.VideoOptionsFragment;
|
||||||
import net.schueller.peertube.helper.APIUrlHelper;
|
import net.schueller.peertube.helper.APIUrlHelper;
|
||||||
import net.schueller.peertube.helper.MetaDataHelper;
|
import net.schueller.peertube.helper.MetaDataHelper;
|
||||||
import net.schueller.peertube.intents.Intents;
|
import net.schueller.peertube.intents.Intents;
|
||||||
@ -241,6 +242,7 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
|||||||
TextView videoMeta = findViewById(R.id.videoMeta);
|
TextView videoMeta = findViewById(R.id.videoMeta);
|
||||||
ImageView avatarView = findViewById(R.id.avatar);
|
ImageView avatarView = findViewById(R.id.avatar);
|
||||||
ImageButton moreButton = findViewById(R.id.moreButton);
|
ImageButton moreButton = findViewById(R.id.moreButton);
|
||||||
|
ImageButton videoOptions = findViewById(R.id.exo_more);
|
||||||
|
|
||||||
Video video = response.body();
|
Video video = response.body();
|
||||||
|
|
||||||
@ -287,6 +289,14 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
|||||||
popup.show();
|
popup.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
videoOptions.setOnClickListener(v -> {
|
||||||
|
|
||||||
|
VideoOptionsFragment videoOptionsFragment =
|
||||||
|
VideoOptionsFragment.newInstance();
|
||||||
|
videoOptionsFragment.show(getSupportFragmentManager(),
|
||||||
|
"video_options_fragment");
|
||||||
|
});
|
||||||
|
|
||||||
mService.setCurrentStreamUrl(video.getFiles().get(0).getFileUrl());
|
mService.setCurrentStreamUrl(video.getFiles().get(0).getFileUrl());
|
||||||
|
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package net.schueller.peertube.fragment;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||||
|
|
||||||
|
import net.schueller.peertube.R;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
public class VideoOptionsFragment extends BottomSheetDialogFragment {
|
||||||
|
|
||||||
|
public static VideoOptionsFragment newInstance() {
|
||||||
|
return new VideoOptionsFragment();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater,
|
||||||
|
@Nullable ViewGroup container,
|
||||||
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
View view = inflater.inflate(R.layout.bottom_sheet_video_options_fragment, container,
|
||||||
|
false);
|
||||||
|
|
||||||
|
// get the views and attach the listener
|
||||||
|
|
||||||
|
return view;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -17,6 +17,7 @@
|
|||||||
android:id="@+id/video_view"
|
android:id="@+id/video_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="250dp"
|
android:layout_height="250dp"
|
||||||
|
android:background="@color/videoBackgroundColor"
|
||||||
|
|
||||||
app:layout_constraintDimensionRatio="H,3:1"
|
app:layout_constraintDimensionRatio="H,3:1"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
@ -111,6 +112,6 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:background="@color/videoBackgroundColor"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_bottom_sheet_heading"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Option 1"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -2,13 +2,44 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="bottom"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:layoutDirection="ltr"
|
android:layoutDirection="ltr"
|
||||||
android:background="#CC000000"
|
android:background="#CC000000"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:targetApi="28">
|
tools:targetApi="28">
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="0dp"
|
||||||
|
android:gravity="bottom"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<ImageButton android:src="@drawable/ic_action_more_vert"
|
||||||
|
android:id="@+id/exo_more"
|
||||||
|
android:tint="#ffffff"
|
||||||
|
android:background="@null"
|
||||||
|
android:paddingTop="0dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -19,9 +50,6 @@
|
|||||||
<ImageButton android:id="@id/exo_rew"
|
<ImageButton android:id="@id/exo_rew"
|
||||||
style="@style/ExoMediaButton.Rewind"/>
|
style="@style/ExoMediaButton.Rewind"/>
|
||||||
|
|
||||||
<ImageButton android:id="@id/exo_shuffle"
|
|
||||||
style="@style/ExoMediaButton.Shuffle"/>
|
|
||||||
|
|
||||||
<ImageButton android:id="@id/exo_repeat_toggle"
|
<ImageButton android:id="@id/exo_repeat_toggle"
|
||||||
style="@style/ExoMediaButton"/>
|
style="@style/ExoMediaButton"/>
|
||||||
|
|
||||||
@ -36,11 +64,18 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="bottom"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView android:id="@id/exo_position"
|
<TextView android:id="@id/exo_position"
|
||||||
@ -48,27 +83,43 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:paddingLeft="4dp"
|
android:paddingLeft="12dp"
|
||||||
android:paddingRight="4dp"
|
android:paddingRight="12dp"
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
android:textColor="#FFBEBEBE"/>
|
android:textColor="#FFBEBEBE"/>
|
||||||
|
|
||||||
<com.google.android.exoplayer2.ui.DefaultTimeBar
|
<View
|
||||||
android:id="@id/exo_progress"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_height="0dp"
|
||||||
android:layout_height="26dp"/>
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<TextView android:id="@id/exo_duration"
|
<TextView android:id="@id/exo_duration"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:paddingLeft="4dp"
|
android:paddingLeft="12dp"
|
||||||
android:paddingRight="4dp"
|
android:paddingRight="12dp"
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
android:textColor="#FFBEBEBE"/>
|
android:textColor="#FFBEBEBE"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:gravity="bottom"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.exoplayer2.ui.DefaultTimeBar
|
||||||
|
android:id="@id/exo_progress"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="26dp"
|
||||||
|
app:played_color="?attr/colorPrimary"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
7
app/src/main/res/menu/menu_video_play_options.xml
Normal file
7
app/src/main/res/menu/menu_video_play_options.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_video_playback_speed"
|
||||||
|
android:icon="@drawable/ic_action_share"
|
||||||
|
android:title="@string/menu_share" />
|
||||||
|
</menu>
|
@ -4,6 +4,7 @@
|
|||||||
<color name="themeDeselected">#d69b9b9b</color>
|
<color name="themeDeselected">#d69b9b9b</color>
|
||||||
<color name="themeSelected">#e300aaff</color>
|
<color name="themeSelected">#e300aaff</color>
|
||||||
<color name="seperator">#7ca6a6a6</color>
|
<color name="seperator">#7ca6a6a6</color>
|
||||||
|
<color name="videoBackgroundColor">#000000</color>
|
||||||
|
|
||||||
|
|
||||||
<!-- RED Theme -->
|
<!-- RED Theme -->
|
||||||
|
Loading…
Reference in New Issue
Block a user