Skip to content

Commit

Permalink
添加sample
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewj committed Mar 13, 2017
1 parent d997cc4 commit a089dcc
Show file tree
Hide file tree
Showing 126 changed files with 6,163 additions and 0 deletions.
5 changes: 5 additions & 0 deletions BBSSDKGUI/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<manifest package="com.mob.bbssdk.gui">

<application/>

</manifest>
11 changes: 11 additions & 0 deletions BBSSDKGUI/assets/html/details/css/base.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions BBSSDKGUI/assets/html/details/css/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added BBSSDKGUI/assets/html/details/img/default_pic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BBSSDKGUI/assets/html/details/img/fileicon-default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BBSSDKGUI/assets/html/details/img/fileicon-doc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BBSSDKGUI/assets/html/details/img/fileicon-mp4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BBSSDKGUI/assets/html/details/img/fileicon-pdf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BBSSDKGUI/assets/html/details/img/fileicon-ppt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BBSSDKGUI/assets/html/details/img/headimg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BBSSDKGUI/assets/html/details/img/icon1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BBSSDKGUI/assets/html/details/img/icon3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions BBSSDKGUI/assets/html/details/imgshow.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>图片展示页面</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="/favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">

<link rel="stylesheet" type="text/css" href="./css/base.css">
<link rel="stylesheet" type="text/css" href="./css/main.css">

</head>
<body>
<div class="page"></div>
<script type="text/javascript" src="./js/base.js"></script>
<script type="text/javascript" src="./js/BBSSDK.js"></script>
<script type="text/javascript">
var getimgdata = BBSSDKNative.getImageUrlsAndIndex();

$(function(){
var imgList = [];
var imgindex = getimgdata.index ? getimgdata.index : 0;
if(getimgdata.imageUrls){
for(var i =0; i <= getimgdata.imageUrls.length-1; i++){
imgList.push("img/default_pic.png");
}
var myPhotoBrowserStandalone = $.photoBrowser({
photos : imgList,
onSlideChangeEnd: function(swiper){
BBSSDKNative.setCurrentImageSrc($(swiper.slides[swiper.activeIndex]).find("img").attr("src"),swiper.activeIndex);
}
});
myPhotoBrowserStandalone.open(imgindex);
BBSSDKNative.downloadImages(getimgdata.imageUrls);
}
});
</script>
</body>
</html>
65 changes: 65 additions & 0 deletions BBSSDKGUI/assets/html/details/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>详情页</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="/favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">

<link rel="stylesheet" type="text/css" href="./css/base.css">
<link rel="stylesheet" type="text/css" href="./css/main.css">

</head>
<body>
<div class="page detail-page">
<div class="content">
<div class="main-content">
<div class="title-content">
<h1 dz-bind="data.subject"></h1>
<p class="sub">
<span dz-bind="data.createdOn"></span>
<span dz-bind="data.replies"><i class="mobicon mobicon-common"></i></span>
</p>
</div>
<div class="detail-content">
<div class="header">
<span class="headimg" dz-bind="data.avatar"></span>
<span dz-bind="data.author"></span>
<span class="tip">楼主</span>
</div>
<div class="center" dz-bind="data.message"></div>
<div class="bottom" dz-repeat="data.attachments">
<p>
<i class="mobicon mobicon-dz{{item.extension}}"></i>
<span class="filename">{{item.fileName}}</span>
<a href="javascript:;" class="external dz-filehref">打开附件</a>
</p>
</div>
</div>
</div>
<div class="content-block-title">评论</div>
<div class="common-content infinite-scroll" data-distance="10">
<ul></ul>
<!-- 加载提示符 -->
<div class="infinite-scroll-preloader">
<div class="preloader"></div>
<div class="preloader-text"><span>正在加载中...</span></div>
</div>
<div class="dz-loading-over">
<span>暂无评论</span>
</div>
</div>
</div>
<!-- <div class="bar bar-footer">
<button class="button button-block"><i class="mobicon mobicon-common-green"></i>我要评论</button>
</div> -->
</div>

