Пример #1
0
void HybridMoblet::initialize()
{
	if (mInitialized) { return; }

	mInitialized = true;

	createUI();

	// Extract files in LocalFiles folder to the device.
	extractFileSystem();

	// Enable message sending from JavaScript to C++.
	enableWebViewMessages();

	// Initialize the message handler. All messages from
	// JavaScript are routed through this handler.
	mMessageHandler.initialize(this);
}
Пример #2
0
	/**
	 * Display a page in the WebView of this moblet.
	 * @param url Url of page to open.
	 */
	void WebAppMoblet::showPage(const MAUtil::String& url)
	{
		// Since extractFileSystem() is moved out of the constructor
		// into application code, make sure it has been called before
		// displaying the page. This makes the code updates backwards
		// compatible with old application code.
		if (!mFileSystemIsExtracted)
		{
			extractFileSystem();
		}

		// Make sure the WebView is displayed.
		// It should do no harm to call this method multiple times.
		showWebView();

		// Open the page.
		getWebView()->openURL(url);
	}
Пример #3
0
	/**
	 * Extract the files in the file system bundle defined
	 * as the first resource in the resource file. Files are
	 * extracted to the root of the local file system on the
	 * device/emulator.
	 *
	 * This function is intended as a high-level way to
	 * extract files packaged in the standard way used in
	 * the HTML5 Project Template.
	 */
	bool FileUtil::extractLocalFiles()
	{
		return extractFileSystem(1, getLocalPath());
	}