mirror of
https://github.com/apache/cordova-android.git
synced 2025-04-25 02:40:11 +08:00
Don't need special method to load a splash screen. Instead, the regular loadUrl() and clearHistory() can be used.
This commit is contained in:
parent
e3ebfea064
commit
090ad56d0b
@ -23,9 +23,7 @@ import android.view.ViewGroup;
|
|||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.webkit.JsResult;
|
import android.webkit.JsResult;
|
||||||
import android.webkit.WebBackForwardList;
|
|
||||||
import android.webkit.WebChromeClient;
|
import android.webkit.WebChromeClient;
|
||||||
import android.webkit.WebHistoryItem;
|
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebStorage;
|
import android.webkit.WebStorage;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
@ -112,9 +110,6 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
// Plugin to call when activity result is received
|
// Plugin to call when activity result is received
|
||||||
private Plugin activityResultCallback = null;
|
private Plugin activityResultCallback = null;
|
||||||
|
|
||||||
// URL of the splash screen that is currently showing
|
|
||||||
private String splashScreenShowing = null;
|
|
||||||
|
|
||||||
// Flag indicates that a loadUrl timeout occurred
|
// Flag indicates that a loadUrl timeout occurred
|
||||||
private int loadUrlTimeout = 0;
|
private int loadUrlTimeout = 0;
|
||||||
|
|
||||||
@ -455,29 +450,6 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
* Load the url into the webview.
|
|
||||||
*
|
|
||||||
* @param url
|
|
||||||
*/
|
|
||||||
public void loadSplashScreen(final String url) {
|
|
||||||
System.out.println("loadSplashScreen("+url+")");
|
|
||||||
this.splashScreenShowing = url;
|
|
||||||
|
|
||||||
// Load URL on UI thread
|
|
||||||
final DroidGap me = this;
|
|
||||||
Runnable runnable = new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
me.runOnUiThread(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
me.appView.loadUrl(url);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Thread thread = new Thread(runnable);
|
|
||||||
thread.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
/**
|
/**
|
||||||
* Called by the system when the device configuration changes while your activity is running.
|
* Called by the system when the device configuration changes while your activity is running.
|
||||||
@ -968,15 +940,11 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
this.ctx.pluginManager.exec("Notification", "activityStop", null, "[]", false);
|
this.ctx.pluginManager.exec("Notification", "activityStop", null, "[]", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear history, so that splash screen isn't there when Back button is pressed
|
// Clear history, so that previous screen isn't there when Back button is pressed
|
||||||
WebBackForwardList history = this.ctx.appView.copyBackForwardList();
|
if (this.ctx.clearHistory) {
|
||||||
int i = history.getCurrentIndex();
|
this.ctx.clearHistory = false;
|
||||||
if (i > 0) {
|
this.ctx.appView.clearHistory();
|
||||||
WebHistoryItem item = history.getItemAtIndex(i-1);
|
}
|
||||||
if (item.getUrl().equals(this.ctx.splashScreenShowing)) {
|
|
||||||
this.ctx.appView.clearHistory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user