Add final modifiers

This commit is contained in:
Martin Fietz 2018-01-14 18:05:45 +01:00
parent b86b6caec8
commit a49048c7f6
87 changed files with 202 additions and 200 deletions

View File

@ -48,13 +48,13 @@ class UITestUtils {
private static final String TEST_FILE_NAME = "3sec.mp3";
private Context context;
private HTTPBin server = new HTTPBin();
private final Context context;
private final HTTPBin server = new HTTPBin();
private File destDir;
private File hostedFeedDir;
private File hostedMediaDir;
public List<Feed> hostedFeeds = new ArrayList<>();
public final List<Feed> hostedFeeds = new ArrayList<>();
public UITestUtils(Context context) {
this.context = context;

View File

@ -45,7 +45,7 @@ public class HTTPBin extends NanoHTTPD {
private static final String MIME_HTML = "text/html";
private static final String MIME_PLAIN = "text/plain";
private List<File> servedFiles;
private final List<File> servedFiles;
public HTTPBin() {
super(PORT);

View File

@ -104,7 +104,7 @@ public abstract class NanoHTTPD {
private final String hostname;
private final int myPort;
private ServerSocket myServerSocket;
private Set<Socket> openConnections = new HashSet<>();
private final Set<Socket> openConnections = new HashSet<>();
private Thread myThread;
/**
* Pluggable strategy for asynchronously executing requests.
@ -557,7 +557,7 @@ public abstract class NanoHTTPD {
/**
* Headers for the HTTP response. Use addHeader() to add lines.
*/
private Map<String, String> header = new ArrayMap<>();
private final Map<String, String> header = new ArrayMap<>();
/**
* The request method that spawned this response.
*/
@ -838,7 +838,7 @@ public abstract class NanoHTTPD {
public static final int BUFSIZE = 8192;
private final TempFileManager tempFileManager;
private final OutputStream outputStream;
private PushbackInputStream inputStream;
private final PushbackInputStream inputStream;
private int splitbyte;
private int rlen;
private String uri;
@ -1320,7 +1320,9 @@ public abstract class NanoHTTPD {
}
public static class Cookie {
private String n, v, e;
private final String n;
private final String v;
private final String e;
public Cookie(String name, String value, String expires) {
n = name;
@ -1360,8 +1362,8 @@ public abstract class NanoHTTPD {
* @author LordFokas
*/
public class CookieHandler implements Iterable<String> {
private ArrayMap<String, String> cookies = new ArrayMap<>();
private ArrayList<Cookie> queue = new ArrayList<>();
private final ArrayMap<String, String> cookies = new ArrayMap<>();
private final ArrayList<Cookie> queue = new ArrayList<>();
public CookieHandler(Map<String, String> httpHeaders) {
String raw = httpHeaders.get("cookie");

View File

@ -21,7 +21,7 @@ import de.danoeh.antennapod.dialog.VariableSpeedDialog;
public class AudioplayerActivity extends MediaplayerInfoActivity {
private static final String TAG = "AudioPlayerActivity";
private AtomicBoolean isSetup = new AtomicBoolean(false);
private final AtomicBoolean isSetup = new AtomicBoolean(false);
@Override
protected void onResume() {

View File

@ -15,7 +15,7 @@ import de.danoeh.antennapod.core.service.playback.PlaybackService;
public class CastplayerActivity extends MediaplayerInfoActivity {
private static final String TAG = "CastPlayerActivity";
private AtomicBoolean isSetup = new AtomicBoolean(false);
private final AtomicBoolean isSetup = new AtomicBoolean(false);
@Override
protected void onCreate(Bundle savedInstanceState) {

View File

@ -100,7 +100,7 @@ public class FeedInfoActivity extends AppCompatActivity {
private boolean authInfoChanged = false;
private TextWatcher authTextWatcher = new TextWatcher() {
private final TextWatcher authTextWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@ -117,7 +117,7 @@ public class FeedInfoActivity extends AppCompatActivity {
private boolean filterTextChanged = false;
private TextWatcher filterTextWatcher = new TextWatcher() {
private final TextWatcher filterTextWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}

View File

@ -398,7 +398,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
}
}
private AdapterView.OnItemClickListener navListClickListener = new AdapterView.OnItemClickListener() {
private final AdapterView.OnItemClickListener navListClickListener = new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
int viewType = parent.getAdapter().getItemViewType(position);
@ -409,7 +409,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
}
};
private AdapterView.OnItemLongClickListener newListLongClickListener = new AdapterView.OnItemLongClickListener() {
private final AdapterView.OnItemLongClickListener newListLongClickListener = new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if(position < navAdapter.getTags().size()) {
@ -630,7 +630,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
private DBReader.NavDrawerData navDrawerData;
private int selectedNavListIndex = 0;
private NavListAdapter.ItemAccess itemAccess = new NavListAdapter.ItemAccess() {
private final NavListAdapter.ItemAccess itemAccess = new NavListAdapter.ItemAccess() {
@Override
public int getCount() {
if (navDrawerData != null) {
@ -748,7 +748,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
snackbar.show();
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {

View File

@ -496,7 +496,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
snackbar.show();
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {

View File

@ -100,7 +100,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
private Subscription download;
private Subscription parser;
private Subscription updater;
private EventDistributor.EventListener listener = new EventDistributor.EventListener() {
private final EventDistributor.EventListener listener = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((arg & EventDistributor.FEED_LIST_UPDATE) != 0) {
@ -581,7 +581,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
private class FeedViewAuthenticationDialog extends AuthenticationDialog {
private String feedUrl;
private final String feedUrl;
FeedViewAuthenticationDialog(Context context, int titleRes, String feedUrl) {
super(context, titleRes, true, false, null, null);

View File

@ -164,7 +164,7 @@ public class StorageErrorActivity extends AppCompatActivity {
startActivity(new Intent(this, MainActivity.class));
}
private BroadcastReceiver mediaUpdate = new BroadcastReceiver() {
private final BroadcastReceiver mediaUpdate = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {

View File

@ -45,7 +45,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
private VideoControlsHider videoControlsHider = new VideoControlsHider(this);
private AtomicBoolean isSetup = new AtomicBoolean(false);
private final AtomicBoolean isSetup = new AtomicBoolean(false);
private LinearLayout controls;
private LinearLayout videoOverlay;
@ -173,7 +173,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
progressIndicator.setVisibility(View.INVISIBLE);
}
private View.OnTouchListener onVideoviewTouched = (v, event) -> {
private final View.OnTouchListener onVideoviewTouched = (v, event) -> {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
videoControlsHider.stop();
toggleVideoControlsVisibility();
@ -353,7 +353,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
private static final int DELAY = 2500;
private WeakReference<VideoplayerActivity> activity;
private final WeakReference<VideoplayerActivity> activity;
public VideoControlsHider(VideoplayerActivity activity) {
this.activity = new WeakReference<>(activity);

View File

@ -225,7 +225,7 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
return pos;
}
private View.OnClickListener secondaryActionListener = new View.OnClickListener() {
private final View.OnClickListener secondaryActionListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
FeedItem item = (FeedItem) v.getTag();

View File

@ -31,9 +31,9 @@ public class DownloadLogAdapter extends BaseAdapter {
private final String TAG = "DownloadLogAdapter";
private Context context;
private final Context context;
private ItemAccess itemAccess;
private final ItemAccess itemAccess;
public DownloadLogAdapter(Context context, ItemAccess itemAccess) {
super();

View File

@ -110,7 +110,7 @@ public class DownloadedEpisodesListAdapter extends BaseAdapter {
return convertView;
}
private View.OnClickListener secondaryActionListener = new View.OnClickListener() {
private final View.OnClickListener secondaryActionListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
FeedItem item = (FeedItem) v.getTag();

View File

@ -22,8 +22,8 @@ public class DownloadlistAdapter extends BaseAdapter {
private static final int SELECTION_NONE = -1;
private int selectedItemIndex;
private ItemAccess itemAccess;
private Context context;
private final ItemAccess itemAccess;
private final Context context;
public DownloadlistAdapter(Context context,
ItemAccess itemAccess) {
@ -105,7 +105,7 @@ public class DownloadlistAdapter extends BaseAdapter {
return convertView;
}
private View.OnClickListener butSecondaryListener = new View.OnClickListener() {
private final View.OnClickListener butSecondaryListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Downloader downloader = (Downloader) v.getTag();

View File

@ -32,13 +32,13 @@ import de.danoeh.antennapod.core.util.ThemeUtils;
*/
public class FeedItemlistAdapter extends BaseAdapter {
private ActionButtonCallback callback;
private final ActionButtonCallback callback;
private final ItemAccess itemAccess;
private final Context context;
private boolean showFeedtitle;
private int selectedItemIndex;
private final boolean showFeedtitle;
private final int selectedItemIndex;
/** true if played items should be made partially transparent */
private boolean makePlayedItemsTransparent;
private final boolean makePlayedItemsTransparent;
private final ActionButtonUtils actionButtonUtils;
private static final int SELECTION_NONE = -1;

View File

@ -62,8 +62,8 @@ public class NavListAdapter extends BaseAdapter
private static List<String> tags;
private static String[] titles;
private ItemAccess itemAccess;
private WeakReference<Activity> activity;
private final ItemAccess itemAccess;
private final WeakReference<Activity> activity;
private boolean showSubscriptionList = true;
public NavListAdapter(ItemAccess itemAccess, Activity context) {

View File

@ -50,7 +50,7 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap
private static final String TAG = QueueRecyclerAdapter.class.getSimpleName();
private WeakReference<MainActivity> mainActivity;
private final WeakReference<MainActivity> mainActivity;
private final ItemAccess itemAccess;
private final ActionButtonCallback actionButtonCallback;
private final ActionButtonUtils actionButtonUtils;
@ -304,7 +304,7 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap
}
private View.OnClickListener secondaryActionListener = new View.OnClickListener() {
private final View.OnClickListener secondaryActionListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
FeedItem item = (FeedItem) v.getTag();

View File

@ -23,7 +23,7 @@ import de.danoeh.antennapod.core.util.Converter;
* Adapter for the statistics list
*/
public class StatisticsListAdapter extends BaseAdapter {
private Context context;
private final Context context;
private List<DBReader.StatisticsItem> feedTime = new ArrayList<>();
private boolean countAll = true;

View File

@ -23,8 +23,8 @@ public class ExportWorker {
private static final String TAG = "ExportWorker";
private static final String DEFAULT_OUTPUT_NAME = "antennapod-feeds";
private ExportWriter exportWriter;
private File output;
private final ExportWriter exportWriter;
private final File output;
public ExportWorker(ExportWriter exportWriter) {
this(exportWriter, new File(UserPreferences.getDataFolder(EXPORT_DIR),

View File

@ -15,9 +15,9 @@ import de.danoeh.antennapod.core.storage.DownloadRequester;
/** Queues items for download in the background. */
public class OpmlFeedQueuer extends AsyncTask<Void, Void, Void> {
private Context context;
private final Context context;
private ProgressDialog progDialog;
private int[] selection;
private final int[] selection;
public OpmlFeedQueuer(Context context, int[] selection) {
super();

View File

@ -20,12 +20,12 @@ public class OpmlImportWorker extends
AsyncTask<Void, Void, ArrayList<OpmlElement>> {
private static final String TAG = "OpmlImportWorker";
private Context context;
private final Context context;
private Exception exception;
private ProgressDialog progDialog;
private Reader mReader;
private final Reader mReader;
public OpmlImportWorker(Context context, Reader reader) {
super();

View File

@ -43,7 +43,7 @@ public class ProxyDialog {
private static final String TAG = "ProxyDialog";
private Context context;
private final Context context;
private MaterialDialog dialog;

View File

@ -24,7 +24,7 @@ public abstract class SleepTimerDialog {
private static final String TAG = SleepTimerDialog.class.getSimpleName();
private Context context;
private final Context context;
private MaterialDialog dialog;
private EditText etxtTime;

View File

@ -346,7 +346,7 @@ public class AllEpisodesFragment extends Fragment {
updateShowOnlyEpisodesListViewState();
}
private AllEpisodesRecycleAdapter.ItemAccess itemAccess = new AllEpisodesRecycleAdapter.ItemAccess() {
private final AllEpisodesRecycleAdapter.ItemAccess itemAccess = new AllEpisodesRecycleAdapter.ItemAccess() {
@Override
public int getCount() {
@ -444,7 +444,7 @@ public class AllEpisodesFragment extends Fragment {
}
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((arg & EVENTS) != 0) {

View File

@ -168,7 +168,7 @@ public class CompletedDownloadsFragment extends ListFragment {
}
}
private DownloadedEpisodesListAdapter.ItemAccess itemAccess = new DownloadedEpisodesListAdapter.ItemAccess() {
private final DownloadedEpisodesListAdapter.ItemAccess itemAccess = new DownloadedEpisodesListAdapter.ItemAccess() {
@Override
public int getCount() {
return (items != null) ? items.size() : 0;
@ -189,7 +189,7 @@ public class CompletedDownloadsFragment extends ListFragment {
}
};
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((arg & EVENTS) != 0) {

View File

@ -82,7 +82,7 @@ public class DownloadLogFragment extends ListFragment {
getActivity().supportInvalidateOptionsMenu();
}
private DownloadLogAdapter.ItemAccess itemAccess = new DownloadLogAdapter.ItemAccess() {
private final DownloadLogAdapter.ItemAccess itemAccess = new DownloadLogAdapter.ItemAccess() {
@Override
public int getCount() {
@ -99,7 +99,7 @@ public class DownloadLogFragment extends ListFragment {
}
};
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {

View File

@ -80,7 +80,7 @@ public class DownloadsFragment extends Fragment {
public class DownloadsPagerAdapter extends FragmentPagerAdapter {
Resources resources;
final Resources resources;
public DownloadsPagerAdapter(FragmentManager fm, Resources resources) {
super(fm);

View File

@ -79,7 +79,7 @@ public class EpisodesFragment extends Fragment {
public static class EpisodesPagerAdapter extends FragmentPagerAdapter {
private final Resources resources;
private AllEpisodesFragment[] fragments = {
private final AllEpisodesFragment[] fragments = {
new NewEpisodesFragment(),
new AllEpisodesFragment(),
new FavoriteEpisodesFragment()

View File

@ -49,7 +49,7 @@ public class FyydSearchFragment extends Fragment {
private Button butRetry;
private TextView txtvEmpty;
private FyydClient client = new FyydClient(AntennapodHttpClient.getHttpClient());
private final FyydClient client = new FyydClient(AntennapodHttpClient.getHttpClient());
/**
* List of podcasts retreived from the search

View File

@ -200,7 +200,7 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo
}
private View.OnLongClickListener webViewLongClickListener = new View.OnLongClickListener() {
private final View.OnLongClickListener webViewLongClickListener = new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {

View File

@ -449,7 +449,7 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
}
}
private View.OnLongClickListener webViewLongClickListener = new View.OnLongClickListener() {
private final View.OnLongClickListener webViewLongClickListener = new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
@ -551,7 +551,7 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((arg & EVENTS) != 0) {

View File

@ -405,7 +405,7 @@ public class ItemlistFragment extends ListFragment {
}
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
@ -571,7 +571,7 @@ public class ItemlistFragment extends ListFragment {
}
}
private FeedItemlistAdapter.ItemAccess itemAccess = new FeedItemlistAdapter.ItemAccess() {
private final FeedItemlistAdapter.ItemAccess itemAccess = new FeedItemlistAdapter.ItemAccess() {
@Override
public FeedItem getItem(int position) {

View File

@ -199,7 +199,7 @@ public class PlaybackHistoryFragment extends ListFragment {
}
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
@ -224,7 +224,7 @@ public class PlaybackHistoryFragment extends ListFragment {
getActivity().supportInvalidateOptionsMenu();
}
private FeedItemlistAdapter.ItemAccess itemAccess = new FeedItemlistAdapter.ItemAccess() {
private final FeedItemlistAdapter.ItemAccess itemAccess = new FeedItemlistAdapter.ItemAccess() {
@Override
public int getItemDownloadProgressPercent(FeedItem item) {

View File

@ -519,7 +519,7 @@ public class QueueFragment extends Fragment {
infoBar.setText(info);
}
private QueueRecyclerAdapter.ItemAccess itemAccess = new QueueRecyclerAdapter.ItemAccess() {
private final QueueRecyclerAdapter.ItemAccess itemAccess = new QueueRecyclerAdapter.ItemAccess() {
@Override
public int getCount() {
return queue != null ? queue.size() : 0;
@ -579,7 +579,7 @@ public class QueueFragment extends Fragment {
}
};
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((arg & EVENTS) != 0) {

View File

@ -75,7 +75,7 @@ public class RunningDownloadsFragment extends ListFragment {
}
private DownloadlistAdapter.ItemAccess itemAccess = new DownloadlistAdapter.ItemAccess() {
private final DownloadlistAdapter.ItemAccess itemAccess = new DownloadlistAdapter.ItemAccess() {
@Override
public int getCount() {
return (downloaderList != null) ? downloaderList.size() : 0;

View File

@ -210,7 +210,7 @@ public class SubscriptionFragment extends Fragment {
loadSubscriptions();
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((EVENTS & arg) != 0) {
@ -220,7 +220,7 @@ public class SubscriptionFragment extends Fragment {
}
};
private SubscriptionsAdapter.ItemAccess itemAccess = new SubscriptionsAdapter.ItemAccess() {
private final SubscriptionsAdapter.ItemAccess itemAccess = new SubscriptionsAdapter.ItemAccess() {
@Override
public int getCount() {
if (navDrawerData != null) {

View File

@ -71,7 +71,7 @@ public class GpodnetMainFragment extends Fragment {
private static final int POS_TAGS = 1;
private static final int POS_SUGGESTIONS = 2;
Resources resources;
final Resources resources;
public GpodnetPagerAdapter(FragmentManager fm, Resources resources) {
super(fm);

View File

@ -193,7 +193,7 @@ public class PlayerWidgetService extends Service {
}
}
private ServiceConnection mConnection = new ServiceConnection() {
private final ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
Log.d(TAG, "Connection to service established");
synchronized (psLock) {
@ -223,7 +223,7 @@ public class PlayerWidgetService extends Service {
class ViewUpdater extends Thread {
private static final String THREAD_NAME = "ViewUpdater";
private PlayerWidgetService service;
private final PlayerWidgetService service;
public ViewUpdater(PlayerWidgetService service) {
super();

View File

@ -10,7 +10,7 @@ import android.support.v4.media.session.PlaybackStateCompat;
*/
class PlaybackServiceFlavorHelper {
private PlaybackService.FlavorHelperCallback callback;
private final PlaybackService.FlavorHelperCallback callback;
PlaybackServiceFlavorHelper(Context context, PlaybackService.FlavorHelperCallback callback) {
this.callback = callback;

View File

@ -14,9 +14,9 @@ import de.danoeh.antennapod.core.storage.DBWriter;
/** Removes a feed in the background. */
public class FeedRemover extends AsyncTask<Void, Void, Void> {
private Context context;
private final Context context;
private ProgressDialog dialog;
private Feed feed;
private final Feed feed;
public boolean skipOnCompletion = false;
public FeedRemover(Context context, Feed feed) {

View File

@ -19,7 +19,7 @@ import de.danoeh.antennapod.core.util.flattr.FlattrUtils;
public class FlattrStatusFetcher extends Thread {
private static final String TAG = "FlattrStatusFetcher";
private Context context;
private final Context context;
public FlattrStatusFetcher(Context context) {
super();

View File

@ -22,10 +22,10 @@ import de.danoeh.antennapod.core.util.flattr.FlattrUtils;
public class FlattrTokenFetcher extends AsyncTask<Void, Void, AccessToken> {
private static final String TAG = "FlattrTokenFetcher";
private Context context;
private AndroidAuthenticator auth;
private final Context context;
private final AndroidAuthenticator auth;
private AccessToken token;
private Uri uri;
private final Uri uri;
private ProgressDialog dialog;
private FlattrException exception;

View File

@ -15,9 +15,9 @@ public abstract class ConfirmationDialog {
private static final String TAG = ConfirmationDialog.class.getSimpleName();
private Context context;
private int titleId;
private String message;
private final Context context;
private final int titleId;
private final String message;
private int positiveText;
private int negativeText;

View File

@ -22,7 +22,7 @@ class HtmlSymbols extends CommonSymbols {
static final String ORDERED_LIST = "ol";
static final String LIST_ITEM = "li";
static String HEADING = "h1";
static final String HEADING = "h1";
static final String LINK = "a";
static final String LINK_DESTINATION = "href";

View File

@ -27,8 +27,8 @@ public class EventDistributor extends Observable {
public static final int DOWNLOAD_HANDLED = 64;
public static final int PLAYER_STATUS_UPDATE = 128;
private Handler handler;
private AbstractQueue<Integer> events;
private final Handler handler;
private final AbstractQueue<Integer> events;
private static EventDistributor instance;

View File

@ -9,8 +9,8 @@ public class FeedFilter {
private static final String TAG = "FeedFilter";
private String includeFilter;
private String excludeFilter;
private final String includeFilter;
private final String excludeFilter;
public FeedFilter() {
this("", "");

View File

@ -59,7 +59,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
public static final int PLAYED = 1;
private String paymentLink;
private FlattrStatus flattrStatus;
private final FlattrStatus flattrStatus;
/**
* Is true if the database contains any chapters that belong to this item. This attribute is only
@ -87,7 +87,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
/**
* Any tags assigned to this item
*/
private Set<String> tags = new HashSet<>();
private final Set<String> tags = new HashSet<>();
public FeedItem() {
this.state = UNPLAYED;

View File

@ -1,11 +1,11 @@
package de.danoeh.antennapod.core.feed;
public class SearchResult {
private FeedComponent component;
private final FeedComponent component;
/** Additional information (e.g. where it was found) */
private String subtitle;
/** Higher value means more importance */
private int value;
private final int value;
public SearchResult(FeedComponent component, int value, String subtitle) {
super();

View File

@ -37,7 +37,7 @@ class ApOkHttpUrlLoader implements ModelLoader<String, InputStream> {
public static class Factory implements ModelLoaderFactory<String, InputStream> {
private static volatile OkHttpClient internalClient;
private OkHttpClient client;
private final OkHttpClient client;
private static OkHttpClient getInternalClient() {
if (internalClient == null) {

View File

@ -1,7 +1,7 @@
package de.danoeh.antennapod.core.gpoddernet;
class GpodnetServiceBadStatusCodeException extends GpodnetServiceException {
private int statusCode;
private final int statusCode;
public GpodnetServiceBadStatusCodeException(String message, int statusCode) {
super(message);

View File

@ -4,10 +4,10 @@ import android.support.annotation.NonNull;
public class GpodnetDevice {
private String id;
private String caption;
private DeviceType type;
private int subscriptions;
private final String id;
private final String caption;
private final DeviceType type;
private final int subscriptions;
public GpodnetDevice(@NonNull String id,
String caption,

View File

@ -3,13 +3,13 @@ package de.danoeh.antennapod.core.gpoddernet.model;
import android.support.annotation.NonNull;
public class GpodnetPodcast {
private String url;
private String title;
private String description;
private int subscribers;
private String logoUrl;
private String website;
private String mygpoLink;
private final String url;
private final String title;
private final String description;
private final int subscribers;
private final String logoUrl;
private final String website;
private final String mygpoLink;
public GpodnetPodcast(@NonNull String url,
@NonNull String title,

View File

@ -5,9 +5,9 @@ import android.support.annotation.NonNull;
import java.util.List;
public class GpodnetSubscriptionChange {
private List<String> added;
private List<String> removed;
private long timestamp;
private final List<String> added;
private final List<String> removed;
private final long timestamp;
public GpodnetSubscriptionChange(@NonNull List<String> added,
@NonNull List<String> removed,

View File

@ -46,7 +46,7 @@ public class GpodnetPreferences {
private static String deviceID;
private static String hostname;
private static ReentrantLock feedListLock = new ReentrantLock();
private static final ReentrantLock feedListLock = new ReentrantLock();
private static Set<String> addedFeeds;
private static Set<String> removedFeeds;

View File

@ -125,7 +125,7 @@ public class UserPreferences {
private static final int NOTIFICATION_BUTTON_REWIND = 0;
private static final int NOTIFICATION_BUTTON_FAST_FORWARD = 1;
private static final int NOTIFICATION_BUTTON_SKIP = 2;
private static int EPISODE_CACHE_SIZE_UNLIMITED = -1;
private static final int EPISODE_CACHE_SIZE_UNLIMITED = -1;
public static final int FEED_ORDER_COUNTER = 0;
public static final int FEED_ORDER_ALPHABETICAL = 1;
public static final int FEED_ORDER_LAST_UPDATE = 2;

View File

@ -333,7 +333,7 @@ public class GpodnetSyncService extends Service {
nm.notify(id, notification);
}
private WaiterThread syncWaiterThread = new WaiterThread(WAIT_INTERVAL) {
private final WaiterThread syncWaiterThread = new WaiterThread(WAIT_INTERVAL) {
@Override
public void onWaitCompleted() {
sync();
@ -341,7 +341,7 @@ public class GpodnetSyncService extends Service {
};
private abstract class WaiterThread {
private long waitInterval;
private final long waitInterval;
private Thread thread;
private WaiterThread(long waitInterval) {

View File

@ -17,7 +17,7 @@ public class DownloadRequest implements Parcelable {
private String username;
private String password;
private String lastModified;
private boolean deleteOnFailure;
private final boolean deleteOnFailure;
private final long feedfileId;
private final int feedfileType;
private final Bundle arguments;
@ -254,15 +254,15 @@ public class DownloadRequest implements Parcelable {
}
public static class Builder {
private String destination;
private String source;
private String title;
private final String destination;
private final String source;
private final String title;
private String username;
private String password;
private String lastModified;
private boolean deleteOnFailure = false;
private long feedfileId;
private int feedfileType;
private final long feedfileId;
private final int feedfileType;
private Bundle arguments;
public Builder(@NonNull String destination, @NonNull FeedFile item) {

View File

@ -127,8 +127,8 @@ public class DownloadService extends Service {
private NotificationCompat.Builder notificationCompatBuilder;
private int NOTIFICATION_ID = 2;
private int REPORT_ID = 3;
private final int NOTIFICATION_ID = 2;
private final int REPORT_ID = 3;
/**
* Currently running downloads.
@ -152,7 +152,7 @@ public class DownloadService extends Service {
private static final int SCHED_EX_POOL_SIZE = 1;
private ScheduledThreadPoolExecutor schedExecutor;
private Handler postHandler = new Handler();
private final Handler postHandler = new Handler();
private final IBinder mBinder = new LocalBinder();
@ -162,7 +162,7 @@ public class DownloadService extends Service {
}
}
private Thread downloadCompletionThread = new Thread() {
private final Thread downloadCompletionThread = new Thread() {
private static final String TAG = "downloadCompletionThd";
@Override
@ -384,7 +384,7 @@ public class DownloadService extends Service {
return null;
}
private BroadcastReceiver cancelDownloadReceiver = new BroadcastReceiver() {
private final BroadcastReceiver cancelDownloadReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@ -604,9 +604,9 @@ public class DownloadService extends Service {
private class FeedSyncThread extends Thread {
private static final String TAG = "FeedSyncThread";
private BlockingQueue<DownloadRequest> completedRequests = new LinkedBlockingDeque<>();
private CompletionService<Pair<DownloadRequest, FeedHandlerResult>> parserService = new ExecutorCompletionService<>(Executors.newSingleThreadExecutor());
private ExecutorService dbService = Executors.newSingleThreadExecutor();
private final BlockingQueue<DownloadRequest> completedRequests = new LinkedBlockingDeque<>();
private final CompletionService<Pair<DownloadRequest, FeedHandlerResult>> parserService = new ExecutorCompletionService<>(Executors.newSingleThreadExecutor());
private final ExecutorService dbService = Executors.newSingleThreadExecutor();
private Future<?> dbUpdateFuture;
private volatile boolean isActive = true;
private volatile boolean isCollectingRequests = false;
@ -766,7 +766,7 @@ public class DownloadService extends Service {
private class FeedParserTask implements Callable<Pair<DownloadRequest, FeedHandlerResult>> {
private DownloadRequest request;
private final DownloadRequest request;
private FeedParserTask(DownloadRequest request) {
this.request = request;
@ -952,8 +952,8 @@ public class DownloadService extends Service {
*/
private class FailedDownloadHandler implements Runnable {
private DownloadRequest request;
private DownloadStatus status;
private final DownloadRequest request;
private final DownloadStatus status;
FailedDownloadHandler(DownloadStatus status, DownloadRequest request) {
this.request = request;
@ -975,7 +975,7 @@ public class DownloadService extends Service {
*/
private class MediaHandlerThread implements Runnable {
private DownloadRequest request;
private final DownloadRequest request;
private DownloadStatus status;
MediaHandlerThread(@NonNull DownloadStatus status,

View File

@ -25,7 +25,7 @@ public class DownloadStatus {
* identify the download. Should be the title of the item/feed/media or the
* URL if the download has no other title.
*/
private String title;
private final String title;
private DownloadError reason;
/**
* A message which can be presented to the user to give more information.
@ -34,13 +34,13 @@ public class DownloadStatus {
private String reasonDetailed;
private boolean successful;
private Date completionDate;
private long feedfileId;
private final long feedfileId;
/**
* Is used to determine the type of the feedfile even if the feedfile does
* not exist anymore. The value should be FEEDFILETYPE_FEED,
* FEEDFILETYPE_FEEDIMAGE or FEEDFILETYPE_FEEDMEDIA
*/
private int feedfileType;
private final int feedfileType;
// ------------------------------------ NOT STORED IN DB
private boolean done;

View File

@ -18,8 +18,8 @@ public abstract class Downloader implements Callable<Downloader> {
volatile boolean cancelled;
DownloadRequest request;
DownloadStatus result;
final DownloadRequest request;
final DownloadStatus result;
Downloader(DownloadRequest request) {
super();

View File

@ -316,7 +316,7 @@ public class HttpDownloader extends Downloader {
private class BasicAuthorizationInterceptor implements Interceptor {
private DownloadRequest downloadRequest;
private final DownloadRequest downloadRequest;
public BasicAuthorizationInterceptor(DownloadRequest downloadRequest) {
this.downloadRequest = downloadRequest;

View File

@ -42,7 +42,7 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
private volatile boolean stream;
private volatile MediaType mediaType;
private volatile AtomicBoolean startWhenPrepared;
private final AtomicBoolean startWhenPrepared;
private volatile boolean pausedBecauseOfTransientAudiofocusLoss;
private volatile Pair<Integer, Integer> videoSize;

View File

@ -1784,7 +1784,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
}
};
private SharedPreferences.OnSharedPreferenceChangeListener prefListener =
private final SharedPreferences.OnSharedPreferenceChangeListener prefListener =
(sharedPreferences, key) -> {
if (UserPreferences.PREF_LOCKSCREEN_BACKGROUND.equals(key)) {
updateMediaSessionMetadata(getPlayable());
@ -1806,7 +1806,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
void unregisterReceiver(BroadcastReceiver receiver);
}
private FlavorHelperCallback flavorHelperCallback = new FlavorHelperCallback() {
private final FlavorHelperCallback flavorHelperCallback = new FlavorHelperCallback() {
@Override
public PlaybackServiceMediaPlayer.PSMPCallback getMediaPlayerCallback() {
return PlaybackService.this.mediaPlayerCallback;

View File

@ -365,9 +365,9 @@ public abstract class PlaybackServiceMediaPlayer {
* Holds information about a PSMP object.
*/
public static class PSMPInfo {
public PlayerStatus oldPlayerStatus;
public PlayerStatus playerStatus;
public Playable playable;
public final PlayerStatus oldPlayerStatus;
public final PlayerStatus playerStatus;
public final Playable playable;
PSMPInfo(PlayerStatus oldPlayerStatus, PlayerStatus playerStatus, Playable playable) {
this.oldPlayerStatus = oldPlayerStatus;

View File

@ -13,8 +13,8 @@ class ShakeListener implements SensorEventListener
private Sensor mAccelerometer;
private SensorManager mSensorMgr;
private PlaybackServiceTaskManager.SleepTimer mSleepTimer;
private Context mContext;
private final PlaybackServiceTaskManager.SleepTimer mSleepTimer;
private final Context mContext;
public ShakeListener(Context context, PlaybackServiceTaskManager.SleepTimer sleepTimer) {
mContext = context;

View File

@ -1023,14 +1023,14 @@ public final class DBReader {
/**
* Simply sums up time of podcasts that are marked as played
*/
public long totalTimeCountAll;
public final long totalTimeCountAll;
/**
* Respects speed, listening twice, ...
*/
public long totalTime;
public final long totalTime;
public List<StatisticsItem> feedTime;
public final List<StatisticsItem> feedTime;
public StatisticsData(long totalTime, long totalTimeCountAll, List<StatisticsItem> feedTime) {
this.totalTime = totalTime;
@ -1040,26 +1040,26 @@ public final class DBReader {
}
public static class StatisticsItem {
public Feed feed;
public long time;
public final Feed feed;
public final long time;
/**
* Respects speed, listening twice, ...
*/
public long timePlayed;
public final long timePlayed;
/**
* Simply sums up time of podcasts that are marked as played
*/
public long timePlayedCountAll;
public long episodes;
public final long timePlayedCountAll;
public final long episodes;
/**
* Episodes that are actually played
*/
public long episodesStarted;
public final long episodesStarted;
/**
* All episodes that are marked as played (or have position != 0)
*/
public long episodesStartedIncludingMarked;
public final long episodesStartedIncludingMarked;
public StatisticsItem(Feed feed, long time, long timePlayed, long timePlayedCountAll,
long episodes, long episodesStarted, long episodesStartedIncludingMarked) {
@ -1195,12 +1195,12 @@ public final class DBReader {
}
public static class NavDrawerData {
public List<Feed> feeds;
public int queueSize;
public int numNewItems;
public int numDownloadedItems;
public LongIntMap feedCounters;
public int reclaimableSpace;
public final List<Feed> feeds;
public final int queueSize;
public final int numNewItems;
public final int numDownloadedItems;
public final LongIntMap feedCounters;
public final int reclaimableSpace;
public NavDrawerData(List<Feed> feeds,
int queueSize,

View File

@ -53,7 +53,7 @@ public final class DBTasks {
/**
* Executor service used by the autodownloadUndownloadedEpisodes method.
*/
private static ExecutorService autodownloadExec;
private static final ExecutorService autodownloadExec;
static {
autodownloadExec = Executors.newSingleThreadExecutor(r -> {
@ -149,7 +149,7 @@ public final class DBTasks {
}
}
private static AtomicBoolean isRefreshing = new AtomicBoolean(false);
private static final AtomicBoolean isRefreshing = new AtomicBoolean(false);
/**
* Refreshes a given list of Feeds in a separate Thread. This method might ignore subsequent calls if it is still
@ -803,7 +803,7 @@ public final class DBTasks {
*/
abstract static class QueryTask<T> implements Callable<T> {
private T result;
private Context context;
private final Context context;
public QueryTask(Context context) {
this.context = context;

View File

@ -48,7 +48,7 @@ public class DownloadRequester {
private static DownloadRequester downloader;
private Map<String, DownloadRequest> downloads;
private final Map<String, DownloadRequest> downloads;
private DownloadRequester() {
downloads = new ConcurrentHashMap<>();

View File

@ -8,11 +8,11 @@ import java.util.Date;
* Contains information about a feed's items.
*/
public class FeedItemStatistics {
private long feedID;
private int numberOfItems;
private int numberOfNewItems;
private int numberOfInProgressItems;
private Date lastUpdate;
private final long feedID;
private final int numberOfItems;
private final int numberOfNewItems;
private final int numberOfInProgressItems;
private final Date lastUpdate;
private static final Date UNKNOWN_DATE = new Date(0);

View File

@ -309,8 +309,8 @@ public class PodDBAdapter {
private static PodDBHelper dbHelper;
private static volatile SQLiteDatabase db;
private static Lock dbLock = new ReentrantLock();
private static AtomicInteger counter = new AtomicInteger(0);
private static final Lock dbLock = new ReentrantLock();
private static final AtomicInteger counter = new AtomicInteger(0);
public static void init(Context context) {
PodDBAdapter.context = context.getApplicationContext();
@ -1666,7 +1666,7 @@ public class PodDBAdapter {
private static final int VERSION = 1060200;
private Context context;
private final Context context;
/**
* Constructor.

View File

@ -9,8 +9,8 @@ import de.danoeh.antennapod.core.feed.Feed;
*/
public class FeedHandlerResult {
public Feed feed;
public Map<String, String> alternateFeedUrls;
public final Feed feed;
public final Map<String, String> alternateFeedUrls;
public FeedHandlerResult(Feed feed, Map<String, String> alternateFeedUrls) {
this.feed = feed;

View File

@ -25,15 +25,15 @@ public class HandlerState {
* Contains links to related feeds, e.g. feeds with enclosures in other formats. The key of the map is the
* URL of the feed, the value is the title
*/
Map<String, String> alternateUrls;
private ArrayList<FeedItem> items;
final Map<String, String> alternateUrls;
private final ArrayList<FeedItem> items;
private FeedItem currentItem;
Stack<SyndElement> tagstack;
final Stack<SyndElement> tagstack;
/**
* Namespaces that have been defined so far.
*/
Map<String, Namespace> namespaces;
Stack<Namespace> defaultNamespaces;
final Map<String, Namespace> namespaces;
final Stack<Namespace> defaultNamespaces;
/**
* Buffer for saving characters.
*/
@ -42,7 +42,7 @@ public class HandlerState {
/**
* Temporarily saved objects.
*/
private Map<String, Object> tempObjects;
private final Map<String, Object> tempObjects;
public HandlerState(Feed feed) {
this.feed = feed;

View File

@ -21,7 +21,7 @@ import de.danoeh.antennapod.core.syndication.namespace.atom.NSAtom;
class SyndHandler extends DefaultHandler {
private static final String TAG = "SyndHandler";
private static final String DEFAULT_PREFIX = "";
HandlerState state;
final HandlerState state;
public SyndHandler(Feed feed, TypeGetter.Type type) {
state = new HandlerState(feed);

View File

@ -4,7 +4,7 @@ import de.danoeh.antennapod.core.syndication.handler.TypeGetter.Type;
public class UnsupportedFeedtypeException extends Exception {
private static final long serialVersionUID = 9105878964928170669L;
private TypeGetter.Type type;
private final TypeGetter.Type type;
private String rootElement;
public UnsupportedFeedtypeException(Type type) {

View File

@ -2,8 +2,8 @@ package de.danoeh.antennapod.core.syndication.namespace;
/** Defines a XML Element that is pushed on the tagstack */
public class SyndElement {
private String name;
private Namespace namespace;
private final String name;
private final Namespace namespace;
public SyndElement(String name, Namespace namespace) {
this.name = name;

View File

@ -11,7 +11,7 @@ public class AtomText extends SyndElement {
private static final String TYPE_HTML = "html";
private static final String TYPE_XHTML = "xhtml";
private String type;
private final String type;
private String content;
public AtomText(String name, Namespace namespace, String type) {

View File

@ -7,7 +7,7 @@ import java.nio.charset.Charset;
public class LangUtils {
public static final Charset UTF_8 = Charset.forName("UTF-8");
private static ArrayMap<String, String> languages;
private static final ArrayMap<String, String> languages;
static {
languages = new ArrayMap<>();
languages.put("af", "Afrikaans");

View File

@ -5,7 +5,7 @@ import de.danoeh.antennapod.core.feed.FeedMedia;
public class MediaFileNotFoundException extends Exception {
private static final long serialVersionUID = 1L;
private FeedMedia media;
private final FeedMedia media;
public MediaFileNotFoundException(String msg, FeedMedia media) {
super(msg);

View File

@ -24,7 +24,7 @@ public class SimpleFlattrThing implements FlattrThing {
return this.status;
}
private String title;
private String url;
private FlattrStatus status;
private final String title;
private final String url;
private final FlattrStatus status;
}

View File

@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.util.id3reader.model;
public class FrameHeader extends Header {
private char flags;
private final char flags;
public FrameHeader(String id, int size, char flags) {
super(id, size);

View File

@ -2,8 +2,8 @@ package de.danoeh.antennapod.core.util.id3reader.model;
public abstract class Header {
String id;
int size;
final String id;
final int size;
Header(String id, int size) {
super();

View File

@ -2,8 +2,8 @@ package de.danoeh.antennapod.core.util.id3reader.model;
public class TagHeader extends Header {
private char version;
private byte flags;
private final char version;
private final byte flags;
public TagHeader(String id, int size, char version, byte flags) {
super(id, size);

View File

@ -23,7 +23,7 @@ public class ExternalMedia implements Playable {
public static final String PREF_MEDIA_TYPE = "ExternalMedia.PrefMediaType";
public static final String PREF_LAST_PLAYED_TIME = "ExternalMedia.PrefLastPlayedTime";
private String source;
private final String source;
private String episodeTitle;
private String feedTitle;

View File

@ -42,7 +42,7 @@ public class HtmlToPlainText {
// the formatting rules, implemented in a breadth-first DOM traverse
private class FormattingVisitor implements NodeVisitor {
private StringBuilder accum = new StringBuilder(); // holds the accumulated text
private final StringBuilder accum = new StringBuilder(); // holds the accumulated text
// hit when the node is first seen
public void head(Node node, int depth) {

View File

@ -7,7 +7,7 @@ import java.io.InputStream;
import java.util.Arrays;
class OggInputStream extends InputStream {
private InputStream input;
private final InputStream input;
/** True if OggInputStream is currently inside an Ogg page. */
private boolean isInPage;

View File

@ -1,7 +1,7 @@
package de.danoeh.antennapod.core.util.vorbiscommentreader;
class VorbisCommentHeader {
private String vendorString;
private long userCommentLength;
private final String vendorString;
private final long userCommentLength;
public VorbisCommentHeader(String vendorString, long userCommentLength) {
super();