Created
August 20, 2015 19:56
-
-
Save wfortin/7caf9e5c4eca5497407a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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