cleaner way for handling splashscreens

This commit is contained in:
Anis Kadri 2010-10-22 12:07:02 -07:00
parent 072613be99
commit 1761cbb3dc
4 changed files with 4 additions and 61 deletions

View File

@ -1,13 +0,0 @@
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
*
* Copyright (c) 2005-2010, Nitobi Software Inc.
* Copyright (c) 2010, IBM Corporation
*/
PhoneGap.addConstructor(function() {
if (typeof navigator.splashScreen == "undefined") {
navigator.splashScreen = SplashScreen; // SplashScreen object come from native side through addJavaScriptInterface
}
});

View File

@ -2199,11 +2199,6 @@ PositionError.UNKNOWN_ERROR = 0;
PositionError.PERMISSION_DENIED = 1;
PositionError.POSITION_UNAVAILABLE = 2;
PositionError.TIMEOUT = 3;
PhoneGap.addConstructor(function() {
if (typeof navigator.splashScreen == "undefined") {
navigator.splashScreen = SplashScreen; // SplashScreen object come from native side through addJavaScriptInterface
}
});
/*
* This is purely for the Android 1.5/1.6 HTML 5 Storage
* I was hoping that Android 2.0 would deprecate this, but given the fact that

View File

@ -63,7 +63,6 @@ public class DroidGap extends Activity {
private static final String LOG_TAG = "DroidGap";
protected WebView appView; // The webview for our app
protected ImageView splashScreen;
protected Boolean loadInWebView = false;
private LinearLayout root;
@ -95,17 +94,10 @@ public class DroidGap extends Activity {
root.setBackgroundColor(Color.BLACK);
root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT, 0.0F));
/*
splashScreen = new ImageView(this);
splashScreen.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT,
1.0F));
splashScreen.setImageResource(R.drawable.splash);
root.addView(splashScreen);
*/
// Uncomment if you want to enable a splashscreen
// Make sure R.drawable.splash exists
// appView.setBackgroundColor(0);
// appView.setBackgroundResource(R.drawable.splash);
initWebView();
root.addView(this.appView);
@ -464,8 +456,6 @@ public class DroidGap extends Activity {
*/
public class GapViewClient extends WebViewClient {
// TODO: hide splash screen here
DroidGap ctx;
/**
@ -614,14 +604,6 @@ public class DroidGap extends Activity {
return false;
}
/**
* Removes the splash screen from root view and adds the WebView
*/
public void hideSplashScreen() {
root.removeView(splashScreen);
root.addView(this.appView);
}
/**
* Any calls to Activity.startActivityForResult must use method below, so
* the result can be routed to them correctly.

View File

@ -1,21 +0,0 @@
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
*
* Copyright (c) 2005-2010, Nitobi Software Inc.
*/
package com.phonegap;
public class SplashScreen {
private final DroidGap gap;
public SplashScreen(DroidGap gap) {
this.gap = gap;
}
public void hide() {
gap.runOnUiThread(new Runnable() {
public void run() {
gap.hideSplashScreen();
}
});
}
}