Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Adds invoke-card sample. #20

Merged
merged 1 commit into from Oct 11, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
add
.DS_Store
1 change: 1 addition & 0 deletions invoke-card/App/BlackBerry-JQM-all.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions invoke-card/App/BlackBerry-JQM-all.min.js

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions invoke-card/App/config.xml
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:rim="http://www.blackberry.com/ns/widgets"
version="1.0.0"
id="InvokeCard">
<name>InvokeCard</name>
<content src="index.htm"/>
<author>self</author>
<description>This app tests the invoke API.</description>
<feature id="blackberry.invoke" required="true" version="1.0.0.0"/>
<feature id="blackberry.invoke.card" required="true" version="1.0.0.0"/>
<feature id="blackberry.invoked" required="true" version="1.0.0.0"/>
<feature id="blackberry.app.orientation">
<param name="mode" value="portrait"/>
</feature>
<access uri="*"/>
<license href="http://www.apache.org/licenses/LICENSE-2.0">My License</license>

<rim:permissions>
<rim:permit>access_shared</rim:permit>
</rim:permissions>
</widget>
Binary file added invoke-card/App/img/img1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
113 changes: 113 additions & 0 deletions invoke-card/App/index.htm
@@ -0,0 +1,113 @@
<html>
<head>
<title>Invoke API</title>

<link rel="stylesheet" href="BlackBerry-JQM-all.min.css" />
<script src="BlackBerry-JQM-all.min.js"></script>

<script type="text/javascript" src="webworks-1.0.0.7.js"></script>
<script>
function onInvokeSuccess() {
console.log("Invocation successful!");
}

function onInvokeError(error) {
console.log("Invocation failed, error: " + error);
}

function invokeBrowser() {
// invoke web link - allows the system to choose an appropriate target that handles http://
blackberry.invoke.invoke({
uri: "http://www.blackberry.com"
}, onInvokeSuccess, onInvokeError);
}

function invokePictureViewer() {
// invoking Card is the same as invoking an application, except the target specified should point to the "Card" target entry point
blackberry.invoke.invoke({
action: "bb.action.VIEW",
uri : "local:///img/img1.jpg",
file_transfer_mode : blackberry.invoke.FILE_TRANSFER_COPY_RO
}, onInvokeSuccess, onInvokeError);
}

function boundInvokeCard() {
blackberry.invoke.invoke({
target: "picture.card",
action: "bb.action.VIEW",
type: "text/plain",
uri : "local:///img/img1.jpg"
}, onInvokeSuccess, onInvokeError);

blackberry.event.addEventListener('onChildCardClosed', function (info) {
console.log("Card was closed");
});
}
function boundInvokeCard2() {
blackberry.invoke.invoke({
target: "net.rim.webworks.invoke.invoke.card.type",
action: "bb.action.VIEW",
type: "text/plain"
}, onInvokeSuccess, onInvokeError);

blackberry.event.addEventListener('onChildCardClosed', function (info) {
console.log("Card was closed");
});
}

function invokeCamera() {
var mode = blackberry.invoke.card.CAMERA_MODE_PHOTO;
blackberry.invoke.card.invokeCamera(mode, function (path) {
console.log("saved "+ path);
},
function (reason) {
console.log("cancelled " + reason);
},
function (error) {
if (error) {
console.log("invoke error "+ error);
} else {
console.log("invoke success " );
}
});
}

