Skip to content

Commit

Permalink
Added a custom title
Browse files Browse the repository at this point in the history
to also save some margin/padding/etc
  • Loading branch information
litetex committed Nov 4, 2021
1 parent cddb9bc commit f933db8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.schabi.newpipe.player.helper;

import static org.schabi.newpipe.player.Player.DEBUG;
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
Expand All @@ -18,9 +21,6 @@
import org.schabi.newpipe.R;
import org.schabi.newpipe.util.SliderStrategy;

import static org.schabi.newpipe.player.Player.DEBUG;
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;

public class PlaybackParameterDialog extends DialogFragment {
// Minimum allowable range in ExoPlayer
private static final double MINIMUM_PLAYBACK_VALUE = 0.10f;
Expand Down Expand Up @@ -157,7 +157,11 @@ public Dialog onCreateDialog(@Nullable final Bundle savedInstanceState) {
setupControlViews(view);

final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireActivity())
.setTitle(R.string.playback_speed_control)
.setCustomTitle(
View.inflate(
getContext(),
R.layout.dialog_playback_parameter_title,
null))
.setView(view)
.setCancelable(true)
.setNegativeButton(R.string.cancel, (dialogInterface, i) ->
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/res/layout/dialog_playback_parameter_title.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Title for the dialog of the playback parameters -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">

<org.schabi.newpipe.views.NewPipeTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:text="@string/playback_speed_control"
android:textColor="?attr/colorAccent"
android:textSize="18sp"
android:textStyle="bold" />

</LinearLayout>

0 comments on commit f933db8

Please sign in to comment.