Skip to content

Instantly share code, notes, and snippets.

@wfortin
Created August 20, 2015 19:56
Show Gist options
  • Save wfortin/7caf9e5c4eca5497407a to your computer and use it in GitHub Desktop.
Save wfortin/7caf9e5c4eca5497407a to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="coveo.com.dreamforce"
android:versionCode="2">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="DF15 Explorer"
android:theme="@style/Theme.AppCompat.Light" >
<activity
android:name=".Dreamforce"
android:label="DF15 Explorer"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Light.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
public class Dreamforce extends Activity {
private WebView myWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dreamforce);
this.myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
myWebView.setWebViewClient(new WebViewClient());
myWebView.loadUrl("http://df15.coveodemo.com");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_dreamforce, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
if (myWebView.canGoBack()) {
myWebView.goBack();
} else {
finish();
}
return true;
}
}
return super.onKeyDown(keyCode, event);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment