Browse Source

Implement javascript close window method in the browser

master
Anthony Restaino 9 years ago
parent
commit
7e67770617
  1. 9
      app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java
  2. 4
      app/src/main/java/acr/browser/lightning/controller/BrowserController.java
  3. 3
      app/src/main/java/acr/browser/lightning/view/LightningView.java

9
app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java

@ -2368,6 +2368,15 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse
} }
} }
/**
* Closes the specified view, implementing the JavaScript callback to close a window
* @param view the LightningView to close
*/
@Override
public void onCloseWindow(LightningView view) {
deleteTab(mWebViewList.indexOf(view));
}
/** /**
* returns the Activity instance for this activity, * returns the Activity instance for this activity,
* very helpful when creating things in other classes... I think * very helpful when creating things in other classes... I think

4
app/src/main/java/acr/browser/lightning/controller/BrowserController.java

@ -12,6 +12,8 @@ import android.webkit.ValueCallback;
import android.webkit.WebChromeClient.CustomViewCallback; import android.webkit.WebChromeClient.CustomViewCallback;
import android.webkit.WebView; import android.webkit.WebView;
import acr.browser.lightning.view.LightningView;
public interface BrowserController { public interface BrowserController {
void updateUrl(String title, boolean shortUrl); void updateUrl(String title, boolean shortUrl);
@ -36,6 +38,8 @@ public interface BrowserController {
void onCreateWindow(Message resultMsg); void onCreateWindow(Message resultMsg);
void onCloseWindow(LightningView view);
Activity getActivity(); Activity getActivity();
void hideActionBar(); void hideActionBar();

3
app/src/main/java/acr/browser/lightning/view/LightningView.java

@ -998,8 +998,7 @@ public class LightningView {
@Override @Override
public void onCloseWindow(WebView window) { public void onCloseWindow(WebView window) {
// TODO Auto-generated method stub mBrowserController.onCloseWindow(LightningView.this);
super.onCloseWindow(window);
} }
public void openFileChooser(ValueCallback<Uri> uploadMsg) { public void openFileChooser(ValueCallback<Uri> uploadMsg) {

Loading…
Cancel
Save