mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2026-04-18 04:41:24 +00:00
-Added info item menu with custom title banner on long click. -Enabled starting playlists and channels from middle. -Enabled caching for play queue item thumbnails. -Modified play queue to revert to first item on deleting last item.
40 lines
1.3 KiB
Java
40 lines
1.3 KiB
Java
package org.schabi.newpipe.info_list;
|
|
|
|
import android.app.Activity;
|
|
import android.app.AlertDialog;
|
|
import android.content.DialogInterface;
|
|
import android.support.annotation.NonNull;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.widget.TextView;
|
|
|
|
import org.schabi.newpipe.R;
|
|
import org.schabi.newpipe.extractor.InfoItem;
|
|
|
|
public class InfoItemDialog {
|
|
private final AlertDialog dialog;
|
|
|
|
public InfoItemDialog(@NonNull final Activity activity,
|
|
@NonNull final InfoItem item,
|
|
@NonNull final String[] commands,
|
|
@NonNull final DialogInterface.OnClickListener actions) {
|
|
|
|
final LayoutInflater inflater = activity.getLayoutInflater();
|
|
final View bannerView = inflater.inflate(R.layout.dialog_title, null);
|
|
bannerView.setSelected(true);
|
|
TextView titleView = bannerView.findViewById(R.id.itemTitleView);
|
|
titleView.setText(item.name);
|
|
TextView typeView = bannerView.findViewById(R.id.itemTypeView);
|
|
typeView.setText(item.info_type.name());
|
|
|
|
dialog = new AlertDialog.Builder(activity)
|
|
.setCustomTitle(bannerView)
|
|
.setItems(commands, actions)
|
|
.create();
|
|
}
|
|
|
|
public void show() {
|
|
dialog.show();
|
|
}
|
|
}
|