Skip to content

Instantly share code, notes, and snippets.

private void initScriptEnv() {
jsContext = org.mozilla.javascript.Context.enter();
jsContext.setOptimizationLevel(-1);
jsScope = jsContext.initStandardObjects();
Object RObj = org.mozilla.javascript.Context.javaToJS(new Rwrapper(), jsScope);
ScriptableObject.putProperty(jsScope, "R", RObj);
ScriptableObject.putProperty(jsScope, "log", new Log());
ScriptableObject.putProperty(jsScope, "findview", new FindViewById(this));
observer = new FileObserver(this.getCacheDir().getAbsolutePath(), FileObserver.ALL_EVENTS) {
@Override
public void onEvent(int event, String path) {
Log.d("Observer","PATH: " + path +" EVENT: " + event);
}
};
observer.startWatching();
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Tab test</title>
<link rel="stylesheet"
href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script
src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
<div data-role="page" id="homepage">
<div id="home" data-title="home" data-role="tab" data-icon="home">
<h1>I'm Tab1</h1>
<img src="http://images.apple.com/home/images/hero.jpg" />
</div>
<div id="test" data-title="test" data-role="tab" data-icon="info">
<h1>I'm Tab2</h1>
</div>
</div>
@julianshen
julianshen / gist:1301821
Created October 20, 2011 18:03
sentab1
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Tabs 2</title>
<link rel="stylesheet" href="touch/resources/css/sencha-touch.css" type="text/css">
<script type="text/javascript" src="touch/sencha-touch-all.js"></script>
<script type="text/javascript" src="app.js"></script>
</head>
<body></body>
Ext.application({
name: 'tabtest1',
launch: function() {
Ext.create("Ext.TabPanel", {
fullscreen: true,
tabBar: {
docked: 'bottom',
Ext.application({
name: 'tabtest1',
launch: function() {
var tabItems = [];
var pages = Ext.query('div[data-role=page]');
var main = pages[0]; //take first page as main page
var tabs = Ext.query('div[data-role=tab]', main);
@Override
public WebResourceResponse shouldInterceptRequest(WebView view,
String url) {
if(url.startsWith("asset://")) {
String fileName = url.substring(8);
try {
WebResourceResponse resp = new WebResourceResponse("text/javascript", "UTF-8", MyActivity.this.getAssets().open(fileName));
return resp;
} catch (IOException e) {
Ext.define('Ext.data.proxy.Facebook', {
extend: 'Ext.data.proxy.Proxy',
alias: 'proxy.facebook',
constructor: function(config) {
this.callParent([config]);
this.api = config.api;
//ensures that the reader has been instantiated properly
this.setReader(this.reader);
var myStroe = Ext.create('Ext.data.Store', {
model: 'Group',
proxy: {
type: 'facebook',
api : '/me/groups'
},
autoLoad: false,
autoSync: true
});