1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-06-25 22:53:20 +00:00

Optimize imports and solve checkstyle issues

This commit is contained in:
Stypox 2020-12-11 15:07:18 +01:00
parent c43bca6007
commit 1fc8e4c148
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
25 changed files with 101 additions and 98 deletions

View File

@ -155,7 +155,7 @@ task formatKtlint(type: JavaExec) {
} }
afterEvaluate { afterEvaluate {
//preDebugBuild.dependsOn formatKtlint, runCheckstyle, runKtlint preDebugBuild.dependsOn formatKtlint, runCheckstyle, runKtlint
} }
dependencies { dependencies {

View File

@ -60,6 +60,7 @@ import org.schabi.newpipe.databinding.DrawerHeaderBinding;
import org.schabi.newpipe.databinding.DrawerLayoutBinding; import org.schabi.newpipe.databinding.DrawerLayoutBinding;
import org.schabi.newpipe.databinding.InstanceSpinnerLayoutBinding; import org.schabi.newpipe.databinding.InstanceSpinnerLayoutBinding;
import org.schabi.newpipe.databinding.ToolbarLayoutBinding; import org.schabi.newpipe.databinding.ToolbarLayoutBinding;
import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ExtractionException;
@ -72,7 +73,6 @@ import org.schabi.newpipe.player.Player;
import org.schabi.newpipe.player.event.OnKeyDownListener; import org.schabi.newpipe.player.event.OnKeyDownListener;
import org.schabi.newpipe.player.helper.PlayerHolder; import org.schabi.newpipe.player.helper.PlayerHolder;
import org.schabi.newpipe.player.playqueue.PlayQueue; import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.util.Constants; import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.DeviceUtils; import org.schabi.newpipe.util.DeviceUtils;
import org.schabi.newpipe.util.KioskTranslator; import org.schabi.newpipe.util.KioskTranslator;
@ -679,19 +679,16 @@ public class MainActivity extends AppCompatActivity {
} }
@Override @Override
public boolean onOptionsItemSelected(final MenuItem item) { public boolean onOptionsItemSelected(@NonNull final MenuItem item) {
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "onOptionsItemSelected() called with: item = [" + item + "]"); Log.d(TAG, "onOptionsItemSelected() called with: item = [" + item + "]");
} }
final int id = item.getItemId();
switch (id) { if (item.getItemId() == android.R.id.home) {
case android.R.id.home: onHomeButtonPressed();
onHomeButtonPressed(); return true;
return true;
default:
return super.onOptionsItemSelected(item);
} }
return super.onOptionsItemSelected(item);
} }
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////

View File

