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. 6
      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. 8
      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; @@ -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> { @@ -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);
}

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

@ -11,9 +11,7 @@ import acr.browser.lightning.utils.Preconditions; @@ -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> { @@ -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);
}

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

@ -21,9 +21,9 @@ public class BaseSearchEngine { @@ -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);

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

@ -151,6 +151,7 @@ public abstract class BaseSuggestionsModel { @@ -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 {

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

@ -8,7 +8,7 @@ import android.support.annotation.NonNull; @@ -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 { @@ -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);

Loading…
Cancel
Save