2017-11-11 23:47:34 +01:00
|
|
|
package org.schabi.newpipe.info_list;
|
|
|
|
|
2022-02-18 23:44:14 +01:00
|
|
|
import static org.schabi.newpipe.MainActivity.DEBUG;
|
|
|
|
|
2017-11-11 23:47:34 +01:00
|
|
|
import android.app.Activity;
|
2021-12-26 15:34:36 +01:00
|
|
|
import android.content.Context;
|
2017-11-11 23:47:34 +01:00
|
|
|
import android.content.DialogInterface;
|
2022-02-18 23:44:14 +01:00
|
|
|
import android.os.Build;
|
|
|
|
import android.util.Log;
|
2017-11-11 23:47:34 +01:00
|
|
|
import android.view.View;
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
2020-03-31 19:20:15 +02:00
|
|
|
import androidx.annotation.NonNull;
|
2021-04-01 21:46:29 +02:00
|
|
|
import androidx.appcompat.app.AlertDialog;
|
2021-12-27 16:16:40 +01:00
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import androidx.preference.PreferenceManager;
|
2020-03-31 19:20:15 +02:00
|
|
|
|
2022-02-18 23:44:14 +01:00
|
|
|
import org.schabi.newpipe.App;
|
2017-11-11 23:47:34 +01:00
|
|
|
import org.schabi.newpipe.R;
|
2022-02-18 23:44:14 +01:00
|
|
|
import org.schabi.newpipe.error.ErrorInfo;
|
|
|
|
import org.schabi.newpipe.error.ErrorUtil;
|
|
|
|
import org.schabi.newpipe.error.UserAction;
|
|
|
|
import org.schabi.newpipe.extractor.InfoItem;
|
2017-11-14 06:13:52 +01:00
|
|
|
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
2021-12-27 16:16:40 +01:00
|
|
|
import org.schabi.newpipe.extractor.stream.StreamType;
|
|
|
|
import org.schabi.newpipe.player.helper.PlayerHolder;
|
|
|
|
import org.schabi.newpipe.util.StreamDialogDefaultEntry;
|
|
|
|
import org.schabi.newpipe.util.StreamDialogEntry;
|
|
|
|
import org.schabi.newpipe.util.external_communication.KoreUtils;
|
2017-11-11 23:47:34 +01:00
|
|
|
|
2021-12-27 16:16:40 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2022-02-18 23:44:14 +01:00
|
|
|
import java.util.stream.Stream;
|
2017-11-11 23:47:34 +01:00
|
|
|
|
2021-12-27 16:16:40 +01:00
|
|
|
/**
|
2021-12-26 15:34:36 +01:00
|
|
|
* Dialog for a {@link StreamInfoItem}.
|
2022-02-18 23:44:14 +01:00
|
|
|
* The dialog's content are actions that can be performed on the {@link StreamInfoItem}.
|
2021-12-27 16:16:40 +01:00
|
|
|
* This dialog is mostly used for longpress context menus.
|
|
|
|
*/
|
|
|
|
public final class InfoItemDialog {
|
2022-02-18 23:44:14 +01:00
|
|
|
private static final String TAG = Build.class.getSimpleName();
|
2021-12-26 15:34:36 +01:00
|
|
|
/**
|
|
|
|
* Ideally, {@link InfoItemDialog} would extend {@link AlertDialog}.
|
|
|
|
* However, extending {@link AlertDialog} requires many additional lines
|
|
|
|
* and brings more complexity to this class, especially the constructor.
|
|
|
|
* To circumvent this, an {@link AlertDialog.Builder} is used in the constructor.
|
|
|
|
* Its result is stored in this class variable to allow access via the {@link #show()} method.
|
|
|
|
*/
|
2021-12-27 16:16:40 +01:00
|
|
|
private final AlertDialog dialog;
|
2017-11-14 06:13:52 +01:00
|
|
|
|
2021-12-27 16:16:40 +01:00
|
|
|
private InfoItemDialog(@NonNull final Activity activity,
|
|
|
|
@NonNull final Fragment fragment,
|
|
|
|
@NonNull final StreamInfoItem info,
|
|
|
|
@NonNull final List<StreamDialogEntry> entries) {
|
2017-11-11 23:47:34 +01:00
|
|
|
|
2022-02-18 23:44:14 +01:00
|
|
|
// Create the dialog's title
|
2018-01-16 20:48:52 +01:00
|
|
|
final View bannerView = View.inflate(activity, R.layout.dialog_title, null);
|
2017-11-11 23:47:34 +01:00
|
|
|
bannerView.setSelected(true);
|
2017-11-14 06:13:52 +01:00
|
|
|
|
2020-08-16 10:24:58 +02:00
|
|
|
final TextView titleView = bannerView.findViewById(R.id.itemTitleView);
|
2021-12-27 16:16:40 +01:00
|
|
|
titleView.setText(info.getName());
|
2017-11-14 06:13:52 +01:00
|
|
|
|
2020-08-16 10:24:58 +02:00
|
|
|
final TextView detailsView = bannerView.findViewById(R.id.itemAdditionalDetails);
|
2021-12-27 16:16:40 +01:00
|
|
|
if (info.getUploaderName() != null) {
|
|
|
|
detailsView.setText(info.getUploaderName());
|
2017-11-14 06:13:52 +01:00
|
|
|
detailsView.setVisibility(View.VISIBLE);
|
|
|
|
} else {
|
|
|
|
detailsView.setVisibility(View.GONE);
|
|
|
|
}
|
2017-11-11 23:47:34 +01:00
|
|
|
|
2022-02-18 23:44:14 +01:00
|
|
|
// Get the entry's descriptions which are displayed in the dialog
|
2021-12-27 16:16:40 +01:00
|
|
|
final String[] items = entries.stream()
|
|
|
|
.map(entry -> entry.getString(activity)).toArray(String[]::new);
|
|
|
|
|
2022-02-18 23:44:14 +01:00
|
|
|
// Call an entry's action / onClick method when the entry is selected.
|
2021-12-27 16:16:40 +01:00
|
|
|
final DialogInterface.OnClickListener action = (d, index) ->
|
|
|
|
entries.get(index).action.onClick(fragment, info);
|
|
|
|
|
2017-11-11 23:47:34 +01:00
|
|
|
dialog = new AlertDialog.Builder(activity)
|
|
|
|
.setCustomTitle(bannerView)
|
2021-12-27 16:16:40 +01:00
|
|
|
.setItems(items, action)
|
2017-11-11 23:47:34 +01:00
|
|
|
.create();
|
2021-12-27 16:16:40 +01:00
|
|
|
|
2017-11-11 23:47:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void show() {
|
|
|
|
dialog.show();
|
|
|
|
}
|
2021-12-27 16:16:40 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* <p>Builder to generate a {@link InfoItemDialog}.</p>
|
|
|
|
* Use {@link #addEntry(StreamDialogDefaultEntry)}
|
|
|
|
* and {@link #addAllEntries(StreamDialogDefaultEntry...)} to add options to the dialog.
|
|
|
|
* <br>
|
|
|
|
* Custom actions for entries can be set using
|
|
|
|
* {@link #setAction(StreamDialogDefaultEntry, StreamDialogEntry.StreamDialogEntryAction)}.
|
|
|
|
*/
|
|
|
|
public static class Builder {
|
|
|
|
@NonNull private final Activity activity;
|
2021-12-26 15:34:36 +01:00
|
|
|
@NonNull private final Context context;
|
2021-12-23 00:33:34 +01:00
|
|
|
@NonNull private final StreamInfoItem infoItem;
|
2021-12-27 16:16:40 +01:00
|
|
|
@NonNull private final Fragment fragment;
|
|
|
|
@NonNull private final List<StreamDialogEntry> entries = new ArrayList<>();
|
2021-12-23 00:33:34 +01:00
|
|
|
private final boolean addDefaultEntriesAutomatically;
|
2021-12-27 16:16:40 +01:00
|
|
|
|
2021-12-26 15:34:36 +01:00
|
|
|
/**
|
|
|
|
* <p>Create a Builder instance that automatically adds the some default entries
|
|
|
|
* at the top and bottom of the dialog.</p>
|
|
|
|
* The dialog has the following structure:
|
|
|
|
* <pre>
|
|
|
|
* + - - - - - - - - - - - - - - - - - - - - - -+
|
|
|
|
* | ENQUEUE |
|
2022-02-18 23:44:14 +01:00
|
|
|
* | ENQUEUE_NEXT |
|
2021-12-26 15:34:36 +01:00
|
|
|
* | START_ON_BACKGROUND |
|
|
|
|
* | START_ON_POPUP |
|
|
|
|
* + - - - - - - - - - - - - - - - - - - - - - -+
|
|
|
|
* | entries added manually with |
|
|
|
|
* | addEntry() and addAllEntries() |
|
|
|
|
* + - - - - - - - - - - - - - - - - - - - - - -+
|
|
|
|
* | APPEND_PLAYLIST |
|
|
|
|
* | SHARE |
|
|
|
|
* | OPEN_IN_BROWSER |
|
|
|
|
* | PLAY_WITH_KODI |
|
|
|
|
* | MARK_AS_WATCHED |
|
|
|
|
* | SHOW_CHANNEL_DETAILS |
|
|
|
|
* + - - - - - - - - - - - - - - - - - - - - - -+
|
|
|
|
* </pre>
|
|
|
|
* Please note that some entries are not added depending on the user's preferences,
|
|
|
|
* the item's {@link StreamType} and the current player state.
|
|
|
|
*
|
|
|
|
* @param activity
|
|
|
|
* @param context
|
|
|
|
* @param fragment
|
|
|
|
* @param infoItem the item for this dialog; all entries and their actions work with
|
2022-02-18 23:44:14 +01:00
|
|
|
* this {@link StreamInfoItem}
|
|
|
|
* @throws IllegalArgumentException if <code>activity, context</code>
|
|
|
|
* or resources is <code>null</code>
|
2021-12-26 15:34:36 +01:00
|
|
|
*/
|
2022-02-18 23:44:14 +01:00
|
|
|
public Builder(final Activity activity,
|
|
|
|
final Context context,
|
2021-12-27 16:16:40 +01:00
|
|
|
@NonNull final Fragment fragment,
|
2021-12-23 00:33:34 +01:00
|
|
|
@NonNull final StreamInfoItem infoItem) {
|
2021-12-26 15:34:36 +01:00
|
|
|
this(activity, context, fragment, infoItem, true);
|
2021-12-23 00:33:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-12-26 15:34:36 +01:00
|
|
|
* <p>Create an instance of this Builder.</p>
|
|
|
|
* <p>If {@code addDefaultEntriesAutomatically} is set to {@code true},
|
|
|
|
* some default entries are added to the top and bottom of the dialog.</p>
|
|
|
|
* The dialog has the following structure:
|
|
|
|
* <pre>
|
|
|
|
* + - - - - - - - - - - - - - - - - - - - - - -+
|
|
|
|
* | ENQUEUE |
|
2022-02-18 23:44:14 +01:00
|
|
|
* | ENQUEUE_NEXT |
|
2021-12-26 15:34:36 +01:00
|
|
|
* | START_ON_BACKGROUND |
|
|
|
|
* | START_ON_POPUP |
|
|
|
|
* + - - - - - - - - - - - - - - - - - - - - - -+
|
|
|
|
* | entries added manually with |
|
|
|
|
* | addEntry() and addAllEntries() |
|
|
|
|
* + - - - - - - - - - - - - - - - - - - - - - -+
|
|
|
|
* | APPEND_PLAYLIST |
|
|
|
|
* | SHARE |
|
|
|
|
* | OPEN_IN_BROWSER |
|
|
|
|
* | PLAY_WITH_KODI |
|
|
|
|
* | MARK_AS_WATCHED |
|
|
|
|
* | SHOW_CHANNEL_DETAILS |
|
|
|
|
* + - - - - - - - - - - - - - - - - - - - - - -+
|
|
|
|
* </pre>
|
|
|
|
* Please note that some entries are not added depending on the user's preferences,
|
|
|
|
* the item's {@link StreamType} and the current player state.
|
|
|
|
*
|
2021-12-23 00:33:34 +01:00
|
|
|
* @param activity
|
2021-12-26 15:34:36 +01:00
|
|
|
* @param context
|
2021-12-23 00:33:34 +01:00
|
|
|
* @param fragment
|
|
|
|
* @param infoItem
|
2021-12-26 15:34:36 +01:00
|
|
|
* @param addDefaultEntriesAutomatically
|
|
|
|
* whether default entries added with {@link #addDefaultBeginningEntries()}
|
|
|
|
* and {@link #addDefaultEndEntries()} are added automatically when generating
|
|
|
|
* the {@link InfoItemDialog}.
|
|
|
|
* <br/>
|
|
|
|
* Entries added with {@link #addEntry(StreamDialogDefaultEntry)} and
|
|
|
|
* {@link #addAllEntries(StreamDialogDefaultEntry...)} are added in between.
|
2022-02-18 23:44:14 +01:00
|
|
|
* @throws IllegalArgumentException if <code>activity, context</code>
|
|
|
|
* or resources is <code>null</code>
|
2021-12-23 00:33:34 +01:00
|
|
|
*/
|
2022-02-18 23:44:14 +01:00
|
|
|
public Builder(final Activity activity,
|
|
|
|
final Context context,
|
2021-12-23 00:33:34 +01:00
|
|
|
@NonNull final Fragment fragment,
|
|
|
|
@NonNull final StreamInfoItem infoItem,
|
|
|
|
final boolean addDefaultEntriesAutomatically) {
|
2022-02-18 23:44:14 +01:00
|
|
|
if (activity == null || context == null || context.getResources() == null) {
|
|
|
|
if (DEBUG) {
|
|
|
|
Log.d(TAG, "activity, context or resources is null: activity = "
|
|
|
|
+ activity + ", context = " + context);
|
|
|
|
}
|
|
|
|
throw new IllegalArgumentException("activity, context or resources is null");
|
|
|
|
}
|
2021-12-27 16:16:40 +01:00
|
|
|
this.activity = activity;
|
2021-12-26 15:34:36 +01:00
|
|
|
this.context = context;
|
2021-12-27 16:16:40 +01:00
|
|
|
this.fragment = fragment;
|
2021-12-23 00:33:34 +01:00
|
|
|
this.infoItem = infoItem;
|
|
|
|
this.addDefaultEntriesAutomatically = addDefaultEntriesAutomatically;
|
|
|
|
if (addDefaultEntriesAutomatically) {
|
2021-12-26 15:34:36 +01:00
|
|
|
addDefaultBeginningEntries();
|
2021-12-23 00:33:34 +01:00
|
|
|
}
|
2021-12-27 16:16:40 +01:00
|
|
|
}
|
|
|
|
|
2022-02-18 23:44:14 +01:00
|
|
|
/**
|
|
|
|
* Adds a new entry and appends it to the current entry list.
|
|
|
|
* @param entry the entry to add
|
|
|
|
* @return the current {@link Builder} instance
|
|
|
|
*/
|
|
|
|
public Builder addEntry(@NonNull final StreamDialogDefaultEntry entry) {
|
2021-12-27 16:16:40 +01:00
|
|
|
entries.add(entry.toStreamDialogEntry());
|
2022-02-18 23:44:14 +01:00
|
|
|
return this;
|
2021-12-27 16:16:40 +01:00
|
|
|
}
|
|
|
|
|
2022-02-18 23:44:14 +01:00
|
|
|
/**
|
|
|
|
* Adds new entries. These are appended to the current entry list.
|
|
|
|
* @param newEntries the entries to add
|
|
|
|
* @return the current {@link Builder} instance
|
|
|
|
*/
|
|
|
|
public Builder addAllEntries(@NonNull final StreamDialogDefaultEntry... newEntries) {
|
|
|
|
Stream.of(newEntries).forEach(this::addEntry);
|
|
|
|
return this;
|
2021-12-27 16:16:40 +01:00
|
|
|
}
|
|
|
|
|
2021-12-23 00:33:34 +01:00
|
|
|
/**
|
|
|
|
* <p>Change an entries' action that is called when the entry is selected.</p>
|
|
|
|
* <p><strong>Warning:</strong> Only use this method when the entry has been already added.
|
|
|
|
* Changing the action of an entry which has not been added to the Builder yet
|
|
|
|
* does not have an effect.</p>
|
|
|
|
* @param entry the entry to change
|
|
|
|
* @param action the action to perform when the entry is selected
|
2022-02-18 23:44:14 +01:00
|
|
|
* @return the current {@link Builder} instance
|
2021-12-23 00:33:34 +01:00
|
|
|
*/
|
2022-02-18 23:44:14 +01:00
|
|
|
public Builder setAction(@NonNull final StreamDialogDefaultEntry entry,
|
2021-12-27 16:16:40 +01:00
|
|
|
@NonNull final StreamDialogEntry.StreamDialogEntryAction action) {
|
|
|
|
for (int i = 0; i < entries.size(); i++) {
|
|
|
|
if (entries.get(i).resource == entry.resource) {
|
|
|
|
entries.set(i, new StreamDialogEntry(entry.resource, action));
|
2022-02-18 23:44:14 +01:00
|
|
|
return this;
|
2021-12-27 16:16:40 +01:00
|
|
|
}
|
|
|
|
}
|
2022-02-18 23:44:14 +01:00
|
|
|
return this;
|
2021-12-27 16:16:40 +01:00
|
|
|
}
|
|
|
|
|
2021-12-26 15:34:36 +01:00
|
|
|
/**
|
|
|
|
* Adds {@link StreamDialogDefaultEntry#ENQUEUE} if the player is open and
|
|
|
|
* {@link StreamDialogDefaultEntry#ENQUEUE_NEXT} if there are multiple streams
|
|
|
|
* in the play queue.
|
2022-02-18 23:44:14 +01:00
|
|
|
* @return the current {@link Builder} instance
|
2021-12-26 15:34:36 +01:00
|
|
|
*/
|
2022-02-18 23:44:14 +01:00
|
|
|
public Builder addEnqueueEntriesIfNeeded() {
|
2022-02-19 00:02:15 +01:00
|
|
|
if (PlayerHolder.getInstance().isPlayQueueReady()) {
|
2021-12-27 16:16:40 +01:00
|
|
|
addEntry(StreamDialogDefaultEntry.ENQUEUE);
|
|
|
|
|
|
|
|
if (PlayerHolder.getInstance().getQueueSize() > 1) {
|
|
|
|
addEntry(StreamDialogDefaultEntry.ENQUEUE_NEXT);
|
|
|
|
}
|
|
|
|
}
|
2022-02-18 23:44:14 +01:00
|
|
|
return this;
|
2021-12-27 16:16:40 +01:00
|
|
|
}
|
|
|
|
|
2021-12-26 15:34:36 +01:00
|
|
|
/**
|
|
|
|
* Adds the {@link StreamDialogDefaultEntry#START_HERE_ON_BACKGROUND}.
|
|
|
|
* If the {@link #infoItem} is not a pure audio (live) stream,
|
|
|
|
* {@link StreamDialogDefaultEntry#START_HERE_ON_POPUP} is added, too.
|
2022-02-18 23:44:14 +01:00
|
|
|
* @return the current {@link Builder} instance
|
2021-12-26 15:34:36 +01:00
|
|
|
*/
|
2022-02-18 23:44:14 +01:00
|
|
|
public Builder addStartHereEntries() {
|
2021-12-27 16:16:40 +01:00
|
|
|
addEntry(StreamDialogDefaultEntry.START_HERE_ON_BACKGROUND);
|
2021-12-23 00:33:34 +01:00
|
|
|
if (infoItem.getStreamType() != StreamType.AUDIO_STREAM
|
|
|
|
&& infoItem.getStreamType() != StreamType.AUDIO_LIVE_STREAM) {
|
2021-12-27 16:16:40 +01:00
|
|
|
addEntry(StreamDialogDefaultEntry.START_HERE_ON_POPUP);
|
|
|
|
}
|
2022-02-18 23:44:14 +01:00
|
|
|
return this;
|
2021-12-27 16:16:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds {@link StreamDialogDefaultEntry.MARK_AS_WATCHED} if the watch history is enabled
|
|
|
|
* and the stream is not a livestream.
|
2022-02-18 23:44:14 +01:00
|
|
|
* @return the current {@link Builder} instance
|
2021-12-27 16:16:40 +01:00
|
|
|
*/
|
2022-02-18 23:44:14 +01:00
|
|
|
public Builder addMarkAsWatchedEntryIfNeeded() {
|
2021-12-27 16:16:40 +01:00
|
|
|
final boolean isWatchHistoryEnabled = PreferenceManager
|
2021-12-26 15:34:36 +01:00
|
|
|
.getDefaultSharedPreferences(context)
|
|
|
|
.getBoolean(context.getString(R.string.enable_watch_history_key), false);
|
2021-12-23 00:33:34 +01:00
|
|
|
if (isWatchHistoryEnabled
|
|
|
|
&& infoItem.getStreamType() != StreamType.LIVE_STREAM
|
|
|
|
&& infoItem.getStreamType() != StreamType.AUDIO_LIVE_STREAM) {
|
2021-12-27 16:16:40 +01:00
|
|
|
addEntry(StreamDialogDefaultEntry.MARK_AS_WATCHED);
|
|
|
|
}
|
2022-02-18 23:44:14 +01:00
|
|
|
return this;
|
2021-12-27 16:16:40 +01:00
|
|
|
}
|
|
|
|
|
2022-02-18 23:44:14 +01:00
|
|
|
/**
|
|
|
|
* Adds the {@link StreamDialogDefaultEntry.PLAY_WITH_KODI} entry if it is needed.
|
|
|
|
* @return the current {@link Builder} instance
|
|
|
|
*/
|
|
|
|
public Builder addPlayWithKodiEntryIfNeeded() {
|
2021-12-26 15:34:36 +01:00
|
|
|
if (KoreUtils.shouldShowPlayWithKodi(context, infoItem.getServiceId())) {
|
2021-12-27 16:16:40 +01:00
|
|
|
addEntry(StreamDialogDefaultEntry.PLAY_WITH_KODI);
|
|
|
|
}
|
2022-02-18 23:44:14 +01:00
|
|
|
return this;
|
2021-12-27 16:16:40 +01:00
|
|
|
}
|
|
|
|
|
2021-12-26 15:34:36 +01:00
|
|
|
/**
|
|
|
|
* Add the entries which are usually at the top of the action list.
|
|
|
|
* <br/>
|
|
|
|
* This method adds the "enqueue" (see {@link #addEnqueueEntriesIfNeeded()})
|
|
|
|
* and "start here" (see {@link #addStartHereEntries()} entries.
|
2022-02-18 23:44:14 +01:00
|
|
|
* @return the current {@link Builder} instance
|
2021-12-26 15:34:36 +01:00
|
|
|
*/
|
2022-02-18 23:44:14 +01:00
|
|
|
public Builder addDefaultBeginningEntries() {
|
2021-12-27 16:16:36 +01:00
|
|
|
addEnqueueEntriesIfNeeded();
|
|
|
|
addStartHereEntries();
|
2022-02-18 23:44:14 +01:00
|
|
|
return this;
|
2021-12-27 16:16:36 +01:00
|
|
|
}
|
|
|
|
|
2021-12-26 15:34:36 +01:00
|
|
|
/**
|
|
|
|
* Add the entries which are usually at the bottom of the action list.
|
2022-02-18 23:44:14 +01:00
|
|
|
* @return the current {@link Builder} instance
|
2021-12-26 15:34:36 +01:00
|
|
|
*/
|
2022-02-18 23:44:14 +01:00
|
|
|
public Builder addDefaultEndEntries() {
|
2021-12-27 16:16:36 +01:00
|
|
|
addAllEntries(
|
|
|
|
StreamDialogDefaultEntry.APPEND_PLAYLIST,
|
|
|
|
StreamDialogDefaultEntry.SHARE,
|
|
|
|
StreamDialogDefaultEntry.OPEN_IN_BROWSER
|
|
|
|
);
|
|
|
|
addPlayWithKodiEntryIfNeeded();
|
2021-12-23 00:33:34 +01:00
|
|
|
addMarkAsWatchedEntryIfNeeded();
|
2021-12-26 15:34:36 +01:00
|
|
|
addEntry(StreamDialogDefaultEntry.SHOW_CHANNEL_DETAILS);
|
2022-02-18 23:44:14 +01:00
|
|
|
return this;
|
2021-12-27 16:16:36 +01:00
|
|
|
}
|
|
|
|
|
2021-12-27 16:16:40 +01:00
|
|
|
/**
|
|
|
|
* Creates the {@link InfoItemDialog}.
|
|
|
|
* @return a new instance of {@link InfoItemDialog}
|
|
|
|
*/
|
|
|
|
public InfoItemDialog create() {
|
2021-12-23 00:33:34 +01:00
|
|
|
if (addDefaultEntriesAutomatically) {
|
2021-12-26 15:34:36 +01:00
|
|
|
addDefaultEndEntries();
|
2021-12-23 00:33:34 +01:00
|
|
|
}
|
|
|
|
return new InfoItemDialog(this.activity, this.fragment, this.infoItem, this.entries);
|
2021-12-27 16:16:40 +01:00
|
|
|
}
|
2022-02-18 23:44:14 +01:00
|
|
|
|
|
|
|
public static void reportErrorDuringInitialization(final Throwable throwable,
|
|
|
|
final InfoItem item) {
|
|
|
|
ErrorUtil.showSnackbar(App.getApp().getBaseContext(), new ErrorInfo(
|
|
|
|
throwable,
|
|
|
|
UserAction.OPEN_INFO_ITEM_DIALOG,
|
|
|
|
"none",
|
|
|
|
item.getServiceId()));
|
|
|
|
}
|
2021-12-27 16:16:40 +01:00
|
|
|
}
|
2017-11-11 23:47:34 +01:00
|
|
|
}
|