Commit ee6f5f8c authored by ar-arvind's avatar ar-arvind Committed by Simon Xu
Browse files

Fixed lint warnings.

parent 805c206c
...@@ -23,8 +23,8 @@ import androidx.appcompat.app.AlertDialog; ...@@ -23,8 +23,8 @@ import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
public abstract class AddStickerPackActivity extends BaseActivity { public abstract class AddStickerPackActivity extends BaseActivity {
public static final int ADD_PACK = 200; private static final int ADD_PACK = 200;
public static final String TAG = "AddStickerPackActivity"; private static final String TAG = "AddStickerPackActivity";
protected void addStickerPackToWhatsApp(String identifier, String stickerPackName) { protected void addStickerPackToWhatsApp(String identifier, String stickerPackName) {
try { try {
......
...@@ -14,8 +14,8 @@ import android.os.Parcelable; ...@@ -14,8 +14,8 @@ import android.os.Parcelable;
import java.util.List; import java.util.List;
class Sticker implements Parcelable { class Sticker implements Parcelable {
String imageFileName; final String imageFileName;
List<String> emojis; final List<String> emojis;
long size; long size;
Sticker(String imageFileName, List<String> emojis) { Sticker(String imageFileName, List<String> emojis) {
......
...@@ -51,15 +51,15 @@ public class StickerContentProvider extends ContentProvider { ...@@ -51,15 +51,15 @@ public class StickerContentProvider extends ContentProvider {
public static final String STICKER_FILE_NAME_IN_QUERY = "sticker_file_name"; public static final String STICKER_FILE_NAME_IN_QUERY = "sticker_file_name";
public static final String STICKER_FILE_EMOJI_IN_QUERY = "sticker_emoji"; public static final String STICKER_FILE_EMOJI_IN_QUERY = "sticker_emoji";
public static final String CONTENT_FILE_NAME = "contents.json"; private static final String CONTENT_FILE_NAME = "contents.json";
public static Uri AUTHORITY_URI = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(BuildConfig.CONTENT_PROVIDER_AUTHORITY).appendPath(StickerContentProvider.METADATA).build(); public static final Uri AUTHORITY_URI = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(BuildConfig.CONTENT_PROVIDER_AUTHORITY).appendPath(StickerContentProvider.METADATA).build();
/** /**
* Do not change the values in the UriMatcher because otherwise, WhatsApp will not be able to fetch the stickers from the ContentProvider. * Do not change the values in the UriMatcher because otherwise, WhatsApp will not be able to fetch the stickers from the ContentProvider.
*/ */
private static final UriMatcher MATCHER = new UriMatcher(UriMatcher.NO_MATCH); private static final UriMatcher MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
static final String METADATA = "metadata"; private static final String METADATA = "metadata";
private static final int METADATA_CODE = 1; private static final int METADATA_CODE = 1;
private static final int METADATA_CODE_FOR_SINGLE_PACK = 2; private static final int METADATA_CODE_FOR_SINGLE_PACK = 2;
...@@ -153,7 +153,7 @@ public class StickerContentProvider extends ContentProvider { ...@@ -153,7 +153,7 @@ public class StickerContentProvider extends ContentProvider {
} }
} }
public List<StickerPack> getStickerPackList() { private List<StickerPack> getStickerPackList() {
if (stickerPackList == null) { if (stickerPackList == null) {
readContentFile(Objects.requireNonNull(getContext())); readContentFile(Objects.requireNonNull(getContext()));
} }
......
...@@ -14,10 +14,10 @@ import android.os.Parcelable; ...@@ -14,10 +14,10 @@ import android.os.Parcelable;
import java.util.List; import java.util.List;
class StickerPack implements Parcelable { class StickerPack implements Parcelable {
String identifier; final String identifier;
String name; final String name;
String publisher; final String publisher;
String trayImageFile; final String trayImageFile;
final String publisherEmail; final String publisherEmail;
final String publisherWebsite; final String publisherWebsite;
final String privacyPolicyWebsite; final String privacyPolicyWebsite;
...@@ -52,7 +52,7 @@ class StickerPack implements Parcelable { ...@@ -52,7 +52,7 @@ class StickerPack implements Parcelable {
return isWhitelisted; return isWhitelisted;
} }
protected StickerPack(Parcel in) { private StickerPack(Parcel in) {
identifier = in.readString(); identifier = in.readString();
name = in.readString(); name = in.readString();
publisher = in.readString(); publisher = in.readString();
......
...@@ -190,7 +190,6 @@ public class StickerPackDetailsActivity extends AddStickerPackActivity { ...@@ -190,7 +190,6 @@ public class StickerPackDetailsActivity extends AddStickerPackActivity {
protected final Boolean doInBackground(StickerPack... stickerPacks) { protected final Boolean doInBackground(StickerPack... stickerPacks) {
StickerPack stickerPack = stickerPacks[0]; StickerPack stickerPack = stickerPacks[0];
final StickerPackDetailsActivity stickerPackDetailsActivity = stickerPackDetailsActivityWeakReference.get(); final StickerPackDetailsActivity stickerPackDetailsActivity = stickerPackDetailsActivityWeakReference.get();
//noinspection SimplifiableIfStatement
if (stickerPackDetailsActivity == null) { if (stickerPackDetailsActivity == null) {
return false; return false;
} }
......
...@@ -17,12 +17,12 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -17,12 +17,12 @@ import androidx.recyclerview.widget.RecyclerView;
class StickerPackListItemViewHolder extends RecyclerView.ViewHolder { class StickerPackListItemViewHolder extends RecyclerView.ViewHolder {
View container; final View container;
TextView titleView; final TextView titleView;
TextView publisherView; final TextView publisherView;
TextView filesizeView; final TextView filesizeView;
ImageView addButton; final ImageView addButton;
LinearLayout imageRowView; final LinearLayout imageRowView;
StickerPackListItemViewHolder(final View itemView) { StickerPackListItemViewHolder(final View itemView) {
super(itemView); super(itemView);
......
...@@ -18,11 +18,11 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -18,11 +18,11 @@ import androidx.recyclerview.widget.RecyclerView;
public class StickerPreviewAdapter extends RecyclerView.Adapter<StickerPreviewViewHolder> { public class StickerPreviewAdapter extends RecyclerView.Adapter<StickerPreviewViewHolder> {
@NonNull @NonNull
private StickerPack stickerPack; private final StickerPack stickerPack;
private final int cellSize; private final int cellSize;
private int cellLimit; private final int cellLimit;
private int cellPadding; private final int cellPadding;
private final int errorResource; private final int errorResource;
private final LayoutInflater layoutInflater; private final LayoutInflater layoutInflater;
......
...@@ -18,16 +18,15 @@ import android.net.Uri; ...@@ -18,16 +18,15 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@SuppressWarnings("FieldCanBeLocal")
class WhitelistCheck { class WhitelistCheck {
private static final String AUTHORITY_QUERY_PARAM = "authority"; private static final String AUTHORITY_QUERY_PARAM = "authority";
private static final String IDENTIFIER_QUERY_PARAM = "identifier"; private static final String IDENTIFIER_QUERY_PARAM = "identifier";
private static String STICKER_APP_AUTHORITY = BuildConfig.CONTENT_PROVIDER_AUTHORITY; private static final String STICKER_APP_AUTHORITY = BuildConfig.CONTENT_PROVIDER_AUTHORITY;
static final String CONSUMER_WHATSAPP_PACKAGE_NAME = "com.whatsapp"; static final String CONSUMER_WHATSAPP_PACKAGE_NAME = "com.whatsapp";
static final String SMB_WHATSAPP_PACKAGE_NAME = "com.whatsapp.w4b"; static final String SMB_WHATSAPP_PACKAGE_NAME = "com.whatsapp.w4b";
private static String CONTENT_PROVIDER = ".provider.sticker_whitelist_check"; private static final String CONTENT_PROVIDER = ".provider.sticker_whitelist_check";
private static String QUERY_PATH = "is_whitelisted"; private static final String QUERY_PATH = "is_whitelisted";
private static String QUERY_RESULT_COLUMN_NAME = "result"; private static final String QUERY_RESULT_COLUMN_NAME = "result";
static boolean isWhitelisted(@NonNull Context context, @NonNull String identifier) { static boolean isWhitelisted(@NonNull Context context, @NonNull String identifier) {
try { try {
...@@ -65,7 +64,7 @@ class WhitelistCheck { ...@@ -65,7 +64,7 @@ class WhitelistCheck {
return false; return false;
} }
public static boolean isPackageInstalled(String packageName, PackageManager packageManager) { static boolean isPackageInstalled(String packageName, PackageManager packageManager) {
try { try {
final ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0); final ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
//noinspection SimplifiableIfStatement //noinspection SimplifiableIfStatement
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment