mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-05 00:11:18 +01:00
Merge pull request #8601 from litetex/checkstyle-assign-on-same-line
Checkstyle assign on same line
This commit is contained in:
commit
d9ff114e1a
@ -132,8 +132,8 @@ public final class FlingBehavior extends AppBarLayout.Behavior {
|
||||
try {
|
||||
final Class<?> headerBehaviorType = this.getClass().getSuperclass().getSuperclass();
|
||||
if (headerBehaviorType != null) {
|
||||
final Field field
|
||||
= headerBehaviorType.getDeclaredField("lastNestedScrollingChildRef");
|
||||
final Field field =
|
||||
headerBehaviorType.getDeclaredField("lastNestedScrollingChildRef");
|
||||
field.setAccessible(true);
|
||||
return field;
|
||||
}
|
||||
|
@ -26,10 +26,10 @@ import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
public final class DownloaderImpl extends Downloader {
|
||||
public static final String USER_AGENT
|
||||
= "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0";
|
||||
public static final String YOUTUBE_RESTRICTED_MODE_COOKIE_KEY
|
||||
= "youtube_restricted_mode_key";
|
||||
public static final String USER_AGENT =
|
||||
"Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0";
|
||||
public static final String YOUTUBE_RESTRICTED_MODE_COOKIE_KEY =
|
||||
"youtube_restricted_mode_key";
|
||||
public static final String YOUTUBE_RESTRICTED_MODE_COOKIE = "PREF=f2=8000000";
|
||||
public static final String YOUTUBE_DOMAIN = "youtube.com";
|
||||
|
||||
|
@ -473,8 +473,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
ErrorUtil.showUiErrorSnackbar(this, "Setting up service toggle", e);
|
||||
}
|
||||
|
||||
final SharedPreferences sharedPreferences
|
||||
= PreferenceManager.getDefaultSharedPreferences(this);
|
||||
final SharedPreferences sharedPreferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (sharedPreferences.getBoolean(Constants.KEY_THEME_CHANGE, false)) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Theme has changed, recreating activity...");
|
||||
@ -646,8 +646,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
super.onCreateOptionsMenu(menu);
|
||||
|
||||
final Fragment fragment
|
||||
= getSupportFragmentManager().findFragmentById(R.id.fragment_holder);
|
||||
final Fragment fragment =
|
||||
getSupportFragmentManager().findFragmentById(R.id.fragment_holder);
|
||||
if (!(fragment instanceof SearchFragment)) {
|
||||
toolbarLayoutBinding.toolbarSearchContainer.getRoot().setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
package org.schabi.newpipe.download;
|
||||
|
||||
import static org.schabi.newpipe.extractor.stream.DeliveryMethod.PROGRESSIVE_HTTP;
|
||||
import static org.schabi.newpipe.util.ListHelper.getStreamsOfSpecifiedDelivery;
|
||||
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@ -82,10 +86,6 @@ import us.shandian.giga.service.DownloadManagerService;
|
||||
import us.shandian.giga.service.DownloadManagerService.DownloadManagerBinder;
|
||||
import us.shandian.giga.service.MissionState;
|
||||
|
||||
import static org.schabi.newpipe.extractor.stream.DeliveryMethod.PROGRESSIVE_HTTP;
|
||||
import static org.schabi.newpipe.util.ListHelper.getStreamsOfSpecifiedDelivery;
|
||||
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
||||
|
||||
public class DownloadDialog extends DialogFragment
|
||||
implements RadioGroup.OnCheckedChangeListener, AdapterView.OnItemSelectedListener {
|
||||
private static final String TAG = "DialogFragment";
|
||||
@ -205,8 +205,8 @@ public class DownloadDialog extends DialogFragment
|
||||
setStyle(STYLE_NO_TITLE, ThemeHelper.getDialogTheme(context));
|
||||
Icepick.restoreInstanceState(this, savedInstanceState);
|
||||
|
||||
final SparseArray<SecondaryStreamHelper<AudioStream>> secondaryStreams
|
||||
= new SparseArray<>(4);
|
||||
final SparseArray<SecondaryStreamHelper<AudioStream>> secondaryStreams =
|
||||
new SparseArray<>(4);
|
||||
final List<VideoStream> videoStreams = wrappedVideoStreams.getStreamsList();
|
||||
|
||||
for (int i = 0; i < videoStreams.size(); i++) {
|
||||
|
@ -65,11 +65,11 @@ public class ErrorActivity extends AppCompatActivity {
|
||||
public static final String ERROR_EMAIL_ADDRESS = "crashreport@newpipe.schabi.org";
|
||||
public static final String ERROR_EMAIL_SUBJECT = "Exception in ";
|
||||
|
||||
public static final String ERROR_GITHUB_ISSUE_URL
|
||||
= "https://github.com/TeamNewPipe/NewPipe/issues";
|
||||
public static final String ERROR_GITHUB_ISSUE_URL =
|
||||
"https://github.com/TeamNewPipe/NewPipe/issues";
|
||||
|
||||
public static final DateTimeFormatter CURRENT_TIMESTAMP_FORMATTER
|
||||
= DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||
public static final DateTimeFormatter CURRENT_TIMESTAMP_FORMATTER =
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||
|
||||
|
||||
private ErrorInfo errorInfo;
|
||||
|
@ -1,5 +1,9 @@
|
||||
package org.schabi.newpipe.fragments.detail;
|
||||
|
||||
import static android.text.TextUtils.isEmpty;
|
||||
import static org.schabi.newpipe.extractor.stream.StreamExtractor.NO_AGE_LIMIT;
|
||||
import static org.schabi.newpipe.extractor.utils.Utils.isBlank;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -33,10 +37,6 @@ import java.util.List;
|
||||
import icepick.State;
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
||||
|
||||
import static android.text.TextUtils.isEmpty;
|
||||
import static org.schabi.newpipe.extractor.stream.StreamExtractor.NO_AGE_LIMIT;
|
||||
import static org.schabi.newpipe.extractor.utils.Utils.isBlank;
|
||||
|
||||
public class DescriptionFragment extends BaseFragment {
|
||||
|
||||
@State
|
||||
@ -185,8 +185,8 @@ public class DescriptionFragment extends BaseFragment {
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemMetadataBinding itemBinding
|
||||
= ItemMetadataBinding.inflate(inflater, layout, false);
|
||||
final ItemMetadataBinding itemBinding =
|
||||
ItemMetadataBinding.inflate(inflater, layout, false);
|
||||
|
||||
itemBinding.metadataTypeView.setText(type);
|
||||
itemBinding.metadataTypeView.setOnLongClickListener(v -> {
|
||||
@ -206,8 +206,8 @@ public class DescriptionFragment extends BaseFragment {
|
||||
|
||||
private void addTagsMetadataItem(final LayoutInflater inflater, final LinearLayout layout) {
|
||||
if (streamInfo.getTags() != null && !streamInfo.getTags().isEmpty()) {
|
||||
final ItemMetadataTagsBinding itemBinding
|
||||
= ItemMetadataTagsBinding.inflate(inflater, layout, false);
|
||||
final ItemMetadataTagsBinding itemBinding =
|
||||
ItemMetadataTagsBinding.inflate(inflater, layout, false);
|
||||
|
||||
final List<String> tags = new ArrayList<>(streamInfo.getTags());
|
||||
Collections.sort(tags);
|
||||
|
@ -1555,8 +1555,8 @@ public final class VideoDetailFragment
|
||||
binding.detailUploaderThumbnailView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
final Drawable buddyDrawable
|
||||
= AppCompatResources.getDrawable(activity, R.drawable.placeholder_person);
|
||||
final Drawable buddyDrawable =
|
||||
AppCompatResources.getDrawable(activity, R.drawable.placeholder_person);
|
||||
binding.detailSubChannelThumbnailView.setImageDrawable(buddyDrawable);
|
||||
binding.detailUploaderThumbnailView.setImageDrawable(buddyDrawable);
|
||||
|
||||
@ -2030,6 +2030,7 @@ public final class VideoDetailFragment
|
||||
}
|
||||
|
||||
// Listener implementation
|
||||
@Override
|
||||
public void hideSystemUiIfNeeded() {
|
||||
if (isFullscreen()
|
||||
&& bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
|
||||
|
@ -67,8 +67,8 @@ public class InfoItemBuilder {
|
||||
public View buildView(@NonNull final ViewGroup parent, @NonNull final InfoItem infoItem,
|
||||
final HistoryRecordManager historyRecordManager,
|
||||
final boolean useMiniVariant) {
|
||||
final InfoItemHolder holder
|
||||
= holderFromInfoType(parent, infoItem.getInfoType(), useMiniVariant);
|
||||
final InfoItemHolder holder =
|
||||
holderFromInfoType(parent, infoItem.getInfoType(), useMiniVariant);
|
||||
holder.updateFromItem(infoItem, historyRecordManager);
|
||||
return holder.itemView;
|
||||
}
|
||||
|
@ -115,8 +115,8 @@ public enum StreamDialogDefaultEntry {
|
||||
DOWNLOAD(R.string.download, (fragment, item) ->
|
||||
fetchStreamInfoAndSaveToDatabase(fragment.requireContext(), item.getServiceId(),
|
||||
item.getUrl(), info -> {
|
||||
final DownloadDialog downloadDialog
|
||||
= new DownloadDialog(fragment.requireContext(), info);
|
||||
final DownloadDialog downloadDialog =
|
||||
new DownloadDialog(fragment.requireContext(), info);
|
||||
downloadDialog.show(fragment.getChildFragmentManager(), "downloadDialog");
|
||||
})
|
||||
),
|
||||
|
@ -23,9 +23,9 @@ import org.schabi.newpipe.util.CommentTextOnTouchListener;
|
||||
import org.schabi.newpipe.util.DeviceUtils;
|
||||
import org.schabi.newpipe.util.Localization;
|
||||
import org.schabi.newpipe.util.NavigationHelper;
|
||||
import org.schabi.newpipe.util.external_communication.TimestampExtractor;
|
||||
import org.schabi.newpipe.util.external_communication.ShareUtils;
|
||||
import org.schabi.newpipe.util.PicassoHelper;
|
||||
import org.schabi.newpipe.util.external_communication.ShareUtils;
|
||||
import org.schabi.newpipe.util.external_communication.TimestampExtractor;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
@ -204,8 +204,9 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
|
||||
boolean hasEllipsis = false;
|
||||
|
||||
if (itemContentView.getLineCount() > COMMENT_DEFAULT_LINES) {
|
||||
final int endOfLastLine
|
||||
= itemContentView.getLayout().getLineEnd(COMMENT_DEFAULT_LINES - 1);
|
||||
final int endOfLastLine = itemContentView
|
||||
.getLayout()
|
||||
.getLineEnd(COMMENT_DEFAULT_LINES - 1);
|
||||
int end = itemContentView.getText().toString().lastIndexOf(' ', endOfLastLine - 2);
|
||||
if (end == -1) {
|
||||
end = Math.max(endOfLastLine - 2, 0);
|
||||
|
@ -14,8 +14,8 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
import org.schabi.newpipe.info_list.InfoItemBuilder;
|
||||
import org.schabi.newpipe.ktx.ViewUtils;
|
||||
import org.schabi.newpipe.local.history.HistoryRecordManager;
|
||||
import org.schabi.newpipe.util.PicassoHelper;
|
||||
import org.schabi.newpipe.util.Localization;
|
||||
import org.schabi.newpipe.util.PicassoHelper;
|
||||
import org.schabi.newpipe.util.StreamTypeUtil;
|
||||
import org.schabi.newpipe.views.AnimatedProgressBar;
|
||||
|
||||
@ -111,8 +111,9 @@ public class StreamMiniInfoItemHolder extends InfoItemHolder {
|
||||
final HistoryRecordManager historyRecordManager) {
|
||||
final StreamInfoItem item = (StreamInfoItem) infoItem;
|
||||
|
||||
final StreamStateEntity state
|
||||
= historyRecordManager.loadStreamState(infoItem).blockingGet()[0];
|
||||
final StreamStateEntity state = historyRecordManager
|
||||
.loadStreamState(infoItem)
|
||||
.blockingGet()[0];
|
||||
if (state != null && item.getDuration() > 0
|
||||
&& !StreamTypeUtil.isLiveStream(item.getStreamType())) {
|
||||
itemProgressView.setMax((int) item.getDuration());
|
||||
|
@ -256,8 +256,8 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
|
||||
}
|
||||
|
||||
private void showLocalDialog(final PlaylistMetadataEntry selectedItem) {
|
||||
final DialogEditTextBinding dialogBinding
|
||||
= DialogEditTextBinding.inflate(getLayoutInflater());
|
||||
final DialogEditTextBinding dialogBinding =
|
||||
DialogEditTextBinding.inflate(getLayoutInflater());
|
||||
dialogBinding.dialogEditText.setHint(R.string.name);
|
||||
dialogBinding.dialogEditText.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
dialogBinding.dialogEditText.setText(selectedItem.name);
|
||||
|
@ -45,8 +45,8 @@ public final class PlaylistCreationDialog extends PlaylistDialog {
|
||||
return super.onCreateDialog(savedInstanceState);
|
||||
}
|
||||
|
||||
final DialogEditTextBinding dialogBinding
|
||||
= DialogEditTextBinding.inflate(getLayoutInflater());
|
||||
final DialogEditTextBinding dialogBinding =
|
||||
DialogEditTextBinding.inflate(getLayoutInflater());
|
||||
dialogBinding.getRoot().getContext().setTheme(ThemeHelper.getDialogTheme(requireContext()));
|
||||
dialogBinding.dialogEditText.setHint(R.string.name);
|
||||
dialogBinding.dialogEditText.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
|
@ -42,6 +42,7 @@ import org.schabi.newpipe.error.ErrorInfo;
|
||||
import org.schabi.newpipe.error.UserAction;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
import org.schabi.newpipe.info_list.dialog.InfoItemDialog;
|
||||
import org.schabi.newpipe.info_list.dialog.StreamDialogDefaultEntry;
|
||||
import org.schabi.newpipe.local.BaseLocalListFragment;
|
||||
import org.schabi.newpipe.local.history.HistoryRecordManager;
|
||||
import org.schabi.newpipe.player.PlayerType;
|
||||
@ -50,7 +51,6 @@ import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
|
||||
import org.schabi.newpipe.util.Localization;
|
||||
import org.schabi.newpipe.util.NavigationHelper;
|
||||
import org.schabi.newpipe.util.OnClickGesture;
|
||||
import org.schabi.newpipe.info_list.dialog.StreamDialogDefaultEntry;
|
||||
import org.schabi.newpipe.util.external_communication.ShareUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -402,8 +402,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
||||
final Iterator<PlaylistStreamEntry> playlistIter = playlist.iterator();
|
||||
|
||||
// History data
|
||||
final HistoryRecordManager recordManager
|
||||
= new HistoryRecordManager(getContext());
|
||||
final HistoryRecordManager recordManager =
|
||||
new HistoryRecordManager(getContext());
|
||||
final Iterator<StreamHistoryEntry> historyIter = recordManager
|
||||
.getStreamHistorySortedById().blockingFirst().iterator();
|
||||
|
||||
@ -544,8 +544,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
||||
return;
|
||||
}
|
||||
|
||||
final DialogEditTextBinding dialogBinding
|
||||
= DialogEditTextBinding.inflate(getLayoutInflater());
|
||||
final DialogEditTextBinding dialogBinding =
|
||||
DialogEditTextBinding.inflate(getLayoutInflater());
|
||||
dialogBinding.dialogEditText.setHint(R.string.name);
|
||||
dialogBinding.dialogEditText.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
dialogBinding.dialogEditText.setSelection(dialogBinding.dialogEditText.getText().length());
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package org.schabi.newpipe.local.subscription.services;
|
||||
|
||||
import static org.schabi.newpipe.MainActivity.DEBUG;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
@ -43,8 +45,6 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.functions.Function;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
import static org.schabi.newpipe.MainActivity.DEBUG;
|
||||
|
||||
public class SubscriptionsExportService extends BaseImportExportService {
|
||||
public static final String KEY_FILE_PATH = "key_file_path";
|
||||
|
||||
@ -109,8 +109,8 @@ public class SubscriptionsExportService extends BaseImportExportService {
|
||||
|
||||
subscriptionManager.subscriptionTable().getAll().take(1)
|
||||
.map(subscriptionEntities -> {
|
||||
final List<SubscriptionItem> result
|
||||
= new ArrayList<>(subscriptionEntities.size());
|
||||
final List<SubscriptionItem> result =
|
||||
new ArrayList<>(subscriptionEntities.size());
|
||||
for (final SubscriptionEntity entity : subscriptionEntities) {
|
||||
result.add(new SubscriptionItem(entity.getServiceId(), entity.getUrl(),
|
||||
entity.getName()));
|
||||
|
@ -39,8 +39,8 @@ final class CacheFactory implements DataSource.Factory {
|
||||
.createDataSource();
|
||||
|
||||
final FileDataSource fileSource = new FileDataSource();
|
||||
final CacheDataSink dataSink
|
||||
= new CacheDataSink(cache, PlayerHelper.getPreferredFileSize());
|
||||
final CacheDataSink dataSink =
|
||||
new CacheDataSink(cache, PlayerHelper.getPreferredFileSize());
|
||||
return new CacheDataSource(cache, dataSource, fileSource, dataSink, CACHE_FLAGS, null);
|
||||
}
|
||||
}
|
||||
|
@ -208,8 +208,8 @@ public class PlayerDataSource {
|
||||
Log.w(TAG, "instantiateCacheIfNeeded: could not create cache dir");
|
||||
}
|
||||
|
||||
final LeastRecentlyUsedCacheEvictor evictor
|
||||
= new LeastRecentlyUsedCacheEvictor(PlayerHelper.getPreferredCacheSize());
|
||||
final LeastRecentlyUsedCacheEvictor evictor =
|
||||
new LeastRecentlyUsedCacheEvictor(PlayerHelper.getPreferredCacheSize());
|
||||
cache = new SimpleCache(cacheDir, evictor, new StandaloneDatabaseProvider(context));
|
||||
}
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public final class PlayerHelper {
|
||||
private static final StringBuilder STRING_BUILDER = new StringBuilder();
|
||||
private static final Formatter STRING_FORMATTER
|
||||
= new Formatter(STRING_BUILDER, Locale.getDefault());
|
||||
private static final Formatter STRING_FORMATTER =
|
||||
new Formatter(STRING_BUILDER, Locale.getDefault());
|
||||
private static final NumberFormat SPEED_FORMATTER = new DecimalFormat("0.##x");
|
||||
private static final NumberFormat PITCH_FORMATTER = new DecimalFormat("##%");
|
||||
|
||||
|
@ -30,25 +30,26 @@ public final class NotificationConstants {
|
||||
// Intent actions
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
public static final String ACTION_CLOSE
|
||||
= App.PACKAGE_NAME + ".player.MainPlayer.CLOSE";
|
||||
public static final String ACTION_PLAY_PAUSE
|
||||
= App.PACKAGE_NAME + ".player.MainPlayer.PLAY_PAUSE";
|
||||
public static final String ACTION_REPEAT
|
||||
= App.PACKAGE_NAME + ".player.MainPlayer.REPEAT";
|
||||
public static final String ACTION_PLAY_NEXT
|
||||
= App.PACKAGE_NAME + ".player.MainPlayer.ACTION_PLAY_NEXT";
|
||||
public static final String ACTION_PLAY_PREVIOUS
|
||||
= App.PACKAGE_NAME + ".player.MainPlayer.ACTION_PLAY_PREVIOUS";
|
||||
public static final String ACTION_FAST_REWIND
|
||||
= App.PACKAGE_NAME + ".player.MainPlayer.ACTION_FAST_REWIND";
|
||||
public static final String ACTION_FAST_FORWARD
|
||||
= App.PACKAGE_NAME + ".player.MainPlayer.ACTION_FAST_FORWARD";
|
||||
public static final String ACTION_SHUFFLE
|
||||
= App.PACKAGE_NAME + ".player.MainPlayer.ACTION_SHUFFLE";
|
||||
public static final String ACTION_RECREATE_NOTIFICATION
|
||||
= App.PACKAGE_NAME + ".player.MainPlayer.ACTION_RECREATE_NOTIFICATION";
|
||||
|
||||
private static final String BASE_ACTION =
|
||||
App.PACKAGE_NAME + ".player.MainPlayer.";
|
||||
public static final String ACTION_CLOSE =
|
||||
BASE_ACTION + "CLOSE";
|
||||
public static final String ACTION_PLAY_PAUSE =
|
||||
BASE_ACTION + ".player.MainPlayer.PLAY_PAUSE";
|
||||
public static final String ACTION_REPEAT =
|
||||
BASE_ACTION + ".player.MainPlayer.REPEAT";
|
||||
public static final String ACTION_PLAY_NEXT =
|
||||
BASE_ACTION + ".player.MainPlayer.ACTION_PLAY_NEXT";
|
||||
public static final String ACTION_PLAY_PREVIOUS =
|
||||
BASE_ACTION + ".player.MainPlayer.ACTION_PLAY_PREVIOUS";
|
||||
public static final String ACTION_FAST_REWIND =
|
||||
BASE_ACTION + ".player.MainPlayer.ACTION_FAST_REWIND";
|
||||
public static final String ACTION_FAST_FORWARD =
|
||||
BASE_ACTION + ".player.MainPlayer.ACTION_FAST_FORWARD";
|
||||
public static final String ACTION_SHUFFLE =
|
||||
BASE_ACTION + ".player.MainPlayer.ACTION_SHUFFLE";
|
||||
public static final String ACTION_RECREATE_NOTIFICATION =
|
||||
BASE_ACTION + ".player.MainPlayer.ACTION_RECREATE_NOTIFICATION";
|
||||
|
||||
|
||||
public static final int NOTHING = 0;
|
||||
|
@ -61,8 +61,7 @@ public class PlayerMediaSession implements MediaSessionCallback {
|
||||
return null;
|
||||
}
|
||||
|
||||
final MediaDescriptionCompat.Builder descriptionBuilder
|
||||
= new MediaDescriptionCompat.Builder()
|
||||
final MediaDescriptionCompat.Builder descBuilder = new MediaDescriptionCompat.Builder()
|
||||
.setMediaId(String.valueOf(index))
|
||||
.setTitle(item.getTitle())
|
||||
.setSubtitle(item.getUploader());
|
||||
@ -76,14 +75,14 @@ public class PlayerMediaSession implements MediaSessionCallback {
|
||||
additionalMetadata.putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, index + 1);
|
||||
additionalMetadata
|
||||
.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, player.getPlayQueue().size());
|
||||
descriptionBuilder.setExtras(additionalMetadata);
|
||||
descBuilder.setExtras(additionalMetadata);
|
||||
|
||||
final Uri thumbnailUri = Uri.parse(item.getThumbnailUrl());
|
||||
if (thumbnailUri != null) {
|
||||
descriptionBuilder.setIconUri(thumbnailUri);
|
||||
descBuilder.setIconUri(thumbnailUri);
|
||||
}
|
||||
|
||||
return descriptionBuilder.build();
|
||||
return descBuilder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -534,8 +534,8 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh
|
||||
binding.brightnessProgressBar.setMax(maxGestureLength);
|
||||
|
||||
setInitialGestureValues();
|
||||
binding.itemsListPanel.getLayoutParams().height
|
||||
= height - binding.itemsListPanel.getTop();
|
||||
binding.itemsListPanel.getLayoutParams().height =
|
||||
height - binding.itemsListPanel.getTop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -710,8 +710,9 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh
|
||||
}
|
||||
|
||||
int nearestPosition = 0;
|
||||
final List<StreamSegment> segments
|
||||
= player.getCurrentStreamInfo().get().getStreamSegments();
|
||||
final List<StreamSegment> segments = player.getCurrentStreamInfo()
|
||||
.get()
|
||||
.getStreamSegments();
|
||||
|
||||
for (int i = 0; i < segments.size(); i++) {
|
||||
if (segments.get(i).getStartTimeSeconds() * 1000L > playbackPosition) {
|
||||
@ -912,8 +913,8 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "toggleFullscreen() called");
|
||||
}
|
||||
final PlayerServiceEventListener fragmentListener
|
||||
= player.getFragmentListener().orElse(null);
|
||||
final PlayerServiceEventListener fragmentListener = player.getFragmentListener()
|
||||
.orElse(null);
|
||||
if (fragmentListener == null || player.exoPlayerIsNull()) {
|
||||
return;
|
||||
}
|
||||
@ -939,8 +940,9 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh
|
||||
|
||||
public void checkLandscape() {
|
||||
// check if landscape is correct
|
||||
final boolean videoInLandscapeButNotInFullscreen
|
||||
= isLandscape() && !isFullscreen && !player.isAudioOnly();
|
||||
final boolean videoInLandscapeButNotInFullscreen = isLandscape()
|
||||
&& !isFullscreen
|
||||
&& !player.isAudioOnly();
|
||||
final boolean notPaused = player.getCurrentState() != STATE_COMPLETED
|
||||
&& player.getCurrentState() != STATE_PAUSED;
|
||||
|
||||
|
@ -226,8 +226,8 @@ public abstract class VideoPlayerUi extends PlayerUi
|
||||
|
||||
// PlaybackControlRoot already consumed window insets but we should pass them to
|
||||
// player_overlays and fast_seek_overlay too. Without it they will be off-centered.
|
||||
onLayoutChangeListener
|
||||
= (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||
onLayoutChangeListener =
|
||||
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||
binding.playerOverlays.setPadding(
|
||||
v.getPaddingLeft(),
|
||||
v.getPaddingTop(),
|
||||
@ -1053,8 +1053,7 @@ public abstract class VideoPlayerUi extends PlayerUi
|
||||
}
|
||||
qualityPopupMenu.getMenu().removeGroup(POPUP_MENU_ID_QUALITY);
|
||||
|
||||
@Nullable final List<VideoStream> availableStreams
|
||||
= Optional.ofNullable(player.getCurrentMetadata())
|
||||
final List<VideoStream> availableStreams = Optional.ofNullable(player.getCurrentMetadata())
|
||||
.flatMap(MediaItemTag::getMaybeQuality)
|
||||
.map(MediaItemTag.Quality::getSortedVideoStreams)
|
||||
.orElse(null);
|
||||
|
@ -43,8 +43,8 @@ import java.util.Objects;
|
||||
public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||
private static final String ZIP_MIME_TYPE = "application/zip";
|
||||
|
||||
private final SimpleDateFormat exportDateFormat
|
||||
= new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US);
|
||||
private final SimpleDateFormat exportDateFormat =
|
||||
new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US);
|
||||
|
||||
private ContentSettingsManager manager;
|
||||
|
||||
@ -160,8 +160,8 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||
// will be saved only on success
|
||||
final Uri lastExportDataUri = result.getData().getData();
|
||||
|
||||
final StoredFileHelper file
|
||||
= new StoredFileHelper(getContext(), result.getData().getData(), ZIP_MIME_TYPE);
|
||||
final StoredFileHelper file =
|
||||
new StoredFileHelper(getContext(), result.getData().getData(), ZIP_MIME_TYPE);
|
||||
|
||||
exportDatabase(file, lastExportDataUri);
|
||||
}
|
||||
@ -173,8 +173,8 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||
// will be saved only on success
|
||||
final Uri lastImportDataUri = result.getData().getData();
|
||||
|
||||
final StoredFileHelper file
|
||||
= new StoredFileHelper(getContext(), result.getData().getData(), ZIP_MIME_TYPE);
|
||||
final StoredFileHelper file =
|
||||
new StoredFileHelper(getContext(), result.getData().getData(), ZIP_MIME_TYPE);
|
||||
|
||||
new AlertDialog.Builder(requireActivity())
|
||||
.setMessage(R.string.override_current_data)
|
||||
|
@ -9,8 +9,8 @@ import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.error.ErrorInfo;
|
||||
import org.schabi.newpipe.error.ErrorUtil;
|
||||
import org.schabi.newpipe.error.UserAction;
|
||||
import org.schabi.newpipe.util.PicassoHelper;
|
||||
import org.schabi.newpipe.local.feed.notifications.NotificationWorker;
|
||||
import org.schabi.newpipe.util.PicassoHelper;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@ -21,20 +21,20 @@ public class DebugSettingsFragment extends BasePreferenceFragment {
|
||||
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
|
||||
addPreferencesFromResourceRegistry();
|
||||
|
||||
final Preference allowHeapDumpingPreference
|
||||
= findPreference(getString(R.string.allow_heap_dumping_key));
|
||||
final Preference showMemoryLeaksPreference
|
||||
= findPreference(getString(R.string.show_memory_leaks_key));
|
||||
final Preference showImageIndicatorsPreference
|
||||
= findPreference(getString(R.string.show_image_indicators_key));
|
||||
final Preference checkNewStreamsPreference
|
||||
= findPreference(getString(R.string.check_new_streams_key));
|
||||
final Preference crashTheAppPreference
|
||||
= findPreference(getString(R.string.crash_the_app_key));
|
||||
final Preference showErrorSnackbarPreference
|
||||
= findPreference(getString(R.string.show_error_snackbar_key));
|
||||
final Preference createErrorNotificationPreference
|
||||
= findPreference(getString(R.string.create_error_notification_key));
|
||||
final Preference allowHeapDumpingPreference =
|
||||
findPreference(getString(R.string.allow_heap_dumping_key));
|
||||
final Preference showMemoryLeaksPreference =
|
||||
findPreference(getString(R.string.show_memory_leaks_key));
|
||||
final Preference showImageIndicatorsPreference =
|
||||
findPreference(getString(R.string.show_image_indicators_key));
|
||||
final Preference checkNewStreamsPreference =
|
||||
findPreference(getString(R.string.check_new_streams_key));
|
||||
final Preference crashTheAppPreference =
|
||||
findPreference(getString(R.string.crash_the_app_key));
|
||||
final Preference showErrorSnackbarPreference =
|
||||
findPreference(getString(R.string.show_error_snackbar_key));
|
||||
final Preference createErrorNotificationPreference =
|
||||
findPreference(getString(R.string.create_error_notification_key));
|
||||
|
||||
assert allowHeapDumpingPreference != null;
|
||||
assert showMemoryLeaksPreference != null;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package org.schabi.newpipe.settings;
|
||||
|
||||
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
@ -32,8 +34,6 @@ import java.net.URI;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
||||
|
||||
public class DownloadSettingsFragment extends BasePreferenceFragment {
|
||||
public static final boolean IGNORE_RELEASE_ON_OLD_PATH = true;
|
||||
private String downloadPathVideoPreference;
|
||||
@ -255,8 +255,8 @@ public class DownloadSettingsFragment extends BasePreferenceFragment {
|
||||
context.grantUriPermission(context.getPackageName(), uri,
|
||||
StoredDirectoryHelper.PERMISSION_FLAGS);
|
||||
|
||||
final StoredDirectoryHelper mainStorage
|
||||
= new StoredDirectoryHelper(context, uri, null);
|
||||
final StoredDirectoryHelper mainStorage =
|
||||
new StoredDirectoryHelper(context, uri, null);
|
||||
Log.i(TAG, "Acquiring tree success from " + uri.toString());
|
||||
|
||||
if (!mainStorage.canWrite()) {
|
||||
|
@ -199,8 +199,8 @@ public class PeertubeInstanceListFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void showAddItemDialog(final Context c) {
|
||||
final DialogEditTextBinding dialogBinding
|
||||
= DialogEditTextBinding.inflate(getLayoutInflater());
|
||||
final DialogEditTextBinding dialogBinding =
|
||||
DialogEditTextBinding.inflate(getLayoutInflater());
|
||||
dialogBinding.dialogEditText.setInputType(
|
||||
InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
|
||||
dialogBinding.dialogEditText.setHint(R.string.peertube_instance_add_help);
|
||||
|
@ -9,19 +9,19 @@ import org.schabi.newpipe.NewVersionWorker;
|
||||
import org.schabi.newpipe.R;
|
||||
|
||||
public class UpdateSettingsFragment extends BasePreferenceFragment {
|
||||
private final Preference.OnPreferenceChangeListener updatePreferenceChange
|
||||
= (preference, checkForUpdates) -> {
|
||||
private final Preference.OnPreferenceChangeListener updatePreferenceChange = (p, nVal) -> {
|
||||
final boolean checkForUpdates = (boolean) nVal;
|
||||
defaultPreferences.edit()
|
||||
.putBoolean(getString(R.string.update_app_key), (boolean) checkForUpdates).apply();
|
||||
.putBoolean(getString(R.string.update_app_key), checkForUpdates)
|
||||
.apply();
|
||||
|
||||
if ((boolean) checkForUpdates) {
|
||||
if (checkForUpdates) {
|
||||
checkNewVersionNow();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
private final Preference.OnPreferenceClickListener manualUpdateClick
|
||||
= preference -> {
|
||||
private final Preference.OnPreferenceClickListener manualUpdateClick = preference -> {
|
||||
Toast.makeText(getContext(), R.string.checking_updates_toast, Toast.LENGTH_SHORT).show();
|
||||
checkNewVersionNow();
|
||||
return true;
|
||||
|
@ -82,8 +82,8 @@ public class DataReader {
|
||||
|
||||
public long readLong() throws IOException {
|
||||
primitiveRead(LONG_SIZE);
|
||||
final long high
|
||||
= primitive[0] << 24 | primitive[1] << 16 | primitive[2] << 8 | primitive[3];
|
||||
final long high =
|
||||
primitive[0] << 24 | primitive[1] << 16 | primitive[2] << 8 | primitive[3];
|
||||
final long low = primitive[4] << 24 | primitive[5] << 16 | primitive[6] << 8 | primitive[7];
|
||||
return high << 32 | low;
|
||||
}
|
||||
|
@ -307,8 +307,8 @@ public class Mp4FromDashWriter {
|
||||
outWrite(makeMdat(totalSampleSize, is64));
|
||||
|
||||
final int[] sampleIndex = new int[readers.length];
|
||||
final int[] sizes
|
||||
= new int[singleSampleBuffer > 0 ? singleSampleBuffer : SAMPLES_PER_CHUNK];
|
||||
final int[] sizes =
|
||||
new int[singleSampleBuffer > 0 ? singleSampleBuffer : SAMPLES_PER_CHUNK];
|
||||
final int[] sync = new int[singleSampleBuffer > 0 ? singleSampleBuffer : SAMPLES_PER_CHUNK];
|
||||
|
||||
int written = readers.length;
|
||||
|
@ -176,8 +176,8 @@ public final class ListHelper {
|
||||
@Nullable final List<VideoStream> videoOnlyStreams,
|
||||
final boolean ascendingOrder,
|
||||
final boolean preferVideoOnlyStreams) {
|
||||
final SharedPreferences preferences
|
||||
= PreferenceManager.getDefaultSharedPreferences(context);
|
||||
final SharedPreferences preferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
final boolean showHigherResolutions = preferences.getBoolean(
|
||||
context.getString(R.string.show_higher_resolutions_key), false);
|
||||
@ -214,8 +214,8 @@ public final class ListHelper {
|
||||
|
||||
private static String computeDefaultResolution(final Context context, final int key,
|
||||
final int value) {
|
||||
final SharedPreferences preferences
|
||||
= PreferenceManager.getDefaultSharedPreferences(context);
|
||||
final SharedPreferences preferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
// Load the preferred resolution otherwise the best available
|
||||
String resolution = preferences != null
|
||||
@ -254,8 +254,8 @@ public final class ListHelper {
|
||||
return 0;
|
||||
}
|
||||
|
||||
final int defaultStreamIndex
|
||||
= getVideoStreamIndex(defaultResolution, defaultFormat, videoStreams);
|
||||
final int defaultStreamIndex =
|
||||
getVideoStreamIndex(defaultResolution, defaultFormat, videoStreams);
|
||||
|
||||
// this is actually an error,
|
||||
// but maybe there is really no stream fitting to the default value.
|
||||
@ -446,8 +446,9 @@ public final class ListHelper {
|
||||
final String targetResolutionNoRefresh = targetResolution.replaceAll("p\\d+$", "p");
|
||||
|
||||
for (int idx = 0; idx < videoStreams.size(); idx++) {
|
||||
final MediaFormat format
|
||||
= targetFormat == null ? null : videoStreams.get(idx).getFormat();
|
||||
final MediaFormat format = targetFormat == null
|
||||
? null
|
||||
: videoStreams.get(idx).getFormat();
|
||||
final String resolution = videoStreams.get(idx).getResolution();
|
||||
final String resolutionNoRefresh = resolution.replaceAll("p\\d+$", "p");
|
||||
|
||||
@ -510,8 +511,8 @@ public final class ListHelper {
|
||||
private static MediaFormat getDefaultFormat(@NonNull final Context context,
|
||||
@StringRes final int defaultFormatKey,
|
||||
@StringRes final int defaultFormatValueKey) {
|
||||
final SharedPreferences preferences
|
||||
= PreferenceManager.getDefaultSharedPreferences(context);
|
||||
final SharedPreferences preferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
final String defaultFormat = context.getString(defaultFormatValueKey);
|
||||
final String defaultFormatString = preferences.getString(
|
||||
@ -617,8 +618,8 @@ public final class ListHelper {
|
||||
private static String getResolutionLimit(@NonNull final Context context) {
|
||||
String resolutionLimit = null;
|
||||
if (isMeteredNetwork(context)) {
|
||||
final SharedPreferences preferences
|
||||
= PreferenceManager.getDefaultSharedPreferences(context);
|
||||
final SharedPreferences preferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(context);
|
||||
final String defValue = context.getString(R.string.limit_data_usage_none_key);
|
||||
final String value = preferences.getString(
|
||||
context.getString(R.string.limit_mobile_data_usage_key), defValue);
|
||||
@ -634,8 +635,8 @@ public final class ListHelper {
|
||||
* @return {@code true} if connected to a metered network
|
||||
*/
|
||||
public static boolean isMeteredNetwork(@NonNull final Context context) {
|
||||
final ConnectivityManager manager
|
||||
= ContextCompat.getSystemService(context, ConnectivityManager.class);
|
||||
final ConnectivityManager manager =
|
||||
ContextCompat.getSystemService(context, ConnectivityManager.class);
|
||||
if (manager == null || manager.getActiveNetworkInfo() == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ public final class PeertubeHelper {
|
||||
final Context context) {
|
||||
final SharedPreferences sharedPreferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
final String selectedInstanceKey
|
||||
= context.getString(R.string.peertube_selected_instance_key);
|
||||
final String selectedInstanceKey =
|
||||
context.getString(R.string.peertube_selected_instance_key);
|
||||
final JsonStringWriter jsonWriter = JsonWriter.string().object();
|
||||
jsonWriter.value("name", instance.getName());
|
||||
jsonWriter.value("url", instance.getUrl());
|
||||
|
@ -122,8 +122,8 @@ public final class PermissionHelper {
|
||||
}
|
||||
|
||||
public static void showPopupEnablementToast(final Context context) {
|
||||
final Toast toast
|
||||
= Toast.makeText(context, R.string.msg_popup_permission, Toast.LENGTH_LONG);
|
||||
final Toast toast =
|
||||
Toast.makeText(context, R.string.msg_popup_permission, Toast.LENGTH_LONG);
|
||||
final TextView messageView = toast.getView().findViewById(android.R.id.message);
|
||||
if (messageView != null) {
|
||||
messageView.setGravity(Gravity.CENTER);
|
||||
|
@ -28,8 +28,8 @@ import okhttp3.OkHttpClient;
|
||||
|
||||
public final class PicassoHelper {
|
||||
public static final String PLAYER_THUMBNAIL_TAG = "PICASSO_PLAYER_THUMBNAIL_TAG";
|
||||
private static final String PLAYER_THUMBNAIL_TRANSFORMATION_KEY
|
||||
= "PICASSO_PLAYER_THUMBNAIL_TRANSFORMATION_KEY";
|
||||
private static final String PLAYER_THUMBNAIL_TRANSFORMATION_KEY =
|
||||
"PICASSO_PLAYER_THUMBNAIL_TRANSFORMATION_KEY";
|
||||
|
||||
private PicassoHelper() {
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public final class StateSaver {
|
||||
public static final String KEY_SAVED_STATE = "key_saved_state";
|
||||
private static final ConcurrentHashMap<String, Queue<Object>> STATE_OBJECTS_HOLDER
|
||||
= new ConcurrentHashMap<>();
|
||||
private static final ConcurrentHashMap<String, Queue<Object>> STATE_OBJECTS_HOLDER =
|
||||
new ConcurrentHashMap<>();
|
||||
private static final String TAG = "StateSaver";
|
||||
private static final String CACHE_DIR_NAME = "state_cache";
|
||||
private static String cacheDirPath;
|
||||
@ -107,8 +107,8 @@ public final class StateSaver {
|
||||
}
|
||||
|
||||
try {
|
||||
Queue<Object> savedObjects
|
||||
= STATE_OBJECTS_HOLDER.remove(savedState.getPrefixFileSaved());
|
||||
Queue<Object> savedObjects =
|
||||
STATE_OBJECTS_HOLDER.remove(savedState.getPrefixFileSaved());
|
||||
if (savedObjects != null) {
|
||||
writeRead.readFrom(savedObjects);
|
||||
if (MainActivity.DEBUG) {
|
||||
|
@ -153,13 +153,13 @@ public final class InternalUrlsHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Single<StreamInfo> single
|
||||
= ExtractorHelper.getStreamInfo(service.getServiceId(), cleanUrl, false);
|
||||
final Single<StreamInfo> single =
|
||||
ExtractorHelper.getStreamInfo(service.getServiceId(), cleanUrl, false);
|
||||
disposables.add(single.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(info -> {
|
||||
final PlayQueue playQueue
|
||||
= new SinglePlayQueue(info, seconds * 1000L);
|
||||
final PlayQueue playQueue =
|
||||
new SinglePlayQueue(info, seconds * 1000L);
|
||||
NavigationHelper.playOnPopupPlayer(context, playQueue, false);
|
||||
}, throwable -> {
|
||||
if (DEBUG) {
|
||||
|
@ -18,159 +18,17 @@
|
||||
|
||||
package org.schabi.newpipe.util.urlfinder;
|
||||
|
||||
import androidx.annotation.RestrictTo;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;
|
||||
|
||||
/**
|
||||
* Commonly used regular expression patterns.
|
||||
*/
|
||||
public final class PatternsCompat {
|
||||
/**
|
||||
* Regular expression to match all IANA top-level domains.
|
||||
*
|
||||
* List accurate as of 2015/11/24. List taken from:
|
||||
* http://data.iana.org/TLD/tlds-alpha-by-domain.txt
|
||||
* This pattern is auto-generated by frameworks/ex/common/tools/make-iana-tld-pattern.py
|
||||
*/
|
||||
static final String IANA_TOP_LEVEL_DOMAINS = "(?:"
|
||||
+ "(?:aaa|aarp|abb|abbott|abogado|academy|accenture|accountant|accountants|aco|active"
|
||||
+ "|actor|ads|adult|aeg|aero|afl|agency|aig|airforce|airtel|allfinanz|alsace|amica"
|
||||
+ "|amsterdam|android|apartments|app|apple|aquarelle|aramco|archi|army|arpa|arte|asia"
|
||||
+ "|associates|attorney|auction|audio|auto|autos|axa|azure|a[cdefgilmoqrstuwxz])"
|
||||
+ "|(?:band|bank|bar|barcelona|barclaycard|barclays|bargains|bauhaus|bayern|bbc|bbva"
|
||||
+ "|bcn|beats|beer|bentley|berlin|best|bet|bharti|bible|bid|bike|bing|bingo|bio|biz"
|
||||
+ "|black|blackfriday|bloomberg|blue|bms|bmw|bnl|bnpparibas|boats|bom|bond|boo|boots"
|
||||
+ "|boutique|bradesco|bridgestone|broadway|broker|brother|brussels|budapest|build"
|
||||
+ "|builders|business|buzz|bzh|b[abdefghijmnorstvwyz])"
|
||||
+ "|(?:cab|cafe|cal|camera|camp|cancerresearch|canon|capetown|capital|car|caravan|cards"
|
||||
+ "|care|career|careers|cars|cartier|casa|cash|casino|cat|catering|cba|cbn|ceb|center"
|
||||
+ "|ceo|cern|cfa|cfd|chanel|channel|chat|cheap|chloe|christmas|chrome|church|cipriani"
|
||||
+ "|cisco|citic|city|cityeats|claims|cleaning|click|clinic|clothing|cloud|club|clubmed"
|
||||
+ "|coach|codes|coffee|college|cologne|com|commbank|community|company|computer|comsec"
|
||||
+ "|condos|construction|consulting|contractors|cooking|cool|coop|corsica|country"
|
||||
+ "|coupons|courses|credit|creditcard|creditunion|cricket|crown|crs|cruises|csc"
|
||||
+ "|cuisinella|cymru|cyou|c[acdfghiklmnoruvwxyz])"
|
||||
+ "|(?:dabur|dad|dance|date|dating|datsun|day|dclk|deals|degree|delivery|dell|delta"
|
||||
+ "|democrat|dental|dentist|desi|design|dev|diamonds|diet|digital|direct|directory"
|
||||
+ "|discount|dnp|docs|dog|doha|domains|doosan|download|drive|durban|dvag|d[ejkmoz])"
|
||||
+ "|(?:earth|eat|edu|education|email|emerck|energy|engineer|engineering|enterprises"
|
||||
+ "|epson|equipment|erni|esq|estate|eurovision|eus|events|everbank|exchange|expert"
|
||||
+ "|exposed|express|e[cegrstu])"
|
||||
+ "|(?:fage|fail|fairwinds|faith|family|fan|fans|farm"
|
||||
+ "|fashion|feedback|ferrero|film|final|finance|financial|firmdale|fish|fishing|fit"
|
||||
+ "|fitness|flights|florist|flowers|flsmidth|fly|foo|football|forex|forsale|forum"
|
||||
+ "|foundation|frl|frogans|fund|furniture|futbol|fyi|f[ijkmor])"
|
||||
+ "|(?:gal|gallery|game|garden|gbiz|gdn|gea|gent|genting|ggee|gift|gifts|gives|giving"
|
||||
+ "|glass|gle|global|globo|gmail|gmo|gmx|gold|goldpoint|golf|goo|goog|google|gop|gov"
|
||||
+ "|grainger|graphics|gratis|green|gripe|group|gucci|guge|guide|guitars|guru"
|
||||
+ "|g[abdefghilmnpqrstuwy])"
|
||||
+ "|(?:hamburg|hangout|haus|healthcare|help|here|hermes|hiphop|hitachi|hiv|hockey"
|
||||
+ "|holdings|holiday|homedepot|homes|honda|horse|host|hosting|hoteles|hotmail|house"
|
||||
+ "|how|hsbc|hyundai|h[kmnrtu])"
|
||||
+ "|(?:ibm|icbc|ice|icu|ifm|iinet|immo|immobilien|industries|infiniti|info|ing|ink"
|
||||
+ "|institute|insure|int|international|investments|ipiranga|irish|ist|istanbul|itau"
|
||||
+ "|iwc|i[delmnoqrst])"
|
||||
+ "|(?:jaguar|java|jcb|jetzt|jewelry|jlc|jll|jobs|joburg|jprs|juegos|j[emop])"
|
||||
+ "|(?:kaufen|kddi|kia|kim|kinder|kitchen|kiwi|koeln|komatsu|krd|kred|kyoto"
|
||||
+ "|k[eghimnprwyz])"
|
||||
+ "|(?:lacaixa|lancaster|land|landrover|lasalle|lat|latrobe|law|lawyer|lds|lease"
|
||||
+ "|leclerc|legal|lexus|lgbt|liaison|lidl|life|lifestyle|lighting|limited|limo|linde"
|
||||
+ "|link|live|lixil|loan|loans|lol|london|lotte|lotto|love|ltd|ltda|lupin|luxe|luxury"
|
||||
+ "|l[abcikrstuvy])"
|
||||
+ "|(?:madrid|maif|maison|man|management|mango|market|marketing|markets|marriott|mba"
|
||||
+ "|media|meet|melbourne|meme|memorial|men|menu|meo|miami|microsoft|mil|mini|mma|mobi"
|
||||
+ "|moda|moe|moi|mom|monash|money|montblanc|mormon|mortgage|moscow|motorcycles|mov"
|
||||
+ "|movie|movistar|mtn|mtpc|mtr|museum|mutuelle|m[acdeghklmnopqrstuvwxyz])"
|
||||
+ "|(?:nadex|nagoya|name|navy|nec|net|netbank|network|neustar|new|news|nexus|ngo|nhk"
|
||||
+ "|nico|ninja|nissan|nokia|nra|nrw|ntt|nyc|n[acefgilopruz])"
|
||||
+ "|(?:obi|office|okinawa|omega|one|ong|onl|online|ooo|oracle|orange|org|organic|osaka"
|
||||
+ "|otsuka|ovh|om)"
|
||||
+ "|(?:page|panerai|paris|partners|parts|party|pet|pharmacy|philips|photo|photography"
|
||||
+ "|photos|physio|piaget|pics|pictet|pictures|ping|pink|pizza|place|play|playstation"
|
||||
+ "|plumbing|plus|pohl|poker|porn|post|praxi|press|pro|prod|productions|prof|properties"
|
||||
+ "|property|protection|pub|p[aefghklmnrstwy])"
|
||||
+ "|(?:qpon|quebec|qa)"
|
||||
+ "|(?:racing|realtor|realty|recipes|red|redstone|rehab|reise|reisen|reit|ren|rent"
|
||||
+ "|rentals|repair|report|republican|rest|restaurant|review|reviews|rich|ricoh|rio|rip"
|
||||
+ "|rocher|rocks|rodeo|rsvp|ruhr|run|rwe|ryukyu|r[eosuw])"
|
||||
+ "|(?:saarland|sakura|sale|samsung|sandvik|sandvikcoromant|sanofi|sap|sapo|sarl|saxo"
|
||||
+ "|sbs|sca|scb|schmidt|scholarships|school|schule|schwarz|science|scor|scot|seat"
|
||||
+ "|security|seek|sener|services|seven|sew|sex|sexy|shiksha|shoes|show|shriram|singles"
|
||||
+ "|site|ski|sky|skype|sncf|soccer|social|software|sohu|solar|solutions|sony|soy|space"
|
||||
+ "|spiegel|spreadbetting|srl|stada|starhub|statoil|stc|stcgroup|stockholm|studio|study"
|
||||
+ "|style|sucks|supplies|supply|support|surf|surgery|suzuki|swatch|swiss|sydney|systems"
|
||||
+ "|s[abcdeghijklmnortuvxyz])"
|
||||
+ "|(?:tab|taipei|tatamotors|tatar|tattoo|tax|taxi|team|tech|technology|tel|telefonica"
|
||||
+ "|temasek|tennis|thd|theater|theatre|tickets|tienda|tips|tires|tirol|today|tokyo"
|
||||
+ "|tools|top|toray|toshiba|tours|town|toyota|toys|trade|trading|training|travel|trust"
|
||||
+ "|tui|t[cdfghjklmnortvwz])"
|
||||
+ "|(?:ubs|university|uno|uol|u[agksyz])"
|
||||
+ "|(?:vacations|vana|vegas|ventures|versicherung|vet|viajes|video|villas|vin|virgin"
|
||||
+ "|vision|vista|vistaprint|viva|vlaanderen|vodka|vote|voting|voto|voyage|v[aceginu])"
|
||||
+ "|(?:wales|walter|wang|watch|webcam|website|wed|wedding|weir|whoswho|wien|wiki"
|
||||
+ "|williamhill|win|windows|wine|wme|work|works|world|wtc|wtf|w[fs])"
|
||||
+ "|(?:\u03b5\u03bb|\u0431\u0435\u043b|\u0434\u0435\u0442\u0438|\u043a\u043e\u043c"
|
||||
+ "|\u043c\u043a\u0434|\u043c\u043e\u043d|\u043c\u043e\u0441\u043a\u0432\u0430"
|
||||
+ "|\u043e\u043d\u043b\u0430\u0439\u043d|\u043e\u0440\u0433|\u0440\u0443\u0441"
|
||||
+ "|\u0440\u0444|\u0441\u0430\u0439\u0442|\u0441\u0440\u0431|\u0443\u043a\u0440"
|
||||
+ "|\u049b\u0430\u0437|\u0570\u0561\u0575|\u05e7\u05d5\u05dd"
|
||||
+ "|\u0627\u0631\u0627\u0645\u0643\u0648|\u0627\u0644\u0627\u0631\u062f\u0646"
|
||||
+ "|\u0627\u0644\u062c\u0632\u0627\u0626\u0631"
|
||||
+ "|\u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629"
|
||||
+ "|\u0627\u0644\u0645\u063a\u0631\u0628|\u0627\u0645\u0627\u0631\u0627\u062a"
|
||||
+ "|\u0627\u06cc\u0631\u0627\u0646|\u0628\u0627\u0632\u0627\u0631"
|
||||
+ "|\u0628\u06be\u0627\u0631\u062a|\u062a\u0648\u0646\u0633"
|
||||
+ "|\u0633\u0648\u062f\u0627\u0646|\u0633\u0648\u0631\u064a\u0629"
|
||||
+ "|\u0634\u0628\u0643\u0629|\u0639\u0631\u0627\u0642|\u0639\u0645\u0627\u0646"
|
||||
+ "|\u0641\u0644\u0633\u0637\u064a\u0646|\u0642\u0637\u0631|\u0643\u0648\u0645"
|
||||
+ "|\u0645\u0635\u0631|\u0645\u0644\u064a\u0633\u064a\u0627|\u0645\u0648\u0642\u0639"
|
||||
+ "|\u0915\u0949\u092e|\u0928\u0947\u091f|\u092d\u093e\u0930\u0924"
|
||||
+ "|\u0938\u0902\u0917\u0920\u0928|\u09ad\u09be\u09b0\u09a4|\u0a2d\u0a3e\u0a30\u0a24"
|
||||
+ "|\u0aad\u0abe\u0ab0\u0aa4|\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe"
|
||||
+ "|\u0b87\u0bb2\u0b99\u0bcd\u0b95\u0bc8"
|
||||
+ "|\u0b9a\u0bbf\u0b99\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0bc2\u0bb0\u0bcd"
|
||||
+ "|\u0c2d\u0c3e\u0c30\u0c24\u0c4d|\u0dbd\u0d82\u0d9a\u0dcf|\u0e04\u0e2d\u0e21"
|
||||
+ "|\u0e44\u0e17\u0e22|\u10d2\u10d4|\u307f\u3093\u306a|\u30b0\u30fc\u30b0\u30eb"
|
||||
+ "|\u30b3\u30e0|\u4e16\u754c|\u4e2d\u4fe1|\u4e2d\u56fd|\u4e2d\u570b|\u4e2d\u6587\u7f51"
|
||||
+ "|\u4f01\u4e1a|\u4f5b\u5c71|\u4fe1\u606f|\u5065\u5eb7|\u516b\u5366|\u516c\u53f8"
|
||||
+ "|\u516c\u76ca|\u53f0\u6e7e|\u53f0\u7063|\u5546\u57ce|\u5546\u5e97|\u5546\u6807"
|
||||
+ "|\u5728\u7ebf|\u5927\u62ff|\u5a31\u4e50|\u5de5\u884c|\u5e7f\u4e1c|\u6148\u5584"
|
||||
+ "|\u6211\u7231\u4f60|\u624b\u673a|\u653f\u52a1|\u653f\u5e9c|\u65b0\u52a0\u5761"
|
||||
+ "|\u65b0\u95fb|\u65f6\u5c1a|\u673a\u6784|\u6de1\u9a6c\u9521|\u6e38\u620f|\u70b9\u770b"
|
||||
+ "|\u79fb\u52a8|\u7ec4\u7ec7\u673a\u6784|\u7f51\u5740|\u7f51\u5e97|\u7f51\u7edc"
|
||||
+ "|\u8c37\u6b4c|\u96c6\u56e2|\u98de\u5229\u6d66|\u9910\u5385|\u9999\u6e2f|\ub2f7\ub137"
|
||||
+ "|\ub2f7\ucef4|\uc0bc\uc131|\ud55c\uad6d|xbox|xerox|xin|xn\\-\\-11b4c3d"
|
||||
+ "|xn\\-\\-1qqw23a|xn\\-\\-30rr7y|xn\\-\\-3bst00m|xn\\-\\-3ds443g|xn\\-\\-3e0b707e"
|
||||
+ "|xn\\-\\-3pxu8k|xn\\-\\-42c2d9a|xn\\-\\-45brj9c|xn\\-\\-45q11c|xn\\-\\-4gbrim"
|
||||
+ "|xn\\-\\-55qw42g|xn\\-\\-55qx5d|xn\\-\\-6frz82g|xn\\-\\-6qq986b3xl|xn\\-\\-80adxhks"
|
||||
+ "|xn\\-\\-80ao21a|xn\\-\\-80asehdb|xn\\-\\-80aswg|xn\\-\\-90a3ac|xn\\-\\-90ais"
|
||||
+ "|xn\\-\\-9dbq2a|xn\\-\\-9et52u|xn\\-\\-b4w605ferd|xn\\-\\-c1avg|xn\\-\\-c2br7g"
|
||||
+ "|xn\\-\\-cg4bki|xn\\-\\-clchc0ea0b2g2a9gcd|xn\\-\\-czr694b|xn\\-\\-czrs0t"
|
||||
+ "|xn\\-\\-czru2d|xn\\-\\-d1acj3b|xn\\-\\-d1alf|xn\\-\\-efvy88h|xn\\-\\-estv75g"
|
||||
+ "|xn\\-\\-fhbei|xn\\-\\-fiq228c5hs|xn\\-\\-fiq64b|xn\\-\\-fiqs8s|xn\\-\\-fiqz9s"
|
||||
+ "|xn\\-\\-fjq720a|xn\\-\\-flw351e|xn\\-\\-fpcrj9c3d|xn\\-\\-fzc2c9e2c|xn\\-\\-gecrj9c"
|
||||
+ "|xn\\-\\-h2brj9c|xn\\-\\-hxt814e|xn\\-\\-i1b6b1a6a2e|xn\\-\\-imr513n|xn\\-\\-io0a7i"
|
||||
+ "|xn\\-\\-j1aef|xn\\-\\-j1amh|xn\\-\\-j6w193g|xn\\-\\-kcrx77d1x4a|xn\\-\\-kprw13d"
|
||||
+ "|xn\\-\\-kpry57d|xn\\-\\-kput3i|xn\\-\\-l1acc|xn\\-\\-lgbbat1ad8j|xn\\-\\-mgb9awbf"
|
||||
+ "|xn\\-\\-mgba3a3ejt|xn\\-\\-mgba3a4f16a|xn\\-\\-mgbaam7a8h|xn\\-\\-mgbab2bd"
|
||||
+ "|xn\\-\\-mgbayh7gpa|xn\\-\\-mgbbh1a71e|xn\\-\\-mgbc0a9azcg|xn\\-\\-mgberp4a5d4ar"
|
||||
+ "|xn\\-\\-mgbpl2fh|xn\\-\\-mgbtx2b|xn\\-\\-mgbx4cd0ab|xn\\-\\-mk1bu44c|xn\\-\\-mxtq1m"
|
||||
+ "|xn\\-\\-ngbc5azd|xn\\-\\-node|xn\\-\\-nqv7f|xn\\-\\-nqv7fs00ema|xn\\-\\-nyqy26a"
|
||||
+ "|xn\\-\\-o3cw4h|xn\\-\\-ogbpf8fl|xn\\-\\-p1acf|xn\\-\\-p1ai|xn\\-\\-pgbs0dh"
|
||||
+ "|xn\\-\\-pssy2u|xn\\-\\-q9jyb4c|xn\\-\\-qcka1pmc|xn\\-\\-qxam|xn\\-\\-rhqv96g"
|
||||
+ "|xn\\-\\-s9brj9c|xn\\-\\-ses554g|xn\\-\\-t60b56a|xn\\-\\-tckwe|xn\\-\\-unup4y"
|
||||
+ "|xn\\-\\-vermgensberater\\-ctb|xn\\-\\-vermgensberatung\\-pwb|xn\\-\\-vhquv"
|
||||
+ "|xn\\-\\-vuq861b|xn\\-\\-wgbh1c|xn\\-\\-wgbl6a|xn\\-\\-xhq521b|xn\\-\\-xkc2al3hye2a"
|
||||
+ "|xn\\-\\-xkc2dl3a5ee0h|xn\\-\\-y9a3aq|xn\\-\\-yfro4i67o|xn\\-\\-ygbi2ammx"
|
||||
+ "|xn\\-\\-zfr164b|xperia|xxx|xyz)"
|
||||
+ "|(?:yachts|yamaxun|yandex|yodobashi|yoga|yokohama|youtube|y[et])"
|
||||
+ "|(?:zara|zip|zone|zuerich|z[amw]))";
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// CHANGED: Removed unused code //
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
public static final Pattern IP_ADDRESS
|
||||
= Pattern.compile(
|
||||
public static final Pattern IP_ADDRESS = Pattern.compile(
|
||||
"((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]"
|
||||
+ "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]"
|
||||
+ "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
|
||||
@ -204,28 +62,11 @@ public final class PatternsCompat {
|
||||
*/
|
||||
private static final String LABEL_CHAR = "a-zA-Z0-9" + UCS_CHAR;
|
||||
|
||||
/**
|
||||
* Valid characters for IRI TLD defined in RFC 3987.
|
||||
*/
|
||||
private static final String TLD_CHAR = "a-zA-Z" + UCS_CHAR;
|
||||
|
||||
/**
|
||||
* RFC 1035 Section 2.3.4 limits the labels to a maximum 63 octets.
|
||||
*/
|
||||
private static final String IRI_LABEL
|
||||
= "[" + LABEL_CHAR + "](?:[" + LABEL_CHAR + "_\\-]{0,61}[" + LABEL_CHAR + "]){0,1}";
|
||||
|
||||
/**
|
||||
* RFC 3492 references RFC 1034 and limits Punycode algorithm output to 63 characters.
|
||||
*/
|
||||
private static final String PUNYCODE_TLD = "xn\\-\\-[\\w\\-]{0,58}\\w";
|
||||
|
||||
private static final String TLD = "(" + PUNYCODE_TLD + "|" + "[" + TLD_CHAR + "]{2,63}" + ")";
|
||||
|
||||
private static final String HOST_NAME = "(" + IRI_LABEL + "\\.)+" + TLD;
|
||||
|
||||
public static final Pattern DOMAIN_NAME
|
||||
= Pattern.compile("(" + HOST_NAME + "|" + IP_ADDRESS + ")");
|
||||
private static final String IRI_LABEL =
|
||||
"[" + LABEL_CHAR + "](?:[" + LABEL_CHAR + "_\\-]{0,61}[" + LABEL_CHAR + "]){0,1}";
|
||||
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// CHANGED: Removed rtsp from supported protocols //
|
||||
@ -245,59 +86,11 @@ public final class PatternsCompat {
|
||||
+ ";/\\?:@&=#~" // plus optional query params
|
||||
+ "\\-\\.\\+!\\*'\\(\\),_\\$])|(?:%[a-fA-F0-9]{2}))*";
|
||||
|
||||
/**
|
||||
* Regular expression pattern to match most part of RFC 3987
|
||||
* Internationalized URLs, aka IRIs.
|
||||
*/
|
||||
public static final Pattern WEB_URL = Pattern.compile("("
|
||||
+ "("
|
||||
+ "(?:" + PROTOCOL + "(?:" + USER_INFO + ")?" + ")?"
|
||||
+ "(?:" + DOMAIN_NAME + ")"
|
||||
+ "(?:" + PORT_NUMBER + ")?"
|
||||
+ ")"
|
||||
+ "(" + PATH_AND_QUERY + ")?"
|
||||
+ WORD_BOUNDARY
|
||||
+ ")");
|
||||
|
||||
/**
|
||||
* Regular expression that matches known TLDs and punycode TLDs.
|
||||
*/
|
||||
private static final String STRICT_TLD = "(?:"
|
||||
+ IANA_TOP_LEVEL_DOMAINS + "|" + PUNYCODE_TLD + ")";
|
||||
|
||||
/**
|
||||
* Regular expression that matches host names using {@link #STRICT_TLD}.
|
||||
*/
|
||||
private static final String STRICT_HOST_NAME = "(?:(?:" + IRI_LABEL + "\\.)+"
|
||||
+ STRICT_TLD + ")";
|
||||
|
||||
/**
|
||||
* Regular expression that matches domain names using either {@link #STRICT_HOST_NAME} or
|
||||
* {@link #IP_ADDRESS}.
|
||||
*/
|
||||
private static final Pattern STRICT_DOMAIN_NAME
|
||||
= Pattern.compile("(?:" + STRICT_HOST_NAME + "|" + IP_ADDRESS + ")");
|
||||
|
||||
/**
|
||||
* Regular expression that matches domain names without a TLD.
|
||||
*/
|
||||
private static final String RELAXED_DOMAIN_NAME
|
||||
= "(?:" + "(?:" + IRI_LABEL + "(?:\\.(?=\\S))" + "?)+" + "|" + IP_ADDRESS + ")";
|
||||
|
||||
/**
|
||||
* Regular expression to match strings that do not start with a supported protocol. The TLDs
|
||||
* are expected to be one of the known TLDs.
|
||||
*/
|
||||
private static final String WEB_URL_WITHOUT_PROTOCOL = "("
|
||||
+ WORD_BOUNDARY
|
||||
+ "(?<!:\\/\\/)"
|
||||
+ "("
|
||||
+ "(?:" + STRICT_DOMAIN_NAME + ")"
|
||||
+ "(?:" + PORT_NUMBER + ")?"
|
||||
+ ")"
|
||||
+ "(?:" + PATH_AND_QUERY + ")?"
|
||||
+ WORD_BOUNDARY
|
||||
+ ")";
|
||||
private static final String RELAXED_DOMAIN_NAME =
|
||||
"(?:" + "(?:" + IRI_LABEL + "(?:\\.(?=\\S))" + "?)+" + "|" + IP_ADDRESS + ")";
|
||||
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// CHANGED: Field visibility was modified //
|
||||
@ -317,59 +110,6 @@ public final class PatternsCompat {
|
||||
+ WORD_BOUNDARY
|
||||
+ ")";
|
||||
|
||||
/**
|
||||
* Regular expression pattern to match IRIs. If a string starts with http(s):// the expression
|
||||
* tries to match the URL structure with a relaxed rule for TLDs. If the string does not start
|
||||
* with http(s):// the TLDs are expected to be one of the known TLDs.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RestrictTo(LIBRARY_GROUP_PREFIX)
|
||||
public static final Pattern AUTOLINK_WEB_URL = Pattern.compile(
|
||||
"(" + WEB_URL_WITH_PROTOCOL + "|" + WEB_URL_WITHOUT_PROTOCOL + ")");
|
||||
|
||||
/**
|
||||
* Regular expression for valid email characters. Does not include some of the valid characters
|
||||
* defined in RFC5321: #&~!^`{}/=$*?|
|
||||
*/
|
||||
private static final String EMAIL_CHAR = LABEL_CHAR + "\\+\\-_%'";
|
||||
|
||||
/**
|
||||
* Regular expression for local part of an email address. RFC5321 section 4.5.3.1.1 limits
|
||||
* the local part to be at most 64 octets.
|
||||
*/
|
||||
private static final String EMAIL_ADDRESS_LOCAL_PART
|
||||
= "[" + EMAIL_CHAR + "]" + "(?:[" + EMAIL_CHAR + "\\.]{0,62}[" + EMAIL_CHAR + "])?";
|
||||
|
||||
/**
|
||||
* Regular expression for the domain part of an email address. RFC5321 section 4.5.3.1.2 limits
|
||||
* the domain to be at most 255 octets.
|
||||
*/
|
||||
private static final String EMAIL_ADDRESS_DOMAIN
|
||||
= "(?=.{1,255}(?:\\s|$|^))" + HOST_NAME;
|
||||
|
||||
/**
|
||||
* Regular expression pattern to match email addresses. It excludes double quoted local parts
|
||||
* and the special characters #&~!^`{}/=$*?| that are included in RFC5321.
|
||||
* @hide
|
||||
*/
|
||||
@RestrictTo(LIBRARY_GROUP_PREFIX)
|
||||
public static final Pattern AUTOLINK_EMAIL_ADDRESS = Pattern.compile("(" + WORD_BOUNDARY
|
||||
+ "(?:" + EMAIL_ADDRESS_LOCAL_PART + "@" + EMAIL_ADDRESS_DOMAIN + ")"
|
||||
+ WORD_BOUNDARY + ")"
|
||||
);
|
||||
|
||||
public static final Pattern EMAIL_ADDRESS
|
||||
= Pattern.compile(
|
||||
"[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}"
|
||||
+ "\\@"
|
||||
+ "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}"
|
||||
+ "("
|
||||
+ "\\."
|
||||
+ "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}"
|
||||
+ ")+"
|
||||
);
|
||||
|
||||
/**
|
||||
* Do not create this static utility class.
|
||||
*/
|
||||
|
@ -57,8 +57,8 @@ public final class FocusAwareDrawerLayout extends DrawerLayout {
|
||||
for (int i = 0; i < getChildCount(); ++i) {
|
||||
final View child = getChildAt(i);
|
||||
|
||||
final DrawerLayout.LayoutParams lp
|
||||
= (DrawerLayout.LayoutParams) child.getLayoutParams();
|
||||
final DrawerLayout.LayoutParams lp =
|
||||
(DrawerLayout.LayoutParams) child.getLayoutParams();
|
||||
|
||||
if (lp.gravity != 0 && isDrawerVisible(child)) {
|
||||
hasOpenPanels = true;
|
||||
@ -85,8 +85,8 @@ public final class FocusAwareDrawerLayout extends DrawerLayout {
|
||||
for (int i = 0; i < getChildCount(); ++i) {
|
||||
final View child = getChildAt(i);
|
||||
|
||||
final DrawerLayout.LayoutParams lp
|
||||
= (DrawerLayout.LayoutParams) child.getLayoutParams();
|
||||
final DrawerLayout.LayoutParams lp =
|
||||
(DrawerLayout.LayoutParams) child.getLayoutParams();
|
||||
|
||||
if (lp.gravity == 0) {
|
||||
content = child;
|
||||
|
@ -1,5 +1,8 @@
|
||||
package org.schabi.newpipe.local.subscription.services;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
|
||||
import org.schabi.newpipe.extractor.subscription.SubscriptionItem;
|
||||
@ -11,9 +14,6 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* @see ImportExportJsonHelper
|
||||
*/
|
||||
@ -47,8 +47,8 @@ public class ImportExportJsonHelperTest {
|
||||
|
||||
fail("didn't throw exception");
|
||||
} catch (final Exception e) {
|
||||
final boolean isExpectedException
|
||||
= e instanceof SubscriptionExtractor.InvalidSourceException;
|
||||
final boolean isExpectedException =
|
||||
e instanceof SubscriptionExtractor.InvalidSourceException;
|
||||
assertTrue("\"" + e.getClass().getSimpleName()
|
||||
+ "\" is not the expected exception", isExpectedException);
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
package org.schabi.newpipe.settings.tabs;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
import com.grack.nanojson.JsonArray;
|
||||
import com.grack.nanojson.JsonObject;
|
||||
import com.grack.nanojson.JsonParser;
|
||||
@ -11,11 +16,6 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class TabsJsonHelperTest {
|
||||
private static final String JSON_TABS_ARRAY_KEY = "tabs";
|
||||
private static final String JSON_TAB_ID_KEY = "tab_id";
|
||||
@ -59,8 +59,8 @@ public class TabsJsonHelperTest {
|
||||
|
||||
fail("didn't throw exception");
|
||||
} catch (final Exception e) {
|
||||
final boolean isExpectedException
|
||||
= e instanceof TabsJsonHelper.InvalidJsonException;
|
||||
final boolean isExpectedException =
|
||||
e instanceof TabsJsonHelper.InvalidJsonException;
|
||||
assertTrue("\"" + e.getClass().getSimpleName()
|
||||
+ "\" is not the expected exception", isExpectedException);
|
||||
}
|
||||
|
@ -116,6 +116,10 @@
|
||||
<module name="NoWhitespaceAfter"/>
|
||||
<module name="NoWhitespaceBefore"/>
|
||||
<module name="OperatorWrap"/>
|
||||
<module name="OperatorWrap">
|
||||
<property name="tokens" value="ASSIGN,DIV_ASSIGN,PLUS_ASSIGN,MINUS_ASSIGN,STAR_ASSIGN,MOD_ASSIGN,SR_ASSIGN,BSR_ASSIGN,SL_ASSIGN,BXOR_ASSIGN,BOR_ASSIGN,BAND_ASSIGN"/>
|
||||
<property name="option" value="eol"/>
|
||||
</module>
|
||||
<module name="ParenPad"/>
|
||||
<module name="TypecastParenPad"/>
|
||||
<module name="WhitespaceAfter"/>
|
||||
|
Loading…
Reference in New Issue
Block a user