File app/src/main/assets/index.html changed (mode: 100644) (index a7c165e..4eba13f) |
27 |
27 |
<script src="js/rucker/lodash.js"></script>
|
<script src="js/rucker/lodash.js"></script>
|
28 |
28 |
<script src="js/rucker/mithril.js"></script>
|
<script src="js/rucker/mithril.js"></script>
|
29 |
29 |
<script src="js/rucker/webfont.js"></script>
|
<script src="js/rucker/webfont.js"></script>
|
|
30 |
|
<script src="js/rucker/app.js"></script>
|
30 |
31 |
<script src="js/rucker/rkr.js"></script>
|
<script src="js/rucker/rkr.js"></script>
|
31 |
32 |
<script type='text/javascript'>var require = {"baseUrl":"js/","deps":["js/index.js"]};</script>
|
<script type='text/javascript'>var require = {"baseUrl":"js/","deps":["js/index.js"]};</script>
|
32 |
33 |
<script src="js/rucker/require.js"></script>
|
<script src="js/rucker/require.js"></script>
|
File app/src/main/assets/js/com/mobile/authors.rkr.js changed (mode: 100644) (index 899a383..19b29c1) |
... |
... |
define(["data/authors"], function(authorsData) { |
5 |
5 |
var self = this;
|
var self = this;
|
6 |
6 |
|
|
7 |
7 |
this.authors = authorsData.authors;
|
this.authors = authorsData.authors;
|
8 |
|
this.webApp = args.webApp;
|
|
9 |
8 |
|
|
10 |
9 |
this.onSelection = function (author) {
|
this.onSelection = function (author) {
|
11 |
10 |
m.startComputation();
|
m.startComputation();
|
|
... |
... |
define(["data/authors"], function(authorsData) { |
17 |
16 |
require([booksPath], function (books) {
|
require([booksPath], function (books) {
|
18 |
17 |
var pageArguments = books;
|
var pageArguments = books;
|
19 |
18 |
pageArguments.author = author;
|
pageArguments.author = author;
|
20 |
|
self.webApp.addPage({type: "books", active: true, arguments: pageArguments});
|
|
|
19 |
|
iApp.newPage({
|
|
20 |
|
type: "books",
|
|
21 |
|
active: true,
|
|
22 |
|
arguments: pageArguments
|
|
23 |
|
});
|
21 |
24 |
m.endComputation();
|
m.endComputation();
|
22 |
25 |
});
|
});
|
23 |
26 |
}, 200);
|
}, 200);
|
24 |
|
}
|
|
|
27 |
|
};
|
|
28 |
|
|
|
29 |
|
this.onClose = function () {
|
|
30 |
|
iApp.exit();
|
|
31 |
|
};
|
25 |
32 |
};
|
};
|
26 |
33 |
|
|
27 |
34 |
|
|
28 |
35 |
|
|
29 |
36 |
comAuthors.view = function(ctrl) {
|
comAuthors.view = function(ctrl) {
|
30 |
37 |
return m('div', [
|
return m('div', [
|
|
38 |
|
m('span', {onclick: ctrl.onClose.bind(this)}, 'Exit'),
|
31 |
39 |
m('h1', "Autori"),
|
m('h1', "Autori"),
|
32 |
40 |
m('ul.mAuthors', [
|
m('ul.mAuthors', [
|
33 |
41 |
ctrl.authors.map(function (author, index) {
|
ctrl.authors.map(function (author, index) {
|
File app/src/main/assets/js/com/mobile/webapp.rkr.js changed (mode: 100644) (index a524907..d8f8ded) |
... |
... |
define([ |
29 |
29 |
var newPage = new comWebApp.page(pageData, vm.activePage);
|
var newPage = new comWebApp.page(pageData, vm.activePage);
|
30 |
30 |
|
|
31 |
31 |
vm.vacuum();
|
vm.vacuum();
|
32 |
|
|
|
33 |
32 |
vm.list.push(newPage);
|
vm.list.push(newPage);
|
34 |
33 |
|
|
35 |
34 |
if (pageData.active) {
|
if (pageData.active) {
|
|
... |
... |
define([ |
84 |
83 |
comWebApp.vm.addPage(data);
|
comWebApp.vm.addPage(data);
|
85 |
84 |
};
|
};
|
86 |
85 |
|
|
|
86 |
|
comWebApp.canGoBack = function () {
|
|
87 |
|
comWebApp.vm.vacuum();
|
|
88 |
|
return comWebApp.vm.list.length > 2;
|
|
89 |
|
};
|
|
90 |
|
|
87 |
91 |
comWebApp.back = function () {
|
comWebApp.back = function () {
|
88 |
92 |
comWebApp.vm.removePage();
|
comWebApp.vm.removePage();
|
89 |
93 |
};
|
};
|
|
... |
... |
define([ |
139 |
143 |
|
|
140 |
144 |
if (_.isUndefined(pageArguments)) { pageArguments = {}; }
|
if (_.isUndefined(pageArguments)) { pageArguments = {}; }
|
141 |
145 |
|
|
142 |
|
pageArguments.webApp = comWebApp;
|
|
|
146 |
|
// pageArguments.webApp = comWebApp;
|
143 |
147 |
pageContent.push(m.component(pageComponent, pageArguments));
|
pageContent.push(m.component(pageComponent, pageArguments));
|
144 |
148 |
}
|
}
|
145 |
149 |
|
|
File app/src/main/assets/js/index.js changed (mode: 100644) (index a91db4e..9229abe) |
5 |
5 |
log.enableAll();
|
log.enableAll();
|
6 |
6 |
|
|
7 |
7 |
var appConf = {};
|
var appConf = {};
|
|
8 |
|
var iApp = new AppInterface();
|
8 |
9 |
|
|
9 |
10 |
function pageReady (conf) {
|
function pageReady (conf) {
|
10 |
11 |
require(["app.conf", "com/mobile/webapp.rkr"], function (config, rkrWebApp) {
|
require(["app.conf", "com/mobile/webapp.rkr"], function (config, rkrWebApp) {
|
11 |
12 |
appConf = config;
|
appConf = config;
|
12 |
13 |
|
|
|
14 |
|
iApp.setWebApp(rkrWebApp);
|
|
15 |
|
|
13 |
16 |
var rkrContainer = document.getElementsByClassName(appConf.classContainer)[0];
|
var rkrContainer = document.getElementsByClassName(appConf.classContainer)[0];
|
14 |
17 |
|
|
15 |
18 |
// m.route(rkrContainer, rkrRoute, rkrRoutes);
|
// m.route(rkrContainer, rkrRoute, rkrRoutes);
|
File app/src/main/assets/js/rucker/app.js added (mode: 100644) (index 0000000..20ec060) |
|
1 |
|
var AppInterface = function () {
|
|
2 |
|
this._webApp = null;
|
|
3 |
|
};
|
|
4 |
|
|
|
5 |
|
AppInterface.prototype.setWebApp = function (comWebApp) {
|
|
6 |
|
this._webApp = comWebApp;
|
|
7 |
|
};
|
|
8 |
|
|
|
9 |
|
AppInterface.prototype.canGoBack = function () {
|
|
10 |
|
return this._webApp.canGoBack();
|
|
11 |
|
};
|
|
12 |
|
|
|
13 |
|
AppInterface.prototype.newPage = function (data) {
|
|
14 |
|
this._webApp.addPage(data);
|
|
15 |
|
};
|
|
16 |
|
|
|
17 |
|
AppInterface.prototype.goBack = function () {
|
|
18 |
|
m.startComputation();
|
|
19 |
|
this._webApp.back();
|
|
20 |
|
m.endComputation();
|
|
21 |
|
};
|
|
22 |
|
|
|
23 |
|
AppInterface.prototype.exit = function () {
|
|
24 |
|
Android.exit();
|
|
25 |
|
};
|
File app/src/main/java/ro/bitvice/cufarulcupovestiapk/FullscreenActivity.java changed (mode: 100644) (index a20a4ea..84073d7) |
... |
... |
import ro.bitvice.cufarulcupovestiapk.WebAppInterface; |
5 |
5 |
|
|
6 |
6 |
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
7 |
7 |
import android.app.Activity;
|
import android.app.Activity;
|
|
8 |
|
import android.content.Context;
|
8 |
9 |
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
9 |
10 |
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
10 |
11 |
import android.os.Bundle;
|
import android.os.Bundle;
|
11 |
12 |
import android.os.Handler;
|
import android.os.Handler;
|
|
13 |
|
import android.util.Log;
|
12 |
14 |
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
13 |
15 |
import android.view.View;
|
import android.view.View;
|
14 |
16 |
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
|
17 |
|
import android.webkit.ValueCallback;
|
15 |
18 |
import android.webkit.WebView;
|
import android.webkit.WebView;
|
16 |
19 |
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
17 |
20 |
import android.webkit.WebChromeClient;
|
import android.webkit.WebChromeClient;
|
|
21 |
|
import android.widget.Toast;
|
18 |
22 |
|
|
19 |
23 |
|
|
20 |
24 |
/**
|
/**
|
|
... |
... |
public class FullscreenActivity extends Activity { |
92 |
96 |
|
|
93 |
97 |
@Override
|
@Override
|
94 |
98 |
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
99 |
|
final Context c = this.getApplicationContext();
|
95 |
100 |
// Check if the key event was the Back button and if there's history
|
// Check if the key event was the Back button and if there's history
|
96 |
101 |
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
|
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
|
97 |
|
mWebView.loadUrl("javascript:prevPage()");
|
|
|
102 |
|
mWebView.evaluateJavascript("(function(){ return iApp.canGoBack();})();", new ValueCallback<String>() {
|
|
103 |
|
@Override
|
|
104 |
|
public void onReceiveValue(String s) {
|
|
105 |
|
Toast.makeText(c, s, Toast.LENGTH_SHORT).show();
|
|
106 |
|
if (s.equals("true")) {
|
|
107 |
|
mWebView.loadUrl("javascript:iApp.goBack()");
|
|
108 |
|
} else {
|
|
109 |
|
Toast.makeText(c, "Close APP", Toast.LENGTH_SHORT).show();
|
|
110 |
|
// System.exit(0);
|
|
111 |
|
}
|
|
112 |
|
}
|
|
113 |
|
});
|
98 |
114 |
return true;
|
return true;
|
99 |
115 |
}
|
}
|
100 |
116 |
// If it wasn't the Back key or there's no web page history, bubble up to the default
|
// If it wasn't the Back key or there's no web page history, bubble up to the default
|