<script type="text/javascript" src="./js/base.js"></script>
<script type="text/javascript" src="./js/BBSSDK.js"></script>
<script type="text/javascript" src="./js/main.js"></script>
</body>
</html>
138 changes: 138 additions & 0 deletions BBSSDKGUI/assets/html/details/js/BBSSDK.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
(function() {
/*获取主题帖子详情*/
function getForumThreadDetails() {
try {
if (window.forumThread) {
return JSON.parse(window.forumThread.getForumThreadDetails());
} else {
return JSON.parse(prompt("getForumThreadDetails"));
}
} catch(err) {
return null;
}
}

/*获取主题帖子回帖列表*/
function getPosts(fid, tid, page, pageSize, callback) {
try {
var postList = [];
if (window.forumThread) {
postList = JSON.parse(window.forumThread.getPosts(fid, tid, page, pageSize));
} else {
var map = {
fid: fid,
tid: tid,
page: page,
pageSize: pageSize
};
postList = JSON.parse(prompt("getPosts", JSON.stringify(map)));
}
if (postList && postList.length > 0) {
callback(postList);
return;
}
} catch(err) {
err.toString();
}
callback(false);
}

/*打开图片*/
function openImage(imageUrls, index) {
if (window.forumThread) {
window.forumThread.openImage(imageUrls, index);
} else {
var map = {
imageUrls: imageUrls,
index: index
};
prompt("openImage", JSON.stringify(map));
}
}

/*打开附件*/
function openAttachment(attachment) {
if (window.forumThread) {
window.forumThread.openAttachment(JSON.stringify(attachment));
} else {
prompt("openAttachment", JSON.stringify(attachment));
}
}

/*打开链接*/
function openHref(url) {

}

/*获取网页图片集和当前点击的图片id*/
function getImageUrlsAndIndex() {
if (window.forumImage) {
return JSON.parse(window.forumImage.getImageUrlsAndIndex());
} else {
return JSON.parse(prompt("getImageUrlsAndIndex"));
}
}

/*设置当前页面图片地址和index*/
function setCurrentImageSrc(imgSrc, index) {
console.log(imgSrc);
console.log(index);
if (window.forumImage) {
window.forumImage.setCurrentImageSrc(imgSrc, index);
} else {
var map = {
imageSrc: imgSrc,
index: index
};
prompt("setCurrentImageSrc", JSON.stringify(map));
}
}

/* 下载图片,imgUrlList为界面所有的img标签对应的图片链接 */
function downloadImages(imgUrls) {
if (window.forumThread) {
window.forumThread.downloadImages(imgUrls);
} else if (window.forumImage) {
window.forumImage.downloadImages(imgUrls);
} else {
var map = {
imgUrls: imgUrls,
};
prompt("downloadImages", JSON.stringify(map));
}
}

/* 显示图片,替换imgUrl对应的img标签的src值为imgSrc,其中imgSrc为Native已经下载好的本地图片地址 */
function showImage(index, imgUrlMD5, imgSrc, isImageViewer) {
if (isImageViewer) {
if (imgSrc) {
$(".photo-browser .photo-browser-swiper-container .swiper-slide").eq(index).find("img").attr("src", imgSrc);
} else {
$(".photo-browser .photo-browser-swiper-container .swiper-slide").eq(index).find("img").attr("src", "img/default_pic_error.png");
}
} else {
$.each($("[dz-imgshow]"), function(index, item){
if (item.src_link == imgUrlMD5) {
if (imgSrc) {
item.src = imgSrc;
} else {
item.src = "img/default_pic_error.png";
}
}
});
}
}

/*定义BBSSDKNative全局属性*/
window.BBSSDKNative = {
getForumThreadDetails: getForumThreadDetails,
getPosts: getPosts,
openImage: openImage,
openAttachment: openAttachment,
openHref: openHref,
getImageUrlsAndIndex: getImageUrlsAndIndex,
setCurrentImageSrc: setCurrentImageSrc,
downloadImages: downloadImages,
showImage: showImage
}
})();
7 changes: 7 additions & 0 deletions BBSSDKGUI/assets/html/details/js/base.js

Large diffs are not rendered by default.

Loading

0 comments on commit a089dcc

Please sign in to comment.