mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 08:30:44 +00:00
Merge pull request #4929 from TacoTheDank/murder-all-the-annoying-lints
Various code improvements
This commit is contained in:
commit
bbfa280e86
@ -86,8 +86,8 @@ public abstract class FragmentStatePagerAdapterMenuWorkaround extends PagerAdapt
|
|||||||
private final int mBehavior;
|
private final int mBehavior;
|
||||||
private FragmentTransaction mCurTransaction = null;
|
private FragmentTransaction mCurTransaction = null;
|
||||||
|
|
||||||
private ArrayList<Fragment.SavedState> mSavedState = new ArrayList<Fragment.SavedState>();
|
private final ArrayList<Fragment.SavedState> mSavedState = new ArrayList<Fragment.SavedState>();
|
||||||
private ArrayList<Fragment> mFragments = new ArrayList<Fragment>();
|
private final ArrayList<Fragment> mFragments = new ArrayList<Fragment>();
|
||||||
private Fragment mCurrentPrimaryItem = null;
|
private Fragment mCurrentPrimaryItem = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,8 +50,8 @@ public final class DownloaderImpl extends Downloader {
|
|||||||
public static final String YOUTUBE_DOMAIN = "youtube.com";
|
public static final String YOUTUBE_DOMAIN = "youtube.com";
|
||||||
|
|
||||||
private static DownloaderImpl instance;
|
private static DownloaderImpl instance;
|
||||||
private Map<String, String> mCookies;
|
private final Map<String, String> mCookies;
|
||||||
private OkHttpClient client;
|
private final OkHttpClient client;
|
||||||
|
|
||||||
private DownloaderImpl(final OkHttpClient.Builder builder) {
|
private DownloaderImpl(final OkHttpClient.Builder builder) {
|
||||||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
|
||||||
|
@ -139,8 +139,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
if (getSupportFragmentManager() != null
|
if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
||||||
&& getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
|
||||||
initFragments();
|
initFragments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ public class RouterActivity extends AppCompatActivity {
|
|||||||
disposables.add(ExtractorHelper.getStreamInfo(currentServiceId, currentUrl, true)
|
disposables.add(ExtractorHelper.getStreamInfo(currentServiceId, currentUrl, true)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe((@NonNull StreamInfo result) -> {
|
.subscribe(result -> {
|
||||||
final List<VideoStream> sortedVideoStreams = ListHelper
|
final List<VideoStream> sortedVideoStreams = ListHelper
|
||||||
.getSortedStreamVideosList(this, result.getVideoStreams(),
|
.getSortedStreamVideosList(this, result.getVideoStreams(),
|
||||||
result.getVideoOnlyStreams(), false);
|
result.getVideoOnlyStreams(), false);
|
||||||
@ -534,9 +534,8 @@ public class RouterActivity extends AppCompatActivity {
|
|||||||
downloadDialog.show(fm, "downloadDialog");
|
downloadDialog.show(fm, "downloadDialog");
|
||||||
fm.executePendingTransactions();
|
fm.executePendingTransactions();
|
||||||
downloadDialog.requireDialog().setOnDismissListener(dialog -> finish());
|
downloadDialog.requireDialog().setOnDismissListener(dialog -> finish());
|
||||||
}, (@NonNull Throwable throwable) -> {
|
}, throwable ->
|
||||||
showUnsupportedUrlDialog(currentUrl);
|
showUnsupportedUrlDialog(currentUrl)));
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,7 +31,7 @@ public class AboutActivity extends AppCompatActivity {
|
|||||||
/**
|
/**
|
||||||
* List of all software components.
|
* List of all software components.
|
||||||
*/
|
*/
|
||||||
private static final SoftwareComponent[] SOFTWARE_COMPONENTS = new SoftwareComponent[]{
|
private static final SoftwareComponent[] SOFTWARE_COMPONENTS = {
|
||||||
new SoftwareComponent("Giga Get", "2014 - 2015", "Peter Cai",
|
new SoftwareComponent("Giga Get", "2014 - 2015", "Peter Cai",
|
||||||
"https://github.com/PaperAirplane-Dev-Team/GigaGet", StandardLicenses.GPL3),
|
"https://github.com/PaperAirplane-Dev-Team/GigaGet", StandardLicenses.GPL3),
|
||||||
new SoftwareComponent("NewPipe Extractor", "2017 - 2020", "Christian Schabesberger",
|
new SoftwareComponent("NewPipe Extractor", "2017 - 2020", "Christian Schabesberger",
|
||||||
|
@ -23,7 +23,7 @@ public class License implements Parcelable, Serializable {
|
|||||||
};
|
};
|
||||||
private final String abbreviation;
|
private final String abbreviation;
|
||||||
private final String name;
|
private final String name;
|
||||||
private String filename;
|
private final String filename;
|
||||||
|
|
||||||
public License(final String name, final String abbreviation, final String filename) {
|
public License(final String name, final String abbreviation, final String filename) {
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
|
@ -43,7 +43,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
|||||||
private SelectedTabsPagerAdapter pagerAdapter;
|
private SelectedTabsPagerAdapter pagerAdapter;
|
||||||
private ScrollableTabLayout tabLayout;
|
private ScrollableTabLayout tabLayout;
|
||||||
|
|
||||||
private List<Tab> tabsList = new ArrayList<>();
|
private final List<Tab> tabsList = new ArrayList<>();
|
||||||
private TabsManager tabsManager;
|
private TabsManager tabsManager;
|
||||||
|
|
||||||
private boolean hasTabsChanged = false;
|
private boolean hasTabsChanged = false;
|
||||||
|
@ -14,12 +14,10 @@ public abstract class OnScrollBelowItemsListener extends RecyclerView.OnScrollLi
|
|||||||
super.onScrolled(recyclerView, dx, dy);
|
super.onScrolled(recyclerView, dx, dy);
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
int pastVisibleItems = 0;
|
int pastVisibleItems = 0;
|
||||||
final int visibleItemCount;
|
|
||||||
final int totalItemCount;
|
|
||||||
final RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
|
final RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
|
||||||
|
|
||||||
visibleItemCount = layoutManager.getChildCount();
|
final int visibleItemCount = layoutManager.getChildCount();
|
||||||
totalItemCount = layoutManager.getItemCount();
|
final int totalItemCount = layoutManager.getItemCount();
|
||||||
|
|
||||||
// Already covers the GridLayoutManager case
|
// Already covers the GridLayoutManager case
|
||||||
if (layoutManager instanceof LinearLayoutManager) {
|
if (layoutManager instanceof LinearLayoutManager) {
|
||||||
|
@ -19,7 +19,6 @@ import android.view.ViewTreeObserver;
|
|||||||
import androidx.core.text.HtmlCompat;
|
import androidx.core.text.HtmlCompat;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.Spanned;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
@ -731,7 +730,7 @@ public final class VideoDetailFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private View.OnTouchListener getOnControlsTouchListener() {
|
private View.OnTouchListener getOnControlsTouchListener() {
|
||||||
return (View view, MotionEvent motionEvent) -> {
|
return (view, motionEvent) -> {
|
||||||
if (!PreferenceManager.getDefaultSharedPreferences(activity)
|
if (!PreferenceManager.getDefaultSharedPreferences(activity)
|
||||||
.getBoolean(getString(R.string.show_hold_to_append_key), true)) {
|
.getBoolean(getString(R.string.show_hold_to_append_key), true)) {
|
||||||
return false;
|
return false;
|
||||||
@ -948,7 +947,7 @@ public final class VideoDetailFragment
|
|||||||
currentWorker = ExtractorHelper.getStreamInfo(serviceId, url, forceLoad)
|
currentWorker = ExtractorHelper.getStreamInfo(serviceId, url, forceLoad)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe((@NonNull final StreamInfo result) -> {
|
.subscribe(result -> {
|
||||||
isLoading.set(false);
|
isLoading.set(false);
|
||||||
hideMainPlayer();
|
hideMainPlayer();
|
||||||
if (result.getAgeLimit() != NO_AGE_LIMIT && !prefs.getBoolean(
|
if (result.getAgeLimit() != NO_AGE_LIMIT && !prefs.getBoolean(
|
||||||
@ -969,7 +968,7 @@ public final class VideoDetailFragment
|
|||||||
openVideoPlayer();
|
openVideoPlayer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, (@NonNull final Throwable throwable) -> {
|
}, throwable -> {
|
||||||
isLoading.set(false);
|
isLoading.set(false);
|
||||||
onError(throwable);
|
onError(throwable);
|
||||||
});
|
});
|
||||||
@ -1140,7 +1139,7 @@ public final class VideoDetailFragment
|
|||||||
|
|
||||||
PlayQueue queue = playQueue;
|
PlayQueue queue = playQueue;
|
||||||
// Size can be 0 because queue removes bad stream automatically when error occurs
|
// Size can be 0 because queue removes bad stream automatically when error occurs
|
||||||
if (queue == null || queue.size() == 0) {
|
if (queue == null || queue.isEmpty()) {
|
||||||
queue = new SinglePlayQueue(currentInfo);
|
queue = new SinglePlayQueue(currentInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1224,12 +1223,12 @@ public final class VideoDetailFragment
|
|||||||
|
|
||||||
if (description.getType() == Description.HTML) {
|
if (description.getType() == Description.HTML) {
|
||||||
disposables.add(Single.just(description.getContent())
|
disposables.add(Single.just(description.getContent())
|
||||||
.map((@NonNull final String descriptionText) ->
|
.map(descriptionText ->
|
||||||
HtmlCompat.fromHtml(descriptionText,
|
HtmlCompat.fromHtml(descriptionText,
|
||||||
HtmlCompat.FROM_HTML_MODE_LEGACY))
|
HtmlCompat.FROM_HTML_MODE_LEGACY))
|
||||||
.subscribeOn(Schedulers.computation())
|
.subscribeOn(Schedulers.computation())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe((@NonNull final Spanned spanned) -> {
|
.subscribe(spanned -> {
|
||||||
videoDescriptionView.setText(spanned);
|
videoDescriptionView.setText(spanned);
|
||||||
videoDescriptionView.setVisibility(View.VISIBLE);
|
videoDescriptionView.setVisibility(View.VISIBLE);
|
||||||
}));
|
}));
|
||||||
@ -1346,19 +1345,24 @@ public final class VideoDetailFragment
|
|||||||
broadcastReceiver = new BroadcastReceiver() {
|
broadcastReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(final Context context, final Intent intent) {
|
public void onReceive(final Context context, final Intent intent) {
|
||||||
if (intent.getAction().equals(ACTION_SHOW_MAIN_PLAYER)) {
|
switch (intent.getAction()) {
|
||||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
case ACTION_SHOW_MAIN_PLAYER:
|
||||||
} else if (intent.getAction().equals(ACTION_HIDE_MAIN_PLAYER)) {
|
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
break;
|
||||||
} else if (intent.getAction().equals(ACTION_PLAYER_STARTED)) {
|
case ACTION_HIDE_MAIN_PLAYER:
|
||||||
// If the state is not hidden we don't need to show the mini player
|
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||||
if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN) {
|
break;
|
||||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
case ACTION_PLAYER_STARTED:
|
||||||
}
|
// If the state is not hidden we don't need to show the mini player
|
||||||
// Rebound to the service if it was closed via notification or mini player
|
if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN) {
|
||||||
if (!PlayerHolder.bound) {
|
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||||
PlayerHolder.startService(App.getApp(), false, VideoDetailFragment.this);
|
}
|
||||||
}
|
// Rebound to the service if it was closed via notification or mini player
|
||||||
|
if (!PlayerHolder.bound) {
|
||||||
|
PlayerHolder.startService(
|
||||||
|
App.getApp(), false, VideoDetailFragment.this);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -204,7 +204,7 @@ public abstract class BaseListInfoFragment<I extends ListInfo>
|
|||||||
name = result.getName();
|
name = result.getName();
|
||||||
setTitle(name);
|
setTitle(name);
|
||||||
|
|
||||||
if (infoListAdapter.getItemsList().size() == 0) {
|
if (infoListAdapter.getItemsList().isEmpty()) {
|
||||||
if (result.getRelatedItems().size() > 0) {
|
if (result.getRelatedItems().size() > 0) {
|
||||||
infoListAdapter.addInfoItemList(result.getRelatedItems());
|
infoListAdapter.addInfoItemList(result.getRelatedItems());
|
||||||
showListFooter(hasMoreItems());
|
showListFooter(hasMoreItems());
|
||||||
|
@ -24,7 +24,7 @@ import io.reactivex.Single;
|
|||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
|
|
||||||
public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
|
public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
|
||||||
private CompositeDisposable disposables = new CompositeDisposable();
|
private final CompositeDisposable disposables = new CompositeDisposable();
|
||||||
|
|
||||||
public static CommentsFragment getInstance(final int serviceId, final String url,
|
public static CommentsFragment getInstance(final int serviceId, final String url,
|
||||||
final String name) {
|
final String name) {
|
||||||
|
@ -256,7 +256,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
|||||||
if (!TextUtils.isEmpty(searchString)) {
|
if (!TextUtils.isEmpty(searchString)) {
|
||||||
if (wasLoading.getAndSet(false)) {
|
if (wasLoading.getAndSet(false)) {
|
||||||
search(searchString, contentFilter, sortFilter);
|
search(searchString, contentFilter, sortFilter);
|
||||||
} else if (infoListAdapter.getItemsList().size() == 0) {
|
} else if (infoListAdapter.getItemsList().isEmpty()) {
|
||||||
if (savedState == null) {
|
if (savedState == null) {
|
||||||
search(searchString, contentFilter, sortFilter);
|
search(searchString, contentFilter, sortFilter);
|
||||||
} else if (!isLoading.get() && !wasSearchFocused) {
|
} else if (!isLoading.get() && !wasSearchFocused) {
|
||||||
@ -977,7 +977,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
|||||||
lastSearchedString = searchString;
|
lastSearchedString = searchString;
|
||||||
nextPage = result.getNextPage();
|
nextPage = result.getNextPage();
|
||||||
|
|
||||||
if (infoListAdapter.getItemsList().size() == 0) {
|
if (infoListAdapter.getItemsList().isEmpty()) {
|
||||||
if (!result.getRelatedItems().isEmpty()) {
|
if (!result.getRelatedItems().isEmpty()) {
|
||||||
infoListAdapter.addInfoItemList(result.getRelatedItems());
|
infoListAdapter.addInfoItemList(result.getRelatedItems());
|
||||||
} else {
|
} else {
|
||||||
|
@ -31,7 +31,7 @@ import io.reactivex.disposables.CompositeDisposable;
|
|||||||
public class RelatedVideosFragment extends BaseListInfoFragment<RelatedStreamInfo>
|
public class RelatedVideosFragment extends BaseListInfoFragment<RelatedStreamInfo>
|
||||||
implements SharedPreferences.OnSharedPreferenceChangeListener {
|
implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
private static final String INFO_KEY = "related_info_key";
|
private static final String INFO_KEY = "related_info_key";
|
||||||
private CompositeDisposable disposables = new CompositeDisposable();
|
private final CompositeDisposable disposables = new CompositeDisposable();
|
||||||
private RelatedStreamInfo relatedStreamInfo;
|
private RelatedStreamInfo relatedStreamInfo;
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -371,7 +371,7 @@ public class InfoListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HFHolder extends RecyclerView.ViewHolder {
|
public static class HFHolder extends RecyclerView.ViewHolder {
|
||||||
public View view;
|
public View view;
|
||||||
|
|
||||||
HFHolder(final View v) {
|
HFHolder(final View v) {
|
||||||
|
@ -38,7 +38,7 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
|||||||
private RecyclerView playlistRecyclerView;
|
private RecyclerView playlistRecyclerView;
|
||||||
private LocalItemListAdapter playlistAdapter;
|
private LocalItemListAdapter playlistAdapter;
|
||||||
|
|
||||||
private CompositeDisposable playlistDisposables = new CompositeDisposable();
|
private final CompositeDisposable playlistDisposables = new CompositeDisposable();
|
||||||
|
|
||||||
public static Disposable onPlaylistFound(
|
public static Disposable onPlaylistFound(
|
||||||
final Context context, final Runnable onSuccess, final Runnable onFailed
|
final Context context, final Runnable onSuccess, final Runnable onFailed
|
||||||
|
@ -29,6 +29,7 @@ import android.view.MenuItem
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import androidx.core.content.edit
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
@ -142,9 +143,9 @@ class FeedFragment : BaseListFragment<FeedState, Unit>() {
|
|||||||
AlertDialog.Builder(requireContext())
|
AlertDialog.Builder(requireContext())
|
||||||
.setMessage(R.string.feed_use_dedicated_fetch_method_help_text)
|
.setMessage(R.string.feed_use_dedicated_fetch_method_help_text)
|
||||||
.setNeutralButton(enableDisableButtonText) { _, _ ->
|
.setNeutralButton(enableDisableButtonText) { _, _ ->
|
||||||
sharedPreferences.edit()
|
sharedPreferences.edit {
|
||||||
.putBoolean(getString(R.string.feed_use_dedicated_fetch_method_key), !usingDedicatedMethod)
|
putBoolean(getString(R.string.feed_use_dedicated_fetch_method_key), !usingDedicatedMethod)
|
||||||
.apply()
|
}
|
||||||
}
|
}
|
||||||
.setPositiveButton(resources.getString(R.string.finish), null)
|
.setPositiveButton(resources.getString(R.string.finish), null)
|
||||||
.create()
|
.create()
|
||||||
@ -255,8 +256,9 @@ class FeedFragment : BaseListFragment<FeedState, Unit>() {
|
|||||||
|
|
||||||
oldestSubscriptionUpdate = loadedState.oldestUpdate
|
oldestSubscriptionUpdate = loadedState.oldestUpdate
|
||||||
|
|
||||||
refresh_subtitle_text.isVisible = loadedState.notLoadedCount > 0
|
val loadedCount = loadedState.notLoadedCount > 0
|
||||||
if (loadedState.notLoadedCount > 0) {
|
refresh_subtitle_text.isVisible = loadedCount
|
||||||
|
if (loadedCount) {
|
||||||
refresh_subtitle_text.text = getString(R.string.feed_subscription_not_loaded_count, loadedState.notLoadedCount)
|
refresh_subtitle_text.text = getString(R.string.feed_subscription_not_loaded_count, loadedState.notLoadedCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,7 @@ class FeedViewModel(applicationContext: Context, val groupId: Long = FeedGroupEn
|
|||||||
.throttleLatest(DEFAULT_THROTTLE_TIMEOUT, TimeUnit.MILLISECONDS)
|
.throttleLatest(DEFAULT_THROTTLE_TIMEOUT, TimeUnit.MILLISECONDS)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe {
|
.subscribe { (event, listFromDB, notLoadedCount, oldestUpdate) ->
|
||||||
val (event, listFromDB, notLoadedCount, oldestUpdate) = it
|
|
||||||
|
|
||||||
val oldestUpdateCalendar = oldestUpdate?.toCalendar()
|
val oldestUpdateCalendar = oldestUpdate?.toCalendar()
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package org.schabi.newpipe.local.subscription.dialog
|
|||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.text.TextUtils
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@ -225,7 +224,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toolbar_search_clear.setOnClickListener {
|
toolbar_search_clear.setOnClickListener {
|
||||||
if (TextUtils.isEmpty(toolbar_search_edit_text.text)) {
|
if (toolbar_search_edit_text.text.isEmpty()) {
|
||||||
hideSearch()
|
hideSearch()
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
|
@ -1545,8 +1545,7 @@ public abstract class BasePlayer implements
|
|||||||
if (simpleExoPlayer == null) {
|
if (simpleExoPlayer == null) {
|
||||||
return PlaybackParameters.DEFAULT;
|
return PlaybackParameters.DEFAULT;
|
||||||
}
|
}
|
||||||
final PlaybackParameters parameters = simpleExoPlayer.getPlaybackParameters();
|
return simpleExoPlayer.getPlaybackParameters();
|
||||||
return parameters == null ? PlaybackParameters.DEFAULT : parameters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +48,7 @@ public final class NotificationUtil {
|
|||||||
@Nullable private static NotificationUtil instance = null;
|
@Nullable private static NotificationUtil instance = null;
|
||||||
|
|
||||||
@NotificationConstants.Action
|
@NotificationConstants.Action
|
||||||
private int[] notificationSlots = NotificationConstants.SLOT_DEFAULTS.clone();
|
private final int[] notificationSlots = NotificationConstants.SLOT_DEFAULTS.clone();
|
||||||
|
|
||||||
private NotificationManagerCompat notificationManager;
|
private NotificationManagerCompat notificationManager;
|
||||||
private NotificationCompat.Builder notificationBuilder;
|
private NotificationCompat.Builder notificationBuilder;
|
||||||
|
@ -337,7 +337,7 @@ public class VideoPlayerImpl extends VideoPlayer
|
|||||||
view.setFixedTextSize(TypedValue.COMPLEX_UNIT_PX,
|
view.setFixedTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||||
(float) minimumLength / captionRatioInverse);
|
(float) minimumLength / captionRatioInverse);
|
||||||
}
|
}
|
||||||
view.setApplyEmbeddedStyles(captionStyle.equals(CaptionStyleCompat.DEFAULT));
|
view.setApplyEmbeddedStyles(captionStyle == CaptionStyleCompat.DEFAULT);
|
||||||
view.setStyle(captionStyle);
|
view.setStyle(captionStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import org.schabi.newpipe.util.AnimationUtils
|
|||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlin.math.hypot
|
import kotlin.math.hypot
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
import kotlin.math.min
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base gesture handling for [VideoPlayerImpl]
|
* Base gesture handling for [VideoPlayerImpl]
|
||||||
@ -117,7 +118,7 @@ abstract class BasePlayerGestureListener(
|
|||||||
initSecPointerX = event.getX(1)
|
initSecPointerX = event.getX(1)
|
||||||
initSecPointerY = event.getY(1)
|
initSecPointerY = event.getY(1)
|
||||||
// record distance between fingers
|
// record distance between fingers
|
||||||
initPointerDistance = Math.hypot(initFirstPointerX - initSecPointerX.toDouble(),
|
initPointerDistance = hypot(initFirstPointerX - initSecPointerX.toDouble(),
|
||||||
initFirstPointerY - initSecPointerY.toDouble())
|
initFirstPointerY - initSecPointerY.toDouble())
|
||||||
|
|
||||||
isResizing = true
|
isResizing = true
|
||||||
@ -185,7 +186,7 @@ abstract class BasePlayerGestureListener(
|
|||||||
playerImpl.updateScreenSize()
|
playerImpl.updateScreenSize()
|
||||||
|
|
||||||
playerImpl.updatePopupSize(
|
playerImpl.updatePopupSize(
|
||||||
Math.min(playerImpl.screenWidth.toDouble(), newWidth).toInt(),
|
min(playerImpl.screenWidth.toDouble(), newWidth).toInt(),
|
||||||
-1)
|
-1)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ public class MediaSourceManager {
|
|||||||
@NonNull
|
@NonNull
|
||||||
private ManagedMediaSourcePlaylist playlist;
|
private ManagedMediaSourcePlaylist playlist;
|
||||||
|
|
||||||
private Handler removeMediaSourceHandler = new Handler();
|
private final Handler removeMediaSourceHandler = new Handler();
|
||||||
|
|
||||||
public MediaSourceManager(@NonNull final PlaybackListener listener,
|
public MediaSourceManager(@NonNull final PlaybackListener listener,
|
||||||
@NonNull final PlayQueue playQueue) {
|
@NonNull final PlayQueue playQueue) {
|
||||||
|
@ -215,7 +215,7 @@ public class PlayQueueAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HFHolder extends RecyclerView.ViewHolder {
|
public static class HFHolder extends RecyclerView.ViewHolder {
|
||||||
public View view;
|
public View view;
|
||||||
|
|
||||||
public HFHolder(final View v) {
|
public HFHolder(final View v) {
|
||||||
|
@ -154,7 +154,7 @@ public class ErrorActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public static void reportError(final Context context, final CrashReportData report,
|
public static void reportError(final Context context, final CrashReportData report,
|
||||||
final ErrorInfo errorInfo) {
|
final ErrorInfo errorInfo) {
|
||||||
final String[] el = new String[]{report.getString(ReportField.STACK_TRACE)};
|
final String[] el = {report.getString(ReportField.STACK_TRACE)};
|
||||||
|
|
||||||
final Intent intent = new Intent(context, ErrorActivity.class);
|
final Intent intent = new Intent(context, ErrorActivity.class);
|
||||||
intent.putExtra(ERROR_INFO, errorInfo);
|
intent.putExtra(ERROR_INFO, errorInfo);
|
||||||
@ -216,15 +216,15 @@ public class ErrorActivity extends AppCompatActivity {
|
|||||||
addGuruMeditation();
|
addGuruMeditation();
|
||||||
currentTimeStamp = getCurrentTimeStamp();
|
currentTimeStamp = getCurrentTimeStamp();
|
||||||
|
|
||||||
reportEmailButton.setOnClickListener((View v) ->
|
reportEmailButton.setOnClickListener(v ->
|
||||||
openPrivacyPolicyDialog(this, "EMAIL"));
|
openPrivacyPolicyDialog(this, "EMAIL"));
|
||||||
|
|
||||||
copyButton.setOnClickListener((View v) -> {
|
copyButton.setOnClickListener(v -> {
|
||||||
ShareUtils.copyToClipboard(this, buildMarkdown());
|
ShareUtils.copyToClipboard(this, buildMarkdown());
|
||||||
Toast.makeText(this, R.string.msg_copied, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.msg_copied, Toast.LENGTH_SHORT).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
reportGithubButton.setOnClickListener((View v) ->
|
reportGithubButton.setOnClickListener(v ->
|
||||||
openPrivacyPolicyDialog(this, "GITHUB"));
|
openPrivacyPolicyDialog(this, "GITHUB"));
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package org.schabi.newpipe.settings;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -134,7 +133,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
|||||||
addPreferencesFromResource(R.xml.content_settings);
|
addPreferencesFromResource(R.xml.content_settings);
|
||||||
|
|
||||||
final Preference importDataPreference = findPreference(getString(R.string.import_data));
|
final Preference importDataPreference = findPreference(getString(R.string.import_data));
|
||||||
importDataPreference.setOnPreferenceClickListener((Preference p) -> {
|
importDataPreference.setOnPreferenceClickListener(p -> {
|
||||||
final Intent i = new Intent(getActivity(), FilePickerActivityHelper.class)
|
final Intent i = new Intent(getActivity(), FilePickerActivityHelper.class)
|
||||||
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_MULTIPLE, false)
|
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_MULTIPLE, false)
|
||||||
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_CREATE_DIR, false)
|
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_CREATE_DIR, false)
|
||||||
@ -145,7 +144,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
final Preference exportDataPreference = findPreference(getString(R.string.export_data));
|
final Preference exportDataPreference = findPreference(getString(R.string.export_data));
|
||||||
exportDataPreference.setOnPreferenceClickListener((Preference p) -> {
|
exportDataPreference.setOnPreferenceClickListener(p -> {
|
||||||
final Intent i = new Intent(getActivity(), FilePickerActivityHelper.class)
|
final Intent i = new Intent(getActivity(), FilePickerActivityHelper.class)
|
||||||
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_MULTIPLE, false)
|
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_MULTIPLE, false)
|
||||||
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_CREATE_DIR, true)
|
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_CREATE_DIR, true)
|
||||||
@ -199,9 +198,9 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
|||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setMessage(R.string.override_current_data)
|
builder.setMessage(R.string.override_current_data)
|
||||||
.setPositiveButton(getString(R.string.finish),
|
.setPositiveButton(getString(R.string.finish),
|
||||||
(DialogInterface d, int id) -> importDatabase(path))
|
(d, id) -> importDatabase(path))
|
||||||
.setNegativeButton(android.R.string.cancel,
|
.setNegativeButton(android.R.string.cancel,
|
||||||
(DialogInterface d, int id) -> d.cancel());
|
(d, id) -> d.cancel());
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ import io.reactivex.schedulers.Schedulers;
|
|||||||
public class PeertubeInstanceListFragment extends Fragment {
|
public class PeertubeInstanceListFragment extends Fragment {
|
||||||
private static final int MENU_ITEM_RESTORE_ID = 123456;
|
private static final int MENU_ITEM_RESTORE_ID = 123456;
|
||||||
|
|
||||||
private List<PeertubeInstance> instanceList = new ArrayList<>();
|
private final List<PeertubeInstance> instanceList = new ArrayList<>();
|
||||||
private PeertubeInstance selectedInstance;
|
private PeertubeInstance selectedInstance;
|
||||||
private String savedInstanceListKey;
|
private String savedInstanceListKey;
|
||||||
private InstanceListAdapter instanceListAdapter;
|
private InstanceListAdapter instanceListAdapter;
|
||||||
@ -344,7 +344,7 @@ public class PeertubeInstanceListFragment extends Fragment {
|
|||||||
private class InstanceListAdapter
|
private class InstanceListAdapter
|
||||||
extends RecyclerView.Adapter<InstanceListAdapter.TabViewHolder> {
|
extends RecyclerView.Adapter<InstanceListAdapter.TabViewHolder> {
|
||||||
private final LayoutInflater inflater;
|
private final LayoutInflater inflater;
|
||||||
private ItemTouchHelper itemTouchHelper;
|
private final ItemTouchHelper itemTouchHelper;
|
||||||
private RadioButton lastChecked;
|
private RadioButton lastChecked;
|
||||||
|
|
||||||
InstanceListAdapter(final Context context, final ItemTouchHelper itemTouchHelper) {
|
InstanceListAdapter(final Context context, final ItemTouchHelper itemTouchHelper) {
|
||||||
@ -377,11 +377,11 @@ public class PeertubeInstanceListFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class TabViewHolder extends RecyclerView.ViewHolder {
|
class TabViewHolder extends RecyclerView.ViewHolder {
|
||||||
private AppCompatImageView instanceIconView;
|
private final AppCompatImageView instanceIconView;
|
||||||
private TextView instanceNameView;
|
private final TextView instanceNameView;
|
||||||
private TextView instanceUrlView;
|
private final TextView instanceUrlView;
|
||||||
private RadioButton instanceRB;
|
private final RadioButton instanceRB;
|
||||||
private ImageView handle;
|
private final ImageView handle;
|
||||||
|
|
||||||
TabViewHolder(final View itemView) {
|
TabViewHolder(final View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
@ -8,7 +8,7 @@ import androidx.preference.Preference;
|
|||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
|
||||||
public class UpdateSettingsFragment extends BasePreferenceFragment {
|
public class UpdateSettingsFragment extends BasePreferenceFragment {
|
||||||
private Preference.OnPreferenceChangeListener updatePreferenceChange
|
private final Preference.OnPreferenceChangeListener updatePreferenceChange
|
||||||
= (preference, newValue) -> {
|
= (preference, newValue) -> {
|
||||||
defaultPreferences.edit()
|
defaultPreferences.edit()
|
||||||
.putBoolean(getString(R.string.update_app_key), (boolean) newValue).apply();
|
.putBoolean(getString(R.string.update_app_key), (boolean) newValue).apply();
|
||||||
|
@ -334,7 +334,7 @@ public class ChooseTabsFragment extends Fragment {
|
|||||||
private class SelectedTabsAdapter
|
private class SelectedTabsAdapter
|
||||||
extends RecyclerView.Adapter<ChooseTabsFragment.SelectedTabsAdapter.TabViewHolder> {
|
extends RecyclerView.Adapter<ChooseTabsFragment.SelectedTabsAdapter.TabViewHolder> {
|
||||||
private final LayoutInflater inflater;
|
private final LayoutInflater inflater;
|
||||||
private ItemTouchHelper itemTouchHelper;
|
private final ItemTouchHelper itemTouchHelper;
|
||||||
|
|
||||||
SelectedTabsAdapter(final Context context, final ItemTouchHelper itemTouchHelper) {
|
SelectedTabsAdapter(final Context context, final ItemTouchHelper itemTouchHelper) {
|
||||||
this.itemTouchHelper = itemTouchHelper;
|
this.itemTouchHelper = itemTouchHelper;
|
||||||
@ -367,9 +367,9 @@ public class ChooseTabsFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class TabViewHolder extends RecyclerView.ViewHolder {
|
class TabViewHolder extends RecyclerView.ViewHolder {
|
||||||
private AppCompatImageView tabIconView;
|
private final AppCompatImageView tabIconView;
|
||||||
private TextView tabNameView;
|
private final TextView tabNameView;
|
||||||
private ImageView handle;
|
private final ImageView handle;
|
||||||
|
|
||||||
TabViewHolder(final View itemView) {
|
TabViewHolder(final View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
@ -116,7 +116,7 @@ public abstract class Tab {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj instanceof Tab && obj.getClass().equals(this.getClass())
|
return obj instanceof Tab && obj.getClass() == this.getClass()
|
||||||
&& ((Tab) obj).getTabId() == this.getTabId();
|
&& ((Tab) obj).getTabId() == this.getTabId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ public abstract class Tab {
|
|||||||
CHANNEL(new ChannelTab()),
|
CHANNEL(new ChannelTab()),
|
||||||
PLAYLIST(new PlaylistTab());
|
PLAYLIST(new PlaylistTab());
|
||||||
|
|
||||||
private Tab tab;
|
private final Tab tab;
|
||||||
|
|
||||||
Type(final Tab tab) {
|
Type(final Tab tab) {
|
||||||
this.tab = tab;
|
this.tab = tab;
|
||||||
|
@ -743,24 +743,24 @@ public class Mp4DashReader {
|
|||||||
return readFullBox(b);
|
return readFullBox(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Box {
|
static class Box {
|
||||||
int type;
|
int type;
|
||||||
long offset;
|
long offset;
|
||||||
long size;
|
long size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Moof {
|
public static class Moof {
|
||||||
int mfhdSequenceNumber;
|
int mfhdSequenceNumber;
|
||||||
public Traf traf;
|
public Traf traf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Traf {
|
public static class Traf {
|
||||||
public Tfhd tfhd;
|
public Tfhd tfhd;
|
||||||
long tfdt;
|
long tfdt;
|
||||||
public Trun trun;
|
public Trun trun;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Tfhd {
|
public static class Tfhd {
|
||||||
int bFlags;
|
int bFlags;
|
||||||
public int trackId;
|
public int trackId;
|
||||||
int defaultSampleDuration;
|
int defaultSampleDuration;
|
||||||
@ -768,7 +768,7 @@ public class Mp4DashReader {
|
|||||||
int defaultSampleFlags;
|
int defaultSampleFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TrunEntry {
|
static class TrunEntry {
|
||||||
int sampleDuration;
|
int sampleDuration;
|
||||||
int sampleSize;
|
int sampleSize;
|
||||||
int sampleFlags;
|
int sampleFlags;
|
||||||
@ -779,7 +779,7 @@ public class Mp4DashReader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Trun {
|
public static class Trun {
|
||||||
public int chunkDuration;
|
public int chunkDuration;
|
||||||
public int chunkSize;
|
public int chunkSize;
|
||||||
|
|
||||||
@ -837,7 +837,7 @@ public class Mp4DashReader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Tkhd {
|
public static class Tkhd {
|
||||||
int trackId;
|
int trackId;
|
||||||
long duration;
|
long duration;
|
||||||
short bVolume;
|
short bVolume;
|
||||||
@ -848,25 +848,25 @@ public class Mp4DashReader {
|
|||||||
short bAlternateGroup;
|
short bAlternateGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Trak {
|
public static class Trak {
|
||||||
public Tkhd tkhd;
|
public Tkhd tkhd;
|
||||||
public Elst edstElst;
|
public Elst edstElst;
|
||||||
public Mdia mdia;
|
public Mdia mdia;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Mvhd {
|
static class Mvhd {
|
||||||
long timeScale;
|
long timeScale;
|
||||||
long nextTrackId;
|
long nextTrackId;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Moov {
|
static class Moov {
|
||||||
Mvhd mvhd;
|
Mvhd mvhd;
|
||||||
Trak[] trak;
|
Trak[] trak;
|
||||||
Trex[] mvexTrex;
|
Trex[] mvexTrex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Trex {
|
public static class Trex {
|
||||||
private int trackId;
|
private int trackId;
|
||||||
int defaultSampleDescriptionIndex;
|
int defaultSampleDescriptionIndex;
|
||||||
int defaultSampleDuration;
|
int defaultSampleDuration;
|
||||||
@ -874,37 +874,37 @@ public class Mp4DashReader {
|
|||||||
int defaultSampleFlags;
|
int defaultSampleFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Elst {
|
public static class Elst {
|
||||||
public long mediaTime;
|
public long mediaTime;
|
||||||
public int bMediaRate;
|
public int bMediaRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Mdia {
|
public static class Mdia {
|
||||||
public int mdhdTimeScale;
|
public int mdhdTimeScale;
|
||||||
public byte[] mdhd;
|
public byte[] mdhd;
|
||||||
public Hdlr hdlr;
|
public Hdlr hdlr;
|
||||||
public Minf minf;
|
public Minf minf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Hdlr {
|
public static class Hdlr {
|
||||||
public int type;
|
public int type;
|
||||||
public int subType;
|
public int subType;
|
||||||
public byte[] bReserved;
|
public byte[] bReserved;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Minf {
|
public static class Minf {
|
||||||
public byte[] dinf;
|
public byte[] dinf;
|
||||||
public byte[] stblStsd;
|
public byte[] stblStsd;
|
||||||
public byte[] mhd;
|
public byte[] mhd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Mp4Track {
|
public static class Mp4Track {
|
||||||
public TrackKind kind;
|
public TrackKind kind;
|
||||||
public Trak trak;
|
public Trak trak;
|
||||||
public Trex trex;
|
public Trex trex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Mp4DashChunk {
|
public static class Mp4DashChunk {
|
||||||
public InputStream data;
|
public InputStream data;
|
||||||
public Moof moof;
|
public Moof moof;
|
||||||
private int i = 0;
|
private int i = 0;
|
||||||
@ -936,7 +936,7 @@ public class Mp4DashReader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Mp4DashSample {
|
public static class Mp4DashSample {
|
||||||
public TrunEntry info;
|
public TrunEntry info;
|
||||||
public byte[] data;
|
public byte[] data;
|
||||||
}
|
}
|
||||||
|
@ -897,7 +897,7 @@ public class Mp4FromDashWriter {
|
|||||||
return buffer.array();
|
return buffer.array();
|
||||||
}
|
}
|
||||||
|
|
||||||
class TablesInfo {
|
static class TablesInfo {
|
||||||
int stts;
|
int stts;
|
||||||
int stsc;
|
int stsc;
|
||||||
int[] stscBEntries;
|
int[] stscBEntries;
|
||||||
|
@ -31,8 +31,8 @@ public class OggFromWebMWriter implements Closeable {
|
|||||||
private boolean done = false;
|
private boolean done = false;
|
||||||
private boolean parsed = false;
|
private boolean parsed = false;
|
||||||
|
|
||||||
private SharpStream source;
|
private final SharpStream source;
|
||||||
private SharpStream output;
|
private final SharpStream output;
|
||||||
|
|
||||||
private int sequenceCount = 0;
|
private int sequenceCount = 0;
|
||||||
private final int streamId;
|
private final int streamId;
|
||||||
|
@ -20,8 +20,8 @@ import java.nio.charset.StandardCharsets;
|
|||||||
public class SrtFromTtmlWriter {
|
public class SrtFromTtmlWriter {
|
||||||
private static final String NEW_LINE = "\r\n";
|
private static final String NEW_LINE = "\r\n";
|
||||||
|
|
||||||
private SharpStream out;
|
private final SharpStream out;
|
||||||
private boolean ignoreEmptyFrames;
|
private final boolean ignoreEmptyFrames;
|
||||||
private final Charset charset = StandardCharsets.UTF_8;
|
private final Charset charset = StandardCharsets.UTF_8;
|
||||||
|
|
||||||
private int frameIndex = 0;
|
private int frameIndex = 0;
|
||||||
|
@ -49,7 +49,7 @@ public class WebMReader {
|
|||||||
Audio/*2*/, Video/*1*/, Other
|
Audio/*2*/, Video/*1*/, Other
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataReader stream;
|
private final DataReader stream;
|
||||||
private Segment segment;
|
private Segment segment;
|
||||||
private WebMTrack[] tracks;
|
private WebMTrack[] tracks;
|
||||||
private int selectedTrack;
|
private int selectedTrack;
|
||||||
@ -397,19 +397,19 @@ public class WebMReader {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Element {
|
static class Element {
|
||||||
int type;
|
int type;
|
||||||
long offset;
|
long offset;
|
||||||
long contentSize;
|
long contentSize;
|
||||||
long size;
|
long size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Info {
|
public static class Info {
|
||||||
public long timecodeScale;
|
public long timecodeScale;
|
||||||
public long duration;
|
public long duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WebMTrack {
|
public static class WebMTrack {
|
||||||
public long trackNumber;
|
public long trackNumber;
|
||||||
protected int trackType;
|
protected int trackType;
|
||||||
public String codecId;
|
public String codecId;
|
||||||
@ -454,7 +454,7 @@ public class WebMReader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SimpleBlock {
|
public static class SimpleBlock {
|
||||||
public InputStream data;
|
public InputStream data;
|
||||||
public boolean createdFromBlock;
|
public boolean createdFromBlock;
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public final class AnimationUtils {
|
|||||||
+ "colorStart = [" + colorStart + "], colorEnd = [" + colorEnd + "]");
|
+ "colorStart = [" + colorStart + "], colorEnd = [" + colorEnd + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
final int[][] empty = new int[][]{new int[0]};
|
final int[][] empty = {new int[0]};
|
||||||
final ValueAnimator viewPropertyAnimator = ValueAnimator
|
final ValueAnimator viewPropertyAnimator = ValueAnimator
|
||||||
.ofObject(new ArgbEvaluator(), colorStart, colorEnd);
|
.ofObject(new ArgbEvaluator(), colorStart, colorEnd);
|
||||||
viewPropertyAnimator.setInterpolator(new FastOutSlowInInterpolator());
|
viewPropertyAnimator.setInterpolator(new FastOutSlowInInterpolator());
|
||||||
|
@ -2,7 +2,6 @@ package org.schabi.newpipe.util;
|
|||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
@ -20,9 +19,9 @@ public final class KoreUtil {
|
|||||||
public static void showInstallKoreDialog(final Context context) {
|
public static void showInstallKoreDialog(final Context context) {
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setMessage(R.string.kore_not_found)
|
builder.setMessage(R.string.kore_not_found)
|
||||||
.setPositiveButton(R.string.install, (DialogInterface dialog, int which) ->
|
.setPositiveButton(R.string.install, (dialog, which) ->
|
||||||
NavigationHelper.installKore(context))
|
NavigationHelper.installKore(context))
|
||||||
.setNegativeButton(R.string.cancel, (DialogInterface dialog, int which) -> {
|
.setNegativeButton(R.string.cancel, (dialog, which) -> {
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ public class TLSSocketFactoryCompat extends SSLSocketFactory {
|
|||||||
|
|
||||||
private static TLSSocketFactoryCompat instance = null;
|
private static TLSSocketFactoryCompat instance = null;
|
||||||
|
|
||||||
private SSLSocketFactory internalSSLSocketFactory;
|
private final SSLSocketFactory internalSSLSocketFactory;
|
||||||
|
|
||||||
public TLSSocketFactoryCompat() throws KeyManagementException, NoSuchAlgorithmException {
|
public TLSSocketFactoryCompat() throws KeyManagementException, NoSuchAlgorithmException {
|
||||||
final SSLContext context = SSLContext.getInstance("TLS");
|
final SSLContext context = SSLContext.getInstance("TLS");
|
||||||
|
@ -109,7 +109,7 @@ public final class FocusAwareSeekBar extends AppCompatSeekBar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class NestedListener implements OnSeekBarChangeListener {
|
private static final class NestedListener implements OnSeekBarChangeListener {
|
||||||
private final OnSeekBarChangeListener delegate;
|
private final OnSeekBarChangeListener delegate;
|
||||||
|
|
||||||
boolean isSeeking;
|
boolean isSeeking;
|
||||||
|
@ -33,8 +33,8 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
public class NewPipeRecyclerView extends RecyclerView {
|
public class NewPipeRecyclerView extends RecyclerView {
|
||||||
private static final String TAG = "NewPipeRecyclerView";
|
private static final String TAG = "NewPipeRecyclerView";
|
||||||
|
|
||||||
private Rect focusRect = new Rect();
|
private final Rect focusRect = new Rect();
|
||||||
private Rect tempFocus = new Rect();
|
private final Rect tempFocus = new Rect();
|
||||||
|
|
||||||
private boolean allowDpadScroll = true;
|
private boolean allowDpadScroll = true;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public class DownloadInitializer extends Thread {
|
|||||||
private final static int RESERVE_SPACE_DEFAULT = 5 * 1024 * 1024;// 5 MiB
|
private final static int RESERVE_SPACE_DEFAULT = 5 * 1024 * 1024;// 5 MiB
|
||||||
private final static int RESERVE_SPACE_MAXIMUM = 150 * 1024 * 1024;// 150 MiB
|
private final static int RESERVE_SPACE_MAXIMUM = 150 * 1024 * 1024;// 150 MiB
|
||||||
|
|
||||||
private DownloadMission mMission;
|
private final DownloadMission mMission;
|
||||||
private HttpURLConnection mConn;
|
private HttpURLConnection mConn;
|
||||||
|
|
||||||
DownloadInitializer(@NonNull DownloadMission mission) {
|
DownloadInitializer(@NonNull DownloadMission mission) {
|
||||||
|
@ -68,7 +68,7 @@ public class FinishedMissionStore extends SQLiteOpenHelper {
|
|||||||
" UNIQUE(" + KEY_TIMESTAMP + ", " + KEY_PATH + "));";
|
" UNIQUE(" + KEY_TIMESTAMP + ", " + KEY_PATH + "));";
|
||||||
|
|
||||||
|
|
||||||
private Context context;
|
private final Context context;
|
||||||
|
|
||||||
public FinishedMissionStore(Context context) {
|
public FinishedMissionStore(Context context) {
|
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||||
|
@ -15,7 +15,7 @@ public class CircularFileWriter extends SharpStream {
|
|||||||
private final static int NOTIFY_BYTES_INTERVAL = 64 * 1024;// 64 KiB
|
private final static int NOTIFY_BYTES_INTERVAL = 64 * 1024;// 64 KiB
|
||||||
private final static int THRESHOLD_AUX_LENGTH = 15 * 1024 * 1024;// 15 MiB
|
private final static int THRESHOLD_AUX_LENGTH = 15 * 1024 * 1024;// 15 MiB
|
||||||
|
|
||||||
private OffsetChecker callback;
|
private final OffsetChecker callback;
|
||||||
|
|
||||||
public ProgressReport onProgress;
|
public ProgressReport onProgress;
|
||||||
public WriteErrorHandle onWriteError;
|
public WriteErrorHandle onWriteError;
|
||||||
|
@ -31,7 +31,7 @@ public class StoredDirectoryHelper {
|
|||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
private String tag;
|
private final String tag;
|
||||||
|
|
||||||
public StoredDirectoryHelper(@NonNull Context context, @NonNull Uri path, String tag) throws IOException {
|
public StoredDirectoryHelper(@NonNull Context context, @NonNull Uri path, String tag) throws IOException {
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
@ -82,7 +82,7 @@ public class StoredDirectoryHelper {
|
|||||||
docTree.getUri(), DocumentsContract.getDocumentId(docTree.getUri())
|
docTree.getUri(), DocumentsContract.getDocumentId(docTree.getUri())
|
||||||
);
|
);
|
||||||
|
|
||||||
String[] projection = new String[]{COLUMN_DISPLAY_NAME};
|
String[] projection = {COLUMN_DISPLAY_NAME};
|
||||||
String selection = "(LOWER(" + COLUMN_DISPLAY_NAME + ") LIKE ?%";
|
String selection = "(LOWER(" + COLUMN_DISPLAY_NAME + ") LIKE ?%";
|
||||||
ContentResolver cr = context.getContentResolver();
|
ContentResolver cr = context.getContentResolver();
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public abstract class Postprocessing implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Gets the given algorithm short name
|
* Gets the given algorithm short name
|
||||||
*/
|
*/
|
||||||
private String name;
|
private final String name;
|
||||||
|
|
||||||
|
|
||||||
private String[] args;
|
private String[] args;
|
||||||
|
@ -686,7 +686,7 @@ public class DownloadManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MissionItem {
|
public static class MissionItem {
|
||||||
public int special;
|
public int special;
|
||||||
public Mission mission;
|
public Mission mission;
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ public class DownloadManagerService extends Service {
|
|||||||
|
|
||||||
private int downloadFailedNotificationID = DOWNLOADS_NOTIFICATION_ID + 1;
|
private int downloadFailedNotificationID = DOWNLOADS_NOTIFICATION_ID + 1;
|
||||||
private Builder downloadFailedNotification = null;
|
private Builder downloadFailedNotification = null;
|
||||||
private SparseArray<DownloadMission> mFailedDownloads = new SparseArray<>(5);
|
private final SparseArray<DownloadMission> mFailedDownloads = new SparseArray<>(5);
|
||||||
|
|
||||||
private Bitmap icLauncher;
|
private Bitmap icLauncher;
|
||||||
private Bitmap icDownloadDone;
|
private Bitmap icDownloadDone;
|
||||||
|
@ -96,21 +96,21 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
|
|||||||
ALGORITHMS.put(R.id.sha1, "SHA1");
|
ALGORITHMS.put(R.id.sha1, "SHA1");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Context mContext;
|
private final Context mContext;
|
||||||
private LayoutInflater mInflater;
|
private final LayoutInflater mInflater;
|
||||||
private DownloadManager mDownloadManager;
|
private final DownloadManager mDownloadManager;
|
||||||
private Deleter mDeleter;
|
private final Deleter mDeleter;
|
||||||
private int mLayout;
|
private int mLayout;
|
||||||
private DownloadManager.MissionIterator mIterator;
|
private final DownloadManager.MissionIterator mIterator;
|
||||||
private ArrayList<ViewHolderItem> mPendingDownloadsItems = new ArrayList<>();
|
private final ArrayList<ViewHolderItem> mPendingDownloadsItems = new ArrayList<>();
|
||||||
private Handler mHandler;
|
private final Handler mHandler;
|
||||||
private MenuItem mClear;
|
private MenuItem mClear;
|
||||||
private MenuItem mStartButton;
|
private MenuItem mStartButton;
|
||||||
private MenuItem mPauseButton;
|
private MenuItem mPauseButton;
|
||||||
private View mEmptyMessage;
|
private final View mEmptyMessage;
|
||||||
private RecoverHelper mRecover;
|
private RecoverHelper mRecover;
|
||||||
private View mView;
|
private final View mView;
|
||||||
private ArrayList<Mission> mHidden;
|
private final ArrayList<Mission> mHidden;
|
||||||
private Snackbar mSnackbar;
|
private Snackbar mSnackbar;
|
||||||
|
|
||||||
private final Runnable rUpdater = this::updater;
|
private final Runnable rUpdater = this::updater;
|
||||||
@ -976,7 +976,7 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ViewHolderHeader extends RecyclerView.ViewHolder {
|
static class ViewHolderHeader extends RecyclerView.ViewHolder {
|
||||||
TextView header;
|
TextView header;
|
||||||
|
|
||||||
ViewHolderHeader(View view) {
|
ViewHolderHeader(View view) {
|
||||||
|
@ -27,12 +27,12 @@ public class Deleter {
|
|||||||
private ArrayList<Mission> items;
|
private ArrayList<Mission> items;
|
||||||
private boolean running = true;
|
private boolean running = true;
|
||||||
|
|
||||||
private Context mContext;
|
private final Context mContext;
|
||||||
private MissionAdapter mAdapter;
|
private final MissionAdapter mAdapter;
|
||||||
private DownloadManager mDownloadManager;
|
private final DownloadManager mDownloadManager;
|
||||||
private MissionIterator mIterator;
|
private final MissionIterator mIterator;
|
||||||
private Handler mHandler;
|
private final Handler mHandler;
|
||||||
private View mView;
|
private final View mView;
|
||||||
|
|
||||||
private final Runnable rShow;
|
private final Runnable rShow;
|
||||||
private final Runnable rNext;
|
private final Runnable rNext;
|
||||||
|
@ -66,7 +66,7 @@ public class MissionsFragment extends Fragment {
|
|||||||
|
|
||||||
private DownloadMission unsafeMissionTarget = null;
|
private DownloadMission unsafeMissionTarget = null;
|
||||||
|
|
||||||
private ServiceConnection mConnection = new ServiceConnection() {
|
private final ServiceConnection mConnection = new ServiceConnection() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServiceConnected(ComponentName name, IBinder binder) {
|
public void onServiceConnected(ComponentName name, IBinder binder) {
|
||||||
|
@ -81,7 +81,7 @@ public class TabsJsonHelperTest {
|
|||||||
private boolean isTabsArrayEmpty(final String returnedJson) throws JsonParserException {
|
private boolean isTabsArrayEmpty(final String returnedJson) throws JsonParserException {
|
||||||
final JsonObject jsonObject = JsonParser.object().from(returnedJson);
|
final JsonObject jsonObject = JsonParser.object().from(returnedJson);
|
||||||
assertTrue(jsonObject.containsKey(JSON_TABS_ARRAY_KEY));
|
assertTrue(jsonObject.containsKey(JSON_TABS_ARRAY_KEY));
|
||||||
return jsonObject.getArray(JSON_TABS_ARRAY_KEY).size() == 0;
|
return jsonObject.getArray(JSON_TABS_ARRAY_KEY).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -7,7 +7,7 @@ buildscript {
|
|||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
classpath 'com.android.tools.build:gradle:4.1.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
Loading…
Reference in New Issue
Block a user