Cleaned up some Lint warnings
This commit is contained in:
parent
ae906de06d
commit
3399be1290
|
@ -18,9 +18,7 @@ public class NthMatcher {
|
|||
@Override
|
||||
public boolean matches(final Object item) {
|
||||
if (matcher.matches(item)) {
|
||||
if (count.incrementAndGet() == index) {
|
||||
return true;
|
||||
}
|
||||
return count.incrementAndGet() == index;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ public class DBWriterTest {
|
|||
assertTrue(queue.size() != 0);
|
||||
|
||||
DBWriter.deleteFeedMediaOfItem(getInstrumentation().getTargetContext(), media.getId());
|
||||
Awaitility.await().until(() -> dest.exists() == false);
|
||||
Awaitility.await().until(() -> !dest.exists());
|
||||
media = DBReader.getFeedMedia(media.getId());
|
||||
assertNotNull(media);
|
||||
assertFalse(dest.exists());
|
||||
|
@ -797,7 +797,7 @@ public class DBWriterTest {
|
|||
) {
|
||||
List<FeedItem> queue = DBReader.getQueue();
|
||||
List<Long> itemIdsActualList = toItemIds(queue);
|
||||
List<Long> itemIdsExpectedList = new ArrayList<Long>(itemIdsExpected.length);
|
||||
List<Long> itemIdsExpectedList = new ArrayList<>(itemIdsExpected.length);
|
||||
for (long id : itemIdsExpected) {
|
||||
itemIdsExpectedList.add(id);
|
||||
}
|
||||
|
@ -806,7 +806,7 @@ public class DBWriterTest {
|
|||
}
|
||||
|
||||
private static List<Long> toItemIds(List<FeedItem> items) {
|
||||
List<Long> itemIds = new ArrayList<Long>(items.size());
|
||||
List<Long> itemIds = new ArrayList<>(items.size());
|
||||
for(FeedItem item : items) {
|
||||
itemIds.add(item.getId());
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ public class OpmlImportActivity extends AppCompatActivity {
|
|||
*/
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
Log.d(TAG, "Received result");
|
||||
if (resultCode == RESULT_CANCELED) {
|
||||
Log.d(TAG, "Activity was cancelled");
|
||||
|
|
|
@ -121,8 +121,9 @@ public class StorageErrorActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == Activity.RESULT_OK &&
|
||||
requestCode == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == Activity.RESULT_OK
|
||||
&& requestCode == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED) {
|
||||
String dir = data.getStringExtra(DirectoryChooserActivity.RESULT_SELECTED_DIR);
|
||||
|
||||
File path;
|
||||
|
@ -131,19 +132,19 @@ public class StorageErrorActivity extends AppCompatActivity {
|
|||
} else {
|
||||
path = getExternalFilesDir(null);
|
||||
}
|
||||
if(path == null) {
|
||||
if (path == null) {
|
||||
return;
|
||||
}
|
||||
String message = null;
|
||||
if(!path.exists()) {
|
||||
if (!path.exists()) {
|
||||
message = String.format(getString(R.string.folder_does_not_exist_error), dir);
|
||||
} else if(!path.canRead()) {
|
||||
} else if (!path.canRead()) {
|
||||
message = String.format(getString(R.string.folder_not_readable_error), dir);
|
||||
} else if(!path.canWrite()) {
|
||||
} else if (!path.canWrite()) {
|
||||
message = String.format(getString(R.string.folder_not_writable_error), dir);
|
||||
}
|
||||
|
||||
if(message == null) {
|
||||
if (message == null) {
|
||||
Log.d(TAG, "Setting data folder: " + dir);
|
||||
UserPreferences.setDataFolder(dir);
|
||||
leaveErrorState();
|
||||
|
|
|
@ -84,16 +84,16 @@ public class ProxyDialog {
|
|||
String host = etHost.getText().toString();
|
||||
String port = etPort.getText().toString();
|
||||
String username = etUsername.getText().toString();
|
||||
if(TextUtils.isEmpty(username)) {
|
||||
if (TextUtils.isEmpty(username)) {
|
||||
username = null;
|
||||
}
|
||||
String password = etPassword.getText().toString();
|
||||
if(TextUtils.isEmpty(password)) {
|
||||
if (TextUtils.isEmpty(password)) {
|
||||
password = null;
|
||||
}
|
||||
int portValue = 0;
|
||||
if(!TextUtils.isEmpty(port)) {
|
||||
portValue = Integer.valueOf(port);
|
||||
if (!TextUtils.isEmpty(port)) {
|
||||
portValue = Integer.parseInt(port);
|
||||
}
|
||||
if (Proxy.Type.valueOf(type) == Proxy.Type.SOCKS) {
|
||||
proxy = ProxyConfig.socks(host, portValue, username, password);
|
||||
|
@ -257,8 +257,8 @@ public class ProxyDialog {
|
|||
String username = etUsername.getText().toString();
|
||||
String password = etPassword.getText().toString();
|
||||
int portValue = 8080;
|
||||
if(!TextUtils.isEmpty(port)) {
|
||||
portValue = Integer.valueOf(port);
|
||||
if (!TextUtils.isEmpty(port)) {
|
||||
portValue = Integer.parseInt(port);
|
||||
}
|
||||
SocketAddress address = InetSocketAddress.createUnresolved(host, portValue);
|
||||
Proxy.Type proxyType = Proxy.Type.valueOf(type.toUpperCase());
|
||||
|
@ -268,7 +268,7 @@ public class ProxyDialog {
|
|||
.proxy(proxy);
|
||||
builder.interceptors().clear();
|
||||
OkHttpClient client = builder.build();
|
||||
if(!TextUtils.isEmpty(username)) {
|
||||
if (!TextUtils.isEmpty(username)) {
|
||||
String credentials = Credentials.basic(username, password);
|
||||
client.interceptors().add(chain -> {
|
||||
Request request = chain.request().newBuilder()
|
||||
|
|
|
@ -96,8 +96,7 @@ public class NetworkPreferencesFragment extends PreferenceFragmentCompat {
|
|||
private void setParallelDownloadsText(int downloads) {
|
||||
final Resources res = getActivity().getResources();
|
||||
|
||||
String s = Integer.toString(downloads)
|
||||
+ res.getString(R.string.parallel_downloads_suffix);
|
||||
String s = downloads + res.getString(R.string.parallel_downloads_suffix);
|
||||
findPreference(UserPreferences.PREF_PARALLEL_DOWNLOADS).setSummary(s);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,26 +59,26 @@ public class UserInterfacePreferencesFragment extends PreferenceFragmentCompat {
|
|||
|
||||
findPreference(UserPreferences.PREF_BACK_BUTTON_BEHAVIOR)
|
||||
.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
if (newValue.equals("page")) {
|
||||
final Context context = getActivity();
|
||||
final String[] navTitles = context.getResources().getStringArray(R.array.back_button_go_to_pages);
|
||||
final String[] navTags = context.getResources().getStringArray(R.array.back_button_go_to_pages_tags);
|
||||
final String[] choice = { UserPreferences.getBackButtonGoToPage() };
|
||||
if (!newValue.equals("page")) {
|
||||
return true;
|
||||
}
|
||||
final Context context = getActivity();
|
||||
final String[] navTitles = context.getResources().getStringArray(R.array.back_button_go_to_pages);
|
||||
final String[] navTags = context.getResources().getStringArray(R.array.back_button_go_to_pages_tags);
|
||||
final String[] choice = { UserPreferences.getBackButtonGoToPage() };
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.back_button_go_to_page_title);
|
||||
builder.setSingleChoiceItems(navTitles, ArrayUtils.indexOf(navTags, UserPreferences.getBackButtonGoToPage()), (dialogInterface, i) -> {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.back_button_go_to_page_title);
|
||||
builder.setSingleChoiceItems(navTitles, ArrayUtils.indexOf(navTags,
|
||||
UserPreferences.getBackButtonGoToPage()), (dialogInterface, i) -> {
|
||||
if (i >= 0) {
|
||||
choice[0] = navTags[i];
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton(R.string.confirm_label, (dialogInterface, i) -> UserPreferences.setBackButtonGoToPage(choice[0]));
|
||||
builder.setNegativeButton(R.string.cancel_label, null);
|
||||
builder.create().show();
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
builder.setPositiveButton(R.string.confirm_label, (dialogInterface, i) -> UserPreferences.setBackButtonGoToPage(choice[0]));
|
||||
builder.setNegativeButton(R.string.cancel_label, null);
|
||||
builder.create().show();
|
||||
return true;
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
|
|
|
@ -18,6 +18,7 @@ public class CircularProgressBar extends View {
|
|||
private float percentage = 0;
|
||||
private float targetPercentage = 0;
|
||||
private Object tag = null;
|
||||
private final RectF bounds = new RectF();
|
||||
|
||||
public CircularProgressBar(Context context) {
|
||||
super(context);
|
||||
|
@ -70,7 +71,7 @@ public class CircularProgressBar extends View {
|
|||
float padding = getHeight() * 0.07f;
|
||||
paintBackground.setStrokeWidth(getHeight() * 0.02f);
|
||||
paintProgress.setStrokeWidth(padding);
|
||||
RectF bounds = new RectF(padding, padding, getWidth() - padding, getHeight() - padding);
|
||||
bounds.set(padding, padding, getWidth() - padding, getHeight() - padding);
|
||||
canvas.drawArc(bounds, 0, 360, false, paintBackground);
|
||||
|
||||
if (percentage > EPSILON && 1 - percentage > EPSILON) {
|
||||
|
|
|
@ -24,6 +24,7 @@ public class PlaybackSpeedIndicatorView extends View {
|
|||
private float degreePerFrame = 2;
|
||||
private float paddingArc = 20;
|
||||
private float paddingIndicator = 10;
|
||||
private RectF arcBounds = new RectF();
|
||||
|
||||
public PlaybackSpeedIndicatorView(Context context) {
|
||||
super(context);
|
||||
|
@ -100,7 +101,7 @@ public class PlaybackSpeedIndicatorView extends View {
|
|||
canvas.drawPath(trianglePath, indicatorPaint);
|
||||
|
||||
arcPaint.setStrokeWidth(getHeight() / 15f);
|
||||
RectF arcBounds = new RectF(paddingArc, paddingArc, getWidth() - paddingArc, getHeight() - paddingArc);
|
||||
arcBounds.set(paddingArc, paddingArc, getWidth() - paddingArc, getHeight() - paddingArc);
|
||||
canvas.drawArc(arcBounds, -180 - 45, 90 + 45 + angle - PADDING_ANGLE, false, arcPaint);
|
||||
canvas.drawArc(arcBounds, -90 + PADDING_ANGLE + angle, 90 + 45 - PADDING_ANGLE - angle, false, arcPaint);
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
android:layout_height="16dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:indeterminateOnly="true"
|
||||
android:layout_centerInParent="true"
|
||||
tools:background="@android:color/holo_red_light" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
android:layout_marginStart="@dimen/listitem_threeline_textleftpadding"
|
||||
android:textSize="40dp"
|
||||
android:gravity="center"
|
||||
tools:text="X"/>
|
||||
tools:text="X"
|
||||
tools:ignore="SpUsage"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RadioGroup
|
||||
android:id="@+id/radio_filter_group"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -104,7 +104,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
tools:background="@android:color/holo_blue_bright">
|
||||
tools:background="@android:color/holo_blue_bright"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
|
@ -123,7 +124,7 @@
|
|||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
tools:src="@drawable/ic_settings_grey600_24dp" />
|
||||
tools:src="@drawable/ic_settings_black" />
|
||||
|
||||
<TextView
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Button"
|
||||
|
@ -151,7 +152,7 @@
|
|||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
tools:src="@drawable/ic_settings_grey600_24dp" />
|
||||
tools:src="@drawable/ic_settings_black" />
|
||||
|
||||
<TextView
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Button"
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/listitem_iconwithtext_height"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
tools:background="@android:color/darker_gray">
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/listitem_iconwithtext_height"
|
||||
android:foreground="?attr/selectableItemBackground" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgvCover"
|
||||
|
@ -24,8 +23,7 @@
|
|||
android:layout_marginStart="@dimen/listitem_icon_leftpadding"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
tools:src="@drawable/ic_file_download_grey600_24dp"
|
||||
tools:background="@android:color/holo_green_dark"/>
|
||||
tools:src="@drawable/ic_download_black"/>
|
||||
|
||||
|
||||
<TextView
|
||||
|
@ -44,9 +42,7 @@
|
|||
android:layout_marginEnd="48dp"
|
||||
android:layout_toRightOf="@id/imgvCover"
|
||||
android:layout_toEndOf="@id/imgvCover"
|
||||
tools:text="Navigation item title"
|
||||
tools:background="@android:color/holo_green_dark"
|
||||
/>
|
||||
tools:text="Navigation item title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvCount"
|
||||
|
@ -62,6 +58,5 @@
|
|||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
tools:text="23"
|
||||
tools:background="@android:color/holo_green_dark"/>
|
||||
tools:text="23" />
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -199,14 +199,14 @@ public class GpodnetEpisodeAction {
|
|||
}
|
||||
|
||||
public String writeToString() {
|
||||
return this.podcast + "\t" +
|
||||
this.episode + "\t" +
|
||||
this.deviceId + "\t" +
|
||||
this.action + "\t" +
|
||||
this.timestamp.getTime() + "\t" +
|
||||
String.valueOf(this.started) + "\t" +
|
||||
String.valueOf(this.position) + "\t" +
|
||||
String.valueOf(this.total);
|
||||
return this.podcast + "\t"
|
||||
+ this.episode + "\t"
|
||||
+ this.deviceId + "\t"
|
||||
+ this.action + "\t"
|
||||
+ this.timestamp.getTime() + "\t"
|
||||
+ this.started + "\t"
|
||||
+ this.position + "\t"
|
||||
+ this.total;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -377,7 +377,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
|
||||
private MediaBrowserCompat.MediaItem createBrowsableMediaItemForFeed(Feed feed) {
|
||||
MediaDescriptionCompat.Builder builder = new MediaDescriptionCompat.Builder()
|
||||
.setMediaId("FeedId:" + Long.toString(feed.getId()))
|
||||
.setMediaId("FeedId:" + feed.getId())
|
||||
.setTitle(feed.getTitle())
|
||||
.setDescription(feed.getDescription())
|
||||
.setSubtitle(feed.getCustomTitle());
|
||||
|
|
|
@ -216,11 +216,11 @@ public class PlaybackServiceTaskManager {
|
|||
* @throws java.lang.IllegalArgumentException if waitingTime <= 0
|
||||
*/
|
||||
public synchronized void setSleepTimer(long waitingTime, boolean shakeToReset, boolean vibrate) {
|
||||
if(waitingTime <= 0) {
|
||||
if (waitingTime <= 0) {
|
||||
throw new IllegalArgumentException("Waiting time <= 0");
|
||||
}
|
||||
|
||||
Log.d(TAG, "Setting sleep timer to " + Long.toString(waitingTime) + " milliseconds");
|
||||
Log.d(TAG, "Setting sleep timer to " + waitingTime + " milliseconds");
|
||||
if (isSleepTimerActive()) {
|
||||
sleepTimerFuture.cancel(true);
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class DBWriter {
|
|||
private static boolean deleteFeedMediaSynchronous(
|
||||
@NonNull Context context, @NonNull FeedMedia media) {
|
||||
Log.i(TAG, String.format("Requested to delete FeedMedia [id=%d, title=%s, downloaded=%s",
|
||||
media.getId(), media.getEpisodeTitle(), String.valueOf(media.isDownloaded())));
|
||||
media.getId(), media.getEpisodeTitle(), media.isDownloaded()));
|
||||
if (media.isDownloaded()) {
|
||||
// delete downloaded media file
|
||||
File mediaFile = new File(media.getFile_url());
|
||||
|
|
|
@ -43,9 +43,7 @@ public class ID3Reader {
|
|||
onNoTagHeaderFound();
|
||||
} else {
|
||||
rc = onStartTagHeader(tagHeader);
|
||||
if (rc == ACTION_SKIP) {
|
||||
onEndTag();
|
||||
} else {
|
||||
if (rc != ACTION_SKIP) {
|
||||
while (readerPosition < tagHeader.getSize()) {
|
||||
FrameHeader frameHeader = createFrameHeader(readChars(input, HEADER_LENGTH));
|
||||
if (checkForNullString(frameHeader.getId())) {
|
||||
|
@ -59,8 +57,8 @@ public class ID3Reader {
|
|||
skipBytes(input, frameHeader.getSize());
|
||||
}
|
||||
}
|
||||
onEndTag();
|
||||
}
|
||||
onEndTag();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import de.danoeh.antennapod.core.util.ShownotesProvider;
|
|||
public class Timeline {
|
||||
private static final String TAG = "Timeline";
|
||||
|
||||
private static final Pattern TIMECODE_LINK_REGEX = Pattern.compile("antennapod://timecode/((\\d+))");
|
||||
private static final Pattern TIMECODE_LINK_REGEX = Pattern.compile("antennapod://timecode/(\\d+)");
|
||||
private static final String TIMECODE_LINK = "<a class=\"timecode\" href=\"antennapod://timecode/%d\">%s</a>";
|
||||
private static final Pattern TIMECODE_REGEX = Pattern.compile("\\b((\\d+):)?(\\d+):(\\d{2})\\b");
|
||||
private static final Pattern LINE_BREAK_REGEX = Pattern.compile("<br */?>");
|
||||
|
|
Loading…
Reference in New Issue