@ -7,7 +7,6 @@ import org.schabi.newpipe.database.playlist.model.PlaylistStreamEntity
import org.schabi.newpipe.database.stream.model.StreamEntity import org.schabi.newpipe.database.stream.model.StreamEntity
import org.schabi.newpipe.database.stream.model.StreamStateEntity import org.schabi.newpipe.database.stream.model.StreamStateEntity
import org.schabi.newpipe.extractor.stream.StreamInfoItem import org.schabi.newpipe.extractor.stream.StreamInfoItem
import kotlin.jvm.Throws
data class PlaylistStreamEntry( data class PlaylistStreamEntry(
@Embedded @Embedded

View File

@ -37,6 +37,9 @@ import org.schabi.newpipe.MainActivity;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.RouterActivity; import org.schabi.newpipe.RouterActivity;
import org.schabi.newpipe.databinding.DownloadDialogBinding; import org.schabi.newpipe.databinding.DownloadDialogBinding;
import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.extractor.MediaFormat; import org.schabi.newpipe.extractor.MediaFormat;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.localization.Localization; import org.schabi.newpipe.extractor.localization.Localization;
@ -45,9 +48,6 @@ import org.schabi.newpipe.extractor.stream.Stream;
import org.schabi.newpipe.extractor.stream.StreamInfo; import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.stream.SubtitlesStream; import org.schabi.newpipe.extractor.stream.SubtitlesStream;
import org.schabi.newpipe.extractor.stream.VideoStream; import org.schabi.newpipe.extractor.stream.VideoStream;
import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.settings.NewPipeSettings; import org.schabi.newpipe.settings.NewPipeSettings;
import org.schabi.newpipe.util.FilePickerActivityHelper; import org.schabi.newpipe.util.FilePickerActivityHelper;
import org.schabi.newpipe.util.FilenameUtils; import org.schabi.newpipe.util.FilenameUtils;
@ -61,7 +61,6 @@ import org.schabi.newpipe.util.ThemeHelper;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;

View File

@ -259,7 +259,8 @@ public class ErrorActivity extends AppCompatActivity {
} }
private void goToReturnActivity() { private void goToReturnActivity() {
final Class<? extends Activity> checkedReturnActivity = getReturnActivity(savedReturnActivity); final Class<? extends Activity> checkedReturnActivity =
getReturnActivity(savedReturnActivity);
if (checkedReturnActivity == null) { if (checkedReturnActivity == null) {
super.onBackPressed(); super.onBackPressed();
} else { } else {

View File

@ -16,58 +16,58 @@ import java.io.StringWriter
@Parcelize @Parcelize
class ErrorInfo( class ErrorInfo(
val stackTraces: Array<String>, val stackTraces: Array<String>,
val userAction: UserAction, val userAction: UserAction,
val serviceName: String, val serviceName: String,
val request: String, val request: String,
val messageStringId: Int, val messageStringId: Int,
@Transient // no need to store throwable, all data for report is in other variables @Transient // no need to store throwable, all data for report is in other variables
var throwable: Throwable? = null var throwable: Throwable? = null
) : Parcelable { ) : Parcelable {
private constructor( private constructor(
throwable: Throwable, throwable: Throwable,
userAction: UserAction, userAction: UserAction,
serviceName: String, serviceName: String,
request: String request: String
) : this( ) : this(
throwableToStringList(throwable), throwableToStringList(throwable),
userAction, userAction,
serviceName, serviceName,
request, request,
getMessageStringId(throwable, userAction), getMessageStringId(throwable, userAction),
throwable throwable
) )
private constructor( private constructor(
throwable: List<Throwable>, throwable: List<Throwable>,
userAction: UserAction, userAction: UserAction,
serviceName: String, serviceName: String,
request: String request: String
) : this( ) : this(
throwableListToStringList(throwable), throwableListToStringList(throwable),
userAction, userAction,
serviceName, serviceName,
request, request,
getMessageStringId(throwable.firstOrNull(), userAction), getMessageStringId(throwable.firstOrNull(), userAction),
throwable.firstOrNull() throwable.firstOrNull()
) )
// constructors with single throwable // constructors with single throwable
constructor(throwable: Throwable, userAction: UserAction, request: String) constructor(throwable: Throwable, userAction: UserAction, request: String) :
: this(throwable, userAction, SERVICE_NONE, request) this(throwable, userAction, SERVICE_NONE, request)
constructor(throwable: Throwable, userAction: UserAction, request: String, serviceId: Int) constructor(throwable: Throwable, userAction: UserAction, request: String, serviceId: Int) :
: this(throwable, userAction, NewPipe.getNameOfService(serviceId), request) this(throwable, userAction, NewPipe.getNameOfService(serviceId), request)
constructor(throwable: Throwable, userAction: UserAction, request: String, info: Info?) constructor(throwable: Throwable, userAction: UserAction, request: String, info: Info?) :
: this(throwable, userAction, getInfoServiceName(info), request) this(throwable, userAction, getInfoServiceName(info), request)
// constructors with list of throwables // constructors with list of throwables
constructor(throwable: List<Throwable>, userAction: UserAction, request: String) constructor(throwable: List<Throwable>, userAction: UserAction, request: String) :
: this(throwable, userAction, SERVICE_NONE, request) this(throwable, userAction, SERVICE_NONE, request)
constructor(throwable: List<Throwable>, userAction: UserAction, request: String, serviceId: Int) constructor(throwable: List<Throwable>, userAction: UserAction, request: String, serviceId: Int) :
: this(throwable, userAction, NewPipe.getNameOfService(serviceId), request) this(throwable, userAction, NewPipe.getNameOfService(serviceId), request)
constructor(throwable: List<Throwable>, userAction: UserAction, request: String, info: Info?) constructor(throwable: List<Throwable>, userAction: UserAction, request: String, info: Info?) :
: this(throwable, userAction, getInfoServiceName(info), request) this(throwable, userAction, getInfoServiceName(info), request)
companion object { companion object {
const val SERVICE_NONE = "none" const val SERVICE_NONE = "none"
@ -87,18 +87,20 @@ class ErrorInfo(
Array(throwable.size) { i -> getStackTrace(throwable[i]) } Array(throwable.size) { i -> getStackTrace(throwable[i]) }
private fun getInfoServiceName(info: Info?) = private fun getInfoServiceName(info: Info?) =
if (info == null) SERVICE_NONE else NewPipe.getNameOfService(info.serviceId) if (info == null) SERVICE_NONE else NewPipe.getNameOfService(info.serviceId)
@StringRes @StringRes
private fun getMessageStringId(throwable: Throwable?, private fun getMessageStringId(
action: UserAction): Int { throwable: Throwable?,
action: UserAction
): Int {
return when { return when {
throwable is ContentNotAvailableException -> R.string.content_not_available throwable is ContentNotAvailableException -> R.string.content_not_available
throwable != null && throwable.isNetworkRelated -> R.string.network_error throwable != null && throwable.isNetworkRelated -> R.string.network_error
throwable is ContentNotSupportedException -> R.string.content_not_supported throwable is ContentNotSupportedException -> R.string.content_not_supported
throwable is DeobfuscateException -> R.string.youtube_signature_deobfuscation_error throwable is DeobfuscateException -> R.string.youtube_signature_deobfuscation_error
throwable is ExtractionException -> R.string.parsing_error throwable is ExtractionException -> R.string.parsing_error
action == UserAction.UI_ERROR -> R.string.app_ui_crash action == UserAction.UI_ERROR -> R.string.app_ui_crash
action == UserAction.REQUESTED_COMMENTS -> R.string.error_unable_to_load_comments action == UserAction.REQUESTED_COMMENTS -> R.string.error_unable_to_load_comments
action == UserAction.SUBSCRIPTION_CHANGE -> R.string.subscription_change_failed action == UserAction.SUBSCRIPTION_CHANGE -> R.string.subscription_change_failed
action == UserAction.SUBSCRIPTION_UPDATE -> R.string.subscription_update_failed action == UserAction.SUBSCRIPTION_UPDATE -> R.string.subscription_update_failed

View File

@ -28,9 +28,9 @@ import org.schabi.newpipe.ktx.isNetworkRelated
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
class ErrorPanelHelper( class ErrorPanelHelper(
private val fragment: Fragment, private val fragment: Fragment,
rootView: View, rootView: View,
onRetry: Runnable onRetry: Runnable
) { ) {
private val context: Context = rootView.context!! private val context: Context = rootView.context!!
private val errorPanelRoot: View = rootView.findViewById(R.id.error_panel) private val errorPanelRoot: View = rootView.findViewById(R.id.error_panel)
@ -62,22 +62,23 @@ class ErrorPanelHelper(
errorButtonAction.setOnClickListener { errorButtonAction.setOnClickListener {
// Starting ReCaptcha Challenge Activity // Starting ReCaptcha Challenge Activity
val intent = Intent(context, ReCaptchaActivity::class.java) val intent = Intent(context, ReCaptchaActivity::class.java)
intent.putExtra(ReCaptchaActivity.RECAPTCHA_URL_EXTRA, intent.putExtra(
(errorInfo.throwable as ReCaptchaException).url) ReCaptchaActivity.RECAPTCHA_URL_EXTRA,
(errorInfo.throwable as ReCaptchaException).url
)
fragment.startActivityForResult(intent, ReCaptchaActivity.RECAPTCHA_REQUEST) fragment.startActivityForResult(intent, ReCaptchaActivity.RECAPTCHA_REQUEST)
errorButtonAction.setOnClickListener(null) errorButtonAction.setOnClickListener(null)
} }
errorTextView.setText(R.string.recaptcha_request_toast) errorTextView.setText(R.string.recaptcha_request_toast)
errorButtonRetry.isVisible = true errorButtonRetry.isVisible = true
} else { } else {
errorButtonAction.setText(R.string.error_snackbar_action) errorButtonAction.setText(R.string.error_snackbar_action)
errorButtonAction.setOnClickListener { errorButtonAction.setOnClickListener {
ErrorActivity.reportError( ErrorActivity.reportError(
context, context,
MainActivity::class.java, MainActivity::class.java,
null, null,
errorInfo errorInfo
) )
} }

View File

@ -306,7 +306,8 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I>
selectedItem.getUrl(), selectedItem.getUrl(),
selectedItem.getName()); selectedItem.getName());
} catch (final Exception e) { } catch (final Exception e) {
ErrorActivity.reportUiError(getActivity(), null, "Opening playlist fragment", e); ErrorActivity.reportUiError(getActivity(), null,
"Opening playlist fragment", e);
} }
} }
}); });

View File

@ -403,7 +403,8 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
currentInfo.getParentChannelUrl(), currentInfo.getParentChannelUrl(),
currentInfo.getParentChannelName()); currentInfo.getParentChannelName());
} catch (final Exception e) { } catch (final Exception e) {
ErrorActivity.reportUiError(getActivity(), null, "Opening channel fragment", e); ErrorActivity.reportUiError(getActivity(), null,
"Opening channel fragment", e);
} }
} else if (DEBUG) { } else if (DEBUG) {
Log.i(TAG, "Can't open parent channel because we got no channel URL"); Log.i(TAG, "Can't open parent channel because we got no channel URL");

View File

@ -3,10 +3,10 @@ package org.schabi.newpipe.fragments.list.kiosk;
import android.os.Bundle; import android.os.Bundle;
import org.schabi.newpipe.error.ErrorInfo; import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.kiosk.KioskList; import org.schabi.newpipe.extractor.kiosk.KioskList;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.util.KioskTranslator; import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.ServiceHelper; import org.schabi.newpipe.util.ServiceHelper;

View File

@ -13,6 +13,7 @@ import androidx.appcompat.app.ActionBar;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.error.ErrorInfo; import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.StreamingService;
@ -21,7 +22,6 @@ import org.schabi.newpipe.extractor.kiosk.KioskInfo;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory; import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
import org.schabi.newpipe.extractor.localization.ContentCountry; import org.schabi.newpipe.extractor.localization.ContentCountry;
import org.schabi.newpipe.fragments.list.BaseListInfoFragment; import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.util.ExtractorHelper; import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.KioskTranslator; import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.Localization; import org.schabi.newpipe.util.Localization;

View File

@ -286,7 +286,8 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
NavigationHelper.openChannelFragment(getFM(), result.getServiceId(), NavigationHelper.openChannelFragment(getFM(), result.getServiceId(),
result.getUploaderUrl(), result.getUploaderName()); result.getUploaderUrl(), result.getUploaderName());
} catch (final Exception e) { } catch (final Exception e) {
ErrorActivity.reportUiError(getActivity(), null, "Opening channel fragment", e); ErrorActivity.reportUiError(getActivity(), null,
"Opening channel fragment", e);
} }
}); });
} }

