Cleaning up code

This commit is contained in:
anthony restaino 2017-06-24 22:19:40 -04:00
parent 83099dc90d
commit 4e4707b524
5 changed files with 17 additions and 23 deletions

View File

@ -12,11 +12,8 @@ import acr.browser.lightning.utils.Preconditions;
public class HistoryItem implements Comparable<HistoryItem> {
@NonNull private String mUrl = "";
@NonNull private String mTitle = "";
@NonNull private String mFolder = "";
@Nullable private Bitmap mBitmap = null;
private int mImageId = 0;
@ -126,13 +123,12 @@ public class HistoryItem implements Comparable<HistoryItem> {
HistoryItem that = (HistoryItem) o;
if (mImageId != that.mImageId) return false;
if (mPosition != that.mPosition) return false;
if (mIsFolder != that.mIsFolder) return false;
if (!mUrl.equals(that.mUrl)) return false;
if (!mTitle.equals(that.mTitle)) return false;
return mFolder.equals(that.mFolder);
return mImageId == that.mImageId &&
mPosition == that.mPosition &&
mIsFolder == that.mIsFolder &&
mUrl.equals(that.mUrl) &&
mTitle.equals(that.mTitle) &&
mFolder.equals(that.mFolder);
}

View File

@ -11,9 +11,7 @@ import acr.browser.lightning.utils.Preconditions;
public class DownloadItem implements Comparable<DownloadItem> {
@NonNull private String mUrl = "";
@NonNull private String mTitle = "";
@NonNull private String mContentSize = "";
public DownloadItem() {}
@ -76,10 +74,9 @@ public class DownloadItem implements Comparable<DownloadItem> {
DownloadItem that = (DownloadItem) o;
if (!mUrl.equals(that.mUrl)) return false;
if (!mTitle.equals(that.mTitle)) return false;
return mContentSize.equals(that.mContentSize);
return mUrl.equals(that.mUrl) &&
mTitle.equals(that.mTitle) &&
mContentSize.equals(that.mContentSize);
}

View File

@ -21,9 +21,9 @@ public class BaseSearchEngine {
@NonNull private final String mQueryUrl;
@StringRes private final int mTitleRes;
public BaseSearchEngine(@NonNull String iconUrl,
@NonNull String queryUrl,
@StringRes int titleRes) {
BaseSearchEngine(@NonNull String iconUrl,
@NonNull String queryUrl,
@StringRes int titleRes) {
Preconditions.checkNonNull(iconUrl);
Preconditions.checkNonNull(queryUrl);

View File

@ -151,6 +151,7 @@ public abstract class BaseSuggestionsModel {
return language;
}
@NonNull
private static final Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = new Interceptor() {
@Override
public Response intercept(@NonNull Chain chain) throws IOException {

View File

@ -8,7 +8,7 @@ import android.support.annotation.NonNull;
* API equality with the {@link String}
* API.
*/
public class StringBuilderUtils {
class StringBuilderUtils {
private static final String SPACE = " ";
private static final String EMPTY = "";
@ -21,9 +21,9 @@ public class StringBuilderUtils {
* @param toReplace the string to replace.
* @param replacement the replacement string.
*/
public static void replace(@NonNull StringBuilder stringBuilder,
@NonNull String toReplace,
@NonNull String replacement) {
static void replace(@NonNull StringBuilder stringBuilder,
@NonNull String toReplace,
@NonNull String replacement) {
int index = stringBuilder.indexOf(toReplace);
if (index >= 0) {
stringBuilder.replace(index, index + toReplace.length(), replacement);