Commit 1e326fa6 authored by Troy A. Griffitts's avatar Troy A. Griffitts

initial commit

parents
build.json
bishop.apk
all: release
rinstall: release uninstall install
debug: refreshplugins copyfromplatform
cordova build
cp platforms/android/build/outputs/apk/android-debug.apk bishop.apk
release: refreshplugins copyfromplatform
find platforms/android/res/ -name screen.png -exec rm {} \;
cordova build --release
cp platforms/android/build/outputs/apk/release/android-release.apk bishop.apk
install:
adb install -r bishop.apk
uninstall:
adb uninstall org.crosswire.bishop
refreshplugins:
cordova plugin remove org.crosswire.sword.cordova.SWORD || true
cordova plugin add ../sword/bindings/cordova/org.crosswire.sword.cordova.SWORD/ --nofetch -verbose
copyfromplatform:
cp -a platforms/android/assets/www/index.html platforms/android/assets/www/img platforms/android/assets/www/css platforms/android/assets/www/js www/
setup:
cordova plugin add cordova-custom-config
cordova plugin add cordova-plugin-intent
<?xml version='1.0' encoding='utf-8'?>
<widget id="org.crosswire.bishop" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android">
<name>Bishop</name>
<description>
A Bible Study App from CrossWire
</description>
<author email="develoment@crosswire.org" href="http://crosswire.org">
Apache Cordova Team
</author>
<icon src="res/swordlogo.png" />
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="android-minSdkVersion" value="14" />
<preference name="android-targetSdkVersion" value="17" />
<preference name="AndroidLaunchMode" value="singleTop" />
<config-file mode="add" parent="./application/activity" target="AndroidManifest.xml">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/x-sword-conf" />
</intent-filter>
</config-file>
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="android" spec="^6.4.0" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
<plugin name="com.napolitano.cordova.plugin.intent" spec="~0.1.2" />
<plugin name="cordova-custom-config" spec="^4.0.2" />
<plugin name="org.crosswire.sword.cordova.SWORD" spec="../sword/bindings/cordova/org.crosswire.sword.cordova.SWORD" />
</widget>
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# Cordova Hooks
Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. See Hooks Guide for more details: http://cordova.apache.org/docs/en/edge/guide_appdev_hooks_index.md.html#Hooks%20Guide.
package com.napolitano.cordova.plugin.intent;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.ClipData;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
public class IntentPlugin extends CordovaPlugin {
private final String pluginName = "IntentPlugin";
private CallbackContext onNewIntentCallbackContext = null;
/**
* Generic plugin command executor
*
* @param action
* @param data
* @param callbackContext
* @return
*/
@Override
public boolean execute(final String action, final JSONArray data, final CallbackContext callbackContext) {
Log.d(pluginName, pluginName + " called with options: " + data);
Class params[] = new Class[2];
params[0] = JSONArray.class;
params[1] = CallbackContext.class;
try {
Method method = this.getClass().getDeclaredMethod(action, params);
method.invoke(this, data, callbackContext);
} catch (Exception ex) {
ex.printStackTrace();
}
return true;
}
/**
* Send a JSON representation of the cordova intent back to the caller
*
* @param data
* @param context
*/
public boolean getCordovaIntent (final JSONArray data, final CallbackContext context) {
if(data.length() != 0) {
context.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
return false;
}
Intent intent = cordova.getActivity().getIntent();
context.sendPluginResult(new PluginResult(PluginResult.Status.OK, getIntentJson(intent)));
return true;
}
/**
* Register handler for onNewIntent event
*
* @param data
* @param context
* @return
*/
public boolean setNewIntentHandler (final JSONArray data, final CallbackContext context) {
if(data.length() != 1) {
context.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
return false;
}
this.onNewIntentCallbackContext = context;
PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
result.setKeepCallback(true);
context.sendPluginResult(result);
return true;
}
/**
* Triggered on new intent
*
* @param intent
*/
@Override
public void onNewIntent(Intent intent) {
if (this.onNewIntentCallbackContext != null) {
PluginResult result = new PluginResult(PluginResult.Status.OK, getIntentJson(intent));
result.setKeepCallback(true);
this.onNewIntentCallbackContext.sendPluginResult(result);
}
}
/**
* Return JSON representation of intent attributes
*
* @param intent
* @return
*/
private JSONObject getIntentJson(Intent intent) {
JSONObject intentJSON = null;
ClipData clipData = null;
JSONObject[] items = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
clipData = intent.getClipData();
if(clipData != null) {
int clipItemCount = clipData.getItemCount();
items = new JSONObject[clipItemCount];
for (int i = 0; i < clipItemCount; i++) {
ClipData.Item item = clipData.getItemAt(i);
try {
items[i] = new JSONObject();
items[i].put("htmlText", item.getHtmlText());
items[i].put("intent", item.getIntent());
items[i].put("text", item.getText());
items[i].put("uri", item.getUri());
} catch (JSONException e) {
Log.d(pluginName, pluginName + " Error thrown during intent > JSON conversion");
Log.d(pluginName, e.getMessage());
Log.d(pluginName, Arrays.toString(e.getStackTrace()));
}
}
}
}
try {
intentJSON = new JSONObject();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if(items != null) {
intentJSON.put("clipItems", new JSONArray(items));
}
}
intentJSON.put("type", intent.getType());
Bundle extraBundle = intent.getExtras();
if (extraBundle != null) {
JSONObject extras = new JSONObject();
for (String k : extraBundle.keySet()) {
Object o = extraBundle.get(k);
extras.put(k, o);
}
intentJSON.put("extras", extras);
}
intentJSON.put("action", intent.getAction());
intentJSON.put("categories", intent.getCategories());
intentJSON.put("flags", intent.getFlags());
intentJSON.put("component", intent.getComponent());
intentJSON.put("data", intent.getData());
intentJSON.put("package", intent.getPackage());
return intentJSON;
} catch (JSONException e) {
Log.d(pluginName, pluginName + " Error thrown during intent > JSON conversion");
Log.d(pluginName, e.getMessage());
Log.d(pluginName, Arrays.toString(e.getStackTrace()));
return null;
}
}
}
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
Note that these image resources are not copied into a project when a project
is created with the CLI. Although there are default image resources in a
newly-created project, those come from the platform-specific project template,
which can generally be found in the platform's `template` directory. Until
icon and splashscreen support is added to the CLI, these image resources
aren't used directly.
See https://issues.apache.org/jira/browse/CB-5145
* {
-webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
}
body {
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
-webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
height:100%;
width:100%;
margin:0px;
padding:0px;
overflow:hidden;
}
@font-face {
font-family: 'AntinoouWeb';
font-weight: normal;
font-style: normal;
src: url('../fonts/antinoou-webfont.woff') format('woff');
}
@font-face {
font-family: GentiumPlus;
font-style: normal;
src: url('../fonts/GentiumPlus-R.woff') format('woff');
}
@font-face {
font-family: GentiumPlus;
font-style: italic;
src: url('../fonts/GentiumPlus-I.woff') format('woff');
}
body,td,div,span,p{
font-family: 'SBL Greek', 'GentiumPlus', 'AntinoouWeb', SymbolGreekU, SymbolGreekTU, SymbolGreekMetU, SymbolGreekTMetU, OdysseaU, OdysseaUBSU, TeubnerLSU, TeubnerLSCU, TeubnerVerticalU, TeubnerVerticalCU, GraecaUBSU, GraecaUBSMetU, GraecaU, HellenicaU, HellenicaCU, GreekSansLSU, GreekSansLSConU, PayneU, UncialLSU;
}
.app {
height: 100%;
width: 100%;
overflow:hidden;
}
#main {
height: 100%;
width: 100%;
overflow:hidden;
}
/* Landscape layout (with min-width) */
@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
#main {
height: 100%;
width: 100%;
overflow:hidden;
}
}
#popup {
top:0px;
float:left;
height:100%;
width:100%;
background-color:#202020;
position:absolute;
opacity:0.90;
overflow-y: auto;
color: #000000;
margin: 0px 0px 0px 0px;
z-index:10;
}
.center {
margin-left:auto;
margin-right:auto;
}
.menupanel {
top:0px;
width:18em;
float:left;
height:100%;
background-color:#303030;
position:absolute;
overflow-y: auto;
left:-18em;
opacity:0.90;
z-index:5;
}
.menutab {
background-image:url('../img/slidebaricon.png');
background-repeat:no-repeat;
background-size:33% 25%;
background-position:left top;
height:6em;
width:6em;
float:left;
position:absolute;
top:.5em;
left:0;
text-decoration:none;
}
table.clean {
border-collapse: collapse;
}
table.clean td, table.clean th {
padding: 5px 4px;
border: 1px solid #CCC;
}
table.nobottom td, table.nobottom th {
border-bottom: none;
}
.slidemenu {
height:2.2em;
line-height:2.2em;
font-size: 150%;
width:100%;
z-index:7;
}
.slidemenu td, .slidemenu th {
padding: 0px 0px 0px .2em;
border: 1px solid #000;
color: #EEEEEE;
z-index:9;
}
.slidemenu select {
width:5.5em;
}
.searchPanel,.bibleSyncPanel,.bookmarkPanel {
height:0em;
overflow:hidden;
width:100%;
}
#bibleSyncResults,#searchResults,#bookmarkResults {
width:100%;
height:100%;
top:0px;
background-color:#444444;
overflow-y: auto;
opacity:0.90;
}
#searchExpression {
float:left;
width:79%;
}
#searchButton {
float:right;
width:20%;
}
.keySelector, .keySelector td, .keySelector th {
margin: 0px 0px 0px -.2em;
font-size: 95%;
background-color: #b9baba;
color: #000000;
}
.about {
padding: 0px 1em 0px 1em;
margin: 0px -1em 0px -1em;
border: 1px solid #000;
border-radius: .75em;
background-color: #FFF;
position:absolute;
overflow-y: auto;
height:90%;
width:80%;
top:5%;
left:10%;
z-index:10;
}
table.clean thead, table.clean tfoot {
background-color: #CCC;
}
table.clean tr.rowodd {
background-color: #FFF;
}
table.clean tr.roweven {
background-color: #F2F2F2;
}
#textDisplay {
position:absolute;
overflow-y: auto;
height:100%;
width:100%;
color: #000000;
background-color: #ffffff;
margin: 0px 0px 0px 0px;
-webkit-user-select: text;
}
#footerBuffer {
height:0;
}
#footnotes {
position:absolute;
overflow-y: auto;
bottom:0;
height:0;
width:100%;
color: #000000;
background-color: #ffffff;
margin: 0px 0px 0px 0px;
z-index: 4;
-webkit-user-select: text;
}
#client {
position:absolute;
overflow-y: auto;
height:100%;
width:100%;
color: #000000;
background-color: #ffffff;
margin: 0px 0px 0px 0px;
-webkit-user-select: text;
}
.client {
position:absolute;
overflow-y: auto;
height:100%;
width:100%;
color: #000000;
background-color: #ffffff;
margin: 0px 0px 0px 0px;
-webkit-user-select: text;
}
.bookButton {
display: inline-block;
font-size: 180%;
width: 3.4em;
height: 2.2em;
line-height: 2.2em;
border: 1px solid #000;
color: #EEEEEE;
text-align: center;
margin:0px;
}
.ntBook {
border: 1px solid #0B0;
}
.otBook {
border: 1px solid #00B;
}
.instDelta {
width:1em;
}
.instName {
width: 7em;
overflow: hidden;
}
.instDesc {
width: 100%;
}
.wizardButton {
position: absolute;
width: 50%;
height: 20%;
bottom: 0px;
right: 0px;
}
/* Dropdown Button */
.dropbtn {
background-color: #4CAF50;
color: white;
padding-left: 1em;
padding-right: 1em;
padding-top: .2em;
padding-bottom: .2em;
border: none;
cursor: pointer;
}
/* Dropdown button on hover & focus */
.dropbtn:hover, .dropbtn:focus {
background-color: #3e8e41;
}
/* Dropdown Content (Hidden by Default) */
#aux {
position: absolute;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
/* Links inside the dropdown */
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #f1f1f1}
/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */
.show {display:block;}
This diff is collapsed.
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
</html>
<html>
<head>
<!--
Customize this policy to fit your own app's needs. For more guidance, see:
https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
Some notes:
* gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
* https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
* Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
* Enable inline JS: add 'unsafe-inline' to default-src
-->
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, height=device-height, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="stylesheet" type="text/css" href="css/wash.css" />
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/dataStore.js"></script>
<script type="text/javascript" src="js/bishop.js"></script>
<script type="text/javascript" src="js/versestudy.js"></script>
<script type="text/javascript" src="js/installmgr.js"></script>
<title>Bishop</title>
</head>
<body>
<div id="main"></div>
<div id="popup"></div>
</body>
</html>
This diff is collapsed.
var dataStore = {
dbName : "bishop",
db : null,