View File

@ -845,7 +845,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
disposables.add(historyRecordManager.onSearched(serviceId, theSearchString) disposables.add(historyRecordManager.onSearched(serviceId, theSearchString)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
ignored -> {}, ignored -> { },
throwable -> showSnackBarError(new ErrorInfo(throwable, UserAction.SEARCHED, throwable -> showSnackBarError(new ErrorInfo(throwable, UserAction.SEARCHED,
theSearchString, serviceId)) theSearchString, serviceId))
)); ));

View File

@ -16,12 +16,11 @@ import androidx.viewbinding.ViewBinding;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.databinding.RelatedStreamsHeaderBinding; import org.schabi.newpipe.databinding.RelatedStreamsHeaderBinding;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.stream.StreamInfo; import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.fragments.list.BaseListInfoFragment; import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
import org.schabi.newpipe.ktx.ViewUtils; import org.schabi.newpipe.ktx.ViewUtils;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.util.RelatedStreamInfo; import org.schabi.newpipe.util.RelatedStreamInfo;
import java.io.Serializable; import java.io.Serializable;
@ -160,11 +159,9 @@ public class RelatedVideosFragment extends BaseListInfoFragment<RelatedStreamInf
@Override @Override
protected void onRestoreInstanceState(@NonNull final Bundle savedState) { protected void onRestoreInstanceState(@NonNull final Bundle savedState) {
super.onRestoreInstanceState(savedState); super.onRestoreInstanceState(savedState);
if (savedState != null) { final Serializable serializable = savedState.getSerializable(INFO_KEY);
final Serializable serializable = savedState.getSerializable(INFO_KEY); if (serializable instanceof RelatedStreamInfo) {
if (serializable instanceof RelatedStreamInfo) { this.relatedStreamInfo = (RelatedStreamInfo) serializable;
this.relatedStreamInfo = (RelatedStreamInfo) serializable;
}
} }
} }