function invokeFilePicker() {
var details = {
mode: blackberry.invoke.card.FILEPICKER_MODE_PICKER,
type: [blackberry.invoke.card.FILEPICKER_TYPE_PICTURE, blackberry.invoke.card.FILEPICKER_TYPE_MUSIC]
};
blackberry.invoke.card.invokeFilePicker(details, function (path) {
console.log("saved "+ path);
},
function (reason) {
console.log("cancelled " + reason);
},
function (error) {
if (error) {
console.log("invoke error "+ error);
} else {
console.log("invoke success " );
}
}
);
}
</script>
</head>
<body>
<div data-role="page">
<div data-role="header" data-theme="c" data-position="fixed">
<h1>Invoke Demo</h1>
</div>
<div data-role="content">
<ul data-role="listview">
<li><a href="#" onclick="boundInvokeCard()">Invoke Bound card</a></li>
<li><a href="#" onclick="invokeBrowser()">Invoke Browser</a></li>
<li><a href="#" onclick="invokePictureViewer()">Invoke Picture viewer</a></li>
<li><a href="#" onclick="invokeCamera()">Invoke Camera</a></li>
<li><a href="#" onclick="invokeFilePicker()">Invoke File Picker</a></li>
</ul>
</div>
</div><!--page-->
</body>
</html>
1 change: 1 addition & 0 deletions invoke-card/Card/BlackBerry-JQM-all.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions invoke-card/Card/BlackBerry-JQM-all.min.js

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions invoke-card/Card/config.xml
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:rim="http://www.blackberry.com/ns/widgets"
version="1.2.3"
id="CardType">
<name>TheCard</name>
<content src="index.htm"/>
<author href="http://www.rim.com/"
rim:copyright="no copyright, go nuts!"
email = "email@rim.com">self
</author>
<description>This app tests invocation</description>
<access uri="*" />
<feature id="blackberry.invoke" />
<feature id="blackberry.app.orientation">
<param name="mode" value="portrait"/>
</feature>
<access uri="*" />
<feature id="blackberry.invoked" />
<license href="http://www.apache.org/licenses/LICENSE-2.0">My License</license>
<rim:invoke-target id="picture.card">
<type>card.previewer</type>
<filter>
<action>bb.action.VIEW</action>
<mime-type>image/*</mime-type>
</filter>
</rim:invoke-target>
<rim:permissions>
<rim:permit>use_camera</rim:permit>
<rim:permit>access_shared</rim:permit>
</rim:permissions>
</widget>
Binary file added invoke-card/Card/images_bb/core_actionbar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added invoke-card/Card/images_bb/core_actionbar_back.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added invoke-card/Card/images_bb/core_container.png
Binary file added invoke-card/Card/images_bb/core_divider_group.png
Binary file added invoke-card/Card/images_bb/core_title_bar.png
Binary file added invoke-card/Card/images_bb/core_titlebar_dark.png
Binary file added invoke-card/Card/images_bb/forward.png
Binary file added invoke-card/Card/images_bb/icons-18-black.png
Binary file added invoke-card/Card/images_bb/icons-18-white.png
Binary file added invoke-card/Card/images_bb/icons-36-black.png
Binary file added invoke-card/Card/images_bb/icons-36-white.png
Binary file added invoke-card/Card/images_bb/icons-71-black.png
Binary file added invoke-card/Card/images_bb/icons-71-white.png
Binary file added invoke-card/Card/images_bb/input_error.png
Binary file added invoke-card/Card/images_bb/input_validation.png
Binary file added invoke-card/Card/images_bb/moat.png
Binary file added invoke-card/Card/images_bb/refresh.png
Binary file added invoke-card/Card/images_bb/search.png
Binary file added invoke-card/Card/images_bb/share.png
Binary file added invoke-card/Card/images_bb/site_info.png
Binary file added invoke-card/Card/img/share.png
138 changes: 138 additions & 0 deletions invoke-card/Card/index.htm
@@ -0,0 +1,138 @@
<!DOCTYPE HTML>
<!--
* Copyright 2012 Research In Motion Limited.
*
* 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.
-->

<html>
<head>
<meta charset="utf-8">

<title>Action Bar</title>
<link rel="stylesheet" href="BlackBerry-JQM-all.min.css" />
<script src="webworks-1.0.0.7.js" type="text/javascript"></script>
<script src="BlackBerry-JQM-all.min.js"></script>
<script>

function ready() {

blackberry.event.addEventListener("invoked", function (onInvokedInfo) {
var obj = document.getElementById('image');
obj.src = onInvokedInfo.uri;
});
findShareTargets();

}
window.addEventListener("load", function(e) {
document.addEventListener("webworksready", ready);
}, false);


function findShareTargets() {

var request = {
action: 'bb.action.SHARE',
type: 'image/*',
target_type: ["APPLICATION", "CARD"]
};

blackberry.invoke.query(request, function (response) {
console.log(response);
onSuccessfulFindTargets(response[0].targets)
}, function () {

});
}

function onSuccessfulFindTargets(items) {
var list = "";
for(var i = 0; i < items.length; i++) {
list += '<li><a href="#"><img src="file://'+ items[i].icon + '">' + items[i].label + '</a></li>';
}
$("#share-items").html(list).listveiw();
}


$(document).bind('pageinit', function(){
$("#action-back").bind( "vclick", function() {
console.log("back close")
blackberry.invoked.cardRequestClosure({
reason: "back"
});
});

$("#action-share").bind( "vclick", function() {
console.log($("#sharePage"));
$.mobile.changePage( $("#sharePage"), {transition: "slideup"});
});

});


</script>

<style>
.center {top:50%; margin-top:260px; /* negative half of the height */}
.peek-area {width:10%; height:100%; position:fixed; top:0; left:0;}
</style>
</head>
<body>
<div id="page" data-role="page" data-theme="a">
<div id ="content" data-role="content">

<div data-role="gridview">
<div data-role="row">
<div class="center">
<img id="image" alt="" />
</div>
</div>
</div>
<div id="peek-area" class="peek-area">
</div>

</div><!-- /content -->

<div data-role="footer" data-position="fixed">
<div id="action-bar-area" data-role="actionbar">
<div id= "action-back" data-role="back"></div>
<div id="action-share" data-role="action">
<img src="img/share.png" alt="" />
<p>Share</p>
</div>
</div>
</div>
</div><!-- /page -->

<div id="sharePage" data-role="page" data-dom-cache="true" data-theme="a">
<div data-role="header">
<a href="#page" data-role="button" data-rel="back">Cancel</a>
<h1>Share</h1>
</div>
<div data-role="content">
<ul id="share-items" data-role="listview">
</ul>
</div>
</div><!-- /page -->


<script>
var obj = document.getElementById('peek-area');
obj.addEventListener('touchstart', function(event) {
console.log("peeking")
blackberry.invoked.cardStartPeek("root");
}, false);
</script>

</body>
</html>
Binary file added invoke-card/JAM39_Bhasin.pptx
Binary file not shown.