Merge pull request #1273 from yemel/mobile/cordova
Mobile - Cordova + IOS
|
@ -54,16 +54,8 @@ browser-extensions/firefox/copay.xpi
|
|||
version.js
|
||||
!js/controllers/version.js
|
||||
|
||||
android/package
|
||||
android/*.apk
|
||||
android/*.keystore
|
||||
|
||||
mobile/*.keystore
|
||||
mobile/assets/www
|
||||
mobile/bin/*
|
||||
mobile/gen/*
|
||||
mobile/cordova/*
|
||||
mobile/CordovaLib/*
|
||||
cordova/project/*
|
||||
cordova/*.keystore
|
||||
|
||||
coverage/
|
||||
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Description: This script compiles and copy the needed files to later package the application for Android
|
||||
|
||||
OpenColor="\033["
|
||||
Red="1;31m"
|
||||
Yellow="1;33m"
|
||||
Green="1;32m"
|
||||
CloseColor="\033[0m"
|
||||
|
||||
# Check function OK
|
||||
checkOK() {
|
||||
if [ $? != 0 ]; then
|
||||
echo "${OpenColor}${Red}* ERROR. Exiting...${CloseColor}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Configs
|
||||
BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
APPDIR="$BUILDDIR/package"
|
||||
VERSION=`cut -d '"' -f2 $BUILDDIR/../version.js`
|
||||
DEBUG=""
|
||||
if [[ $1 = "-d" ]]
|
||||
then
|
||||
DEBUG="--enable-remote-debugging"
|
||||
fi
|
||||
|
||||
if [[ $# -eq 1 && ! $1 = "-d" ]]
|
||||
then
|
||||
if [ ! -f $BUILDDIR/copay.keystore ]
|
||||
then
|
||||
echo "${OpenColor}${Red}* Can't build production app without a keystore${CloseColor}"
|
||||
exit 1
|
||||
fi
|
||||
PRODUCTION="--keystore-path=$BUILDDIR/copay.keystore --keystore-alias=copay_play --keystore-passcode=$1"
|
||||
fi
|
||||
|
||||
# Move to the build directory
|
||||
cd $BUILDDIR
|
||||
|
||||
[ -z "$CROSSWALK" ] && { echo "${OpenColor}${Red}* Need to set CROSSWALK environment variable${CloseColor}"; exit 1; }
|
||||
|
||||
# Create/Clean temp dir
|
||||
echo "${OpenColor}${Green}* Checking temp dir...${CloseColor}"
|
||||
if [ -d $APPDIR ]; then
|
||||
rm -rf $APPDIR
|
||||
fi
|
||||
|
||||
mkdir -p $APPDIR
|
||||
|
||||
# Re-compile copayBundle.js
|
||||
echo "${OpenColor}${Green}* Generating copay bundle...${CloseColor}"
|
||||
grunt --target=dev shell
|
||||
checkOK
|
||||
|
||||
# Copy all app files
|
||||
echo "${OpenColor}${Green}* Copying all app files...${CloseColor}"
|
||||
sed "s/APP_VERSION/$VERSION/g" manifest.json > $APPDIR/manifest.json
|
||||
cd $BUILDDIR/..
|
||||
cp -af {css,font,img,js,lib,sound,config.js,version.js,index.html,./android/icon.png,./android/logo.png} $APPDIR
|
||||
checkOK
|
||||
|
||||
# Building the APK
|
||||
echo "${OpenColor}${Green}* Building APK file...${CloseColor}"
|
||||
cd $CROSSWALK
|
||||
python make_apk.py --manifest=$APPDIR/manifest.json --package=com.bitpay.copay --arch=arm --target-dir=$BUILDDIR $DEBUG $PRODUCTION
|
||||
checkOK
|
||||
cd $BUILDDIR
|
||||
|
||||
echo "${OpenColor}${Yellow}\nAwesome! We have a brand new APK, enjoy it!${CloseColor}"
|
BIN
android/icon.png
Before Width: | Height: | Size: 8.0 KiB |
BIN
android/logo.png
Before Width: | Height: | Size: 7.4 KiB |
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"name": "Copay",
|
||||
"version": "APP_VERSION",
|
||||
"start_url": "index.html",
|
||||
"permissions": [
|
||||
"Vibration"
|
||||
],
|
||||
"xwalk_launch_screen": {
|
||||
"ready_when": "complete",
|
||||
"default": {
|
||||
"background_color": "#2C3E50",
|
||||
"image": "logo.png"
|
||||
}
|
||||
},
|
||||
"icons": {
|
||||
"128": "icon.png"
|
||||
},
|
||||
"xwalk_hosts": [
|
||||
"https://*"
|
||||
]
|
||||
}
|
|
@ -1,23 +1,13 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest android:hardwareAccelerated="true" android:versionCode="8" android:versionName="0.4.6" android:windowSoftInputMode="adjustPan" package="com.bitpay.copay" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.bitpay.copay" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
|
||||
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTask" android:name="Copay" android:theme="@android:style/Theme.Black.NoTitleBar">
|
||||
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTop" android:name="Copay" android:theme="@android:style/Theme.Black.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter android:label="Send Bitcoins">
|
||||
<data android:scheme="bitcoin"/>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
<activity android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden" android:exported="false" android:name="com.google.zxing.client.android.CaptureActivity" android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden">
|
||||
<intent-filter>
|
||||
|
@ -40,7 +30,6 @@
|
|||
<provider android:authorities="com.bitpay.copay.plugin.emailcomposer.attachmentprovider" android:name="de.appplant.cordova.plugin.emailcomposer.AttachmentProvider" />
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
|
@ -2,39 +2,40 @@
|
|||
<widget id="com.bitpay.copay" version="2.0.0" xmlns="http://www.w3.org/ns/widgets">
|
||||
<name>Copay</name>
|
||||
<description>
|
||||
A secure bitcoin wallet for friends and companies
|
||||
A secure bitcoin wallet for friends and companies.
|
||||
</description>
|
||||
<author email="support@bitpay.com" href="http://copay.io">
|
||||
<author email="support@bitpay.com" href="https://copay.io/">
|
||||
Bitpay Inc.
|
||||
</author>
|
||||
<access origin="*" />
|
||||
<content src="index.html" />
|
||||
<access origin="*" />
|
||||
<preference name="loglevel" value="DEBUG" />
|
||||
<preference name="AndroidLaunchMode" value="singleTop" />
|
||||
<preference name="splashscreen" value="screen" />
|
||||
<preference name="splashScreenDelay" value="10000" />
|
||||
<preference name="backgroundColor" value="0x2C3E50" />
|
||||
<feature name="App">
|
||||
<param name="android-package" value="com.bitpay.copay" />
|
||||
</feature>
|
||||
<feature name="Vibration">
|
||||
<param name="android-package" value="org.apache.cordova.vibration.Vibration" />
|
||||
<feature name="WebIntent">
|
||||
<param name="android-package" value="com.borismus.webintent.WebIntent" />
|
||||
</feature>
|
||||
<feature name="BarcodeScanner">
|
||||
<param name="android-package" value="com.phonegap.plugins.barcodescanner.BarcodeScanner" />
|
||||
</feature>
|
||||
<feature name="EmailComposer">
|
||||
<param name="android-package" value="de.appplant.cordova.plugin.emailcomposer.EmailComposer" />
|
||||
</feature>
|
||||
<feature name="SplashScreen">
|
||||
<param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
|
||||
</feature>
|
||||
<feature name="Clipboard">
|
||||
<param name="android-package" value="com.verso.cordova.clipboard.Clipboard" />
|
||||
</feature>
|
||||
<feature name="EmailComposer">
|
||||
<param name="android-package" value="de.appplant.cordova.plugin.emailcomposer.EmailComposer" />
|
||||
</feature>
|
||||
<feature name="Toast">
|
||||
<param name="android-package" value="nl.xservices.plugins.Toast" />
|
||||
</feature>
|
||||
<feature name="WebIntent">
|
||||
<param name="android-package" value="com.borismus.webintent.WebIntent" />
|
||||
<feature name="SplashScreen">
|
||||
<param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
|
||||
</feature>
|
||||
<feature name="StatusBar">
|
||||
<param name="android-package" onload="true" value="org.apache.cordova.statusbar.StatusBar" />
|
||||
</feature>
|
||||
</widget>
|
|
@ -0,0 +1,124 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Usage:
|
||||
# sh ./build.sh --android --reload
|
||||
|
||||
OpenColor="\033["
|
||||
Red="1;31m"
|
||||
Yellow="1;33m"
|
||||
Green="1;32m"
|
||||
CloseColor="\033[0m"
|
||||
|
||||
# Check function OK
|
||||
checkOK() {
|
||||
if [ $? != 0 ]; then
|
||||
echo "${OpenColor}${Red}* ERROR. Exiting...${CloseColor}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Configs
|
||||
BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
PROJECT="$BUILDDIR/project"
|
||||
VERSION=`cut -d '"' -f2 $BUILDDIR/../version.js`
|
||||
|
||||
SKIPIOS=false
|
||||
CLEAR=false
|
||||
|
||||
# Check Args
|
||||
if [[ $1 = "--android" || $2 = "--android" ]]
|
||||
then
|
||||
SKIPIOS=true
|
||||
fi
|
||||
|
||||
if [[ $1 = "--clear" || $2 = "--clear" ]]
|
||||
then
|
||||
CLEAR=true
|
||||
fi
|
||||
|
||||
|
||||
echo "${OpenColor}${Green}* Checking dependencies...${CloseColor}"
|
||||
command -v cordova >/dev/null 2>&1 || { echo >&2 "Cordova is not present, please install it: sudo npm -g cordova."; exit 1; }
|
||||
command -v xcodebuild >/dev/null 2>&1 || { echo >&2 "XCode is not present, install it or use [--android]."; exit 1; }
|
||||
|
||||
|
||||
# Create project dir
|
||||
if [[ CLEAR ]]
|
||||
then
|
||||
if [ -d $PROJECT ]; then
|
||||
rm -rf $PROJECT
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d $PROJECT ]; then
|
||||
cd $BUILDDIR
|
||||
echo "${OpenColor}${Green}* Creating project... ${CloseColor}"
|
||||
cordova create project com.bitpay.copay Copay
|
||||
checkOK
|
||||
|
||||
cd $PROJECT
|
||||
echo "${OpenColor}${Green}* Adding Android platform... ${CloseColor}"
|
||||
cordova platforms add android
|
||||
checkOK
|
||||
|
||||
if [[ !SKIPIOS ]]; then
|
||||
echo "${OpenColor}${Green}* Adding IOS platform... ${CloseColor}"
|
||||
cordova platforms add ios
|
||||
checkOK
|
||||
fi
|
||||
|
||||
echo "${OpenColor}${Green}* Installing plugins... ${CloseColor}"
|
||||
cordova plugin add https://github.com/Initsogar/cordova-webintent.git
|
||||
checkOK
|
||||
|
||||
cordova plugin add https://github.com/wildabeast/BarcodeScanner.git
|
||||
checkOK
|
||||
|
||||
cordova plugin add https://github.com/VersoSolutions/CordovaClipboard
|
||||
checkOK
|
||||
|
||||
cordova plugin add de.appplant.cordova.plugin.email-composer && cordova prepare
|
||||
checkOK
|
||||
|
||||
cordova plugin add https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git && cordova prepare
|
||||
checkOK
|
||||
|
||||
cordova plugin add org.apache.cordova.splashscreen
|
||||
checkOK
|
||||
|
||||
cordova plugin add org.apache.cordova.statusbar
|
||||
checkOK
|
||||
fi
|
||||
|
||||
echo "${OpenColor}${Green}* Generating copay bundle...${CloseColor}"
|
||||
cd $BUILDDIR/..
|
||||
grunt
|
||||
checkOK
|
||||
|
||||
echo "${OpenColor}${Green}* Coping files...${CloseColor}"
|
||||
cd $BUILDDIR/..
|
||||
cp -af {css,font,img,js,lib,sound,views,config.js,version.js} $PROJECT/www
|
||||
checkOK
|
||||
|
||||
sed "s/<\!-- PLACEHOLDER: CORDOVA SRIPT -->/<script type='text\/javascript' charset='utf-8' src='cordova.js'><\/script>/g" index.html > $PROJECT/www/index.html
|
||||
checkOK
|
||||
|
||||
cd $BUILDDIR
|
||||
cp config.xml $PROJECT/config.xml
|
||||
checkOK
|
||||
|
||||
cp android/AndroidManifest.xml $PROJECT/platforms/android/AndroidManifest.xml
|
||||
checkOK
|
||||
|
||||
cp android/config.xml $PROJECT/platforms/android/res/xml/config.xml
|
||||
checkOK
|
||||
|
||||
if [[ !SKIPIOS ]]; then
|
||||
cp -R ios/icons $PROJECT/platforms/ios/Copay/Resources/icons
|
||||
checkOK
|
||||
|
||||
cp -R ios/splash $PROJECT/platforms/ios/Copay/Resources/splash
|
||||
checkOK
|
||||
fi
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<widget id="com.bitpay.copay" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<name>Copay</name>
|
||||
<description>
|
||||
A secure bitcoin wallet for friends and companies.
|
||||
</description>
|
||||
<author email="support@bitpay.com" href="http://copay.io">
|
||||
BitPay Inc.
|
||||
</author>
|
||||
<content src="index.html" />
|
||||
<access origin="*" />
|
||||
<preference name="splashscreen" value="screen" />
|
||||
<preference name="splashScreenDelay" value="10000" />
|
||||
<preference name="backgroundColor" value="0x2C3E50" />
|
||||
<preference name="StatusBarOverlaysWebView" value="false" />
|
||||
</widget>
|
|
@ -0,0 +1,94 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icon.png</string>
|
||||
<key>CFBundleIcons</key>
|
||||
<dict>
|
||||
<key>CFBundlePrimaryIcon</key>
|
||||
<dict>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>icon-40</string>
|
||||
<string>icon-small</string>
|
||||
<string>icon-60</string>
|
||||
<string>icon.png</string>
|
||||
<string>icon@2x</string>
|
||||
<string>icon-72</string>
|
||||
<string>icon-72@2x</string>
|
||||
</array>
|
||||
<key>UIPrerenderedIcon</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>CFBundleIcons~ipad</key>
|
||||
<dict>
|
||||
<key>CFBundlePrimaryIcon</key>
|
||||
<dict>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>icon-small</string>
|
||||
<string>icon-40</string>
|
||||
<string>icon-50</string>
|
||||
<string>icon-76</string>
|
||||
<string>icon-60</string>
|
||||
<string>icon</string>
|
||||
<string>icon@2x</string>
|
||||
<string>icon-72</string>
|
||||
<string>icon-72@2x</string>
|
||||
</array>
|
||||
<key>UIPrerenderedIcon</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.bitpay.copay</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.4.7</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.bitpay.copay</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>bitcoin</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.4.7</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSMainNibFile</key>
|
||||
<string></string>
|
||||
<key>NSMainNibFile~ipad</key>
|
||||
<string></string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 10 KiB |
|
@ -0,0 +1,13 @@
|
|||
# Mobile building
|
||||
|
||||
## Requisites
|
||||
* [Install Android SDK](https://developer.android.com/sdk/installing/index.html?pkg=tools)
|
||||
* [Install XCode for IOS](https://itunes.apple.com/en/app/xcode/id497799835?mt=12)
|
||||
* Install Cordova: ``sudo npm install -g cordova``
|
||||
|
||||
## Build the project
|
||||
|
||||
$ sh cordova/build.sh
|
||||
$ cd cordova/project
|
||||
$ cordova run android
|
||||
$ cordova emulate ios
|
|
@ -28,4 +28,5 @@ function onDeviceReady() {
|
|||
|
||||
window.plugins.webintent.getUri(handleBitcoinURI);
|
||||
window.plugins.webintent.onNewIntent(handleBitcoinURI);
|
||||
window.handleOpenURL = handleBitcoinURI;
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Description: This script compiles and copy the needed files to later package the application for Android
|
||||
|
||||
OpenColor="\033["
|
||||
Red="1;31m"
|
||||
Yellow="1;33m"
|
||||
Green="1;32m"
|
||||
CloseColor="\033[0m"
|
||||
|
||||
# Check function OK
|
||||
checkOK() {
|
||||
if [ $? != 0 ]; then
|
||||
echo "${OpenColor}${Red}* ERROR. Exiting...${CloseColor}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Configs
|
||||
BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
APPDIR="$BUILDDIR/assets/www"
|
||||
VERSION=`cut -d '"' -f2 $BUILDDIR/../version.js`
|
||||
RELEASE=false
|
||||
RUN=false
|
||||
|
||||
if [[ $1 = "--release" ]]
|
||||
then
|
||||
RELEASE=true
|
||||
fi
|
||||
|
||||
if [[ $1 = "-r" ]]
|
||||
then
|
||||
RUN=true
|
||||
fi
|
||||
|
||||
# Move to the build directory
|
||||
cd $BUILDDIR
|
||||
|
||||
[ -z "$CROSSWALK" ] && { echo "${OpenColor}${Red}* Need to set CROSSWALK environment variable${CloseColor}"; exit 1; }
|
||||
|
||||
# Create/Clean temp dir
|
||||
echo "${OpenColor}${Green}* Checking temp dir...${CloseColor}"
|
||||
if [ -d $APPDIR ]; then
|
||||
rm -rf $APPDIR
|
||||
fi
|
||||
|
||||
mkdir -p $APPDIR
|
||||
|
||||
# Re-compile copayBundle.js
|
||||
echo "${OpenColor}${Green}* Generating copay bundle...${CloseColor}"
|
||||
grunt --target=dev shell
|
||||
checkOK
|
||||
|
||||
# Copy all app files
|
||||
echo "${OpenColor}${Green}* Copying all app files...${CloseColor}"
|
||||
cd $BUILDDIR/..
|
||||
cp -af {css,font,img,js,lib,sound,views,config.js,version.js,$BUILDDIR/cordova.js,$BUILDDIR/cordova_plugins.js,$BUILDDIR/plugins} $APPDIR
|
||||
checkOK
|
||||
sed "s/<\!-- PLACEHOLDER: CORDOVA SRIPT -->/<script type='text\/javascript' charset='utf-8' src='cordova.js'><\/script>/g" index.html > $APPDIR/index.html
|
||||
checkOK
|
||||
|
||||
# Building the APK
|
||||
echo "${OpenColor}${Green}* Building APK file...${CloseColor}"
|
||||
cd $BUILDDIR
|
||||
if [[ $RUN == true ]]
|
||||
then
|
||||
./cordova/run
|
||||
elif [[ $RELEASE == true ]]
|
||||
then
|
||||
./cordova/build --release
|
||||
else
|
||||
./cordova/build
|
||||
fi
|
||||
checkOK
|
||||
|
||||
echo "${OpenColor}${Yellow}\nAwesome! We have a brand new APK, enjoy it!${CloseColor}"
|
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Copay" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
|
@ -1,61 +0,0 @@
|
|||
cordova.define('cordova/plugin_list', function(require, exports, module) {
|
||||
module.exports = [
|
||||
{
|
||||
"file": "plugins/de.appplant.cordova.plugin.email-composer/www/email_composer.js",
|
||||
"id": "de.appplant.cordova.plugin.email-composer.EmailComposer",
|
||||
"clobbers": [
|
||||
"plugin.email"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "plugins/com.phonegap.plugins.barcodescanner/www/barcodescanner.js",
|
||||
"id": "com.phonegap.plugins.barcodescanner.BarcodeScanner",
|
||||
"clobbers": [
|
||||
"cordova.plugins.barcodeScanner"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "plugins/org.apache.cordova.splashscreen/www/splashscreen.js",
|
||||
"id": "org.apache.cordova.splashscreen.SplashScreen",
|
||||
"clobbers": [
|
||||
"navigator.splashscreen"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "plugins/com.verso.cordova.clipboard/www/clipboard.js",
|
||||
"id": "com.verso.cordova.clipboard.Clipboard",
|
||||
"clobbers": [
|
||||
"cordova.plugins.clipboard"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "plugins/nl.x-services.plugins.toast/www/Toast.js",
|
||||
"id": "nl.x-services.plugins.toast.Toast",
|
||||
"clobbers": [
|
||||
"window.plugins.toast"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "plugins/nl.x-services.plugins.toast/test/tests.js",
|
||||
"id": "nl.x-services.plugins.toast.tests"
|
||||
},
|
||||
{
|
||||
"file": "plugins/com.borismus.webintent/www/webintent.js",
|
||||
"id": "com.borismus.webintent.WebIntent",
|
||||
"clobbers": [
|
||||
"WebIntent"
|
||||
]
|
||||
}
|
||||
];
|
||||
module.exports.metadata =
|
||||
// TOP OF METADATA
|
||||
{
|
||||
"de.appplant.cordova.plugin.email-composer": "0.8.2dev",
|
||||
"com.phonegap.plugins.barcodescanner": "1.0.1",
|
||||
"org.apache.cordova.splashscreen": "0.3.0",
|
||||
"com.verso.cordova.clipboard": "0.1.0",
|
||||
"nl.x-services.plugins.toast": "2.0",
|
||||
"com.borismus.webintent": "1.0.0"
|
||||
}
|
||||
// BOTTOM OF METADATA
|
||||
});
|
|
@ -1,10 +0,0 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must *NOT* be checked into Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
|
||||
# location of the SDK. This is only used by Ant
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
sdk.dir=/Users/yemeljardi/Documents/sdk
|
|
@ -1,75 +0,0 @@
|
|||
cordova.define("com.borismus.webintent.WebIntent", function(require, exports, module) { /**
|
||||
* cordova Web Intent plugin
|
||||
* Copyright (c) Boris Smus 2010
|
||||
*
|
||||
*/
|
||||
(function(cordova){
|
||||
var WebIntent = function() {
|
||||
|
||||
};
|
||||
|
||||
WebIntent.prototype.ACTION_SEND = "android.intent.action.SEND";
|
||||
WebIntent.prototype.ACTION_VIEW= "android.intent.action.VIEW";
|
||||
WebIntent.prototype.EXTRA_TEXT = "android.intent.extra.TEXT";
|
||||
WebIntent.prototype.EXTRA_SUBJECT = "android.intent.extra.SUBJECT";
|
||||
WebIntent.prototype.EXTRA_STREAM = "android.intent.extra.STREAM";
|
||||
WebIntent.prototype.EXTRA_EMAIL = "android.intent.extra.EMAIL";
|
||||
WebIntent.prototype.ACTION_CALL = "android.intent.action.CALL";
|
||||
WebIntent.prototype.ACTION_SENDTO = "android.intent.action.SENDTO";
|
||||
|
||||
WebIntent.prototype.startActivity = function(params, success, fail) {
|
||||
return cordova.exec(function(args) {
|
||||
success(args);
|
||||
}, function(args) {
|
||||
fail(args);
|
||||
}, 'WebIntent', 'startActivity', [params]);
|
||||
};
|
||||
|
||||
WebIntent.prototype.hasExtra = function(params, success, fail) {
|
||||
return cordova.exec(function(args) {
|
||||
success(args);
|
||||
}, function(args) {
|
||||
fail(args);
|
||||
}, 'WebIntent', 'hasExtra', [params]);
|
||||
};
|
||||
|
||||
WebIntent.prototype.getUri = function(success, fail) {
|
||||
return cordova.exec(function(args) {
|
||||
success(args);
|
||||
}, function(args) {
|
||||
fail(args);
|
||||
}, 'WebIntent', 'getUri', []);
|
||||
};
|
||||
|
||||
WebIntent.prototype.getExtra = function(params, success, fail) {
|
||||
return cordova.exec(function(args) {
|
||||
success(args);
|
||||
}, function(args) {
|
||||
fail(args);
|
||||
}, 'WebIntent', 'getExtra', [params]);
|
||||
};
|
||||
|
||||
|
||||
WebIntent.prototype.onNewIntent = function(callback) {
|
||||
return cordova.exec(function(args) {
|
||||
callback(args);
|
||||
}, function(args) {
|
||||
}, 'WebIntent', 'onNewIntent', []);
|
||||
};
|
||||
|
||||
WebIntent.prototype.sendBroadcast = function(params, success, fail) {
|
||||
return cordova.exec(function(args) {
|
||||
success(args);
|
||||
}, function(args) {
|
||||
fail(args);
|
||||
}, 'WebIntent', 'sendBroadcast', [params]);
|
||||
};
|
||||
|
||||
window.webintent = new WebIntent();
|
||||
|
||||
// backwards compatibility
|
||||
window.plugins = window.plugins || {};
|
||||
window.plugins.webintent = window.webintent;
|
||||
})(window.PhoneGap || window.Cordova || window.cordova);
|
||||
|
||||
});
|
|
@ -1,89 +0,0 @@
|
|||
cordova.define("com.phonegap.plugins.barcodescanner.BarcodeScanner", function(require, exports, module) { /**
|
||||
* cordova is available under *either* the terms of the modified BSD license *or* the
|
||||
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
|
||||
*
|
||||
* Copyright (c) Matt Kane 2010
|
||||
* Copyright (c) 2011, IBM Corporation
|
||||
*/
|
||||
|
||||
|
||||
var exec = require("cordova/exec");
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @returns {BarcodeScanner}
|
||||
*/
|
||||
function BarcodeScanner() {
|
||||
|
||||
/**
|
||||
* Encoding constants.
|
||||
*
|
||||
* @type Object
|
||||
*/
|
||||
this.Encode = {
|
||||
TEXT_TYPE: "TEXT_TYPE",
|
||||
EMAIL_TYPE: "EMAIL_TYPE",
|
||||
PHONE_TYPE: "PHONE_TYPE",
|
||||
SMS_TYPE: "SMS_TYPE"
|
||||
// CONTACT_TYPE: "CONTACT_TYPE", // TODO: not implemented, requires passing a Bundle class from Javascript to Java
|
||||
// LOCATION_TYPE: "LOCATION_TYPE" // TODO: not implemented, requires passing a Bundle class from Javascript to Java
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Read code from scanner.
|
||||
*
|
||||
* @param {Function} successCallback This function will recieve a result object: {
|
||||
* text : '12345-mock', // The code that was scanned.
|
||||
* format : 'FORMAT_NAME', // Code format.
|
||||
* cancelled : true/false, // Was canceled.
|
||||
* }
|
||||
* @param {Function} errorCallback
|
||||
*/
|
||||
BarcodeScanner.prototype.scan = function (successCallback, errorCallback) {
|
||||
if (errorCallback == null) {
|
||||
errorCallback = function () {
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof errorCallback != "function") {
|
||||
console.log("BarcodeScanner.scan failure: failure parameter not a function");
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof successCallback != "function") {
|
||||
console.log("BarcodeScanner.scan failure: success callback parameter must be a function");
|
||||
return;
|
||||
}
|
||||
|
||||
exec(successCallback, errorCallback, 'BarcodeScanner', 'scan', []);
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
BarcodeScanner.prototype.encode = function (type, data, successCallback, errorCallback, options) {
|
||||
if (errorCallback == null) {
|
||||
errorCallback = function () {
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof errorCallback != "function") {
|
||||
console.log("BarcodeScanner.encode failure: failure parameter not a function");
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof successCallback != "function") {
|
||||
console.log("BarcodeScanner.encode failure: success callback parameter must be a function");
|
||||
return;
|
||||
}
|
||||
|
||||
exec(successCallback, errorCallback, 'BarcodeScanner', 'encode', [
|
||||
{"type": type, "data": data, "options": options}
|
||||
]);
|
||||
};
|
||||
|
||||
var barcodeScanner = new BarcodeScanner();
|
||||
module.exports = barcodeScanner;
|
||||
|
||||
|
||||
});
|
|
@ -1,36 +0,0 @@
|
|||
cordova.define("com.verso.cordova.clipboard.Clipboard", function(require, exports, module) { var cordova = require('cordova');
|
||||
|
||||
/**
|
||||
* Clipboard plugin for Cordova
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function Clipboard () {}
|
||||
|
||||
/**
|
||||
* Sets the clipboard content
|
||||
*
|
||||
* @param {String} text The content to copy to the clipboard
|
||||
* @param {Function} onSuccess The function to call in case of success (takes the copied text as argument)
|
||||
* @param {Function} onFail The function to call in case of error
|
||||
*/
|
||||
Clipboard.prototype.copy = function (text, onSuccess, onFail) {
|
||||
if (typeof text === "undefined" || text === null) text = "";
|
||||
cordova.exec(onSuccess, onFail, "Clipboard", "copy", [text]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the clipboard content
|
||||
*
|
||||
* @param {Function} onSuccess The function to call in case of success
|
||||
* @param {Function} onFail The function to call in case of error
|
||||
*/
|
||||
Clipboard.prototype.paste = function (onSuccess, onFail) {
|
||||
cordova.exec(onSuccess, onFail, "Clipboard", "paste", []);
|
||||
};
|
||||
|
||||
// Register the plugin
|
||||
var clipboard = new Clipboard();
|
||||
module.exports = clipboard;
|
||||
|
||||
});
|
|
@ -1,108 +0,0 @@
|
|||
cordova.define("de.appplant.cordova.plugin.email-composer.EmailComposer", function(require, exports, module) { /*
|
||||
Copyright 2013-2014 appPlant UG
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
var EmailComposer = function () {
|
||||
|
||||
};
|
||||
|
||||
EmailComposer.prototype = {
|
||||
/**
|
||||
* Displays the email composer pre-filled with data.
|
||||
*
|
||||
* @param {Object} options
|
||||
* Different properties of the email like the body, subject
|
||||
* @param {Function} callback
|
||||
* A callback function to be called with the result
|
||||
* @param {Object?} scope
|
||||
* The scope of the callback
|
||||
*/
|
||||
open: function (options, callback, scope) {
|
||||
var callbackFn = this.createCallbackFn(callback, scope),
|
||||
options = options || {};
|
||||
|
||||
var defaults = {
|
||||
subject: null,
|
||||
body: null,
|
||||
to: null,
|
||||
cc: null,
|
||||
bcc: null,
|
||||
attachments: null,
|
||||
isHtml: true
|
||||
}
|
||||
|
||||
for (var key in defaults) {
|
||||
if (options[key] !== undefined) {
|
||||
defaults[key] = options[key];
|
||||
} else {
|
||||
console.log('EmailComposer plugin: unknown property "' + key + '"');
|
||||
}
|
||||
}
|
||||
|
||||
cordova.exec(callbackFn, null, 'EmailComposer', 'open', [options]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Alias für `open()`.
|
||||
*/
|
||||
openDraft: function () {
|
||||
this.open.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Verifies if sending emails is supported on the device.
|
||||
*
|
||||
* @param {Function} callback
|
||||
* A callback function to be called with the result
|
||||
* @param {Object} scope
|
||||
* The scope of the callback
|
||||
*/
|
||||
isServiceAvailable: function (callback, scope) {
|
||||
var callbackFn = this.createCallbackFn(callback, scope);
|
||||
|
||||
cordova.exec(callbackFn, null, 'EmailComposer', 'isServiceAvailable', []);
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* Creates a callback, which will be executed within a specific scope.
|
||||
*
|
||||
* @param {Function} callbackFn
|
||||
* The callback function
|
||||
* @param {Object} scope
|
||||
* The scope for the function
|
||||
*
|
||||
* @return {Function}
|
||||
* The new callback function
|
||||
*/
|
||||
createCallbackFn: function (callbackFn, scope) {
|
||||
return function () {
|
||||
if (typeof callbackFn == 'function') {
|
||||
callbackFn.apply(scope || this, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var plugin = new EmailComposer();
|
||||
|
||||
module.exports = plugin;
|
||||
});
|
|
@ -1,59 +0,0 @@
|
|||
cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, module) { exports.defineAutoTests = function() {
|
||||
|
||||
var fail = function (done) {
|
||||
expect(true).toBe(false);
|
||||
done();
|
||||
},
|
||||
succeed = function (done) {
|
||||
expect(true).toBe(true);
|
||||
done();
|
||||
};
|
||||
|
||||
describe('Plugin availability', function () {
|
||||
it("window.plugins.toast should exist", function() {
|
||||
expect(window.plugins.toast).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('API functions', function () {
|
||||
it("should define show", function() {
|
||||
expect(window.plugins.toast.show).toBeDefined();
|
||||
});
|
||||
|
||||
it("should define showShortTop", function() {
|
||||
expect(window.plugins.toast.showShortTop).toBeDefined();
|
||||
});
|
||||
|
||||
it("should define showShortCenter", function() {
|
||||
expect(window.plugins.toast.showShortCenter).toBeDefined();
|
||||
});
|
||||
|
||||
it("should define showShortBottom", function() {
|
||||
expect(window.plugins.toast.showShortBottom).toBeDefined();
|
||||
});
|
||||
|
||||
it("should define showLongTop", function() {
|
||||
expect(window.plugins.toast.showLongTop).toBeDefined();
|
||||
});
|
||||
|
||||
it("should define showLongCenter", function() {
|
||||
expect(window.plugins.toast.showLongCenter).toBeDefined();
|
||||
});
|
||||
|
||||
it("should define showLongBottom", function() {
|
||||
expect(window.plugins.toast.showLongBottom).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Invalid usage', function () {
|
||||
it("should fail due to an invalid position", function(done) {
|
||||
window.plugins.toast.show('hi', 'short', 'nowhere', fail.bind(null, done), succeed.bind(null, done));
|
||||
});
|
||||
|
||||
it("should fail due to an invalid duration", function(done) {
|
||||
window.plugins.toast.show('hi', 'medium', 'top', fail.bind(null, done), succeed.bind(null, done));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
});
|
|
@ -1,42 +0,0 @@
|
|||
cordova.define("nl.x-services.plugins.toast.Toast", function(require, exports, module) { function Toast() {
|
||||
}
|
||||
|
||||
Toast.prototype.show = function (message, duration, position, successCallback, errorCallback) {
|
||||
cordova.exec(successCallback, errorCallback, "Toast", "show", [message, duration, position]);
|
||||
};
|
||||
|
||||
Toast.prototype.showShortTop = function (message, successCallback, errorCallback) {
|
||||
this.show(message, "short", "top", successCallback, errorCallback);
|
||||
};
|
||||
|
||||
Toast.prototype.showShortCenter = function (message, successCallback, errorCallback) {
|
||||
this.show(message, "short", "center", successCallback, errorCallback);
|
||||
};
|
||||
|
||||
Toast.prototype.showShortBottom = function (message, successCallback, errorCallback) {
|
||||
this.show(message, "short", "bottom", successCallback, errorCallback);
|
||||
};
|
||||
|
||||
Toast.prototype.showLongTop = function (message, successCallback, errorCallback) {
|
||||
this.show(message, "long", "top", successCallback, errorCallback);
|
||||
};
|
||||
|
||||
Toast.prototype.showLongCenter = function (message, successCallback, errorCallback) {
|
||||
this.show(message, "long", "center", successCallback, errorCallback);
|
||||
};
|
||||
|
||||
Toast.prototype.showLongBottom = function (message, successCallback, errorCallback) {
|
||||
this.show(message, "long", "bottom", successCallback, errorCallback);
|
||||
};
|
||||
|
||||
Toast.install = function () {
|
||||
if (!window.plugins) {
|
||||
window.plugins = {};
|
||||
}
|
||||
|
||||
window.plugins.toast = new Toast();
|
||||
return window.plugins.toast;
|
||||
};
|
||||
|
||||
cordova.addConstructor(Toast.install);
|
||||
});
|
|
@ -1,35 +0,0 @@
|
|||
cordova.define("org.apache.cordova.splashscreen.SplashScreen", function(require, exports, module) { /*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
var exec = require('cordova/exec');
|
||||
|
||||
var splashscreen = {
|
||||
show:function() {
|
||||
exec(null, null, "SplashScreen", "show", []);
|
||||
},
|
||||
hide:function() {
|
||||
exec(null, null, "SplashScreen", "hide", []);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = splashscreen;
|
||||
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
|
@ -1,17 +0,0 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
android.library.reference.1=CordovaLib
|
||||
# Project target.
|
||||
target=android-19
|
||||
key.store=copay.keystore
|
||||
key.alias=copay_play
|
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.3 KiB |
|
@ -1,48 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:fillViewport="true"
|
||||
android:background="@color/encode_view"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView android:id="@+id/image_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:scaleType="center"/>
|
||||
|
||||
<ScrollView android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView android:id="@+id/contents_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/contents_text"
|
||||
android:paddingRight="8dip"
|
||||
android:paddingTop="8dip"
|
||||
android:paddingBottom="8dip"/>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,90 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dip">
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/msg_share_explanation"
|
||||
android:paddingBottom="12dip"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="12dip">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/share_via_barcode"
|
||||
android:paddingRight="24dip"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button android:id="@+id/share_app_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/button_share_app"/>
|
||||
|
||||
<Button android:id="@+id/share_contact_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/button_share_contact"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button android:id="@+id/share_bookmark_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/button_share_bookmark"/>
|
||||
|
||||
<Button android:id="@+id/share_clipboard_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/button_share_clipboard"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<EditText android:id="@+id/share_text_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/msg_share_text"
|
||||
android:singleLine="true"
|
||||
android:selectAllOnFocus="true"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,219 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<SurfaceView android:id="@+id/preview_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<com.google.zxing.client.android.ViewfinderView
|
||||
android:id="@+id/viewfinder_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<LinearLayout android:id="@+id/result_view"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@color/result_view"
|
||||
android:visibility="gone"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="top"
|
||||
android:padding="@dimen/standard_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="right">
|
||||
|
||||
<ImageView android:id="@+id/barcode_image_view"
|
||||
android:layout_width="150dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="150dip"
|
||||
android:maxHeight="150dip"
|
||||
android:layout_marginBottom="@dimen/half_padding"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/msg_default_format"
|
||||
android:textColor="@color/result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/format_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/msg_default_type"
|
||||
android:textColor="@color/result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/type_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/msg_default_time"
|
||||
android:textColor="@color/result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/time_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:id="@+id/meta_text_view_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/msg_default_meta"
|
||||
android:textColor="@color/result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/meta_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:id="@+id/contents_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_text"
|
||||
android:textColorLink="@color/result_text"
|
||||
android:textSize="22sp"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"/>
|
||||
|
||||
<TextView android:id="@+id/contents_supplement_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_text"
|
||||
android:textColorLink="@color/result_text"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"
|
||||
android:clickable="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/result_button_view"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button android:id="@+id/shopper_button"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawableLeft="@drawable/shopper_icon"
|
||||
android:text="@string/button_google_shopper"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/status_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@color/transparent"
|
||||
android:text="@string/msg_default_status"
|
||||
android:textColor="@color/status_text"/>
|
||||
|
||||
</FrameLayout>
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/half_padding">
|
||||
|
||||
<TextView android:id="@+id/bookmark_title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<TextView android:id="@+id/bookmark_url"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="false"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,218 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<SurfaceView android:id="@+id/preview_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<com.google.zxing.client.android.ViewfinderView
|
||||
android:id="@+id/viewfinder_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<LinearLayout android:id="@+id/result_view"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@color/result_view"
|
||||
android:visibility="gone"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/standard_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="right|center_vertical">
|
||||
|
||||
<ImageView android:id="@+id/barcode_image_view"
|
||||
android:layout_width="160dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="160dip"
|
||||
android:maxHeight="160dip"
|
||||
android:layout_marginBottom="@dimen/half_padding"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/msg_default_format"
|
||||
android:textColor="@color/result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/format_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/msg_default_type"
|
||||
android:textColor="@color/result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/type_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/msg_default_time"
|
||||
android:textColor="@color/result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/time_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:id="@+id/meta_text_view_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/msg_default_meta"
|
||||
android:textColor="@color/result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/meta_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/contents_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_text"
|
||||
android:textColorLink="@color/result_text"
|
||||
android:textSize="22sp"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"/>
|
||||
|
||||
<TextView android:id="@+id/contents_supplement_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/result_text"
|
||||
android:textColorLink="@color/result_text"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/result_button_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button android:id="@+id/shopper_button"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawableLeft="@drawable/shopper_icon"
|
||||
android:text="@string/button_google_shopper"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/status_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@color/transparent"
|
||||
android:text="@string/msg_default_status"
|
||||
android:textColor="@color/status_text"/>
|
||||
|
||||
</FrameLayout>
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:fillViewport="true"
|
||||
android:background="@color/encode_view"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView android:id="@+id/image_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:scaleType="center"/>
|
||||
|
||||
<ScrollView android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView android:id="@+id/contents_text_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/contents_text"
|
||||
android:paddingBottom="@dimen/standard_padding"
|
||||
android:paddingLeft="@dimen/standard_padding"
|
||||
android:paddingRight="@dimen/standard_padding"/>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,50 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<WebView android:id="@+id/help_contents"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:paddingTop="@dimen/half_padding"
|
||||
android:weightSum="1">
|
||||
|
||||
<Button android:id="@+id/back_button"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:text="@string/button_back"/>
|
||||
|
||||
<Button android:id="@+id/done_button"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:text="@string/button_done"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/standard_padding">
|
||||
|
||||
<TextView android:id="@+id/history_title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<TextView android:id="@+id/history_detail"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:singleLine="false"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,51 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0">
|
||||
|
||||
<EditText android:id="@+id/query_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:selectAllOnFocus="true"
|
||||
android:inputType="text"/>
|
||||
|
||||
<Button android:id="@+id/query_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:text="@string/button_search_book_contents"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ListView android:id="@+id/result_list_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/standard_padding"
|
||||
android:paddingBottom="@dimen/half_padding"
|
||||
android:enabled="false"
|
||||
android:singleLine="true"/>
|
|
@ -1,38 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<com.google.zxing.client.android.book.SearchBookContentsListItem
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/standard_padding">
|
||||
|
||||
<TextView android:id="@+id/page_number_view"
|
||||
android:layout_width="75dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|top"
|
||||
android:layout_marginRight="@dimen/standard_padding"
|
||||
android:singleLine="false"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView android:id="@+id/snippet_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|top"
|
||||
android:singleLine="false"/>
|
||||
|
||||
</com.google.zxing.client.android.book.SearchBookContentsListItem>
|
|
@ -1,96 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
|
||||
<!-- ScrollView wrapper is to accommodate small screens. -->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center">
|
||||
|
||||
<!-- Must wrap the rest in one layout -->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/standard_padding">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/msg_share_explanation"
|
||||
android:paddingBottom="@dimen/standard_padding"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/share_via_barcode"
|
||||
android:paddingBottom="@dimen/standard_padding"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/standard_padding">
|
||||
|
||||
<Button android:id="@+id/share_app_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_share_app"/>
|
||||
|
||||
<Button android:id="@+id/share_bookmark_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_share_bookmark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/standard_padding">
|
||||
|
||||
<Button android:id="@+id/share_contact_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_share_contact"/>
|
||||
|
||||
<Button android:id="@+id/share_clipboard_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_share_clipboard"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<EditText android:id="@+id/share_text_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/msg_share_text"
|
||||
android:singleLine="true"
|
||||
android:selectAllOnFocus="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2012 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- removed nonfunctional menu - see file history to retrieve -->
|
||||
</menu>
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2012 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- removed nonfunctional menu - see file history to retrieve -->
|
||||
</menu>
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2012 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/menu_history_send"
|
||||
android:title="@string/history_send"
|
||||
android:icon="@android:drawable/ic_menu_share"
|
||||
android:orderInCategory="1"/>
|
||||
<item android:id="@+id/menu_history_clear_text"
|
||||
android:title="@string/history_clear_text"
|
||||
android:icon="@android:drawable/ic_menu_delete"
|
||||
android:orderInCategory="2"/>
|
||||
</menu>
|
|
@ -1,35 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<string-array name="country_codes">
|
||||
<item>-</item>
|
||||
<item>AR</item>
|
||||
<item>AU</item>
|
||||
<item>BR</item>
|
||||
<item>BG</item>
|
||||
<item>CA</item>
|
||||
<item>CN</item>
|
||||
<item>CZ</item>
|
||||
<item>DE</item>
|
||||
<item>DK</item>
|
||||
<item>ES</item>
|
||||
<item>FI</item>
|
||||
<item>FR</item>
|
||||
<item>GB</item>
|
||||
<item>GR</item>
|
||||
<item>HU</item>
|
||||
<item>ID</item>
|
||||
<item>IT</item>
|
||||
<item>JP</item>
|
||||
<item>KR</item>
|
||||
<item>NL</item>
|
||||
<item>PL</item>
|
||||
<item>PT</item>
|
||||
<item>RU</item>
|
||||
<item>SE</item>
|
||||
<item>SK</item>
|
||||
<item>SI</item>
|
||||
<item>TR</item>
|
||||
<item>TW</item>
|
||||
<item>US</item>
|
||||
</string-array>
|
||||
</resources>
|
|
@ -1,29 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<resources>
|
||||
<color name="contents_text">#ff000000</color>
|
||||
<color name="encode_view">#ffffffff</color>
|
||||
<color name="possible_result_points">#c0ffbd21</color> <!-- Android standard ICS color -->
|
||||
<color name="result_minor_text">#ffc0c0c0</color>
|
||||
<color name="result_points">#c099cc00</color> <!-- Android standard ICS color -->
|
||||
<color name="result_text">#ffffffff</color>
|
||||
<color name="result_view">#b0000000</color>
|
||||
<color name="status_text">#ffffffff</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="viewfinder_laser">#ffcc0000</color> <!-- Android standard ICS color -->
|
||||
<color name="viewfinder_mask">#60000000</color>
|
||||
</resources>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<dimen name="standard_padding">8dip</dimen>
|
||||
<dimen name="half_padding">4dip</dimen>
|
||||
</resources>
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<resources>
|
||||
<item type="id" name="decode"/>
|
||||
<item type="id" name="decode_failed"/>
|
||||
<item type="id" name="decode_succeeded"/>
|
||||
<item type="id" name="launch_product_query"/>
|
||||
<item type="id" name="quit"/>
|
||||
<item type="id" name="restart_preview"/>
|
||||
<item type="id" name="return_scan_result"/>
|
||||
</resources>
|
|
@ -1,123 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="app_name">Copay</string>
|
||||
<string name="app_picker_name">Applications</string>
|
||||
<string name="bookmark_picker_name">Bookmarks</string>
|
||||
<string name="button_add_calendar">Add to calendar</string>
|
||||
<string name="button_add_contact">Add contact</string>
|
||||
<string name="button_back">Back</string>
|
||||
<string name="button_book_search">Book Search</string>
|
||||
<string name="button_cancel">Cancel</string>
|
||||
<string name="button_custom_product_search">Custom search</string>
|
||||
<string name="button_dial">Dial number</string>
|
||||
<string name="button_done">Done</string>
|
||||
<string name="button_email">Send email</string>
|
||||
<string name="button_get_directions">Get directions</string>
|
||||
<string name="button_google_shopper">Shopper</string>
|
||||
<string name="button_mms">Send MMS</string>
|
||||
<string name="button_ok">OK</string>
|
||||
<string name="button_open_browser">Open browser</string>
|
||||
<string name="button_product_search">Product Search</string>
|
||||
<string name="button_search_book_contents">Search contents</string>
|
||||
<string name="button_share_app">Application</string>
|
||||
<string name="button_share_bookmark">Bookmark</string>
|
||||
<string name="button_share_by_email">Share via email</string>
|
||||
<string name="button_share_by_sms">Share via SMS</string>
|
||||
<string name="button_share_clipboard">Clipboard</string>
|
||||
<string name="button_share_contact">Contact</string>
|
||||
<string name="button_show_map">Show map</string>
|
||||
<string name="button_sms">Send SMS</string>
|
||||
<string name="button_web_search">Web search</string>
|
||||
<string name="button_wifi">Connect to Network</string>
|
||||
<string name="contents_contact">Contact info</string>
|
||||
<string name="contents_email">Email address</string>
|
||||
<string name="contents_location">Geographic coordinates</string>
|
||||
<string name="contents_phone">Phone number</string>
|
||||
<string name="contents_sms">SMS address</string>
|
||||
<string name="contents_text">Plain text</string>
|
||||
<string name="history_clear_text">Clear history</string>
|
||||
<string name="history_clear_one_history_text">Clear</string>
|
||||
<string name="history_email_title">Barcode Scanner history</string>
|
||||
<string name="history_empty">Empty</string>
|
||||
<string name="history_empty_detail">No barcode scans have been recorded</string>
|
||||
<string name="history_send">Send history</string>
|
||||
<string name="history_title">History</string>
|
||||
<string name="menu_encode_mecard">Use MECARD</string>
|
||||
<string name="menu_encode_vcard">Use vCard</string>
|
||||
<string name="menu_help">Help</string>
|
||||
<string name="menu_history">History</string>
|
||||
<string name="menu_share">Share</string>
|
||||
<string name="msg_bulk_mode_scanned">Bulk mode: barcode scanned and saved</string>
|
||||
<string name="msg_camera_framework_bug">Sorry, the Android camera encountered a problem. You may need to restart the device.</string>
|
||||
<string name="msg_default_format">Format</string>
|
||||
<string name="msg_default_meta">Metadata</string>
|
||||
<string name="msg_default_mms_subject">Hi</string>
|
||||
<string name="msg_default_status">Place a barcode inside the viewfinder rectangle to scan it.</string>
|
||||
<string name="msg_default_time">Time</string>
|
||||
<string name="msg_default_type">Type</string>
|
||||
<string name="msg_encode_contents_failed">Could not encode a barcode from the data provided.</string>
|
||||
<string name="msg_google_books">Google Books</string>
|
||||
<string name="msg_google_product">Google Product Search</string>
|
||||
<string name="msg_google_shopper_missing">Google Shopper is not installed</string>
|
||||
<string name="msg_install_google_shopper">Google Shopper combines barcode scanning with online and local prices, reviews and more without opening the browser. Would you like to try it?</string>
|
||||
<string name="msg_intent_failed">Sorry, the requested application could not be launched. The barcode contents may be invalid.</string>
|
||||
<string name="msg_redirect">Redirect</string>
|
||||
<string name="msg_sbc_book_not_searchable">Sorry, this book is not searchable.</string>
|
||||
<string name="msg_sbc_failed">Sorry, the search encountered a problem.</string>
|
||||
<string name="msg_sbc_no_page_returned">No page returned</string>
|
||||
<string name="msg_sbc_page">Page</string>
|
||||
<string name="msg_sbc_results">Results</string>
|
||||
<string name="msg_sbc_searching_book">Searching book\u2026</string>
|
||||
<string name="msg_sbc_snippet_unavailable">Snippet not available</string>
|
||||
<string name="msg_sbc_unknown_page">Unknown page</string>
|
||||
<string name="msg_share_explanation">You can share data by displaying a barcode on your screen and scanning it with another phone.</string>
|
||||
<string name="msg_share_subject_line">Here are the contents of a barcode I scanned</string>
|
||||
<string name="msg_share_text">Or type some text and press Enter</string>
|
||||
<string name="msg_sure">Are you sure?</string>
|
||||
<string name="msg_unmount_usb">Sorry, the SD card is not accessible.</string>
|
||||
<string name="preferences_actions_title">When a barcode is found\u2026</string>
|
||||
<string name="preferences_auto_focus_title">Use auto focus</string>
|
||||
<string name="preferences_bulk_mode_summary">Scan and save many barcodes continuously</string>
|
||||
<string name="preferences_bulk_mode_title">Bulk scan mode</string>
|
||||
<string name="preferences_copy_to_clipboard_title">Copy to clipboard</string>
|
||||
<string formatted="false" name="preferences_custom_product_search_summary">Substitutions: %s = contents, %f = format, %t = type</string>
|
||||
<string name="preferences_custom_product_search_title">Custom search URL</string>
|
||||
<string name="preferences_decode_1D_title">1D barcodes</string>
|
||||
<string name="preferences_decode_Data_Matrix_title">Data Matrix</string>
|
||||
<string name="preferences_decode_QR_title">QR Codes</string>
|
||||
<string name="preferences_device_bug_workarounds_title">Device Bug Workarounds</string>
|
||||
<string name="preferences_disable_continuous_focus_summary">Use only standard focus mode</string>
|
||||
<string name="preferences_disable_continuous_focus_title">No continuous focus</string>
|
||||
<string name="preferences_disable_exposure_title">No exposure</string>
|
||||
<string name="preferences_front_light_summary">Improves scanning in low light on some phones, but may cause glare. Does not work on all phones.</string>
|
||||
<string name="preferences_front_light_title">Use front light</string>
|
||||
<string name="preferences_general_title">General settings</string>
|
||||
<string name="preferences_name">Settings</string>
|
||||
<string name="preferences_play_beep_title">Beep</string>
|
||||
<string name="preferences_remember_duplicates_summary">Store multiple scans of the same barcode in History</string>
|
||||
<string name="preferences_remember_duplicates_title">Remember duplicates</string>
|
||||
<string name="preferences_result_title">Result settings</string>
|
||||
<string name="preferences_scanning_title">When scanning for barcodes, decode\u2026</string>
|
||||
<string name="preferences_search_country">Search country</string>
|
||||
<string name="preferences_try_bsplus">Try Barcode Scanner+</string>
|
||||
<string name="preferences_try_bsplus_summary">Enhanced with new features and interface</string>
|
||||
<string name="preferences_supplemental_summary">Try to retrieve more information about the barcode contents</string>
|
||||
<string name="preferences_supplemental_title">Retrieve more info</string>
|
||||
<string name="preferences_vibrate_title">Vibrate</string>
|
||||
<string name="result_address_book">Found contact info</string>
|
||||
<string name="result_calendar">Found calendar event</string>
|
||||
<string name="result_email_address">Found email address</string>
|
||||
<string name="result_geo">Found geographic coordinates</string>
|
||||
<string name="result_isbn">Found book</string>
|
||||
<string name="result_product">Found product</string>
|
||||
<string name="result_sms">Found SMS address</string>
|
||||
<string name="result_tel">Found phone number</string>
|
||||
<string name="result_text">Found plain text</string>
|
||||
<string name="result_uri">Found URL</string>
|
||||
<string name="result_wifi">Found WLAN Configuration</string>
|
||||
<string name="sbc_name">Google Book Search</string>
|
||||
<string name="share_name">Share via barcode</string>
|
||||
<string name="wifi_changing_network">Requesting connection to network\u2026</string>
|
||||
<string name="wifi_ssid_label">Network Name</string>
|
||||
<string name="wifi_type_label">Type</string>
|
||||
</resources>
|
|
@ -1,102 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory android:title="@string/preferences_scanning_title">
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_decode_1D"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preferences_decode_1D_title"/>
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_decode_QR"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preferences_decode_QR_title"/>
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_decode_Data_Matrix"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preferences_decode_Data_Matrix_title"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/preferences_actions_title">
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_play_beep"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preferences_play_beep_title"/>
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_vibrate"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/preferences_vibrate_title"/>
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_copy_to_clipboard"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preferences_copy_to_clipboard_title"/>
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_remember_duplicates"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/preferences_remember_duplicates_title"
|
||||
android:summary="@string/preferences_remember_duplicates_summary"/>
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_supplemental"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preferences_supplemental_title"
|
||||
android:summary="@string/preferences_supplemental_summary"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/preferences_result_title">
|
||||
<EditTextPreference
|
||||
android:key="preferences_custom_product_search"
|
||||
android:title="@string/preferences_custom_product_search_title"
|
||||
android:summary="@string/preferences_custom_product_search_summary"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/preferences_general_title">
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_front_light"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/preferences_front_light_title"
|
||||
android:summary="@string/preferences_front_light_summary"/>
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_auto_focus"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preferences_auto_focus_title"/>
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_bulk_mode"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/preferences_bulk_mode_title"
|
||||
android:summary="@string/preferences_bulk_mode_summary"/>
|
||||
<ListPreference
|
||||
android:key="preferences_search_country"
|
||||
android:defaultValue="-"
|
||||
android:entries="@array/country_codes"
|
||||
android:entryValues="@array/country_codes"
|
||||
android:title="@string/preferences_search_country"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/preferences_device_bug_workarounds_title">
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_disable_continuous_focus"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preferences_disable_continuous_focus_title"
|
||||
android:summary="@string/preferences_disable_continuous_focus_summary"/>
|
||||
<!--
|
||||
<CheckBoxPreference
|
||||
android:key="preferences_disable_exposure"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/preferences_disable_exposure_title"/>
|
||||
-->
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/preferences_try_bsplus">
|
||||
<com.google.zxing.client.android.pref.BSPlusPreference
|
||||
android:title="@string/preferences_try_bsplus"
|
||||
android:summary="@string/preferences_try_bsplus_summary"/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
package com.bitpay.copay;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class Copay extends CordovaActivity
|
||||
{
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
super.init();
|
||||
// Set by <content src="index.html" /> in config.xml
|
||||
super.loadUrl(Config.getStartUrl());
|
||||
//super.loadUrl("file:///android_asset/www/index.html");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,217 +0,0 @@
|
|||
package com.borismus.webintent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cordova.CordovaActivity;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.Html;
|
||||
|
||||
import org.apache.cordova.CallbackContext;
|
||||
import org.apache.cordova.CordovaPlugin;
|
||||
import org.apache.cordova.CordovaResourceApi;
|
||||
import org.apache.cordova.PluginResult;
|
||||
|
||||
/**
|
||||
* WebIntent is a PhoneGap plugin that bridges Android intents and web
|
||||
* applications:
|
||||
*
|
||||
* 1. web apps can spawn intents that call native Android applications. 2.
|
||||
* (after setting up correct intent filters for PhoneGap applications), Android
|
||||
* intents can be handled by PhoneGap web applications.
|
||||
*
|
||||
* @author boris@borismus.com
|
||||
*
|
||||
*/
|
||||
public class WebIntent extends CordovaPlugin {
|
||||
|
||||
private CallbackContext onNewIntentCallbackContext = null;
|
||||
|
||||
//public boolean execute(String action, JSONArray args, String callbackId) {
|
||||
@Override
|
||||
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
|
||||
try {
|
||||
|
||||
if (action.equals("startActivity")) {
|
||||
if (args.length() != 1) {
|
||||
//return new PluginResult(PluginResult.Status.INVALID_ACTION);
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse the arguments
|
||||
final CordovaResourceApi resourceApi = webView.getResourceApi();
|
||||
JSONObject obj = args.getJSONObject(0);
|
||||
String type = obj.has("type") ? obj.getString("type") : null;
|
||||
Uri uri = obj.has("url") ? resourceApi.remapUri(Uri.parse(obj.getString("url"))) : null;
|
||||
JSONObject extras = obj.has("extras") ? obj.getJSONObject("extras") : null;
|
||||
Map<String, String> extrasMap = new HashMap<String, String>();
|
||||
|
||||
// Populate the extras if any exist
|
||||
if (extras != null) {
|
||||
JSONArray extraNames = extras.names();
|
||||
for (int i = 0; i < extraNames.length(); i++) {
|
||||
String key = extraNames.getString(i);
|
||||
String value = extras.getString(key);
|
||||
extrasMap.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
startActivity(obj.getString("action"), uri, type, extrasMap);
|
||||
//return new PluginResult(PluginResult.Status.OK);
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
|
||||
return true;
|
||||
|
||||
} else if (action.equals("hasExtra")) {
|
||||
if (args.length() != 1) {
|
||||
//return new PluginResult(PluginResult.Status.INVALID_ACTION);
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
|
||||
return false;
|
||||
}
|
||||
Intent i = ((CordovaActivity)this.cordova.getActivity()).getIntent();
|
||||
String extraName = args.getString(0);
|
||||
//return new PluginResult(PluginResult.Status.OK, i.hasExtra(extraName));
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, i.hasExtra(extraName)));
|
||||
return true;
|
||||
|
||||
} else if (action.equals("getExtra")) {
|
||||
if (args.length() != 1) {
|
||||
//return new PluginResult(PluginResult.Status.INVALID_ACTION);
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
|
||||
return false;
|
||||
}
|
||||
Intent i = ((CordovaActivity)this.cordova.getActivity()).getIntent();
|
||||
String extraName = args.getString(0);
|
||||
if (i.hasExtra(extraName)) {
|
||||
//return new PluginResult(PluginResult.Status.OK, i.getStringExtra(extraName));
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, i.getStringExtra(extraName)));
|
||||
return true;
|
||||
} else {
|
||||
//return new PluginResult(PluginResult.Status.ERROR);
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR));
|
||||
return false;
|
||||
}
|
||||
} else if (action.equals("getUri")) {
|
||||
if (args.length() != 0) {
|
||||
//return new PluginResult(PluginResult.Status.INVALID_ACTION);
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
|
||||
return false;
|
||||
}
|
||||
|
||||
Intent i = ((CordovaActivity)this.cordova.getActivity()).getIntent();
|
||||
String uri = i.getDataString();
|
||||
//return new PluginResult(PluginResult.Status.OK, uri);
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, uri));
|
||||
return true;
|
||||
} else if (action.equals("onNewIntent")) {
|
||||
//save reference to the callback; will be called on "new intent" events
|
||||
this.onNewIntentCallbackContext = callbackContext;
|
||||
|
||||
if (args.length() != 0) {
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
|
||||
return false;
|
||||
}
|
||||
|
||||
PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
|
||||
result.setKeepCallback(true); //re-use the callback on intent events
|
||||
callbackContext.sendPluginResult(result);
|
||||
return true;
|
||||
//return result;
|
||||
} else if (action.equals("sendBroadcast"))
|
||||
{
|
||||
if (args.length() != 1) {
|
||||
//return new PluginResult(PluginResult.Status.INVALID_ACTION);
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse the arguments
|
||||
JSONObject obj = args.getJSONObject(0);
|
||||
|
||||
JSONObject extras = obj.has("extras") ? obj.getJSONObject("extras") : null;
|
||||
Map<String, String> extrasMap = new HashMap<String, String>();
|
||||
|
||||
// Populate the extras if any exist
|
||||
if (extras != null) {
|
||||
JSONArray extraNames = extras.names();
|
||||
for (int i = 0; i < extraNames.length(); i++) {
|
||||
String key = extraNames.getString(i);
|
||||
String value = extras.getString(key);
|
||||
extrasMap.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
sendBroadcast(obj.getString("action"), extrasMap);
|
||||
//return new PluginResult(PluginResult.Status.OK);
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
|
||||
return true;
|
||||
}
|
||||
//return new PluginResult(PluginResult.Status.INVALID_ACTION);
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION));
|
||||
return false;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
String errorMessage=e.getMessage();
|
||||
//return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION,errorMessage));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewIntent(Intent intent) {
|
||||
|
||||
if (this.onNewIntentCallbackContext != null) {
|
||||
PluginResult result = new PluginResult(PluginResult.Status.OK, intent.getDataString());
|
||||
result.setKeepCallback(true);
|
||||
this.onNewIntentCallbackContext.sendPluginResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
void startActivity(String action, Uri uri, String type, Map<String, String> extras) {
|
||||
Intent i = (uri != null ? new Intent(action, uri) : new Intent(action));
|
||||
|
||||
if (type != null && uri != null) {
|
||||
i.setDataAndType(uri, type); //Fix the crash problem with android 2.3.6
|
||||
} else {
|
||||
if (type != null) {
|
||||
i.setType(type);
|
||||
}
|
||||
}
|
||||
|
||||
for (String key : extras.keySet()) {
|
||||
String value = extras.get(key);
|
||||
// If type is text html, the extra text must sent as HTML
|
||||
if (key.equals(Intent.EXTRA_TEXT) && type.equals("text/html")) {
|
||||
i.putExtra(key, Html.fromHtml(value));
|
||||
} else if (key.equals(Intent.EXTRA_STREAM)) {
|
||||
// allowes sharing of images as attachments.
|
||||
// value in this case should be a URI of a file
|
||||
final CordovaResourceApi resourceApi = webView.getResourceApi();
|
||||
i.putExtra(key, resourceApi.remapUri(Uri.parse(value)));
|
||||
} else if (key.equals(Intent.EXTRA_EMAIL)) {
|
||||
// allows to add the email address of the receiver
|
||||
i.putExtra(Intent.EXTRA_EMAIL, new String[] { value });
|
||||
} else {
|
||||
i.putExtra(key, value);
|
||||
}
|
||||
}
|
||||
((CordovaActivity)this.cordova.getActivity()).startActivity(i);
|
||||
}
|
||||
|
||||
void sendBroadcast(String action, Map<String, String> extras) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(action);
|
||||
for (String key : extras.keySet()) {
|
||||
String value = extras.get(key);
|
||||
intent.putExtra(key, value);
|
||||
}
|
||||
|
||||
((CordovaActivity)this.cordova.getActivity()).sendBroadcast(intent);
|
||||
}
|
||||
}
|
|
@ -1,169 +0,0 @@
|
|||
/**
|
||||
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
|
||||
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
|
||||
*
|
||||
* Copyright (c) Matt Kane 2010
|
||||
* Copyright (c) 2011, IBM Corporation
|
||||
* Copyright (c) 2013, Maciej Nux Jaros
|
||||
*/
|
||||
package com.phonegap.plugins.barcodescanner;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import org.apache.cordova.CordovaPlugin;
|
||||
import org.apache.cordova.CallbackContext;
|
||||
import org.apache.cordova.PluginResult;
|
||||
|
||||
/**
|
||||
* This calls out to the ZXing barcode reader and returns the result.
|
||||
*
|
||||
* @sa https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaPlugin.java
|
||||
*/
|
||||
public class BarcodeScanner extends CordovaPlugin {
|
||||
public static final int REQUEST_CODE = 0x0ba7c0de;
|
||||
|
||||
private static final String SCAN = "scan";
|
||||
private static final String ENCODE = "encode";
|
||||
private static final String CANCELLED = "cancelled";
|
||||
private static final String FORMAT = "format";
|
||||
private static final String TEXT = "text";
|
||||
private static final String DATA = "data";
|
||||
private static final String TYPE = "type";
|
||||
private static final String SCAN_INTENT = "com.phonegap.plugins.barcodescanner.SCAN";
|
||||
private static final String ENCODE_DATA = "ENCODE_DATA";
|
||||
private static final String ENCODE_TYPE = "ENCODE_TYPE";
|
||||
private static final String ENCODE_INTENT = "com.phonegap.plugins.barcodescanner.ENCODE";
|
||||
private static final String TEXT_TYPE = "TEXT_TYPE";
|
||||
private static final String EMAIL_TYPE = "EMAIL_TYPE";
|
||||
private static final String PHONE_TYPE = "PHONE_TYPE";
|
||||
private static final String SMS_TYPE = "SMS_TYPE";
|
||||
|
||||
private static final String LOG_TAG = "BarcodeScanner";
|
||||
|
||||
private CallbackContext callbackContext;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public BarcodeScanner() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the request.
|
||||
*
|
||||
* This method is called from the WebView thread. To do a non-trivial amount of work, use:
|
||||
* cordova.getThreadPool().execute(runnable);
|
||||
*
|
||||
* To run on the UI thread, use:
|
||||
* cordova.getActivity().runOnUiThread(runnable);
|
||||
*
|
||||
* @param action The action to execute.
|
||||
* @param args The exec() arguments.
|
||||
* @param callbackContext The callback context used when calling back into JavaScript.
|
||||
* @return Whether the action was valid.
|
||||
*
|
||||
* @sa https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaPlugin.java
|
||||
*/
|
||||
@Override
|
||||
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
|
||||
this.callbackContext = callbackContext;
|
||||
|
||||
if (action.equals(ENCODE)) {
|
||||
JSONObject obj = args.optJSONObject(0);
|
||||
if (obj != null) {
|
||||
String type = obj.optString(TYPE);
|
||||
String data = obj.optString(DATA);
|
||||
|
||||
// If the type is null then force the type to text
|
||||
if (type == null) {
|
||||
type = TEXT_TYPE;
|
||||
}
|
||||
|
||||
if (data == null) {
|
||||
callbackContext.error("User did not specify data to encode");
|
||||
return true;
|
||||
}
|
||||
|
||||
encode(type, data);
|
||||
} else {
|
||||
callbackContext.error("User did not specify data to encode");
|
||||
return true;
|
||||
}
|
||||
} else if (action.equals(SCAN)) {
|
||||
scan();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts an intent to scan and decode a barcode.
|
||||
*/
|
||||
public void scan() {
|
||||
Intent intentScan = new Intent(SCAN_INTENT);
|
||||
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
|
||||
this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the barcode scanner intent completes.
|
||||
*
|
||||
* @param requestCode The request code originally supplied to startActivityForResult(),
|
||||
* allowing you to identify who this result came from.
|
||||
* @param resultCode The integer result code returned by the child activity through its setResult().
|
||||
* @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
|
||||
*/
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
if (requestCode == REQUEST_CODE) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
JSONObject obj = new JSONObject();
|
||||
try {
|
||||
obj.put(TEXT, intent.getStringExtra("SCAN_RESULT"));
|
||||
obj.put(FORMAT, intent.getStringExtra("SCAN_RESULT_FORMAT"));
|
||||
obj.put(CANCELLED, false);
|
||||
} catch (JSONException e) {
|
||||
Log.d(LOG_TAG, "This should never happen");
|
||||
}
|
||||
//this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
|
||||
this.callbackContext.success(obj);
|
||||
} else if (resultCode == Activity.RESULT_CANCELED) {
|
||||
JSONObject obj = new JSONObject();
|
||||
try {
|
||||
obj.put(TEXT, "");
|
||||
obj.put(FORMAT, "");
|
||||
obj.put(CANCELLED, true);
|
||||
} catch (JSONException e) {
|
||||
Log.d(LOG_TAG, "This should never happen");
|
||||
}
|
||||
//this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
|
||||
this.callbackContext.success(obj);
|
||||
} else {
|
||||
//this.error(new PluginResult(PluginResult.Status.ERROR), this.callback);
|
||||
this.callbackContext.error("Unexpected error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates a barcode encode.
|
||||
*
|
||||
* @param type Endoiding type.
|
||||
* @param data The data to encode in the bar code.
|
||||
*/
|
||||
public void encode(String type, String data) {
|
||||
Intent intentEncode = new Intent(ENCODE_INTENT);
|
||||
intentEncode.putExtra(ENCODE_TYPE, type);
|
||||
intentEncode.putExtra(ENCODE_DATA, data);
|
||||
|
||||
this.cordova.getActivity().startActivity(intentEncode);
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package com.verso.cordova.clipboard;
|
||||
|
||||
import org.apache.cordova.CordovaPlugin;
|
||||
import org.apache.cordova.PluginResult;
|
||||
import org.apache.cordova.CallbackContext;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipDescription;
|
||||
|
||||
public class Clipboard extends CordovaPlugin {
|
||||
|
||||
private static final String actionCopy = "copy";
|
||||
private static final String actionPaste = "paste";
|
||||
|
||||
@Override
|
||||
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
|
||||
ClipboardManager clipboard = (ClipboardManager) cordova.getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
|
||||
if (action.equals(actionCopy)) {
|
||||
try {
|
||||
String text = args.getString(0);
|
||||
ClipData clip = ClipData.newPlainText("Text", text);
|
||||
|
||||
clipboard.setPrimaryClip(clip);
|
||||
|
||||
callbackContext.success(text);
|
||||
|
||||
return true;
|
||||
} catch (JSONException e) {
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
|
||||
} catch (Exception e) {
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, e.toString()));
|
||||
}
|
||||
} else if (action.equals(actionPaste)) {
|
||||
if (!clipboard.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.NO_RESULT));
|
||||
}
|
||||
|
||||
try {
|
||||
ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
|
||||
String text = item.getText().toString();
|
||||
|
||||
if (text == null) text = "";
|
||||
|
||||
callbackContext.success(text);
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
Copyright 2013-2014 appPlant UG
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package de.appplant.cordova.plugin.emailcomposer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import android.content.ContentProvider;
|
||||
import android.content.ContentValues;
|
||||
import android.content.UriMatcher;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.net.Uri;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.provider.MediaStore;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
public class AttachmentProvider extends ContentProvider {
|
||||
|
||||
public static final String AUTHORITY = ".plugin.emailcomposer.attachmentprovider";
|
||||
|
||||
private UriMatcher uriMatcher;
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
String pkgName = this.getContext().getPackageName();
|
||||
|
||||
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
|
||||
|
||||
uriMatcher.addURI(pkgName + AUTHORITY, "*", 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
|
||||
switch(uriMatcher.match(uri)) {
|
||||
case 1:
|
||||
String storage = getContext().getCacheDir() + EmailComposer.STORAGE_FOLDER;
|
||||
String path = storage + File.separator + uri.getLastPathSegment();
|
||||
|
||||
File file = new File(path);
|
||||
ParcelFileDescriptor pfd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
|
||||
|
||||
return pfd;
|
||||
default:
|
||||
throw new FileNotFoundException("Unsupported uri: " + uri.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Uri arg0, String arg1, String[] arg2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri insert(Uri arg0, ContentValues arg1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType(Uri arg0) {
|
||||
String fileExtension = MimeTypeMap.getFileExtensionFromUrl(arg0.getPath());
|
||||
String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
||||
MatrixCursor result = new MatrixCursor(projection);
|
||||
Object[] row = new Object[projection.length];
|
||||
long fileSize = 0;
|
||||
|
||||
String fileLocation = getContext().getCacheDir() + File.separator + uri.getLastPathSegment();
|
||||
File tempFile = new File(fileLocation);
|
||||
fileSize = tempFile.length();
|
||||
|
||||
for (int i=0; i<projection.length; i++) {
|
||||
if (projection[i].compareToIgnoreCase(MediaStore.MediaColumns.DISPLAY_NAME) == 0) {
|
||||
row[i] = uri.getLastPathSegment();
|
||||
} else if (projection[i].compareToIgnoreCase(MediaStore.MediaColumns.SIZE) == 0) {
|
||||
row[i] = fileSize;
|
||||
}
|
||||
}
|
||||
|
||||
result.addRow(row);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,413 +0,0 @@
|
|||
/*
|
||||
Copyright 2013-2014 appPlant UG
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package de.appplant.cordova.plugin.emailcomposer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.text.Html;
|
||||
import android.util.Base64;
|
||||
|
||||
import org.apache.cordova.CordovaPlugin;
|
||||
import org.apache.cordova.CallbackContext;
|
||||
import org.apache.cordova.PluginResult;
|
||||
|
||||
public class EmailComposer extends CordovaPlugin {
|
||||
|
||||
static protected final String STORAGE_FOLDER = File.separator + "email_composer";
|
||||
|
||||
private CallbackContext command;
|
||||
|
||||
@Override
|
||||
public boolean execute (String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
|
||||
|
||||
this.command = callbackContext;
|
||||
|
||||
// Eine E-Mail soll versendet werden
|
||||
if ("open".equals(action)) {
|
||||
open(args);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Es soll überprüft werden, ob ein Dienst zum Versenden der E-Mail zur Verfügung steht
|
||||
if ("isServiceAvailable".equals(action)) {
|
||||
isServiceAvailable();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returning false results in a "MethodNotFound" error.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Überprüft, ob Emails versendet werden können.
|
||||
*/
|
||||
private void isServiceAvailable () {
|
||||
Boolean available = isEmailAccountConfigured();
|
||||
PluginResult result = new PluginResult(PluginResult.Status.OK, available);
|
||||
|
||||
command.sendPluginResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Öffnet den Email-Kontroller mit vorausgefüllten Daten.
|
||||
*/
|
||||
private void open (JSONArray args) throws JSONException {
|
||||
JSONObject properties = args.getJSONObject(0);
|
||||
Intent draft = getDraftWithProperties(properties);
|
||||
|
||||
openDraft(draft);
|
||||
}
|
||||
|
||||
/**
|
||||
* Erstellt den ViewController für Mails und fügt die übergebenen Eigenschaften ein.
|
||||
*
|
||||
* @param {JSONObject} params (Subject, Body, Recipients, ...)
|
||||
*/
|
||||
private Intent getDraftWithProperties (JSONObject params) throws JSONException {
|
||||
Intent mail = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
|
||||
|
||||
if (params.has("subject"))
|
||||
setSubject(params.getString("subject"), mail);
|
||||
if (params.has("body"))
|
||||
setBody(params.getString("body"), params.optBoolean("isHtml"), mail);
|
||||
if (params.has("to"))
|
||||
setRecipients(params.getJSONArray("to"), mail);
|
||||
if (params.has("cc"))
|
||||
setCcRecipients(params.getJSONArray("cc"), mail);
|
||||
if (params.has("bcc"))
|
||||
setBccRecipients(params.getJSONArray("bcc"), mail);
|
||||
if (params.has("attachments"))
|
||||
setAttachments(params.getJSONArray("attachments"), mail);
|
||||
|
||||
mail.setType("application/octet-stream");
|
||||
|
||||
return mail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Zeigt den ViewController zum Versenden/Bearbeiten der Mail an.
|
||||
*/
|
||||
private void openDraft (final Intent draft) {
|
||||
final EmailComposer plugin = this;
|
||||
|
||||
cordova.getThreadPool().execute( new Runnable() {
|
||||
public void run() {
|
||||
cordova.startActivityForResult(plugin, Intent.createChooser(draft, "Select Email App"), 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt den Subject der Mail.
|
||||
*/
|
||||
private void setSubject (String subject, Intent draft) {
|
||||
draft.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt den Body der Mail.
|
||||
*/
|
||||
private void setBody (String body, Boolean isHTML, Intent draft) {
|
||||
if (isHTML) {
|
||||
draft.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));
|
||||
draft.setType("text/html");
|
||||
} else {
|
||||
draft.putExtra(android.content.Intent.EXTRA_TEXT, body);
|
||||
draft.setType("text/plain");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt die Empfänger der Mail.
|
||||
*/
|
||||
private void setRecipients (JSONArray recipients, Intent draft) throws JSONException {
|
||||
String[] receivers = new String[recipients.length()];
|
||||
|
||||
for (int i = 0; i < recipients.length(); i++) {
|
||||
receivers[i] = recipients.getString(i);
|
||||
}
|
||||
|
||||
draft.putExtra(android.content.Intent.EXTRA_EMAIL, receivers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt die CC-Empfänger der Mail.
|
||||
*/
|
||||
private void setCcRecipients (JSONArray ccRecipients, Intent draft) throws JSONException {
|
||||
String[] receivers = new String[ccRecipients.length()];
|
||||
|
||||
for (int i = 0; i < ccRecipients.length(); i++) {
|
||||
receivers[i] = ccRecipients.getString(i);
|
||||
}
|
||||
|
||||
draft.putExtra(android.content.Intent.EXTRA_CC, receivers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt die BCC-Empfänger der Mail.
|
||||
*/
|
||||
private void setBccRecipients (JSONArray bccRecipients, Intent draft) throws JSONException {
|
||||
String[] receivers = new String[bccRecipients.length()];
|
||||
|
||||
for (int i = 0; i < bccRecipients.length(); i++) {
|
||||
receivers[i] = bccRecipients.getString(i);
|
||||
}
|
||||
|
||||
draft.putExtra(android.content.Intent.EXTRA_BCC, receivers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fügt die Anhände zur Mail hinzu.
|
||||
*/
|
||||
private void setAttachments (JSONArray attachments, Intent draft) throws JSONException {
|
||||
ArrayList<Uri> attachmentUris = new ArrayList<Uri>();
|
||||
|
||||
for (int i = 0; i < attachments.length(); i++) {
|
||||
Uri attachmentUri = getUriForPath(attachments.getString(i));
|
||||
|
||||
attachmentUris.add(attachmentUri);
|
||||
}
|
||||
|
||||
draft.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachmentUris);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt an, ob es eine Anwendung gibt, welche E-Mails versenden kann.
|
||||
*/
|
||||
private Boolean isEmailAccountConfigured () {
|
||||
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto","max@mustermann.com", null));
|
||||
Boolean available = cordova.getActivity().getPackageManager().queryIntentActivities(intent, 0).size() > 1;
|
||||
|
||||
return available;
|
||||
}
|
||||
|
||||
/**
|
||||
* The URI for an attachment path.
|
||||
*
|
||||
* @param {String} path
|
||||
* The given path to the attachment
|
||||
*
|
||||
* @return The URI pointing to the given path
|
||||
*/
|
||||
private Uri getUriForPath (String path) {
|
||||
if (path.startsWith("res:")) {
|
||||
return getUriForResourcePath(path);
|
||||
} else if (path.startsWith("file:")) {
|
||||
return getUriForAbsolutePath(path);
|
||||
} else if (path.startsWith("www:")) {
|
||||
return getUriForAssetPath(path);
|
||||
} else if (path.startsWith("base64:")) {
|
||||
return getUriForBase64Content(path);
|
||||
}
|
||||
|
||||
return Uri.parse(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* The URI for a file.
|
||||
*
|
||||
* @param {String} path
|
||||
* The given absolute path
|
||||
*
|
||||
* @return The URI pointing to the given path
|
||||
*/
|
||||
private Uri getUriForAbsolutePath (String path) {
|
||||
String absPath = path.replaceFirst("file://", "");
|
||||
File file = new File(absPath);
|
||||
|
||||
if (!file.exists()) {
|
||||
System.err.println("Attachment path not found: " + file.getAbsolutePath());
|
||||
}
|
||||
|
||||
return Uri.fromFile(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* The URI for an asset.
|
||||
*
|
||||
* @param {String} path
|
||||
* The given asset path
|
||||
*
|
||||
* @return The URI pointing to the given path
|
||||
*/
|
||||
private Uri getUriForAssetPath (String path) {
|
||||
String resPath = path.replaceFirst("www:/", "www");
|
||||
String fileName = resPath.substring(resPath.lastIndexOf('/') + 1);
|
||||
String storage = cordova.getActivity().getExternalCacheDir().toString() + STORAGE_FOLDER;
|
||||
|
||||
File file = new File(storage, fileName);
|
||||
|
||||
new File(storage).mkdir();
|
||||
|
||||
try {
|
||||
AssetManager assets = cordova.getActivity().getAssets();
|
||||
|
||||
FileOutputStream outStream = new FileOutputStream(file);
|
||||
InputStream inputStream = assets.open(resPath);
|
||||
|
||||
copyFile(inputStream, outStream);
|
||||
outStream.flush();
|
||||
outStream.close();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Attachment asset not found: assets/" + resPath);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return Uri.fromFile(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* The URI for a resource.
|
||||
*
|
||||
* @param {String} path
|
||||
* The given relative path
|
||||
*
|
||||
* @return The URI pointing to the given path
|
||||
*/
|
||||
private Uri getUriForResourcePath (String path) {
|
||||
String resPath = path.replaceFirst("res://", "");
|
||||
String fileName = resPath.substring(resPath.lastIndexOf('/') + 1);
|
||||
String resName = fileName.substring(0, fileName.lastIndexOf('.'));
|
||||
String extension = resPath.substring(resPath.lastIndexOf('.'));
|
||||
String storage = cordova.getActivity().getExternalCacheDir().toString() + STORAGE_FOLDER;
|
||||
|
||||
int resId = getResId(resPath);
|
||||
File file = new File(storage, resName + extension);
|
||||
|
||||
if (resId == 0) {
|
||||
System.err.println("Attachment resource not found: " + resPath);
|
||||
}
|
||||
|
||||
new File(storage).mkdir();
|
||||
|
||||
try {
|
||||
Resources res = cordova.getActivity().getResources();
|
||||
FileOutputStream outStream = new FileOutputStream(file);
|
||||
InputStream inputStream = res.openRawResource(resId);
|
||||
|
||||
copyFile(inputStream, outStream);
|
||||
outStream.flush();
|
||||
outStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return Uri.fromFile(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* The URI for a base64 encoded content.
|
||||
*
|
||||
* @param {String} content
|
||||
* The given base64 encoded content
|
||||
*
|
||||
* @return The URI including the given content
|
||||
*/
|
||||
private Uri getUriForBase64Content (String content) {
|
||||
String resName = content.substring(content.indexOf(":") + 1, content.indexOf("//"));
|
||||
String resData = content.substring(content.indexOf("//") + 2);
|
||||
byte[] bytes = Base64.decode(resData, 0);
|
||||
String storage = this.cordova.getActivity().getCacheDir() + STORAGE_FOLDER;
|
||||
File file = new File(storage, resName);
|
||||
|
||||
new File(storage).mkdir();
|
||||
|
||||
try {
|
||||
FileOutputStream outStream = new FileOutputStream(file);
|
||||
|
||||
outStream.write(bytes);
|
||||
outStream.flush();
|
||||
outStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String pkgName = getPackageName();
|
||||
String uriPath = pkgName + AttachmentProvider.AUTHORITY + "/" + resName;
|
||||
|
||||
return Uri.parse("content://" + uriPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an InputStream to an OutputStream
|
||||
*
|
||||
* @param {InputStream} in
|
||||
* @param {OutputStream} out
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private void copyFile (InputStream in, OutputStream out) throws IOException {
|
||||
byte[] buffer = new byte[1024];
|
||||
int read;
|
||||
|
||||
while((read = in.read(buffer)) != -1){
|
||||
out.write(buffer, 0, read);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* The resource ID for the given resource.
|
||||
*/
|
||||
private int getResId (String resPath) {
|
||||
Resources res = cordova.getActivity().getResources();
|
||||
|
||||
String pkgName = getPackageName();
|
||||
String dirName = resPath.substring(0, resPath.lastIndexOf('/'));
|
||||
String fileName = resPath.substring(resPath.lastIndexOf('/') + 1);
|
||||
String resName = fileName.substring(0, fileName.lastIndexOf('.'));
|
||||
|
||||
int resId = res.getIdentifier(resName, dirName, pkgName);
|
||||
|
||||
return resId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* The name for the package.
|
||||
*/
|
||||
private String getPackageName () {
|
||||
return cordova.getActivity().getPackageName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
super.onActivityResult(requestCode, resultCode, intent);
|
||||
|
||||
command.success();
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package nl.xservices.plugins;
|
||||
|
||||
import android.view.Gravity;
|
||||
import org.apache.cordova.CallbackContext;
|
||||
import org.apache.cordova.CordovaPlugin;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
public class Toast extends CordovaPlugin {
|
||||
|
||||
private static final String ACTION_SHOW_EVENT = "show";
|
||||
|
||||
@Override
|
||||
public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
|
||||
if (ACTION_SHOW_EVENT.equals(action)) {
|
||||
|
||||
final String message = args.getString(0);
|
||||
final String duration = args.getString(1);
|
||||
final String position = args.getString(2);
|
||||
|
||||
cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
android.widget.Toast toast = android.widget.Toast.makeText(webView.getContext(), message, 0);
|
||||
|
||||
if ("top".equals(position)) {
|
||||
toast.setGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL, 0, 20);
|
||||
} else if ("bottom".equals(position)) {
|
||||
toast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 20);
|
||||
} else if ("center".equals(position)) {
|
||||
toast.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL, 0, 0);
|
||||
} else {
|
||||
callbackContext.error("invalid position. valid options are 'top', 'center' and 'bottom'");
|
||||
return;
|
||||
}
|
||||
|
||||
if ("short".equals(duration)) {
|
||||
toast.setDuration(android.widget.Toast.LENGTH_SHORT);
|
||||
} else if ("long".equals(duration)) {
|
||||
toast.setDuration(android.widget.Toast.LENGTH_LONG);
|
||||
} else {
|
||||
callbackContext.error("invalid duration. valid options are 'short' and 'long'");
|
||||
return;
|
||||
}
|
||||
|
||||
toast.show();
|
||||
callbackContext.success();
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
} else {
|
||||
callbackContext.error("toast." + action + " is not a supported function. Did you mean '" + ACTION_SHOW_EVENT + "'?");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
package org.apache.cordova.splashscreen;
|
||||
|
||||
import org.apache.cordova.CallbackContext;
|
||||
import org.apache.cordova.CordovaPlugin;
|
||||
import org.json.JSONArray;
|
||||
|
||||
public class SplashScreen extends CordovaPlugin {
|
||||
|
||||
@Override
|
||||
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
|
||||
if (action.equals("hide")) {
|
||||
this.webView.postMessage("splashscreen", "hide");
|
||||
} else if (action.equals("show")){
|
||||
this.webView.postMessage("splashscreen", "show");
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
callbackContext.success();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
package org.apache.cordova.vibration;
|
||||
|
||||
import org.apache.cordova.CallbackContext;
|
||||
import org.apache.cordova.CordovaPlugin;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import android.content.Context;
|
||||
import android.os.Vibrator;
|
||||
|
||||
/**
|
||||
* This class provides access to vibration on the device.
|
||||
*/
|
||||
public class Vibration extends CordovaPlugin {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public Vibration() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the request and returns PluginResult.
|
||||
*
|
||||
* @param action The action to execute.
|
||||
* @param args JSONArray of arguments for the plugin.
|
||||
* @param callbackContext The callback context used when calling back into JavaScript.
|
||||
* @return True when the action was valid, false otherwise.
|
||||
*/
|
||||
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
|
||||
if (action.equals("vibrate")) {
|
||||
this.vibrate(args.getLong(0));
|
||||
}
|
||||
else if (action.equals("vibrateWithPattern")) {
|
||||
JSONArray pattern = args.getJSONArray(0);
|
||||
int repeat = args.getInt(1);
|
||||
long[] patternArray = new long[pattern.length()];
|
||||
for (int i = 0; i < pattern.length(); i++) {
|
||||
patternArray[i] = pattern.getLong(i);
|
||||
}
|
||||
this.vibrateWithPattern(patternArray, repeat);
|
||||
}
|
||||
else if (action.equals("cancelVibration")) {
|
||||
this.cancelVibration();
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only alert and confirm are async.
|
||||
callbackContext.success();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// LOCAL METHODS
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Vibrates the device for a given amount of time.
|
||||
*
|
||||
* @param time Time to vibrate in ms.
|
||||
*/
|
||||
public void vibrate(long time) {
|
||||
// Start the vibration, 0 defaults to half a second.
|
||||
if (time == 0) {
|
||||
time = 500;
|
||||
}
|
||||
Vibrator vibrator = (Vibrator) this.cordova.getActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
vibrator.vibrate(time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vibrates the device with a given pattern.
|
||||
*
|
||||
* @param pattern Pattern with which to vibrate the device.
|
||||
* Pass in an array of longs that
|
||||
* are the durations for which to
|
||||
* turn on or off the vibrator in
|
||||
* milliseconds. The first value
|
||||
* indicates the number of milliseconds
|
||||
* to wait before turning the vibrator
|
||||
* on. The next value indicates the
|
||||
* number of milliseconds for which
|
||||
* to keep the vibrator on before
|
||||
* turning it off. Subsequent values
|
||||
* alternate between durations in
|
||||
* milliseconds to turn the vibrator
|
||||
* off or to turn the vibrator on.
|
||||
*
|
||||
* @param repeat Optional index into the pattern array at which
|
||||
* to start repeating, or -1 for no repetition (default).
|
||||
*/
|
||||
public void vibrateWithPattern(long[] pattern, int repeat) {
|
||||
Vibrator vibrator = (Vibrator) this.cordova.getActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
vibrator.vibrate(pattern, repeat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Immediately cancels any currently running vibration.
|
||||
*/
|
||||
public void cancelVibration() {
|
||||
Vibrator vibrator = (Vibrator) this.cordova.getActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
vibrator.cancel();
|
||||
}
|
||||
}
|