View File

@ -24,10 +24,10 @@ import org.schabi.newpipe.database.playlist.PlaylistLocalItem;
import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry; import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry;
import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity; import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity;
import org.schabi.newpipe.error.ErrorInfo; import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.local.BaseLocalListFragment; import org.schabi.newpipe.local.BaseLocalListFragment;
import org.schabi.newpipe.local.playlist.LocalPlaylistManager; import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
import org.schabi.newpipe.local.playlist.RemotePlaylistManager; import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.OnClickGesture; import org.schabi.newpipe.util.OnClickGesture;

View File

@ -722,7 +722,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
@Override @Override
public void onSwiped(@NonNull final RecyclerView.ViewHolder viewHolder, public void onSwiped(@NonNull final RecyclerView.ViewHolder viewHolder,
final int swipeDir) {} final int swipeDir) { }
}; };
} }

View File

@ -22,13 +22,13 @@ import com.nononsenseapps.filepicker.Utils;
import org.schabi.newpipe.BaseFragment; import org.schabi.newpipe.BaseFragment;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor; import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
import org.schabi.newpipe.local.subscription.services.SubscriptionsImportService; import org.schabi.newpipe.local.subscription.services.SubscriptionsImportService;
import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.util.Constants; import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.FilePickerActivityHelper; import org.schabi.newpipe.util.FilePickerActivityHelper;
import org.schabi.newpipe.util.ServiceHelper; import org.schabi.newpipe.util.ServiceHelper;

