diff --git a/app/build.gradle b/app/build.gradle index e65c7031..57aade5e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 29 - buildToolsVersion "29.0.1" + buildToolsVersion "29.0.2" flavorDimensions "default" compileOptions { diff --git a/app/src/main/java/io/lbry/browser/FirstRunActivity.java b/app/src/main/java/io/lbry/browser/FirstRunActivity.java index 46c85da7..5760118c 100644 --- a/app/src/main/java/io/lbry/browser/FirstRunActivity.java +++ b/app/src/main/java/io/lbry/browser/FirstRunActivity.java @@ -172,8 +172,8 @@ public class FirstRunActivity extends AppCompatActivity { } private static class CheckInstallIdTask extends AsyncTask { - private Context context; - private InstallIdHandler handler; + private final Context context; + private final InstallIdHandler handler; public CheckInstallIdTask(Context context, InstallIdHandler handler) { this.context = context; this.handler = handler; @@ -236,7 +236,7 @@ public class FirstRunActivity extends AppCompatActivity { } private static class AuthenticateTask extends AsyncTask { - private Context context; + private final Context context; public AuthenticateTask(Context context) { this.context = context; } diff --git a/app/src/main/java/io/lbry/browser/MainActivity.java b/app/src/main/java/io/lbry/browser/MainActivity.java index d59e08d0..b8bc2ea4 100644 --- a/app/src/main/java/io/lbry/browser/MainActivity.java +++ b/app/src/main/java/io/lbry/browser/MainActivity.java @@ -110,6 +110,7 @@ import java.io.InputStreamReader; import java.io.PrintStream; import java.net.ConnectException; import java.net.URI; +import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; @@ -210,6 +211,7 @@ import lombok.SneakyThrows; import okhttp3.OkHttpClient; import static android.os.Build.VERSION_CODES.M; +import static android.os.Build.VERSION_CODES.P; public class MainActivity extends AppCompatActivity implements SdkStatusListener, SharedPreferences.OnSharedPreferenceChangeListener, @@ -243,7 +245,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener public static boolean startingFilePickerActivity = false; public static boolean startingShareActivity = false; public static boolean startingPermissionRequest = false; - public static boolean startingSignInFlowActivity = false; + public static final boolean startingSignInFlowActivity = false; private ActionMode actionMode; @Getter @@ -383,7 +385,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener private List fetchClaimsListeners; private List fetchChannelsListeners; @Getter - private ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); + private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); private boolean walletBalanceUpdateScheduled; private boolean shouldOpenUserSelectedMenuItem; private boolean walletSyncScheduled; @@ -788,9 +790,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener public void removeNavFragment(Class fragmentClass, int navItemId) { String key = buildNavFragmentKey(fragmentClass, navItemId, null); - if (openNavFragments.containsKey(key)) { - openNavFragments.remove(key); - } + openNavFragments.remove(key); } public void addFetchChannelsListener(FetchChannelsListener listener) { @@ -984,7 +984,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener openFragment(RewardsFragment.class, true, NavMenuItem.ID_ITEM_REWARDS); } - private FragmentManager.OnBackStackChangedListener backStackChangedListener = new FragmentManager.OnBackStackChangedListener() { + private final FragmentManager.OnBackStackChangedListener backStackChangedListener = new FragmentManager.OnBackStackChangedListener() { @Override public void onBackStackChanged() { FragmentManager manager = getSupportFragmentManager(); @@ -1743,7 +1743,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener if (!Helper.isNullOrEmpty(encryptedAuthToken)) { try { Lbryio.AUTH_TOKEN = new String(Utils.decrypt( - Base64.decode(encryptedAuthToken, Base64.NO_WRAP), this, Lbry.KEYSTORE), "UTF8"); + Base64.decode(encryptedAuthToken, Base64.NO_WRAP), this, Lbry.KEYSTORE), StandardCharsets.UTF_8); } catch (Exception ex) { // pass. A new auth token would have to be generated if the old one cannot be decrypted Log.e(TAG, "Could not decrypt existing auth token.", ex); @@ -2940,10 +2940,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener } else { try { LbryUri uri = LbryUri.parse(url); + String checkedURL = url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString(); if (uri.isChannel()) { - openChannelUrl(url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString()); + openChannelUrl(checkedURL); } else { - openFileUrl(url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString()); + openFileUrl(checkedURL); } } catch (LbryUriException ex) { // pass @@ -3199,8 +3200,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener } private static class CheckSdkReadyTask extends AsyncTask { - private Context context; - private List listeners; + private final Context context; + private final List listeners; public CheckSdkReadyTask(Context context, List listeners) { this.context = context; diff --git a/app/src/main/java/io/lbry/browser/adapter/ChannelFilterListAdapter.java b/app/src/main/java/io/lbry/browser/adapter/ChannelFilterListAdapter.java index 63e1f406..0f38a3b7 100644 --- a/app/src/main/java/io/lbry/browser/adapter/ChannelFilterListAdapter.java +++ b/app/src/main/java/io/lbry/browser/adapter/ChannelFilterListAdapter.java @@ -23,7 +23,7 @@ import lombok.Getter; import lombok.Setter; public class ChannelFilterListAdapter extends RecyclerView.Adapter { - private Context context; + private final Context context; private List items; @Getter @Setter @@ -42,12 +42,12 @@ public class ChannelFilterListAdapter extends RecyclerView.Adapter quickClaimIdMap; - private Map quickClaimUrlMap; - private Map notFoundClaimIdMap; - private Map notFoundClaimUrlMap; + private final Map quickClaimIdMap; + private final Map quickClaimUrlMap; + private final Map notFoundClaimIdMap; + private final Map notFoundClaimUrlMap; @Setter private boolean hideFee; @Setter private boolean canEnterSelectionMode; - private Context context; + private final Context context; private List items; - private List selectedItems; + private final List selectedItems; @Setter private ClaimListItemListener listener; @Getter @@ -176,27 +175,27 @@ public class ClaimListAdapter extends RecyclerView.Adapter { - private List items; - private Context context; - private boolean nested; + private final List items; + private final Context context; + private final boolean nested; private float scale; @Setter private ClaimListAdapter.ClaimListItemListener listener; @@ -102,14 +102,14 @@ public class CommentListAdapter extends RecyclerView.Adapter items; + private final Context context; + private final List items; @Setter private EditorsChoiceItemListener listener; @@ -48,11 +48,11 @@ public class EditorsChoiceItemAdapter extends RecyclerView.Adapter { - private Context context; - private List items; + private final Context context; + private final List items; @Setter private GalleryItemClickListener listener; @@ -32,8 +32,8 @@ public class GalleryGridAdapter extends RecyclerView.Adapter { - private List channels; - private int layoutResourceId; - private LayoutInflater inflater; + private final List channels; + private final int layoutResourceId; + private final LayoutInflater inflater; public InlineChannelSpinnerAdapter(Context context, int resource, List channels) { super(context, resource, 0, channels); diff --git a/app/src/main/java/io/lbry/browser/adapter/InviteeListAdapter.java b/app/src/main/java/io/lbry/browser/adapter/InviteeListAdapter.java index 7ff066b0..b23604de 100644 --- a/app/src/main/java/io/lbry/browser/adapter/InviteeListAdapter.java +++ b/app/src/main/java/io/lbry/browser/adapter/InviteeListAdapter.java @@ -1,9 +1,7 @@ package io.lbry.browser.adapter; import android.content.Context; -import android.content.Intent; import android.graphics.Typeface; -import android.net.Uri; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -11,21 +9,16 @@ import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; -import java.text.DecimalFormat; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import io.lbry.browser.R; import io.lbry.browser.model.lbryinc.Invitee; -import io.lbry.browser.utils.Helper; -import io.lbry.browser.utils.LbryUri; -import lombok.Setter; public class InviteeListAdapter extends RecyclerView.Adapter { - private Context context; - private List items; + private final Context context; + private final List items; public InviteeListAdapter(List invitees, Context context) { this.context = context; @@ -80,8 +73,8 @@ public class InviteeListAdapter extends RecyclerView.Adapter { - private int layoutResourceId; - private LayoutInflater inflater; + private final int layoutResourceId; + private final LayoutInflater inflater; public LanguageSpinnerAdapter(Context context, int resource) { super(context, resource, 0, Predefined.PUBLISH_LANGUAGES); diff --git a/app/src/main/java/io/lbry/browser/adapter/LicenseSpinnerAdapter.java b/app/src/main/java/io/lbry/browser/adapter/LicenseSpinnerAdapter.java index c6776cf9..9b8a3887 100644 --- a/app/src/main/java/io/lbry/browser/adapter/LicenseSpinnerAdapter.java +++ b/app/src/main/java/io/lbry/browser/adapter/LicenseSpinnerAdapter.java @@ -10,13 +10,12 @@ import android.widget.TextView; import androidx.annotation.NonNull; import io.lbry.browser.R; -import io.lbry.browser.model.Language; import io.lbry.browser.model.License; import io.lbry.browser.utils.Predefined; public class LicenseSpinnerAdapter extends ArrayAdapter { - private int layoutResourceId; - private LayoutInflater inflater; + private final int layoutResourceId; + private final LayoutInflater inflater; public LicenseSpinnerAdapter(Context context, int resource) { super(context, resource, 0, Predefined.LICENSES); diff --git a/app/src/main/java/io/lbry/browser/adapter/NavigationMenuAdapter.java b/app/src/main/java/io/lbry/browser/adapter/NavigationMenuAdapter.java index f5c75a55..00dd7449 100644 --- a/app/src/main/java/io/lbry/browser/adapter/NavigationMenuAdapter.java +++ b/app/src/main/java/io/lbry/browser/adapter/NavigationMenuAdapter.java @@ -2,10 +2,8 @@ package io.lbry.browser.adapter; import android.content.Context; import android.view.LayoutInflater; -import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; @@ -17,15 +15,14 @@ import io.lbry.browser.R; import io.lbry.browser.model.NavMenuItem; import io.lbry.browser.ui.controls.SolidIconView; import io.lbry.browser.utils.Helper; -import lombok.Getter; import lombok.Setter; public class NavigationMenuAdapter extends RecyclerView.Adapter { private static final int TYPE_GROUP = 1; private static final int TYPE_ITEM = 2; - private Context context; - private List menuItems; + private final Context context; + private final List menuItems; private NavMenuItem currentItem; @Setter private NavigationMenuItemClickListener listener; @@ -65,8 +62,8 @@ public class NavigationMenuAdapter extends RecyclerView.Adapter items; - private List selectedItems; + private final Context context; + private final List items; + private final List selectedItems; @Setter private NotificationClickListener clickListener; @Getter @@ -62,13 +59,13 @@ public class NotificationListAdapter extends RecyclerView.Adapter all; private List items; @@ -85,16 +85,16 @@ public class RewardListAdapter extends RecyclerView.Adapter { - private Context context; - private List items; - private List selectedItems; + private final Context context; + private final List items; + private final List selectedItems; @Setter private ChannelItemSelectionListener listener; @@ -35,11 +35,11 @@ public class SuggestedChannelGridAdapter extends RecyclerView.Adapter items; @Setter private TagClickListener clickListener; - @Getter + @Setter + @Getter private int customizeMode; public TagListAdapter(List tags, Context context) { @@ -38,8 +39,8 @@ public class TagListAdapter extends RecyclerView.Adapter items; + private final Context context; + private final List items; @Setter private TransactionClickListener listener; @@ -107,14 +107,14 @@ public class TransactionListAdapter extends RecyclerView.Adapter { - private Context context; - private List items; + private final Context context; + private final List items; @Setter private UrlSuggestionClickListener listener; @@ -130,9 +130,9 @@ public class UrlSuggestionListAdapter extends RecyclerView.Adapter claims; + private final List claims; @Getter - @Setter - private long timestamp; + private final long timestamp; public ClaimSearchCacheValue(List claims, long timestamp) { this.claims = new ArrayList<>(claims); diff --git a/app/src/main/java/io/lbry/browser/model/Comment.java b/app/src/main/java/io/lbry/browser/model/Comment.java index 2e9a9ae1..00375ef7 100644 --- a/app/src/main/java/io/lbry/browser/model/Comment.java +++ b/app/src/main/java/io/lbry/browser/model/Comment.java @@ -3,7 +3,6 @@ package io.lbry.browser.model; import org.json.JSONException; import org.json.JSONObject; -import java.lang.reflect.Array; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/io/lbry/browser/model/Language.java b/app/src/main/java/io/lbry/browser/model/Language.java index e3f4567b..552643d6 100644 --- a/app/src/main/java/io/lbry/browser/model/Language.java +++ b/app/src/main/java/io/lbry/browser/model/Language.java @@ -4,9 +4,9 @@ import lombok.Data; @Data public class Language { - private String code; - private String name; - private int stringResourceId; + private final String code; + private final String name; + private final int stringResourceId; public Language(String code, String name, int stringResourceId) { this.code = code; diff --git a/app/src/main/java/io/lbry/browser/model/License.java b/app/src/main/java/io/lbry/browser/model/License.java index b278eafa..eb8cb6c3 100644 --- a/app/src/main/java/io/lbry/browser/model/License.java +++ b/app/src/main/java/io/lbry/browser/model/License.java @@ -4,9 +4,9 @@ import lombok.Data; @Data public class License { - private String name; + private final String name; private String url; - private int stringResourceId; + private final int stringResourceId; public License(String name, int stringResourceId) { this.name = name; diff --git a/app/src/main/java/io/lbry/browser/model/NavMenuItem.java b/app/src/main/java/io/lbry/browser/model/NavMenuItem.java index 9f5ce45d..492b197c 100644 --- a/app/src/main/java/io/lbry/browser/model/NavMenuItem.java +++ b/app/src/main/java/io/lbry/browser/model/NavMenuItem.java @@ -2,8 +2,6 @@ package io.lbry.browser.model; import android.content.Context; -import androidx.core.content.res.ResourcesCompat; - import java.util.ArrayList; import java.util.List; @@ -37,8 +35,8 @@ public class NavMenuItem { public static final int ID_ITEM_SETTINGS = 401; public static final int ID_ITEM_ABOUT = 402; - private Context context; - private int id; + private final Context context; + private final int id; private boolean group; private int icon; private String title; diff --git a/app/src/main/java/io/lbry/browser/model/StartupStage.java b/app/src/main/java/io/lbry/browser/model/StartupStage.java index 955d239a..469d2cb0 100644 --- a/app/src/main/java/io/lbry/browser/model/StartupStage.java +++ b/app/src/main/java/io/lbry/browser/model/StartupStage.java @@ -1,8 +1,8 @@ package io.lbry.browser.model; public class StartupStage { - public Integer stage; - public Boolean stageDone; + public final Integer stage; + public final Boolean stageDone; public StartupStage(Integer stage, Boolean stageDone) { this.stage = stage; diff --git a/app/src/main/java/io/lbry/browser/model/ViewHistory.java b/app/src/main/java/io/lbry/browser/model/ViewHistory.java index ea668615..a7d92ff2 100644 --- a/app/src/main/java/io/lbry/browser/model/ViewHistory.java +++ b/app/src/main/java/io/lbry/browser/model/ViewHistory.java @@ -3,9 +3,7 @@ package io.lbry.browser.model; import java.math.BigDecimal; import java.util.Date; -import io.lbry.browser.exceptions.LbryUriException; import io.lbry.browser.utils.LbryUri; -import io.lbry.browser.utils.Lbryio; import lombok.Data; @Data diff --git a/app/src/main/java/io/lbry/browser/model/WalletBalance.java b/app/src/main/java/io/lbry/browser/model/WalletBalance.java index c2102b70..b2c881f8 100644 --- a/app/src/main/java/io/lbry/browser/model/WalletBalance.java +++ b/app/src/main/java/io/lbry/browser/model/WalletBalance.java @@ -6,14 +6,28 @@ import java.math.BigDecimal; import io.lbry.browser.utils.Helper; import lombok.Data; +import lombok.Getter; +import lombok.Setter; @Data public class WalletBalance { + @Setter + @Getter private BigDecimal available; + @Setter + @Getter private BigDecimal reserved; + @Setter + @Getter private BigDecimal claims; + @Setter + @Getter private BigDecimal supports; + @Setter + @Getter private BigDecimal tips; + @Setter + @Getter private BigDecimal total; public WalletBalance() { diff --git a/app/src/main/java/io/lbry/browser/model/WalletSync.java b/app/src/main/java/io/lbry/browser/model/WalletSync.java index 05857ff0..24c3eacd 100644 --- a/app/src/main/java/io/lbry/browser/model/WalletSync.java +++ b/app/src/main/java/io/lbry/browser/model/WalletSync.java @@ -1,11 +1,15 @@ package io.lbry.browser.model; import lombok.Data; +import lombok.Getter; @Data public class WalletSync { - private String hash; - private String data; + @Getter + private final String hash; + @Getter + private final String data; + @Getter private boolean changed; public WalletSync(String hash, String data) { @@ -17,4 +21,5 @@ public class WalletSync { this(hash, data); this.changed = changed; } + } diff --git a/app/src/main/java/io/lbry/browser/model/lbryinc/Reward.java b/app/src/main/java/io/lbry/browser/model/lbryinc/Reward.java index 67f46db6..ebaea7eb 100644 --- a/app/src/main/java/io/lbry/browser/model/lbryinc/Reward.java +++ b/app/src/main/java/io/lbry/browser/model/lbryinc/Reward.java @@ -9,7 +9,6 @@ import org.json.JSONObject; import java.lang.reflect.Type; -import io.lbry.browser.model.Claim; import io.lbry.browser.utils.Helper; import lombok.Data; diff --git a/app/src/main/java/io/lbry/browser/tasks/BufferEventTask.java b/app/src/main/java/io/lbry/browser/tasks/BufferEventTask.java index 826e392f..8351d86f 100644 --- a/app/src/main/java/io/lbry/browser/tasks/BufferEventTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/BufferEventTask.java @@ -12,16 +12,17 @@ import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; +import okhttp3.ResponseBody; public class BufferEventTask extends AsyncTask { private static final String TAG = "LbryBufferEvent"; private static final String ENDPOINT = "https://collector-service.api.lbry.tv/api/v1/events/video"; - private String streamUrl; - private String userIdHash; - private long streamDuration; - private long streamPosition; - private long bufferDuration; + private final String streamUrl; + private final String userIdHash; + private final long streamDuration; + private final long streamPosition; + private final long bufferDuration; public BufferEventTask(String streamUrl, long streamDuration, long streamPosition, long bufferDuration, String userIdHash) { this.streamUrl = streamUrl; @@ -53,7 +54,11 @@ public class BufferEventTask extends AsyncTask { build(); Response response = client.newCall(request).execute(); - String responseString = response.body().string(); + ResponseBody resBody = response.body(); + String responseString = ""; + if (resBody != null) { + responseString = response.body().string(); + } Log.d(TAG, String.format("buffer event sent: %s", responseString)); } catch (Exception ex) { // we don't want to fail if a buffer event fails to register diff --git a/app/src/main/java/io/lbry/browser/tasks/FollowUnfollowTagTask.java b/app/src/main/java/io/lbry/browser/tasks/FollowUnfollowTagTask.java index 3c7f4dca..2a9ceba0 100644 --- a/app/src/main/java/io/lbry/browser/tasks/FollowUnfollowTagTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/FollowUnfollowTagTask.java @@ -10,10 +10,10 @@ import io.lbry.browser.model.Tag; import io.lbry.browser.utils.Lbry; public class FollowUnfollowTagTask extends AsyncTask { - private Tag tag; - private boolean unfollowing; - private Context context; - private FollowUnfollowTagHandler handler; + private final Tag tag; + private final boolean unfollowing; + private final Context context; + private final FollowUnfollowTagHandler handler; private Exception error; public FollowUnfollowTagTask(Tag tag, boolean unfollowing, Context context, FollowUnfollowTagHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/LighthouseAutoCompleteTask.java b/app/src/main/java/io/lbry/browser/tasks/LighthouseAutoCompleteTask.java index a0c32b86..d8abb751 100644 --- a/app/src/main/java/io/lbry/browser/tasks/LighthouseAutoCompleteTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/LighthouseAutoCompleteTask.java @@ -12,9 +12,9 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lighthouse; public class LighthouseAutoCompleteTask extends AsyncTask> { - private String text; - private AutoCompleteResultHandler handler; - private View progressView; + private final String text; + private final AutoCompleteResultHandler handler; + private final View progressView; private Exception error; public LighthouseAutoCompleteTask(String text, View progressView, AutoCompleteResultHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/LighthouseSearchTask.java b/app/src/main/java/io/lbry/browser/tasks/LighthouseSearchTask.java index 6da1d943..98fd9e3f 100644 --- a/app/src/main/java/io/lbry/browser/tasks/LighthouseSearchTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/LighthouseSearchTask.java @@ -14,13 +14,13 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lighthouse; public class LighthouseSearchTask extends AsyncTask> { - private String rawQuery; - private int size; - private int from; - private boolean nsfw; - private String relatedTo; - private ClaimSearchResultHandler handler; - private ProgressBar progressBar; + private final String rawQuery; + private final int size; + private final int from; + private final boolean nsfw; + private final String relatedTo; + private final ClaimSearchResultHandler handler; + private final ProgressBar progressBar; private Exception error; public LighthouseSearchTask(String rawQuery, int size, int from, boolean nsfw, String relatedTo, ProgressBar progressBar, ClaimSearchResultHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/LoadTagsTask.java b/app/src/main/java/io/lbry/browser/tasks/LoadTagsTask.java index 4eb465e3..a8f5f859 100644 --- a/app/src/main/java/io/lbry/browser/tasks/LoadTagsTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/LoadTagsTask.java @@ -4,22 +4,16 @@ import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.os.AsyncTask; -import android.view.View; -import android.widget.ProgressBar; import java.util.List; import io.lbry.browser.MainActivity; import io.lbry.browser.data.DatabaseHelper; -import io.lbry.browser.exceptions.LbryRequestException; -import io.lbry.browser.exceptions.LbryResponseException; -import io.lbry.browser.model.Claim; import io.lbry.browser.model.Tag; -import io.lbry.browser.utils.Helper; public class LoadTagsTask extends AsyncTask> { - private Context context; - private LoadTagsHandler handler; + private final Context context; + private final LoadTagsHandler handler; private Exception error; public LoadTagsTask(Context context, LoadTagsHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/MergeSubscriptionsTask.java b/app/src/main/java/io/lbry/browser/tasks/MergeSubscriptionsTask.java index 842c381e..588e0dcb 100644 --- a/app/src/main/java/io/lbry/browser/tasks/MergeSubscriptionsTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/MergeSubscriptionsTask.java @@ -4,7 +4,6 @@ import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.os.AsyncTask; -import android.util.Log; import org.json.JSONArray; import org.json.JSONException; @@ -17,24 +16,21 @@ import java.util.Map; import io.lbry.browser.MainActivity; import io.lbry.browser.data.DatabaseHelper; -import io.lbry.browser.exceptions.LbryUriException; import io.lbry.browser.exceptions.LbryioRequestException; import io.lbry.browser.exceptions.LbryioResponseException; import io.lbry.browser.model.lbryinc.Subscription; -import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.LbryUri; import io.lbry.browser.utils.Lbryio; -import okhttp3.Response; // background task to create a diff of local and remote subscriptions and try to merge public class MergeSubscriptionsTask extends AsyncTask> { private static final String TAG = "MergeSubscriptionsTask"; - private Context context; - private List base; + private final Context context; + private final List base; private List diff; - private MergeSubscriptionsHandler handler; + private final MergeSubscriptionsHandler handler; private Exception error; - private boolean replaceLocal; + private final boolean replaceLocal; public MergeSubscriptionsTask(List base, boolean replaceLocal, Context context, MergeSubscriptionsHandler handler) { this.base = base; diff --git a/app/src/main/java/io/lbry/browser/tasks/ReadTextFileTask.java b/app/src/main/java/io/lbry/browser/tasks/ReadTextFileTask.java index 3dfa6b93..d18b3ef1 100644 --- a/app/src/main/java/io/lbry/browser/tasks/ReadTextFileTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/ReadTextFileTask.java @@ -4,18 +4,15 @@ import android.os.AsyncTask; import java.io.BufferedReader; import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; -import java.nio.Buffer; import io.lbry.browser.utils.Helper; public class ReadTextFileTask extends AsyncTask { - private String filePath; + private final String filePath; private Exception error; - private ReadTextFileHandler handler; + private final ReadTextFileHandler handler; public ReadTextFileTask(String filePath, ReadTextFileHandler handler) { this.filePath = filePath; this.handler = handler; diff --git a/app/src/main/java/io/lbry/browser/tasks/SetSdkSettingTask.java b/app/src/main/java/io/lbry/browser/tasks/SetSdkSettingTask.java index 42dafdc7..87459305 100644 --- a/app/src/main/java/io/lbry/browser/tasks/SetSdkSettingTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/SetSdkSettingTask.java @@ -9,9 +9,9 @@ import io.lbry.browser.exceptions.ApiCallException; import io.lbry.browser.utils.Lbry; public class SetSdkSettingTask extends AsyncTask { - private String key; - private String value; - private GenericTaskHandler handler; + private final String key; + private final String value; + private final GenericTaskHandler handler; private Exception error; public SetSdkSettingTask(String key, String value, GenericTaskHandler handler) { this.key = key; diff --git a/app/src/main/java/io/lbry/browser/tasks/UpdateSuggestedTagsTask.java b/app/src/main/java/io/lbry/browser/tasks/UpdateSuggestedTagsTask.java index d0dd0326..fbd07614 100644 --- a/app/src/main/java/io/lbry/browser/tasks/UpdateSuggestedTagsTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/UpdateSuggestedTagsTask.java @@ -13,13 +13,13 @@ import io.lbry.browser.utils.Lbry; public class UpdateSuggestedTagsTask extends AsyncTask> { - private boolean clearPrevious; - private boolean excludeMature; - private int limit; - private String filter; - private TagListAdapter addedTagsAdapter; - private TagListAdapter suggestedTagsAdapter; - private KnownTagsHandler handler; + private final boolean clearPrevious; + private final boolean excludeMature; + private final int limit; + private final String filter; + private final TagListAdapter addedTagsAdapter; + private final TagListAdapter suggestedTagsAdapter; + private final KnownTagsHandler handler; public UpdateSuggestedTagsTask( String filter, diff --git a/app/src/main/java/io/lbry/browser/tasks/UploadImageTask.java b/app/src/main/java/io/lbry/browser/tasks/UploadImageTask.java index 2dcd8d65..9e4194df 100644 --- a/app/src/main/java/io/lbry/browser/tasks/UploadImageTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/UploadImageTask.java @@ -21,9 +21,9 @@ import okhttp3.RequestBody; import okhttp3.Response; public class UploadImageTask extends AsyncTask { - private String filePath; - private View progressView; - private UploadThumbnailHandler handler; + private final String filePath; + private final View progressView; + private final UploadThumbnailHandler handler; private Exception error; public UploadImageTask(String filePath, View progressView, UploadThumbnailHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/claim/AbandonChannelTask.java b/app/src/main/java/io/lbry/browser/tasks/claim/AbandonChannelTask.java index 3b71a45b..561c907e 100644 --- a/app/src/main/java/io/lbry/browser/tasks/claim/AbandonChannelTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/claim/AbandonChannelTask.java @@ -11,17 +11,16 @@ import java.util.List; import java.util.Map; import io.lbry.browser.exceptions.ApiCallException; -import io.lbry.browser.tasks.GenericTaskHandler; import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class AbandonChannelTask extends AsyncTask { - private List claimIds; + private final List claimIds; private List successfulClaimIds; private List failedClaimIds; private List failedExceptions; - private View progressView; - private AbandonHandler handler; + private final View progressView; + private final AbandonHandler handler; public AbandonChannelTask(List claimIds, View progressView, AbandonHandler handler) { this.claimIds = claimIds; diff --git a/app/src/main/java/io/lbry/browser/tasks/claim/AbandonStreamTask.java b/app/src/main/java/io/lbry/browser/tasks/claim/AbandonStreamTask.java index a5c68d93..00f0b8a1 100644 --- a/app/src/main/java/io/lbry/browser/tasks/claim/AbandonStreamTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/claim/AbandonStreamTask.java @@ -11,17 +11,16 @@ import java.util.List; import java.util.Map; import io.lbry.browser.exceptions.ApiCallException; -import io.lbry.browser.tasks.GenericTaskHandler; import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class AbandonStreamTask extends AsyncTask { - private List claimIds; + private final List claimIds; private List successfulClaimIds; private List failedClaimIds; private List failedExceptions; - private View progressView; - private AbandonHandler handler; + private final View progressView; + private final AbandonHandler handler; public AbandonStreamTask(List claimIds, View progressView, AbandonHandler handler) { this.claimIds = claimIds; diff --git a/app/src/main/java/io/lbry/browser/tasks/claim/ChannelCreateUpdateTask.java b/app/src/main/java/io/lbry/browser/tasks/claim/ChannelCreateUpdateTask.java index 6611572d..42d5abc5 100644 --- a/app/src/main/java/io/lbry/browser/tasks/claim/ChannelCreateUpdateTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/claim/ChannelCreateUpdateTask.java @@ -21,12 +21,12 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class ChannelCreateUpdateTask extends AsyncTask { - private Claim claim; - private BigDecimal deposit; - private boolean update; + private final Claim claim; + private final BigDecimal deposit; + private final boolean update; private Exception error; - private ClaimResultHandler handler; - private View progressView; + private final ClaimResultHandler handler; + private final View progressView; public ChannelCreateUpdateTask(Claim claim, BigDecimal deposit, boolean update, View progressView, ClaimResultHandler handler) { this.claim = claim; diff --git a/app/src/main/java/io/lbry/browser/tasks/claim/ClaimListTask.java b/app/src/main/java/io/lbry/browser/tasks/claim/ClaimListTask.java index 592aab55..63c6d68a 100644 --- a/app/src/main/java/io/lbry/browser/tasks/claim/ClaimListTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/claim/ClaimListTask.java @@ -19,9 +19,9 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class ClaimListTask extends AsyncTask> { - private List types; - private View progressView; - private ClaimListResultHandler handler; + private final List types; + private final View progressView; + private final ClaimListResultHandler handler; private Exception error; public ClaimListTask(String type, View progressView, ClaimListResultHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/claim/ClaimSearchTask.java b/app/src/main/java/io/lbry/browser/tasks/claim/ClaimSearchTask.java index 8b243b86..ec135afc 100644 --- a/app/src/main/java/io/lbry/browser/tasks/claim/ClaimSearchTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/claim/ClaimSearchTask.java @@ -12,10 +12,10 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class ClaimSearchTask extends AsyncTask> { - private Map options; - private String connectionString; - private ClaimSearchResultHandler handler; - private View progressView; + private final Map options; + private final String connectionString; + private final ClaimSearchResultHandler handler; + private final View progressView; private ApiCallException error; public ClaimSearchTask(Map options, String connectionString, View progressView, ClaimSearchResultHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/claim/PublishClaimTask.java b/app/src/main/java/io/lbry/browser/tasks/claim/PublishClaimTask.java index d5e59397..87c6a524 100644 --- a/app/src/main/java/io/lbry/browser/tasks/claim/PublishClaimTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/claim/PublishClaimTask.java @@ -21,10 +21,10 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class PublishClaimTask extends AsyncTask { - private Claim claim; - private String filePath; - private View progressView; - private ClaimResultHandler handler; + private final Claim claim; + private final String filePath; + private final View progressView; + private final ClaimResultHandler handler; private Exception error; public PublishClaimTask(Claim claim, String filePath, View progressView, ClaimResultHandler handler) { this.claim = claim; diff --git a/app/src/main/java/io/lbry/browser/tasks/claim/PurchaseListTask.java b/app/src/main/java/io/lbry/browser/tasks/claim/PurchaseListTask.java index 06b05ba2..e4cee5fa 100644 --- a/app/src/main/java/io/lbry/browser/tasks/claim/PurchaseListTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/claim/PurchaseListTask.java @@ -21,8 +21,8 @@ public class PurchaseListTask extends AsyncTask> { private String claimId; private int page; private int pageSize; - private ClaimSearchResultHandler handler; - private View progressView; + private final ClaimSearchResultHandler handler; + private final View progressView; private Exception error; public PurchaseListTask(String claimId, View progressView, ClaimSearchResultHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/claim/ResolveTask.java b/app/src/main/java/io/lbry/browser/tasks/claim/ResolveTask.java index 120c36b7..b6588caf 100644 --- a/app/src/main/java/io/lbry/browser/tasks/claim/ResolveTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/claim/ResolveTask.java @@ -13,10 +13,10 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class ResolveTask extends AsyncTask> { - private List urls; - private String connectionString; - private ClaimListResultHandler handler; - private View progressView; + private final List urls; + private final String connectionString; + private final ClaimListResultHandler handler; + private final View progressView; private ApiCallException error; public ResolveTask(String url, String connectionString, View progressView, ClaimListResultHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/claim/StreamRepostTask.java b/app/src/main/java/io/lbry/browser/tasks/claim/StreamRepostTask.java index 28ec4dcf..da4aaadc 100644 --- a/app/src/main/java/io/lbry/browser/tasks/claim/StreamRepostTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/claim/StreamRepostTask.java @@ -20,12 +20,12 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class StreamRepostTask extends AsyncTask { - private String name; - private BigDecimal bid; - private String claimId; - private String channelId; - private View progressView; - private ClaimResultHandler handler; + private final String name; + private final BigDecimal bid; + private final String claimId; + private final String channelId; + private final View progressView; + private final ClaimResultHandler handler; private Exception error; public StreamRepostTask(String name, BigDecimal bid, String claimId, String channelId, View progressView, ClaimResultHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/file/BulkDeleteFilesTask.java b/app/src/main/java/io/lbry/browser/tasks/file/BulkDeleteFilesTask.java index b05ec9d8..0cf778ba 100644 --- a/app/src/main/java/io/lbry/browser/tasks/file/BulkDeleteFilesTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/file/BulkDeleteFilesTask.java @@ -7,12 +7,11 @@ import java.util.List; import java.util.Map; import io.lbry.browser.exceptions.ApiCallException; -import io.lbry.browser.tasks.GenericTaskHandler; import io.lbry.browser.utils.Lbry; // Just run delete on the specified claim IDs (no need for a handler) public class BulkDeleteFilesTask extends AsyncTask { - private List claimIds; + private final List claimIds; public BulkDeleteFilesTask(List claimIds) { this.claimIds = claimIds; } diff --git a/app/src/main/java/io/lbry/browser/tasks/file/DeleteFileTask.java b/app/src/main/java/io/lbry/browser/tasks/file/DeleteFileTask.java index bdc50bc4..50bd8ff8 100644 --- a/app/src/main/java/io/lbry/browser/tasks/file/DeleteFileTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/file/DeleteFileTask.java @@ -10,9 +10,9 @@ import io.lbry.browser.tasks.GenericTaskHandler; import io.lbry.browser.utils.Lbry; public class DeleteFileTask extends AsyncTask { - private String claimId; + private final String claimId; private Exception error; - private GenericTaskHandler handler; + private final GenericTaskHandler handler; public DeleteFileTask(String claimId, GenericTaskHandler handler) { this.claimId = claimId; diff --git a/app/src/main/java/io/lbry/browser/tasks/file/FileListTask.java b/app/src/main/java/io/lbry/browser/tasks/file/FileListTask.java index 0b442d77..9fa0119b 100644 --- a/app/src/main/java/io/lbry/browser/tasks/file/FileListTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/file/FileListTask.java @@ -11,12 +11,12 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class FileListTask extends AsyncTask> { - private String claimId; + private final String claimId; private boolean downloads; private int page; private int pageSize; - private FileListResultHandler handler; - private View progressView; + private final FileListResultHandler handler; + private final View progressView; private ApiCallException error; public FileListTask(int page, int pageSize, boolean downloads, View progressView, FileListResultHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/file/GetFileTask.java b/app/src/main/java/io/lbry/browser/tasks/file/GetFileTask.java index bf708c82..69badf6e 100644 --- a/app/src/main/java/io/lbry/browser/tasks/file/GetFileTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/file/GetFileTask.java @@ -14,10 +14,10 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class GetFileTask extends AsyncTask { - private String uri; - private boolean saveFile; - private View progressView; - private GetFileHandler handler; + private final String uri; + private final boolean saveFile; + private final View progressView; + private final GetFileHandler handler; private Exception error; public GetFileTask(String uri, boolean saveFile, View progressView, GetFileHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/ChannelSubscribeTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/ChannelSubscribeTask.java index ee02e63e..d1ee033c 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/ChannelSubscribeTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/ChannelSubscribeTask.java @@ -13,16 +13,15 @@ import io.lbry.browser.data.DatabaseHelper; import io.lbry.browser.exceptions.LbryioRequestException; import io.lbry.browser.exceptions.LbryioResponseException; import io.lbry.browser.model.lbryinc.Subscription; -import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbryio; public class ChannelSubscribeTask extends AsyncTask { - private Context context; - private String channelClaimId; - private Subscription subscription; - private ChannelSubscribeHandler handler; + private final Context context; + private final String channelClaimId; + private final Subscription subscription; + private final ChannelSubscribeHandler handler; private Exception error; - private boolean isUnsubscribing; + private final boolean isUnsubscribing; public ChannelSubscribeTask(Context context, String channelClaimId, Subscription subscription, boolean isUnsubscribing, ChannelSubscribeHandler handler) { this.context = context; diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/ClaimRewardTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/ClaimRewardTask.java index cf2c9319..37c4e994 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/ClaimRewardTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/ClaimRewardTask.java @@ -9,7 +9,6 @@ import org.json.JSONException; import org.json.JSONObject; import java.text.DecimalFormat; -import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -25,12 +24,12 @@ import io.lbry.browser.utils.Lbryio; public class ClaimRewardTask extends AsyncTask { - private Context context; - private String type; - private String rewardCode; - private View progressView; + private final Context context; + private final String type; + private final String rewardCode; + private final View progressView; private double amountClaimed; - private ClaimRewardHandler handler; + private final ClaimRewardHandler handler; private Exception error; public ClaimRewardTask(String type, String rewardCode, View progressView, Context context, ClaimRewardHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchCurrentUserTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchCurrentUserTask.java index eef296d3..c39adb30 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchCurrentUserTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchCurrentUserTask.java @@ -7,9 +7,9 @@ import io.lbry.browser.model.lbryinc.User; import io.lbry.browser.utils.Lbryio; public class FetchCurrentUserTask extends AsyncTask { - private Context context; + private final Context context; private Exception error; - private FetchUserTaskHandler handler; + private final FetchUserTaskHandler handler; public FetchCurrentUserTask(Context context, FetchUserTaskHandler handler) { this.context = context; diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchInviteStatusTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchInviteStatusTask.java index d56f7dbd..45ac5bf7 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchInviteStatusTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchInviteStatusTask.java @@ -17,8 +17,8 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbryio; public class FetchInviteStatusTask extends AsyncTask> { - private FetchInviteStatusHandler handler; - private View progressView; + private final FetchInviteStatusHandler handler; + private final View progressView; private Exception error; public FetchInviteStatusTask(View progressView, FetchInviteStatusHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchReferralCodeTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchReferralCodeTask.java index af15d83a..86a4d4e1 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchReferralCodeTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchReferralCodeTask.java @@ -12,8 +12,8 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbryio; public class FetchReferralCodeTask extends AsyncTask { - private FetchReferralCodeHandler handler; - private View progressView; + private final FetchReferralCodeHandler handler; + private final View progressView; private Exception error; public FetchReferralCodeTask(View progressView, FetchReferralCodeHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchRewardsTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchRewardsTask.java index b9f18067..3bdbd8fa 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchRewardsTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchRewardsTask.java @@ -18,8 +18,8 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbryio; public class FetchRewardsTask extends AsyncTask> { - private FetchRewardsHandler handler; - private View progressView; + private final FetchRewardsHandler handler; + private final View progressView; private Exception error; public FetchRewardsTask(View progressView, FetchRewardsHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchStatCountTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchStatCountTask.java index 1f8bb465..59b4777a 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchStatCountTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchStatCountTask.java @@ -15,10 +15,10 @@ public class FetchStatCountTask extends AsyncTask { public static final int STAT_VIEW_COUNT = 1; public static final int STAT_SUB_COUNT = 2; - private String claimId; - private int stat; - private FetchStatCountHandler handler; - private View progressView; + private final String claimId; + private final int stat; + private final FetchStatCountHandler handler; + private final View progressView; private Exception error; public FetchStatCountTask(int stat, String claimId, View progressView, FetchStatCountHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchSubscriptionsTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchSubscriptionsTask.java index e3c2a1f8..a6182133 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchSubscriptionsTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/FetchSubscriptionsTask.java @@ -23,9 +23,9 @@ import io.lbry.browser.utils.LbryUri; import io.lbry.browser.utils.Lbryio; public class FetchSubscriptionsTask extends AsyncTask> { - private Context context; - private FetchSubscriptionsHandler handler; - private ProgressBar progressBar; + private final Context context; + private final FetchSubscriptionsHandler handler; + private final ProgressBar progressBar; private Exception error; public FetchSubscriptionsTask(Context context, ProgressBar progressBar, FetchSubscriptionsHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/InviteByEmailTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/InviteByEmailTask.java index e2709862..4221a8f6 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/InviteByEmailTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/InviteByEmailTask.java @@ -14,9 +14,9 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbryio; public class InviteByEmailTask extends AsyncTask { - private String email; - private View progressView; - private GenericTaskHandler handler; + private final String email; + private final View progressView; + private final GenericTaskHandler handler; private Exception error; public InviteByEmailTask(String email, View progressView, GenericTaskHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/LogFileViewTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/LogFileViewTask.java index c0055a7c..f3c785ae 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/LogFileViewTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/LogFileViewTask.java @@ -2,24 +2,21 @@ package io.lbry.browser.tasks.lbryinc; import android.os.AsyncTask; -import java.io.IOException; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.Executor; import io.lbry.browser.exceptions.LbryioRequestException; import io.lbry.browser.exceptions.LbryioResponseException; import io.lbry.browser.model.Claim; import io.lbry.browser.tasks.GenericTaskHandler; import io.lbry.browser.utils.Lbryio; -import okhttp3.Response; public class LogFileViewTask extends AsyncTask { - private String uri; - private Claim claim; + private final String uri; + private final Claim claim; private Exception error; - private GenericTaskHandler handler; - private long timeToStart; + private final GenericTaskHandler handler; + private final long timeToStart; public LogFileViewTask(String uri, Claim claim, long timeToStart, GenericTaskHandler handler) { this.uri = uri; diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/LogPublishTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/LogPublishTask.java index f807f360..b92d8b29 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/LogPublishTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/LogPublishTask.java @@ -2,7 +2,6 @@ package io.lbry.browser.tasks.lbryinc; import android.os.AsyncTask; -import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -10,10 +9,9 @@ import io.lbry.browser.exceptions.LbryioRequestException; import io.lbry.browser.exceptions.LbryioResponseException; import io.lbry.browser.model.Claim; import io.lbry.browser.utils.Lbryio; -import okhttp3.Response; public class LogPublishTask extends AsyncTask { - private Claim claimResult; + private final Claim claimResult; public LogPublishTask(Claim claimResult) { this.claimResult = claimResult; } diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationDeleteTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationDeleteTask.java index 42e23391..a30134b5 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationDeleteTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationDeleteTask.java @@ -12,7 +12,7 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbryio; public class NotificationDeleteTask extends AsyncTask { - private List ids; + private final List ids; public NotificationDeleteTask(List ids) { this.ids = ids; diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationListTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationListTask.java index 9dcc4a52..be8c64f6 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationListTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationListTask.java @@ -30,9 +30,9 @@ import io.lbry.browser.utils.Lbryio; public class NotificationListTask extends AsyncTask> { private static final String TAG = "Notifications"; - private Context context; - private ListNotificationsHandler handler; - private ProgressBar progressBar; + private final Context context; + private final ListNotificationsHandler handler; + private final ProgressBar progressBar; private Exception error; public NotificationListTask(Context context, ProgressBar progressBar, ListNotificationsHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationUpdateTask.java b/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationUpdateTask.java index f942f7d6..e8a06570 100644 --- a/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationUpdateTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/lbryinc/NotificationUpdateTask.java @@ -12,10 +12,10 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbryio; public class NotificationUpdateTask extends AsyncTask { - private List ids; - private boolean seen; - private boolean read; - private boolean updateRead; + private final List ids; + private final boolean seen; + private final boolean read; + private final boolean updateRead; public NotificationUpdateTask(List ids, boolean seen) { this(ids, false, true, false); diff --git a/app/src/main/java/io/lbry/browser/tasks/localdata/FetchRecentUrlHistoryTask.java b/app/src/main/java/io/lbry/browser/tasks/localdata/FetchRecentUrlHistoryTask.java index 852e87ae..dd4f7dff 100644 --- a/app/src/main/java/io/lbry/browser/tasks/localdata/FetchRecentUrlHistoryTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/localdata/FetchRecentUrlHistoryTask.java @@ -11,8 +11,8 @@ import io.lbry.browser.data.DatabaseHelper; import io.lbry.browser.model.UrlSuggestion; public class FetchRecentUrlHistoryTask extends AsyncTask> { - private DatabaseHelper dbHelper; - private FetchRecentUrlHistoryHandler handler; + private final DatabaseHelper dbHelper; + private final FetchRecentUrlHistoryHandler handler; public FetchRecentUrlHistoryTask(DatabaseHelper dbHelper, FetchRecentUrlHistoryHandler handler) { this.dbHelper = dbHelper; this.handler = handler; diff --git a/app/src/main/java/io/lbry/browser/tasks/localdata/FetchViewHistoryTask.java b/app/src/main/java/io/lbry/browser/tasks/localdata/FetchViewHistoryTask.java index fd0d4b21..907809ac 100644 --- a/app/src/main/java/io/lbry/browser/tasks/localdata/FetchViewHistoryTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/localdata/FetchViewHistoryTask.java @@ -10,15 +10,14 @@ import java.util.Date; import java.util.List; import io.lbry.browser.data.DatabaseHelper; -import io.lbry.browser.model.UrlSuggestion; import io.lbry.browser.model.ViewHistory; import io.lbry.browser.utils.Helper; public class FetchViewHistoryTask extends AsyncTask> { - private DatabaseHelper dbHelper; - private FetchViewHistoryHandler handler; - private int pageSize; - private Date lastDate; + private final DatabaseHelper dbHelper; + private final FetchViewHistoryHandler handler; + private final int pageSize; + private final Date lastDate; public FetchViewHistoryTask(Date lastDate, int pageSize, DatabaseHelper dbHelper, FetchViewHistoryHandler handler) { this.lastDate = lastDate; this.pageSize = pageSize; diff --git a/app/src/main/java/io/lbry/browser/tasks/localdata/LoadGalleryItemsTask.java b/app/src/main/java/io/lbry/browser/tasks/localdata/LoadGalleryItemsTask.java index 845f5ec5..6b8cc258 100644 --- a/app/src/main/java/io/lbry/browser/tasks/localdata/LoadGalleryItemsTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/localdata/LoadGalleryItemsTask.java @@ -6,7 +6,6 @@ import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.net.Uri; import android.os.AsyncTask; import android.provider.MediaStore; import android.util.Log; @@ -23,9 +22,9 @@ import io.lbry.browser.utils.Helper; public class LoadGalleryItemsTask extends AsyncTask> { private static final String TAG = "LoadGalleryItemsTask"; - private LoadGalleryHandler handler; - private View progressView; - private Context context; + private final LoadGalleryHandler handler; + private final View progressView; + private final Context context; public LoadGalleryItemsTask(View progressView, Context context, LoadGalleryHandler handler) { this.progressView = progressView; @@ -44,6 +43,7 @@ public class LoadGalleryItemsTask extends AsyncTask { - private DatabaseHelper dbHelper; - private UrlSuggestion suggestion; - private SaveUrlHistoryHandler handler; + private final DatabaseHelper dbHelper; + private final UrlSuggestion suggestion; + private final SaveUrlHistoryHandler handler; private Exception error; public SaveUrlHistoryTask(UrlSuggestion suggestion, DatabaseHelper dbHelper, SaveUrlHistoryHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/localdata/SaveViewHistoryTask.java b/app/src/main/java/io/lbry/browser/tasks/localdata/SaveViewHistoryTask.java index bb7e0f64..9c3da2e3 100644 --- a/app/src/main/java/io/lbry/browser/tasks/localdata/SaveViewHistoryTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/localdata/SaveViewHistoryTask.java @@ -7,9 +7,9 @@ import io.lbry.browser.data.DatabaseHelper; import io.lbry.browser.model.ViewHistory; public class SaveViewHistoryTask extends AsyncTask { - private DatabaseHelper dbHelper; - private ViewHistory history; - private SaveViewHistoryHandler handler; + private final DatabaseHelper dbHelper; + private final ViewHistory history; + private final SaveViewHistoryHandler handler; private Exception error; public SaveViewHistoryTask(ViewHistory history, DatabaseHelper dbHelper, SaveViewHistoryHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/verification/CheckUserEmailVerifiedTask.java b/app/src/main/java/io/lbry/browser/tasks/verification/CheckUserEmailVerifiedTask.java index fdf54524..27285ce5 100644 --- a/app/src/main/java/io/lbry/browser/tasks/verification/CheckUserEmailVerifiedTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/verification/CheckUserEmailVerifiedTask.java @@ -8,8 +8,8 @@ import io.lbry.browser.model.lbryinc.User; import io.lbry.browser.utils.Lbryio; public class CheckUserEmailVerifiedTask extends AsyncTask { - private Context context; - private CheckUserEmailVerifiedHandler handler; + private final Context context; + private final CheckUserEmailVerifiedHandler handler; public CheckUserEmailVerifiedTask(Context context, CheckUserEmailVerifiedHandler handler) { this.context = context; diff --git a/app/src/main/java/io/lbry/browser/tasks/verification/EmailNewTask.java b/app/src/main/java/io/lbry/browser/tasks/verification/EmailNewTask.java index f699835e..cfcc5d8f 100644 --- a/app/src/main/java/io/lbry/browser/tasks/verification/EmailNewTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/verification/EmailNewTask.java @@ -3,8 +3,6 @@ package io.lbry.browser.tasks.verification; import android.os.AsyncTask; import android.view.View; -import org.json.JSONObject; - import java.util.HashMap; import java.util.Map; @@ -15,9 +13,9 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbryio; public class EmailNewTask extends AsyncTask { - private String email; - private View progressView; - private EmailNewHandler handler; + private final String email; + private final View progressView; + private final EmailNewHandler handler; private Exception error; public EmailNewTask(String email, View progressView, EmailNewHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/verification/EmailResendTask.java b/app/src/main/java/io/lbry/browser/tasks/verification/EmailResendTask.java index 715acb30..2b92e575 100644 --- a/app/src/main/java/io/lbry/browser/tasks/verification/EmailResendTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/verification/EmailResendTask.java @@ -13,9 +13,9 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbryio; public class EmailResendTask extends AsyncTask { - private String email; - private View progressView; - private GenericTaskHandler handler; + private final String email; + private final View progressView; + private final GenericTaskHandler handler; private Exception error; public EmailResendTask(String email, View progressView, GenericTaskHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/verification/PhoneNewVerifyTask.java b/app/src/main/java/io/lbry/browser/tasks/verification/PhoneNewVerifyTask.java index 15730464..0a9f0295 100644 --- a/app/src/main/java/io/lbry/browser/tasks/verification/PhoneNewVerifyTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/verification/PhoneNewVerifyTask.java @@ -13,11 +13,11 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbryio; public class PhoneNewVerifyTask extends AsyncTask { - private String countryCode; - private String phoneNumber; - private String verificationCode; - private View progressView; - private GenericTaskHandler handler; + private final String countryCode; + private final String phoneNumber; + private final String verificationCode; + private final View progressView; + private final GenericTaskHandler handler; private Exception error; public PhoneNewVerifyTask(String countryCode, String phoneNumber, String verificationCode, View progressView, GenericTaskHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/wallet/LoadSharedUserStateTask.java b/app/src/main/java/io/lbry/browser/tasks/wallet/LoadSharedUserStateTask.java index 323a1949..0570e5a8 100644 --- a/app/src/main/java/io/lbry/browser/tasks/wallet/LoadSharedUserStateTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/wallet/LoadSharedUserStateTask.java @@ -36,8 +36,8 @@ import io.lbry.browser.utils.LbryUri; public class LoadSharedUserStateTask extends AsyncTask { private static final String KEY = "shared"; - private Context context; - private LoadSharedUserStateHandler handler; + private final Context context; + private final LoadSharedUserStateHandler handler; private Exception error; private List subscriptions; diff --git a/app/src/main/java/io/lbry/browser/tasks/wallet/SaveSharedUserStateTask.java b/app/src/main/java/io/lbry/browser/tasks/wallet/SaveSharedUserStateTask.java index 2b962061..07ea8b67 100644 --- a/app/src/main/java/io/lbry/browser/tasks/wallet/SaveSharedUserStateTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/wallet/SaveSharedUserStateTask.java @@ -33,7 +33,7 @@ import io.lbry.browser.utils.Lbryio; public class SaveSharedUserStateTask extends AsyncTask { private static final String KEY = "shared"; private static final String VERSION = "0.1"; - private SaveSharedUserStateHandler handler; + private final SaveSharedUserStateHandler handler; private Exception error; public SaveSharedUserStateTask(SaveSharedUserStateHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/wallet/SupportCreateTask.java b/app/src/main/java/io/lbry/browser/tasks/wallet/SupportCreateTask.java index 5426f0cb..f349da64 100644 --- a/app/src/main/java/io/lbry/browser/tasks/wallet/SupportCreateTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/wallet/SupportCreateTask.java @@ -16,12 +16,12 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class SupportCreateTask extends AsyncTask { - private String claimId; - private String channelId; - private BigDecimal amount; - private boolean tip; - private View progressView; - private GenericTaskHandler handler; + private final String claimId; + private final String channelId; + private final BigDecimal amount; + private final boolean tip; + private final View progressView; + private final GenericTaskHandler handler; private Exception error; public SupportCreateTask(String claimId, String channelId, BigDecimal amount, boolean tip, View progressView, GenericTaskHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/wallet/SyncApplyTask.java b/app/src/main/java/io/lbry/browser/tasks/wallet/SyncApplyTask.java index 51572f49..a089d3ef 100644 --- a/app/src/main/java/io/lbry/browser/tasks/wallet/SyncApplyTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/wallet/SyncApplyTask.java @@ -3,7 +3,6 @@ package io.lbry.browser.tasks.wallet; import android.os.AsyncTask; import android.view.View; -import org.json.JSONException; import org.json.JSONObject; import java.util.HashMap; @@ -17,10 +16,10 @@ public class SyncApplyTask extends AsyncTask { // flag to indicate if this sync_apply is to fetch wallet data or apply data private boolean fetch; private Exception error; - private String password; + private final String password; private String data; private View progressView; - private SyncTaskHandler handler; + private final SyncTaskHandler handler; private String syncHash; private String syncData; diff --git a/app/src/main/java/io/lbry/browser/tasks/wallet/SyncGetTask.java b/app/src/main/java/io/lbry/browser/tasks/wallet/SyncGetTask.java index 76a02bb3..27b92715 100644 --- a/app/src/main/java/io/lbry/browser/tasks/wallet/SyncGetTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/wallet/SyncGetTask.java @@ -19,13 +19,13 @@ import io.lbry.browser.utils.Lbryio; public class SyncGetTask extends AsyncTask { - private boolean applySyncChanges; + private final boolean applySyncChanges; private boolean applySyncSuccessful; private Exception error; private Exception syncApplyError; private String password; - private SyncTaskHandler handler; - private View progressView; + private final SyncTaskHandler handler; + private final View progressView; private String syncHash; private String syncData; diff --git a/app/src/main/java/io/lbry/browser/tasks/wallet/SyncSetTask.java b/app/src/main/java/io/lbry/browser/tasks/wallet/SyncSetTask.java index 1f5c888f..83398c74 100644 --- a/app/src/main/java/io/lbry/browser/tasks/wallet/SyncSetTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/wallet/SyncSetTask.java @@ -14,10 +14,10 @@ import io.lbry.browser.utils.Lbryio; public class SyncSetTask extends AsyncTask { private Exception error; - private String oldHash; - private String newHash; - private String data; - private SyncTaskHandler handler; + private final String oldHash; + private final String newHash; + private final String data; + private final SyncTaskHandler handler; public SyncSetTask(String oldHash, String newHash, String data, SyncTaskHandler handler) { this.oldHash = oldHash; diff --git a/app/src/main/java/io/lbry/browser/tasks/wallet/TransactionListTask.java b/app/src/main/java/io/lbry/browser/tasks/wallet/TransactionListTask.java index b5e35539..73bf8fbe 100644 --- a/app/src/main/java/io/lbry/browser/tasks/wallet/TransactionListTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/wallet/TransactionListTask.java @@ -11,10 +11,10 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class TransactionListTask extends AsyncTask> { - private int page; - private int pageSize; - private View progressView; - private TransactionListHandler handler; + private final int page; + private final int pageSize; + private final View progressView; + private final TransactionListHandler handler; private Exception error; public TransactionListTask(int page, int pageSize, View progressView, TransactionListHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/wallet/WalletAddressUnusedTask.java b/app/src/main/java/io/lbry/browser/tasks/wallet/WalletAddressUnusedTask.java index 437eb2ef..676bdbe6 100644 --- a/app/src/main/java/io/lbry/browser/tasks/wallet/WalletAddressUnusedTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/wallet/WalletAddressUnusedTask.java @@ -2,18 +2,12 @@ package io.lbry.browser.tasks.wallet; import android.os.AsyncTask; -import org.json.JSONException; -import org.json.JSONObject; - -import java.math.BigDecimal; - import io.lbry.browser.exceptions.ApiCallException; -import io.lbry.browser.model.WalletBalance; import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class WalletAddressUnusedTask extends AsyncTask { - private WalletAddressUnusedHandler handler; + private final WalletAddressUnusedHandler handler; private Exception error; public WalletAddressUnusedTask(WalletAddressUnusedHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/wallet/WalletBalanceTask.java b/app/src/main/java/io/lbry/browser/tasks/wallet/WalletBalanceTask.java index cad56be2..e504f6d8 100644 --- a/app/src/main/java/io/lbry/browser/tasks/wallet/WalletBalanceTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/wallet/WalletBalanceTask.java @@ -4,15 +4,12 @@ import android.os.AsyncTask; import org.json.JSONObject; -import java.math.BigDecimal; - import io.lbry.browser.exceptions.ApiCallException; import io.lbry.browser.model.WalletBalance; -import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class WalletBalanceTask extends AsyncTask { - private WalletBalanceHandler handler; + private final WalletBalanceHandler handler; private Exception error; public WalletBalanceTask(WalletBalanceHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/tasks/wallet/WalletSendTask.java b/app/src/main/java/io/lbry/browser/tasks/wallet/WalletSendTask.java index d6183c29..837ab412 100644 --- a/app/src/main/java/io/lbry/browser/tasks/wallet/WalletSendTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/wallet/WalletSendTask.java @@ -12,10 +12,10 @@ import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; public class WalletSendTask extends AsyncTask { - private String recipientAddress; - private String amount; - private View progressView; - private WalletSendHandler handler; + private final String recipientAddress; + private final String amount; + private final View progressView; + private final WalletSendHandler handler; private Exception error; public WalletSendTask(String recipientAddress, String amount, View progressView, WalletSendHandler handler) { diff --git a/app/src/main/java/io/lbry/browser/ui/BaseFragment.java b/app/src/main/java/io/lbry/browser/ui/BaseFragment.java index 3970e582..9cbf3132 100644 --- a/app/src/main/java/io/lbry/browser/ui/BaseFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/BaseFragment.java @@ -22,11 +22,9 @@ import io.lbry.browser.MainActivity; import io.lbry.browser.R; import io.lbry.browser.adapter.InlineChannelSpinnerAdapter; import io.lbry.browser.model.Claim; -import io.lbry.browser.model.WalletBalance; import io.lbry.browser.tasks.claim.ChannelCreateUpdateTask; import io.lbry.browser.tasks.claim.ClaimResultHandler; import io.lbry.browser.tasks.lbryinc.LogPublishTask; -import io.lbry.browser.ui.wallet.RewardsFragment; import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; import io.lbry.browser.utils.LbryAnalytics; diff --git a/app/src/main/java/io/lbry/browser/ui/channel/ChannelCommentsFragment.java b/app/src/main/java/io/lbry/browser/ui/channel/ChannelCommentsFragment.java index 3374e963..38d99834 100644 --- a/app/src/main/java/io/lbry/browser/ui/channel/ChannelCommentsFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/channel/ChannelCommentsFragment.java @@ -1,7 +1,6 @@ package io.lbry.browser.ui.channel; import android.content.Context; -import android.content.DialogInterface; import android.os.AsyncTask; import android.os.Bundle; import android.text.Editable; @@ -16,7 +15,6 @@ import android.widget.ProgressBar; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; import androidx.appcompat.widget.AppCompatSpinner; import androidx.core.widget.NestedScrollView; import androidx.fragment.app.Fragment; @@ -648,8 +646,8 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen showError(getString(R.string.please_enter_valid_deposit)); return; } - if (depositAmount == 0) { - String error = getResources().getQuantityString(R.plurals.min_deposit_required, depositAmount == 1 ? 1 : 2, String.valueOf(Helper.MIN_DEPOSIT)); + if (depositAmount <= 0.000001) { + String error = getResources().getQuantityString(R.plurals.min_deposit_required, Math.abs(depositAmount-1.0) <= 0.000001 ? 1 : 2, String.valueOf(Helper.MIN_DEPOSIT)); showError(error); return; } diff --git a/app/src/main/java/io/lbry/browser/ui/channel/ChannelFormFragment.java b/app/src/main/java/io/lbry/browser/ui/channel/ChannelFormFragment.java index ccb3a609..36899697 100644 --- a/app/src/main/java/io/lbry/browser/ui/channel/ChannelFormFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/channel/ChannelFormFragment.java @@ -3,7 +3,6 @@ package io.lbry.browser.ui.channel; import android.Manifest; import android.content.Context; import android.content.Intent; -import android.graphics.Color; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; @@ -16,7 +15,6 @@ import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.appcompat.app.ActionBar; import androidx.core.content.ContextCompat; import androidx.core.widget.NestedScrollView; import androidx.recyclerview.widget.RecyclerView; diff --git a/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java b/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java index d42d125e..c10ff3a0 100644 --- a/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java @@ -26,7 +26,6 @@ import com.google.android.material.snackbar.Snackbar; import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayoutMediator; -import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Arrays; @@ -185,19 +184,14 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen } if (claim != null) { - CreateSupportDialogFragment dialog = CreateSupportDialogFragment.newInstance(); - dialog.setClaim(claim); - dialog.setListener(new CreateSupportDialogFragment.CreateSupportListener() { - @Override - public void onSupportCreated(BigDecimal amount, boolean isTip) { - double sentAmount = amount.doubleValue(); - View view = getView(); - if (view != null) { - String message = getResources().getQuantityString( - isTip ? R.plurals.you_sent_a_tip : R.plurals.you_sent_a_support, sentAmount == 1.0 ? 1 : 2, - new DecimalFormat("#,###.##").format(sentAmount)); - Snackbar.make(view, message, Snackbar.LENGTH_LONG).show(); - } + CreateSupportDialogFragment dialog = CreateSupportDialogFragment.newInstance(claim, (amount, isTip) -> { + double sentAmount = amount.doubleValue(); + View view1 = getView(); + if (view1 != null) { + String message = getResources().getQuantityString( + isTip ? R.plurals.you_sent_a_tip : R.plurals.you_sent_a_support, sentAmount == 1.0 ? 1 : 2, + new DecimalFormat("#,###.##").format(sentAmount)); + Snackbar.make(view1, message, Snackbar.LENGTH_LONG).show(); } }); Context context = getContext(); @@ -399,7 +393,12 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen } } if (params.containsKey("url")) { - LbryUri newLbryUri = LbryUri.tryParse(params.get("url").toString()); + Object o = params.get("url"); + String urlString = ""; + if (o != null) { + urlString = o.toString(); + } + LbryUri newLbryUri = LbryUri.tryParse(urlString); if (newLbryUri != null) { newUrl = newLbryUri.toString(); String qs = newLbryUri.getQueryString(); @@ -590,8 +589,8 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen } private static class ChannelPagerAdapter extends FragmentStateAdapter { - private Claim channelClaim; - private String commentHash; + private final Claim channelClaim; + private final String commentHash; public ChannelPagerAdapter(Claim channelClaim, String commentHash, FragmentActivity activity) { super(activity); this.channelClaim = channelClaim; @@ -634,6 +633,7 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen return commentsFragment; } + // TODO: createFragment is defined as a @NonNull and should never be able to return null. return null; } diff --git a/app/src/main/java/io/lbry/browser/ui/channel/ChannelManagerFragment.java b/app/src/main/java/io/lbry/browser/ui/channel/ChannelManagerFragment.java index 44276694..c6e3fd75 100644 --- a/app/src/main/java/io/lbry/browser/ui/channel/ChannelManagerFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/channel/ChannelManagerFragment.java @@ -77,7 +77,7 @@ public class ChannelManagerFragment extends BaseFragment implements ActionMode.C return root; } - private View.OnClickListener newChannelClickListener = new View.OnClickListener() { + private final View.OnClickListener newChannelClickListener = new View.OnClickListener() { @Override public void onClick(View view) { Context context = getContext(); diff --git a/app/src/main/java/io/lbry/browser/ui/controls/OutlineIconView.java b/app/src/main/java/io/lbry/browser/ui/controls/OutlineIconView.java index 46c3c2b2..06fb8e25 100644 --- a/app/src/main/java/io/lbry/browser/ui/controls/OutlineIconView.java +++ b/app/src/main/java/io/lbry/browser/ui/controls/OutlineIconView.java @@ -8,7 +8,7 @@ import android.view.Gravity; import androidx.appcompat.widget.AppCompatTextView; public class OutlineIconView extends AppCompatTextView { - private Context context; + private final Context context; public OutlineIconView(Context context) { super(context); diff --git a/app/src/main/java/io/lbry/browser/ui/controls/SolidIconView.java b/app/src/main/java/io/lbry/browser/ui/controls/SolidIconView.java index e9de291b..1f2caa19 100644 --- a/app/src/main/java/io/lbry/browser/ui/controls/SolidIconView.java +++ b/app/src/main/java/io/lbry/browser/ui/controls/SolidIconView.java @@ -8,7 +8,7 @@ import android.view.Gravity; import androidx.appcompat.widget.AppCompatTextView; public class SolidIconView extends AppCompatTextView { - private Context context; + private final Context context; public SolidIconView(Context context) { super(context); diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/AllContentFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/AllContentFragment.java index 1563c773..df62198e 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/AllContentFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/AllContentFragment.java @@ -207,7 +207,11 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi private void checkParams(boolean reload) { Map params = getParams(); if (params != null && params.containsKey("singleTag")) { - String tagName = params.get("singleTag").toString(); + String tagName = ""; + Object o = params.get("singleTag"); + if (o != null) { + tagName = o.toString(); + } singleTagView = true; tags = Arrays.asList(tagName); titleView.setText(Helper.capitalize(tagName)); @@ -289,7 +293,7 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi } } - private FollowUnfollowTagTask.FollowUnfollowTagHandler followUnfollowHandler = new FollowUnfollowTagTask.FollowUnfollowTagHandler() { + private final FollowUnfollowTagTask.FollowUnfollowTagHandler followUnfollowHandler = new FollowUnfollowTagTask.FollowUnfollowTagHandler() { @Override public void onSuccess(Tag tag, boolean unfollowing) { if (tags != null) { diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java index 21c6c21f..fb0b72be 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java @@ -89,7 +89,6 @@ import org.json.JSONObject; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.ArrayList; @@ -830,7 +829,7 @@ public class FileViewFragment extends BaseFragment implements } } - private View.OnClickListener bellIconListener = new View.OnClickListener() { + private final View.OnClickListener bellIconListener = new View.OnClickListener() { @Override public void onClick(View view) { if (claim != null && claim.getSigningChannel() != null) { @@ -866,7 +865,7 @@ public class FileViewFragment extends BaseFragment implements } }; - private View.OnClickListener followUnfollowListener = new View.OnClickListener() { + private final View.OnClickListener followUnfollowListener = new View.OnClickListener() { @Override public void onClick(final View view) { if (claim != null && claim.getSigningChannel() != null) { @@ -1053,17 +1052,12 @@ public class FileViewFragment extends BaseFragment implements } if (claim != null) { - CreateSupportDialogFragment dialog = CreateSupportDialogFragment.newInstance(); - dialog.setClaim(claim); - dialog.setListener(new CreateSupportDialogFragment.CreateSupportListener() { - @Override - public void onSupportCreated(BigDecimal amount, boolean isTip) { - double sentAmount = amount.doubleValue(); - String message = getResources().getQuantityString( - isTip ? R.plurals.you_sent_a_tip : R.plurals.you_sent_a_support, sentAmount == 1.0 ? 1 : 2, - new DecimalFormat("#,###.##").format(sentAmount)); - Snackbar.make(root.findViewById(R.id.file_view_claim_display_area), message, Snackbar.LENGTH_LONG).show(); - } + CreateSupportDialogFragment dialog = CreateSupportDialogFragment.newInstance(claim, (amount, isTip) -> { + double sentAmount = amount.doubleValue(); + String message = getResources().getQuantityString( + isTip ? R.plurals.you_sent_a_tip : R.plurals.you_sent_a_support, sentAmount == 1.0 ? 1 : 2, + new DecimalFormat("#,###.##").format(sentAmount)); + Snackbar.make(root.findViewById(R.id.file_view_claim_display_area), message, Snackbar.LENGTH_LONG).show(); }); Context context = getContext(); if (context instanceof MainActivity) { @@ -1082,15 +1076,10 @@ public class FileViewFragment extends BaseFragment implements } if (claim != null) { - RepostClaimDialogFragment dialog = RepostClaimDialogFragment.newInstance(); - dialog.setClaim(claim); - dialog.setListener(new RepostClaimDialogFragment.RepostClaimListener() { - @Override - public void onClaimReposted(Claim claim) { - Context context = getContext(); - if (context instanceof MainActivity) { - ((MainActivity) context).showMessage(R.string.content_successfully_reposted); - } + RepostClaimDialogFragment dialog = RepostClaimDialogFragment.newInstance(claim, claim -> { + Context context = getContext(); + if (context instanceof MainActivity) { + ((MainActivity) context).showMessage(R.string.content_successfully_reposted); } }); Context context = getContext(); @@ -2431,7 +2420,7 @@ public class FileViewFragment extends BaseFragment implements private void resolveCommentPosters() { if (commentListAdapter != null) { - long st = System.currentTimeMillis();; + long st = System.currentTimeMillis(); List urlsToResolve = new ArrayList<>(commentListAdapter.getClaimUrlsToResolve()); if (urlsToResolve.size() > 0) { ResolveTask task = new ResolveTask(urlsToResolve, Lbry.LBRY_TV_CONNECTION_STRING, null, new ClaimListResultHandler() { @@ -2709,7 +2698,7 @@ public class FileViewFragment extends BaseFragment implements dailyViewTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } - private ClaimRewardTask.ClaimRewardHandler eligibleRewardHandler = new ClaimRewardTask.ClaimRewardHandler() { + private final ClaimRewardTask.ClaimRewardHandler eligibleRewardHandler = new ClaimRewardTask.ClaimRewardHandler() { @Override public void onSuccess(double amountClaimed, String message) { if (Helper.isNullOrEmpty(message)) { @@ -2878,7 +2867,7 @@ public class FileViewFragment extends BaseFragment implements } private static class LbryWebViewClient extends WebViewClient { - private Context context; + private final Context context; public LbryWebViewClient(Context context) { this.context = context; } diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java index 50a22d07..cc89d882 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/FollowingFragment.java @@ -91,8 +91,8 @@ public class FollowingFragment extends BaseFragment implements private View noContentView; private boolean subscriptionsShown; - private List queuedContentPages = new ArrayList<>(); - private List queuedSuggestedPages = new ArrayList<>(); + private final List queuedContentPages = new ArrayList<>(); + private final List queuedSuggestedPages = new ArrayList<>(); private int currentSuggestedPage = 0; private int currentClaimSearchPage; diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java index df7b7456..0d980c4e 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/ShuffleFragment.java @@ -21,7 +21,6 @@ import androidx.annotation.NonNull; import androidx.preference.PreferenceManager; import com.google.android.exoplayer2.C; -import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.audio.AudioAttributes; @@ -642,7 +641,7 @@ public class ShuffleFragment extends BaseFragment { dailyViewTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } - private ClaimRewardTask.ClaimRewardHandler eligibleRewardHandler = new ClaimRewardTask.ClaimRewardHandler() { + private final ClaimRewardTask.ClaimRewardHandler eligibleRewardHandler = new ClaimRewardTask.ClaimRewardHandler() { @Override public void onSuccess(double amountClaimed, String message) { if (Helper.isNullOrEmpty(message)) { @@ -686,10 +685,7 @@ public class ShuffleFragment extends BaseFragment { @Override public boolean onDown(MotionEvent e) { - if (control instanceof PlayerView) { - return false; - } - return true; + return control instanceof PlayerView; } @Override diff --git a/app/src/main/java/io/lbry/browser/ui/other/AboutFragment.java b/app/src/main/java/io/lbry/browser/ui/other/AboutFragment.java index 104fdb61..9173cad4 100644 --- a/app/src/main/java/io/lbry/browser/ui/other/AboutFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/other/AboutFragment.java @@ -14,9 +14,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; -import androidx.appcompat.app.ActionBar; import androidx.core.content.FileProvider; -import androidx.preference.PreferenceManager; import com.google.android.material.snackbar.Snackbar; diff --git a/app/src/main/java/io/lbry/browser/ui/other/SettingsFragment.java b/app/src/main/java/io/lbry/browser/ui/other/SettingsFragment.java index d23c12a5..bfa00def 100644 --- a/app/src/main/java/io/lbry/browser/ui/other/SettingsFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/other/SettingsFragment.java @@ -8,7 +8,6 @@ import android.text.InputType; import android.widget.EditText; import androidx.annotation.NonNull; -import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatDelegate; import androidx.preference.EditTextPreference; import androidx.preference.PreferenceFragmentCompat; diff --git a/app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java b/app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java index 5e6b0dcc..3d8e2a51 100644 --- a/app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java @@ -25,10 +25,8 @@ import android.widget.ProgressBar; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.appcompat.app.ActionBar; import androidx.appcompat.widget.AppCompatSpinner; import androidx.cardview.widget.CardView; -import androidx.core.content.ContextCompat; import androidx.core.widget.NestedScrollView; import androidx.recyclerview.widget.RecyclerView; @@ -52,7 +50,6 @@ import org.json.JSONObject; import java.io.File; import java.io.FileOutputStream; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -77,7 +74,6 @@ import io.lbry.browser.model.License; import io.lbry.browser.model.NavMenuItem; import io.lbry.browser.model.Tag; import io.lbry.browser.model.WalletBalance; -import io.lbry.browser.tasks.claim.ChannelCreateUpdateTask; import io.lbry.browser.tasks.UpdateSuggestedTagsTask; import io.lbry.browser.tasks.UploadImageTask; import io.lbry.browser.tasks.claim.ClaimListResultHandler; @@ -1171,7 +1167,7 @@ public class PublishFormFragment extends BaseFragment implements Helper.setViewEnabled(inputTitle, true); Helper.setViewEnabled(inputDescription, true); Helper.setViewEnabled(inputTagFilter, false); - Helper.setViewEnabled(inputAddress, editMode ? false : true); + Helper.setViewEnabled(inputAddress, !editMode); Helper.setViewEnabled(inputDeposit, true); Helper.setViewEnabled(inputPrice, true); Helper.setViewEnabled(inputOtherLicenseDescription, true); @@ -1351,8 +1347,8 @@ public class PublishFormFragment extends BaseFragment implements } private static class VideoProbeTask extends AsyncTask { - private String filePath; - private VideoProbeHandler handler; + private final String filePath; + private final VideoProbeHandler handler; public VideoProbeTask(String filePath, VideoProbeHandler handler) { this.filePath = filePath; this.handler = handler; @@ -1390,11 +1386,11 @@ public class PublishFormFragment extends BaseFragment implements private static class VideoTranscodeTask extends AsyncTask { - private String filePath; - private String scaleFlag; - private String outputFilePath; - private boolean transcodeRequired; - private VideoTranscodeHandler handler; + private final String filePath; + private final String scaleFlag; + private final String outputFilePath; + private final boolean transcodeRequired; + private final VideoTranscodeHandler handler; public VideoTranscodeTask(String filePath, String outputFilePath, String scaleFlag, boolean transcodeRequired, VideoTranscodeHandler handler) { this.handler = handler; @@ -1504,10 +1500,10 @@ public class PublishFormFragment extends BaseFragment implements } private static class CreateThumbnailTask extends AsyncTask { - private Context context; - private String filePath; - private String type; - private CreateThumbnailHandler handler; + private final Context context; + private final String filePath; + private final String type; + private final CreateThumbnailHandler handler; private Exception error; public CreateThumbnailTask(String filePath, String type, Context context, CreateThumbnailHandler handler) { this.context = context; diff --git a/app/src/main/java/io/lbry/browser/ui/publish/PublishFragment.java b/app/src/main/java/io/lbry/browser/ui/publish/PublishFragment.java index 9dc62832..cd9f57ad 100644 --- a/app/src/main/java/io/lbry/browser/ui/publish/PublishFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/publish/PublishFragment.java @@ -123,7 +123,7 @@ public class PublishFragment extends BaseFragment implements private void displayPreviewWithCameraX() { Context context = getContext(); - if (context != null && MainActivity.hasPermission(Manifest.permission.CAMERA, context)) { + if (MainActivity.hasPermission(Manifest.permission.CAMERA, context)) { cameraProviderFuture = ProcessCameraProvider.getInstance(context); cameraProviderFuture.addListener(new Runnable() { @Override diff --git a/app/src/main/java/io/lbry/browser/ui/publish/PublishesFragment.java b/app/src/main/java/io/lbry/browser/ui/publish/PublishesFragment.java index 79bf9d84..a8729879 100644 --- a/app/src/main/java/io/lbry/browser/ui/publish/PublishesFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/publish/PublishesFragment.java @@ -12,7 +12,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ProgressBar; -import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; @@ -25,9 +24,7 @@ import com.google.android.material.snackbar.Snackbar; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; import io.lbry.browser.MainActivity; import io.lbry.browser.R; @@ -79,7 +76,7 @@ public class PublishesFragment extends BaseFragment implements ActionMode.Callba return root; } - private View.OnClickListener newPublishClickListener = new View.OnClickListener() { + private final View.OnClickListener newPublishClickListener = new View.OnClickListener() { @Override public void onClick(View view) { Context context = getContext(); diff --git a/app/src/main/java/io/lbry/browser/ui/verification/EmailVerificationFragment.java b/app/src/main/java/io/lbry/browser/ui/verification/EmailVerificationFragment.java index 277aba59..afc4c817 100644 --- a/app/src/main/java/io/lbry/browser/ui/verification/EmailVerificationFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/verification/EmailVerificationFragment.java @@ -147,7 +147,7 @@ public class EmailVerificationFragment extends Fragment { if (view != null && error != null) { Snackbar.make(getView(), error.getMessage(), Snackbar.LENGTH_LONG). setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show(); - }; + } Helper.setViewVisibility(buttonContinue, View.VISIBLE); } }); diff --git a/app/src/main/java/io/lbry/browser/ui/wallet/InvitesFragment.java b/app/src/main/java/io/lbry/browser/ui/wallet/InvitesFragment.java index 27d00f54..1a7ff933 100644 --- a/app/src/main/java/io/lbry/browser/ui/wallet/InvitesFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/wallet/InvitesFragment.java @@ -3,7 +3,6 @@ package io.lbry.browser.ui.wallet; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; -import android.graphics.Color; import android.os.AsyncTask; import android.os.Bundle; import android.text.Editable; @@ -25,11 +24,9 @@ import com.google.android.material.snackbar.Snackbar; import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputLayout; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import io.lbry.browser.BuildConfig; import io.lbry.browser.MainActivity; import io.lbry.browser.R; import io.lbry.browser.adapter.InlineChannelSpinnerAdapter; @@ -42,9 +39,6 @@ import io.lbry.browser.model.lbryinc.Invitee; import io.lbry.browser.tasks.claim.ClaimListResultHandler; import io.lbry.browser.tasks.claim.ClaimListTask; import io.lbry.browser.tasks.GenericTaskHandler; -import io.lbry.browser.tasks.claim.ChannelCreateUpdateTask; -import io.lbry.browser.tasks.claim.ClaimResultHandler; -import io.lbry.browser.tasks.lbryinc.LogPublishTask; import io.lbry.browser.tasks.lbryinc.FetchInviteStatusTask; import io.lbry.browser.tasks.lbryinc.FetchReferralCodeTask; import io.lbry.browser.tasks.lbryinc.InviteByEmailTask; diff --git a/app/src/main/java/io/lbry/browser/ui/wallet/TransactionHistoryFragment.java b/app/src/main/java/io/lbry/browser/ui/wallet/TransactionHistoryFragment.java index 13a23009..7c0f6cf4 100644 --- a/app/src/main/java/io/lbry/browser/ui/wallet/TransactionHistoryFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/wallet/TransactionHistoryFragment.java @@ -9,7 +9,6 @@ import android.view.ViewGroup; import android.widget.ProgressBar; import androidx.annotation.NonNull; -import androidx.appcompat.app.ActionBar; import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; diff --git a/app/src/main/java/io/lbry/browser/utils/ExoplayerAudioRenderer.java b/app/src/main/java/io/lbry/browser/utils/ExoplayerAudioRenderer.java index 80cb4488..9fddfef2 100644 --- a/app/src/main/java/io/lbry/browser/utils/ExoplayerAudioRenderer.java +++ b/app/src/main/java/io/lbry/browser/utils/ExoplayerAudioRenderer.java @@ -3,26 +3,18 @@ package io.lbry.browser.utils; import android.content.Context; import android.os.Handler; -import androidx.annotation.Nullable; - import com.google.android.exoplayer2.DefaultRenderersFactory; -import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.Renderer; -import com.google.android.exoplayer2.audio.AudioCapabilities; -import com.google.android.exoplayer2.audio.AudioProcessor; import com.google.android.exoplayer2.audio.AudioRendererEventListener; import com.google.android.exoplayer2.audio.AudioSink; -import com.google.android.exoplayer2.audio.DefaultAudioSink; import com.google.android.exoplayer2.audio.TeeAudioProcessor; -import com.google.android.exoplayer2.drm.DrmSessionManager; -import com.google.android.exoplayer2.drm.FrameworkMediaCrypto; import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; import java.util.ArrayList; public class ExoplayerAudioRenderer extends DefaultRenderersFactory { - private TeeAudioProcessor.AudioBufferSink audioBufferSink; + private final TeeAudioProcessor.AudioBufferSink audioBufferSink; public ExoplayerAudioRenderer(Context context, TeeAudioProcessor.AudioBufferSink audioBufferSink) { super(context); diff --git a/app/src/main/java/io/lbry/browser/utils/Helper.java b/app/src/main/java/io/lbry/browser/utils/Helper.java index 6450732c..fe374aac 100644 --- a/app/src/main/java/io/lbry/browser/utils/Helper.java +++ b/app/src/main/java/io/lbry/browser/utils/Helper.java @@ -687,11 +687,15 @@ public final class Helper { LbryFile file = files.get(i); // remove own claims as well if (Lbry.ownClaims != null && Lbry.ownClaims.size() > 0) { + boolean hasClaim = false; for (Claim own : Lbry.ownClaims) { if (own.getClaimId().equalsIgnoreCase(file.getClaimId())) { - continue; + hasClaim = true; } } + if (hasClaim) { + continue; + } } if (!Helper.isNullOrEmpty(file.getDownloadPath())) { filtered.add(file); @@ -750,11 +754,12 @@ public final class Helper { public static String generateUrl() { Random random = new Random(); - StringBuilder sb = new StringBuilder(); - sb.append(Predefined.ADJECTIVES.get(random.nextInt(Predefined.ADJECTIVES.size()))).append("-"). - append(Predefined.ADJECTIVES.get(random.nextInt(Predefined.ADJECTIVES.size()))).append("-"). - append(Predefined.ANIMALS.get(random.nextInt(Predefined.ANIMALS.size()))); - return sb.toString().toLowerCase(); + + String sb = ""; + sb += Predefined.ADJECTIVES.get(random.nextInt(Predefined.ADJECTIVES.size())) + "-"; + sb += Predefined.ADJECTIVES.get(random.nextInt(Predefined.ADJECTIVES.size())) + "-"; + sb += Predefined.ANIMALS.get(random.nextInt(Predefined.ANIMALS.size())); + return sb.toLowerCase(); } public static void refreshRecyclerView(RecyclerView rv) { @@ -774,7 +779,7 @@ public final class Helper { rv.setAdapter(null); rv.setAdapter(adapter); - rv.scrollToPosition(prevScrollPosition > 0 ? prevScrollPosition : 0); + rv.scrollToPosition(Math.max(prevScrollPosition, 0)); } public static String makeid(int length) { diff --git a/app/src/main/java/io/lbry/browser/utils/Lbry.java b/app/src/main/java/io/lbry/browser/utils/Lbry.java index d900567a..b727948f 100644 --- a/app/src/main/java/io/lbry/browser/utils/Lbry.java +++ b/app/src/main/java/io/lbry/browser/utils/Lbry.java @@ -14,7 +14,6 @@ import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; @@ -34,9 +33,6 @@ import io.lbry.browser.model.Tag; import io.lbry.browser.model.Transaction; import io.lbry.browser.model.WalletBalance; import io.lbry.lbrysdk.Utils; -import kotlin.Pair; -import okhttp3.CacheControl; -import okhttp3.Headers; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; @@ -44,8 +40,8 @@ import okhttp3.Response; public final class Lbry { private static final Object lock = new Object(); - public static LinkedHashMap claimCache = new LinkedHashMap<>(); - public static LinkedHashMap, ClaimSearchCacheValue> claimSearchCache = new LinkedHashMap<>(); + public static final LinkedHashMap claimCache = new LinkedHashMap<>(); + public static final LinkedHashMap, ClaimSearchCacheValue> claimSearchCache = new LinkedHashMap<>(); public static WalletBalance walletBalance = new WalletBalance(); public static List knownTags = new ArrayList<>(); public static List followedTags = new ArrayList<>(); diff --git a/app/src/main/java/io/lbry/browser/utils/LbryUri.java b/app/src/main/java/io/lbry/browser/utils/LbryUri.java index 2cecead7..60a12499 100644 --- a/app/src/main/java/io/lbry/browser/utils/LbryUri.java +++ b/app/src/main/java/io/lbry/browser/utils/LbryUri.java @@ -262,7 +262,7 @@ public class LbryUri { return toString().hashCode(); } public boolean equals(Object o) { - if (o == null || !(o instanceof LbryUri)) { + if (!(o instanceof LbryUri)) { return false; } return toString().equalsIgnoreCase(o.toString()); @@ -270,9 +270,9 @@ public class LbryUri { @Data public static class UriModifier { - private String claimId; - private int claimSequence; - private int bidPosition; + private final String claimId; + private final int claimSequence; + private final int bidPosition; public UriModifier(String claimId, int claimSequence, int bidPosition) { this.claimId = claimId; diff --git a/app/src/main/java/io/lbry/browser/utils/Lbryio.java b/app/src/main/java/io/lbry/browser/utils/Lbryio.java index 237d74c9..ff3311da 100644 --- a/app/src/main/java/io/lbry/browser/utils/Lbryio.java +++ b/app/src/main/java/io/lbry/browser/utils/Lbryio.java @@ -23,13 +23,13 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; -import io.lbry.browser.BuildConfig; import io.lbry.browser.MainActivity; import io.lbry.browser.exceptions.AuthTokenInvalidatedException; import io.lbry.browser.exceptions.LbryioRequestException; @@ -68,8 +68,8 @@ public final class Lbryio { public static String AUTH_TOKEN; private static boolean generatingAuthToken = false; - public static List allRewards = new ArrayList<>(); - public static List unclaimedRewards = new ArrayList<>(); + public static final List allRewards = new ArrayList<>(); + public static final List unclaimedRewards = new ArrayList<>(); public static double totalUnclaimedRewardAmount = 0; public static Response call(String resource, String action, Context context) throws LbryioRequestException, LbryioResponseException { @@ -310,7 +310,7 @@ public final class Lbryio { private static void broadcastAuthTokenGenerated(Context context) { try { if (context != null) { - String encryptedAuthToken = Utils.encrypt(AUTH_TOKEN.getBytes("UTF8"), context, Lbry.KEYSTORE); + String encryptedAuthToken = Utils.encrypt(AUTH_TOKEN.getBytes(StandardCharsets.UTF_8), context, Lbry.KEYSTORE); Intent intent = new Intent(MainActivity.ACTION_AUTH_TOKEN_GENERATED); intent.putExtra("authToken", encryptedAuthToken); context.sendBroadcast(intent); diff --git a/app/src/main/java/io/lbry/browser/utils/Lighthouse.java b/app/src/main/java/io/lbry/browser/utils/Lighthouse.java index 2d5cfbca..7a09976e 100644 --- a/app/src/main/java/io/lbry/browser/utils/Lighthouse.java +++ b/app/src/main/java/io/lbry/browser/utils/Lighthouse.java @@ -21,8 +21,8 @@ import okhttp3.Response; public class Lighthouse { public static final String CONNECTION_STRING = "https://lighthouse.lbry.com"; - public static Map> autocompleteCache = new HashMap<>(); - public static Map, List> searchCache = new HashMap<>(); + public static final Map> autocompleteCache = new HashMap<>(); + public static final Map, List> searchCache = new HashMap<>(); private static Map buildSearchOptionsKey(String rawQuery, int size, int from, boolean nsfw, String relatedTo) { Map options = new HashMap<>(); diff --git a/app/src/main/java/io/lbry/browser/utils/Predefined.java b/app/src/main/java/io/lbry/browser/utils/Predefined.java index aacc42fc..f8443b96 100644 --- a/app/src/main/java/io/lbry/browser/utils/Predefined.java +++ b/app/src/main/java/io/lbry/browser/utils/Predefined.java @@ -2,7 +2,6 @@ package io.lbry.browser.utils; import java.util.Arrays; import java.util.List; -import java.util.Map; import io.lbry.browser.R; import io.lbry.browser.model.Language; diff --git a/app/src/main/res/layout/fragment_verification_manual.xml b/app/src/main/res/layout/fragment_verification_manual.xml index 9ad8f83f..49fc237d 100644 --- a/app/src/main/res/layout/fragment_verification_manual.xml +++ b/app/src/main/res/layout/fragment_verification_manual.xml @@ -70,4 +70,4 @@ android:text="@string/continue_text" /> - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 935eb51c..2f2ce179 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -454,6 +454,9 @@ Verify with Twitter Skip the Queue Skip the manual verification queue by paying a fee in order to start participating in the rewards program immediately. + If you previously completed a purchase successfully and you still see this screen, please tap the verify purchase button below. + No purchase was found for this account. + Verify Purchase Please request to be verified on the <a href="https://discordapp.com/invite/Z3bERWA">LBRY Discord server</a>. A manual review can take anywhere from several minutes to several days. Please enjoy free content in the meantime! Verify Phone Number diff --git a/build.gradle b/build.gradle index e14841db..b7173582 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.6.3' + classpath 'com.android.tools.build:gradle:3.6.4' classpath 'com.google.gms:google-services:4.2.0' // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 736f628e..fc946360 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ +#Tue Jan 12 20:03:24 CET 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionSha256Sum=9d94e6e4a28ad328072ef6e56bce79a810494ae756751fdcedffdeaf27c093b1 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip