Browse Source

Cleaning up code

master
anthony restaino 8 years ago
parent
commit
4e4707b524
  1. 16
      app/src/main/java/acr/browser/lightning/database/HistoryItem.java
  2. 9
      app/src/main/java/acr/browser/lightning/database/downloads/DownloadItem.java
  3. 2
      app/src/main/java/acr/browser/lightning/search/engine/BaseSearchEngine.java
  4. 1
      app/src/main/java/acr/browser/lightning/search/suggestions/BaseSuggestionsModel.java
  5. 4
      app/src/main/java/acr/browser/lightning/utils/StringBuilderUtils.java

16
app/src/main/java/acr/browser/lightning/database/HistoryItem.java

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

9
app/src/main/java/acr/browser/lightning/database/downloads/DownloadItem.java

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

2
app/src/main/java/acr/browser/lightning/search/engine/BaseSearchEngine.java

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

1
app/src/main/java/acr/browser/lightning/search/suggestions/BaseSuggestionsModel.java

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

4
app/src/main/java/acr/browser/lightning/utils/StringBuilderUtils.java

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

Loading…
Cancel
Save