View File

@ -42,7 +42,6 @@ import org.schabi.newpipe.local.subscription.item.PickerSubscriptionItem
import org.schabi.newpipe.util.DeviceUtils import org.schabi.newpipe.util.DeviceUtils
import org.schabi.newpipe.util.ThemeHelper import org.schabi.newpipe.util.ThemeHelper
import java.io.Serializable import java.io.Serializable
import kotlin.collections.contains
class FeedGroupDialog : DialogFragment(), BackPressable { class FeedGroupDialog : DialogFragment(), BackPressable {
private var _feedGroupCreateBinding: DialogFeedGroupCreateBinding? = null private var _feedGroupCreateBinding: DialogFeedGroupCreateBinding? = null

View File

@ -24,6 +24,10 @@ import org.schabi.newpipe.local.subscription.dialog.FeedGroupReorderDialogViewMo
import org.schabi.newpipe.local.subscription.item.FeedGroupReorderItem import org.schabi.newpipe.local.subscription.item.FeedGroupReorderItem
import org.schabi.newpipe.util.ThemeHelper import org.schabi.newpipe.util.ThemeHelper
import java.util.Collections import java.util.Collections
import kotlin.collections.ArrayList
import kotlin.collections.List
import kotlin.collections.map
import kotlin.collections.sortedBy
class FeedGroupReorderDialog : DialogFragment() { class FeedGroupReorderDialog : DialogFragment() {
private var _binding: DialogFeedGroupReorderBinding? = null private var _binding: DialogFeedGroupReorderBinding? = null

View File

@ -10,10 +10,10 @@ import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference; import androidx.preference.Preference;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.local.history.HistoryRecordManager;
import org.schabi.newpipe.error.ErrorActivity; import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.error.ErrorInfo; import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction; import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.local.history.HistoryRecordManager;
import org.schabi.newpipe.util.InfoCache; import org.schabi.newpipe.util.InfoCache;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
@ -91,7 +91,7 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
return recordManager.removeOrphanedRecords() return recordManager.removeOrphanedRecords()
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
howManyDeleted -> {}, howManyDeleted -> { },
throwable -> ErrorActivity.reportError(context, SettingsActivity.class, throwable -> ErrorActivity.reportError(context, SettingsActivity.class,
null, new ErrorInfo(throwable, UserAction.DELETE_FROM_HISTORY, null, new ErrorInfo(throwable, UserAction.DELETE_FROM_HISTORY,
"Clear orphaned records"))); "Clear orphaned records")));

View File

@ -162,7 +162,8 @@ public class SelectChannelFragment extends DialogFragment {
@Override @Override
public void onError(@NonNull final Throwable exception) { public void onError(@NonNull final Throwable exception) {
ErrorActivity.reportUiError(requireContext(), null, "Loading subscription", exception); ErrorActivity.reportUiError(requireContext(), null,
"Loading subscription", exception);
} }
@Override @Override

View File

@ -15,9 +15,9 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.util.KioskTranslator; import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.ServiceHelper; import org.schabi.newpipe.util.ServiceHelper;
import org.schabi.newpipe.util.ThemeHelper; import org.schabi.newpipe.util.ThemeHelper;

View File

@ -24,11 +24,11 @@ import org.schabi.newpipe.database.LocalItem;
import org.schabi.newpipe.database.playlist.PlaylistLocalItem; import org.schabi.newpipe.database.playlist.PlaylistLocalItem;
import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry; import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry;
import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity; import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity;
import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
import org.schabi.newpipe.error.ErrorActivity; import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.error.ErrorInfo; import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction; import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;

View File

@ -27,10 +27,10 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.error.ErrorActivity; import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.error.ErrorInfo; import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction; import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.settings.SelectChannelFragment; import org.schabi.newpipe.settings.SelectChannelFragment;
import org.schabi.newpipe.settings.SelectKioskFragment; import org.schabi.newpipe.settings.SelectKioskFragment;
import org.schabi.newpipe.settings.SelectPlaylistFragment; import org.schabi.newpipe.settings.SelectPlaylistFragment;

View File

@ -12,6 +12,9 @@ import com.grack.nanojson.JsonSink;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.database.LocalItem.LocalItemType; import org.schabi.newpipe.database.LocalItem.LocalItemType;
import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ExtractionException;
@ -25,9 +28,6 @@ import org.schabi.newpipe.local.feed.FeedFragment;
import org.schabi.newpipe.local.history.StatisticsPlaylistFragment; import org.schabi.newpipe.local.history.StatisticsPlaylistFragment;
import org.schabi.newpipe.local.playlist.LocalPlaylistFragment; import org.schabi.newpipe.local.playlist.LocalPlaylistFragment;
import org.schabi.newpipe.local.subscription.SubscriptionFragment; import org.schabi.newpipe.local.subscription.SubscriptionFragment;
import org.schabi.newpipe.error.ErrorActivity;
import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.util.KioskTranslator; import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.ServiceHelper; import org.schabi.newpipe.util.ServiceHelper;
import org.schabi.newpipe.util.ThemeHelper; import org.schabi.newpipe.util.ThemeHelper;