Address error-prone warnings
This commit is contained in:
parent
a7ef246069
commit
6b449c18ee
|
@ -1,5 +1,7 @@
|
|||
package de.danoeh.antennapod.receiver;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProvider;
|
||||
import android.content.Context;
|
||||
|
@ -44,7 +46,7 @@ public class PlayerWidget extends AppWidgetProvider {
|
|||
@Override
|
||||
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
|
||||
int[] appWidgetIds) {
|
||||
Log.d(TAG, "onUpdate() called with: " + "context = [" + context + "], appWidgetManager = [" + appWidgetManager + "], appWidgetIds = [" + appWidgetIds + "]");
|
||||
Log.d(TAG, "onUpdate() called with: " + "context = [" + context + "], appWidgetManager = [" + appWidgetManager + "], appWidgetIds = [" + Arrays.toString(appWidgetIds) + "]");
|
||||
startUpdate(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import de.danoeh.antennapod.core.BuildConfig;
|
||||
import de.danoeh.antennapod.core.ClientConfig;
|
||||
|
@ -46,8 +47,8 @@ public class FlattrClickWorker extends AsyncTask<Void, Integer, FlattrClickWorke
|
|||
|
||||
public static enum ExitCode {EXIT_NORMAL, NO_TOKEN, NO_NETWORK, NO_THINGS}
|
||||
|
||||
private volatile int countFailed = 0;
|
||||
private volatile int countSuccess = 0;
|
||||
private final AtomicInteger countFailed = new AtomicInteger();
|
||||
private final AtomicInteger countSuccess = new AtomicInteger();
|
||||
|
||||
private volatile FlattrThing extraFlattrThing;
|
||||
|
||||
|
@ -114,12 +115,12 @@ public class FlattrClickWorker extends AsyncTask<Void, Integer, FlattrClickWorke
|
|||
FlattrUtils.clickUrl(context, thing.getPaymentLink());
|
||||
thing.getFlattrStatus().setFlattred();
|
||||
publishProgress(R.string.flattr_click_success);
|
||||
countSuccess++;
|
||||
countSuccess.incrementAndGet();
|
||||
|
||||
} catch (FlattrException e) {
|
||||
e.printStackTrace();
|
||||
countFailed++;
|
||||
if (countFailed == 1) {
|
||||
int failed = countFailed.incrementAndGet();
|
||||
if (failed == 1) {
|
||||
exception = e;
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +149,7 @@ public class FlattrClickWorker extends AsyncTask<Void, Integer, FlattrClickWorke
|
|||
super.onPostExecute(exitCode);
|
||||
switch (exitCode) {
|
||||
case EXIT_NORMAL:
|
||||
if (countFailed > 0) {
|
||||
if (countFailed.get() > 0) {
|
||||
postFlattrFailedNotification();
|
||||
}
|
||||
break;
|
||||
|
@ -190,7 +191,8 @@ public class FlattrClickWorker extends AsyncTask<Void, Integer, FlattrClickWorke
|
|||
}
|
||||
|
||||
private void postFlattrFailedNotification() {
|
||||
if (countFailed == 0) {
|
||||
int failed = countFailed.get();
|
||||
if (failed == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -198,15 +200,15 @@ public class FlattrClickWorker extends AsyncTask<Void, Integer, FlattrClickWorke
|
|||
String title;
|
||||
String subtext;
|
||||
|
||||
if (countFailed == 1) {
|
||||
if (failed == 1) {
|
||||
title = context.getString(R.string.flattrd_failed_label);
|
||||
String exceptionMsg = (exception.getMessage() != null) ? exception.getMessage() : "";
|
||||
subtext = context.getString(R.string.flattr_click_failure, extraFlattrThing.getTitle())
|
||||
+ "\n" + exceptionMsg;
|
||||
} else {
|
||||
title = context.getString(R.string.flattrd_label);
|
||||
subtext = context.getString(R.string.flattr_click_success_count, countSuccess) + "\n"
|
||||
+ context.getString(R.string.flattr_click_failure_count, countFailed);
|
||||
subtext = context.getString(R.string.flattr_click_success_count, countSuccess.get()) + "\n"
|
||||
+ context.getString(R.string.flattr_click_failure_count, failed);
|
||||
}
|
||||
|
||||
Notification notification = new NotificationCompat.Builder(context)
|
||||
|
|
|
@ -128,7 +128,8 @@ public class DownloadRequest implements Parcelable {
|
|||
|
||||
DownloadRequest that = (DownloadRequest) o;
|
||||
|
||||
if (lastModified != that.lastModified) return false;
|
||||
if (lastModified != null ? !lastModified.equals(that.lastModified) : that.lastModified != null)
|
||||
return false;
|
||||
if (deleteOnFailure != that.deleteOnFailure) return false;
|
||||
if (feedfileId != that.feedfileId) return false;
|
||||
if (feedfileType != that.feedfileType) return false;
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.database.Cursor;
|
|||
import android.support.v4.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
@ -676,7 +677,7 @@ public final class DBReader {
|
|||
* as well as chapter marks of the FeedItems will also be loaded from the database.
|
||||
*/
|
||||
public static List<FeedItem> getFeedItems(final long... itemIds) {
|
||||
Log.d(TAG, "getFeedItems() called with: " + "itemIds = [" + itemIds + "]");
|
||||
Log.d(TAG, "getFeedItems() called with: " + "itemIds = [" + Arrays.toString(itemIds) + "]");
|
||||
PodDBAdapter adapter = PodDBAdapter.getInstance();
|
||||
adapter.open();
|
||||
List<FeedItem> items = getFeedItems(adapter, itemIds);
|
||||
|
|
|
@ -35,7 +35,7 @@ public final class IntList {
|
|||
int hashCode = 1;
|
||||
for (int i = 0; i < size; i++) {
|
||||
int value = values[i];
|
||||
hashCode = 31 * hashCode + (int)(value ^ (value >>> 32));
|
||||
hashCode = 31 * hashCode + value;
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue