-Modified playback parameter dialog to use translucent background. (reverted from commit 0d25254d4831aca92ad6cf6c0c772279b32b4a07)
This commit is contained in:
parent
50392ed67d
commit
111a0f9f17
3 changed files with 18 additions and 42 deletions
|
@ -459,8 +459,8 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||||
|
|
||||||
private void openPlaybackParameterDialog() {
|
private void openPlaybackParameterDialog() {
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
PlaybackParameterDialog.newInstance(player.getPlaybackSpeed(), player.getPlaybackPitch())
|
PlaybackParameterDialog.newInstance(player.getPlaybackSpeed(),
|
||||||
.show(getSupportFragmentManager(), getTag());
|
player.getPlaybackPitch()).show(getSupportFragmentManager(), getTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,12 +2,11 @@ package org.schabi.newpipe.player.helper;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.ColorInt;
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
@ -16,7 +15,6 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.util.SliderStrategy;
|
import org.schabi.newpipe.util.SliderStrategy;
|
||||||
import org.schabi.newpipe.util.ThemeHelper;
|
|
||||||
|
|
||||||
import static org.schabi.newpipe.player.BasePlayer.DEBUG;
|
import static org.schabi.newpipe.player.BasePlayer.DEBUG;
|
||||||
|
|
||||||
|
@ -70,7 +68,6 @@ public class PlaybackParameterDialog extends DialogFragment {
|
||||||
@Nullable private CheckBox unhookingCheckbox;
|
@Nullable private CheckBox unhookingCheckbox;
|
||||||
|
|
||||||
@Nullable private TextView nightCorePresetText;
|
@Nullable private TextView nightCorePresetText;
|
||||||
@Nullable private TextView defaultPresetText;
|
|
||||||
@Nullable private TextView resetPresetText;
|
@Nullable private TextView resetPresetText;
|
||||||
|
|
||||||
public static PlaybackParameterDialog newInstance(final double playbackTempo,
|
public static PlaybackParameterDialog newInstance(final double playbackTempo,
|
||||||
|
@ -118,23 +115,19 @@ public class PlaybackParameterDialog extends DialogFragment {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
final Context context = requireContext();
|
|
||||||
|
|
||||||
final View view = View.inflate(getContext(), R.layout.dialog_playback_parameter, null);
|
final View view = View.inflate(getContext(), R.layout.dialog_playback_parameter, null);
|
||||||
setupControlViews(view);
|
setupControlViews(view);
|
||||||
|
|
||||||
Dialog dialog = new Dialog(context);
|
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireActivity())
|
||||||
dialog.setCancelable(true);
|
.setTitle(R.string.playback_speed_control)
|
||||||
dialog.setCanceledOnTouchOutside(true);
|
.setView(view)
|
||||||
dialog.setTitle(R.string.playback_speed_control);
|
.setCancelable(true)
|
||||||
dialog.setContentView(view);
|
.setNegativeButton(R.string.cancel, (dialogInterface, i) ->
|
||||||
if (dialog.getWindow() != null) {
|
setPlaybackParameters(initialTempo, initialPitch))
|
||||||
@ColorInt final int backgroundColor = ThemeHelper.resolveColorFromAttr(context,
|
.setPositiveButton(R.string.finish, (dialogInterface, i) ->
|
||||||
R.attr.queue_background_color);
|
setCurrentPlaybackParameters());
|
||||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(backgroundColor));
|
|
||||||
}
|
|
||||||
|
|
||||||
return dialog;
|
return dialogBuilder.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -251,20 +244,11 @@ public class PlaybackParameterDialog extends DialogFragment {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultPresetText = rootView.findViewById(R.id.presetDefault);
|
|
||||||
if (defaultPresetText != null) {
|
|
||||||
defaultPresetText.setOnClickListener(view -> {
|
|
||||||
setTempoSlider(DEFAULT_TEMPO);
|
|
||||||
setPitchSlider(DEFAULT_PITCH);
|
|
||||||
setCurrentPlaybackParameters();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
resetPresetText = rootView.findViewById(R.id.presetReset);
|
resetPresetText = rootView.findViewById(R.id.presetReset);
|
||||||
if (resetPresetText != null) {
|
if (resetPresetText != null) {
|
||||||
resetPresetText.setOnClickListener(view -> {
|
resetPresetText.setOnClickListener(view -> {
|
||||||
setTempoSlider(initialTempo);
|
setTempoSlider(DEFAULT_TEMPO);
|
||||||
setPitchSlider(initialPitch);
|
setPitchSlider(DEFAULT_PITCH);
|
||||||
setCurrentPlaybackParameters();
|
setCurrentPlaybackParameters();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:padding="@dimen/video_item_search_padding">
|
android:paddingLeft="@dimen/video_item_search_padding"
|
||||||
|
android:paddingRight="@dimen/video_item_search_padding"
|
||||||
|
android:paddingTop="@dimen/video_item_search_padding">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -294,23 +296,13 @@
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:textColor="?attr/colorAccent"/>
|
android:textColor="?attr/colorAccent"/>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/presetDefault"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/playback_default"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:textColor="?attr/colorAccent"/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/presetReset"
|
android:id="@+id/presetReset"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Reset"
|
android:text="@string/playback_default"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:textColor="?attr/colorAccent"/>
|
android:textColor="?attr/colorAccent"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
Loading…
Reference in a new issue