Browse Source

minor changes

master
DF1E 8 years ago
parent
commit
20ca7047f3
  1. 2
      app/src/main/java/acr/browser/lightning/constant/Constants.java
  2. 1
      app/src/main/java/acr/browser/lightning/database/downloads/DownloadItem.java
  3. 2
      app/src/main/java/acr/browser/lightning/database/downloads/DownloadsModel.java
  4. 15
      app/src/main/java/acr/browser/lightning/dialog/LightningDialogBuilder.java
  5. 5
      app/src/main/java/acr/browser/lightning/view/LightningWebClient.java

2
app/src/main/java/acr/browser/lightning/constant/Constants.java

@ -8,8 +8,6 @@ import android.support.annotation.IntDef; @@ -8,8 +8,6 @@ import android.support.annotation.IntDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import acr.browser.lightning.BuildConfig;
public final class Constants {
private Constants() {

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

@ -25,6 +25,7 @@ public class DownloadItem implements Comparable<DownloadItem> { @@ -25,6 +25,7 @@ public class DownloadItem implements Comparable<DownloadItem> {
public DownloadItem(@NonNull String url, @NonNull String title, @NonNull String size) {
Preconditions.checkNonNull(url);
Preconditions.checkNonNull(title);
Preconditions.checkNonNull(size);
this.mUrl = url;
this.mTitle = title;
this.mContentSize = size;

2
app/src/main/java/acr/browser/lightning/database/downloads/DownloadsModel.java

@ -12,7 +12,7 @@ import java.util.List; @@ -12,7 +12,7 @@ import java.util.List;
* The interface that should be used to
* communicate with the download database.
* <p>
* Created by anthonycr on 5/6/17.
* Created by df1e on 29/5/17.
*/
public interface DownloadsModel {

15
app/src/main/java/acr/browser/lightning/dialog/LightningDialogBuilder.java

@ -16,6 +16,7 @@ import android.widget.AutoCompleteTextView; @@ -16,6 +16,7 @@ import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import com.anthonycr.bonsai.CompletableOnSubscribe;
import com.anthonycr.bonsai.CompletableSubscriber;
import com.anthonycr.bonsai.Schedulers;
import com.anthonycr.bonsai.SingleOnSubscribe;
@ -39,14 +40,13 @@ import acr.browser.lightning.utils.IntentUtils; @@ -39,14 +40,13 @@ import acr.browser.lightning.utils.IntentUtils;
import acr.browser.lightning.utils.Preconditions;
import acr.browser.lightning.utils.Utils;
import static android.content.ContentValues.TAG;
/**
* TODO Rename this class it doesn't build dialogs only for bookmarks
* <p/>
* Created by Stefano Pacifici on 02/09/15, based on Anthony C. Restaino's code.
*/
public class LightningDialogBuilder {
public static final String TAG = "LightningDialogBuilder";
public enum NewTab {
FOREGROUND,
@ -173,8 +173,15 @@ public class LightningDialogBuilder { @@ -173,8 +173,15 @@ public class LightningDialogBuilder {
new BrowserDialog.Item(R.string.dialog_delete_all_downloads) {
@Override
public void onClick() {
mDownloadsModel.deleteAllDownloads().subscribeOn(Schedulers.io()).subscribe();
uiController.handleDownloadDeleted();
mDownloadsModel.deleteAllDownloads()
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.main())
.subscribe(new CompletableOnSubscribe() {
@Override
public void onComplete() {
uiController.handleDownloadDeleted();
}
});
}
});
}

5
app/src/main/java/acr/browser/lightning/view/LightningWebClient.java

@ -22,7 +22,6 @@ import android.view.View; @@ -22,7 +22,6 @@ import android.view.View;
import android.webkit.HttpAuthHandler;
import android.webkit.MimeTypeMap;
import android.webkit.SslErrorHandler;
import android.webkit.URLUtil;
import android.webkit.ValueCallback;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
@ -360,8 +359,8 @@ public class LightningWebClient extends WebViewClient { @@ -360,8 +359,8 @@ public class LightningWebClient extends WebViewClient {
}
return true;
}
} else if (url.startsWith("file://")) {
File file = new File(url.replace("file://", ""));
} else if (url.startsWith(Constants.FILE)) {
File file = new File(url.replace(Constants.FILE, ""));
if (file.exists()) {
String newMimeType = MimeTypeMap.getSingleton()

Loading…
Cancel
Save