-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from willianchanlovegithub/WillianChan
[add]first version
- Loading branch information
Showing
56 changed files
with
4,034 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project> | ||
<GlobalSetting xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" DownloadMode="1" ProjectName="ART_Brage" DefaultWinWidth="240" DefaultWinHeight="240" EditorFontSize="24" ProjectParentName="ART_Badge_240_UI_2" GUIVersion="V4"> | ||
</GlobalSetting> | ||
<Solution> | ||
<ART_Brage SubType="Project"> | ||
<UI文件 SubType="UIFile"> | ||
<CustomPanels SubType="CustomPanel"> | ||
<AppListCustomPanel.ui SubType="PageUi" /> | ||
<pointerClock.ui SubType="PageUi" /> | ||
</CustomPanels> | ||
<pages SubType="Directory"> | ||
<list_settings SubType="PageDirectory"> | ||
<list_settings.js SubType="PageJs" /> | ||
<list_settings.ui SubType="PageUi" /> | ||
</list_settings> | ||
<main SubType="PageDirectory"> | ||
<main.js SubType="PageJs" /> | ||
<main.ui SubType="PageUi" /> | ||
</main> | ||
</pages> | ||
</UI文件> | ||
<modules SubType="Modules"> | ||
<digit_clock.js SubType="ModulesJs" /> | ||
<hardware.js SubType="ModulesJs" /> | ||
<pointer_clock.js SubType="ModulesJs" /> | ||
<rtc.js SubType="ModulesJs" /> | ||
</modules> | ||
<app.js SubType="AppJs" /> | ||
<app.json SubType="AppJson" /> | ||
</ART_Brage> | ||
</Solution> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
var notifi_lib = require("notification"); | ||
var msg_items = []; | ||
|
||
var page = { | ||
anim: 0, | ||
touchStartY : 0, // panel中触摸的Y坐标 | ||
touchStartX : 0, // panel中触摸的Y坐标 | ||
touchStartPosition : 0,// page中开始触摸的坐标 | ||
touchEndPosition : 0, // page中结束触摸的坐标 | ||
direction: false, | ||
title:"", | ||
|
||
msg_items: [], | ||
call_back: null, | ||
/* 此方法在第一次显示窗体前发生 */ | ||
onLoad:function(event){ | ||
PageTouchInit(this); | ||
|
||
}, | ||
refreshMsg: function () { | ||
msgs = notifi_lib.getMsgs("NotRead"); | ||
for (var i = 0; i < msgs.length; ++i) { | ||
var item = msgs[i]; | ||
var index = msg_items.indexOf(item); | ||
if (index == -1) | ||
{ | ||
msg_items.push(item);// | ||
} | ||
} | ||
this.loadMsg(msg_items); | ||
|
||
}, | ||
loadMsg: function (items) { | ||
this.setData({ listctrl: { empty: true } }); | ||
var array = []; | ||
for (var i = 0, len = items.length; i < len; i++) { | ||
var data = {}; | ||
var content = ""; | ||
var const_length = 18; | ||
if (items[i].text_content.length > const_length) | ||
content = items[i].text_content.substring(0, const_length) + "..."; | ||
else | ||
content = items[i].text_content; | ||
|
||
data["id"] = items[i].id; | ||
data["content"] = { id: "content" + i, value: content}; | ||
data["icon"] = { id: "icon" + i, value: items[i].icon_path }; | ||
data["title"] = { id: "title" + i, value: items[i].title }; | ||
data["button1"]={id: "btn_" + items[i].id, value:""} | ||
array.push(data); | ||
} | ||
|
||
this.setData({ listctrl: { list: { page: this, items: [{ xml: 'Panels/Top_message_item', items: array }] } } }) | ||
}, | ||
|
||
/* 当前页状态变化为隐藏时触发 */ | ||
onHide: function (event) { | ||
notifi_lib.offNotification(this.call_back); | ||
}, | ||
|
||
/* 此方法展示窗体前发生 */ | ||
onShow:function(event){ | ||
var that = this; | ||
notifi_lib.onNotification(this.call_back = function(event) { | ||
var count = notifi_lib.getCount("NotRead"); | ||
if (count > 0) | ||
that.refreshMsg(); | ||
}); | ||
that.refreshMsg(); | ||
}, | ||
|
||
/* 此方法关闭窗体前发生 */ | ||
onExit:function(event){ | ||
PageTouchUninit(this); | ||
}, | ||
onPageTouch: function (event) { | ||
PageTouchEvent(this, event, | ||
0, | ||
0, | ||
function () { pm.navigateBack() }, | ||
0, | ||
0 | ||
) | ||
}, | ||
|
||
// 添加之后不能更新 | ||
onSwitch:function(event) { | ||
|
||
}, | ||
onClick: function (event) { | ||
console.dir(event); | ||
var id = event.target.id | ||
var str_id = id.substring(4, id.length); | ||
for (var index = 0; index < msg_items.length; index ++) | ||
{ | ||
if (msg_items[index].id == str_id) | ||
{ | ||
item = msg_items[index]; | ||
notifi_lib.updateMsgReadStatus(str_id); | ||
msg_items.splice(index, 1); | ||
notifi_lib.offNotification(this.call_back); | ||
pm.navigateTo({url : 'MessagePage/MessagePage', value : item}) | ||
break; | ||
} | ||
} | ||
|
||
}, | ||
}; | ||
|
||
Page(page); | ||
|
||
page = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<rtgui version="1.0"> | ||
<class>Page</class> | ||
<widget class="Page" bindtouch="onPageTouch" name="Top_message"> | ||
<public> | ||
<property name="background">255, 0, 0, 0</property> | ||
</public> | ||
<widgets> | ||
<widget name="Switch" class="Switch" bindchange="onSwitch"> | ||
<public> | ||
<property name="rect">123, -1, 73, 79</property> | ||
<property name="background">0, 212, 208, 200</property> | ||
</public> | ||
<property name="offBgImg">images/message.png</property> | ||
<property name="onBgImg">images/message.png</property> | ||
</widget> | ||
<widget name="listctrl" class="listctrl"> | ||
<public> | ||
<property name="rect">38, 84, 250, 225</property> | ||
<property name="background">0, 212, 208, 200</property> | ||
</public> | ||
<property name="gap">3</property> | ||
</widget> | ||
</widgets> | ||
</widget> | ||
</rtgui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
var date = new Date(); | ||
|
||
var data_pool; /* dcmlib data pool */ | ||
|
||
var TouchMode = { | ||
cancel: 0, | ||
press: 1, /* 长按 */ | ||
move: 2, /* 移动 */ | ||
} | ||
|
||
var app = { | ||
data: { | ||
/* 全局设定 */ | ||
mainPage: 0, | ||
clockIndex: 2, | ||
date: new Date(), | ||
stepCount: 489, | ||
bpmCount: 100, | ||
isSaveMode: false, | ||
language: "中文", | ||
version: "1.0.2", | ||
flag: 1, | ||
}, | ||
|
||
page: "pages/main/main", | ||
/* app 加载完成触发该函数 */ | ||
onLaunch: function () { | ||
|
||
}, | ||
|
||
/* app 退出触发该函数 */ | ||
onExit: function () { | ||
}, | ||
|
||
}; | ||
|
||
PageTouchInit = function (page) { | ||
page.touchStartY = 0; /* panel中触摸的Y坐标 */ | ||
page.touchStartPosition = 0; /* page中开始触摸的坐标 */ | ||
page.touchEndPosition = 0; /* page中结束触摸的坐标 */ | ||
page.touchStatus = TouchMode.cancel; | ||
page.touchTimer = 0; | ||
page.navigateEnable = true; | ||
} | ||
|
||
PageTouchUninit = function (page) { | ||
var that = page; | ||
if (that.touchTimer != 0) { | ||
clearInterval(that.touchTimer); | ||
that.touchTimer = 0; | ||
} | ||
} | ||
|
||
PageTouchEvent = function (page, event, longPress, R2L, L2R, T2D, D2T) { | ||
var that = page; | ||
var touchItem = event.touchs[0]; | ||
|
||
if (touchItem.type == "touchstart") { | ||
// console.log(" >>> touchStart") | ||
/* 长按操作 */ | ||
that.touchStatus = TouchMode.press; | ||
that.touchStartPosition = { x: touchItem.x, y: touchItem.y }; | ||
// console.log("that.touchTimer: ", that.touchTimer); | ||
if (that.touchTimer != 0) { | ||
clearInterval(that.touchTimer); | ||
that.touchTimer = 0; | ||
} | ||
|
||
that.touchTimer = setTimeout(function () { | ||
// console.log(">> long press"); | ||
clearInterval(that.touchTimer); | ||
that.touchTimer = 0; | ||
if (that.touchStatus == TouchMode.press) { | ||
if (typeof (longPress) == "function") { | ||
longPress(); | ||
} | ||
} | ||
}, 1000); | ||
|
||
} else if (touchItem.type == "touchmove") { | ||
// console.log(" >>> touch move") | ||
that.touchStatus = TouchMode.move; | ||
that.touchEndPosition = { x: touchItem.x, y: touchItem.y }; | ||
} else if (touchItem.type == "touchend") { | ||
console.log(" >>> touch end") | ||
if (that.touchStatus == TouchMode.move) { | ||
var d_ValueX = that.touchEndPosition.x - that.touchStartPosition.x | ||
var d_ValueY = that.touchEndPosition.y - that.touchStartPosition.y | ||
// console.log(" x : " + d_ValueX); | ||
// console.log(" y : " + d_ValueY); | ||
// console.log(" that.navigateEnable : " + that.navigateEnable); | ||
if (d_ValueY > 50 && that.navigateEnable == true) { | ||
console.log("slide down") | ||
if (typeof (T2D) == "function") { | ||
T2D(); | ||
return; | ||
} | ||
} else if (d_ValueY < -50 && that.navigateEnable == true) { | ||
console.log("slide up") | ||
if (typeof (D2T) == "function") { | ||
D2T(); | ||
return; | ||
} | ||
} | ||
|
||
if (d_ValueX > 50 && that.navigateEnable == true) { | ||
console.log("slide right") | ||
if (typeof (L2R) == "function") { | ||
L2R(); | ||
return; | ||
} | ||
} else if (d_ValueX < -50 && that.navigateEnable == true) { | ||
console.log("slide left") | ||
if (typeof (R2L) == "function") { | ||
R2L(); | ||
return; | ||
} | ||
} | ||
} | ||
that.touchStatus = TouchMode.cancel; | ||
if (that.touchTimer != 0) { | ||
clearInterval(that.touchTimer); | ||
that.touchTimer = 0; | ||
} | ||
} else if (touchItem.type == "touchcancel") { | ||
if (that.touchTimer != 0) { | ||
clearInterval(that.touchTimer); | ||
that.touchTimer = 0; | ||
} | ||
} | ||
} | ||
|
||
App(app); | ||
|
||
app = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "320x320", | ||
"version": "v4.0.0", | ||
"tag":[ "demo"], | ||
"icon": "icon.png" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var digit_clock = function (that,date) { | ||
var hourStr; | ||
var minStr; | ||
var secStr; | ||
if(date.getHours() < 10) | ||
{ | ||
hourStr = "0" + date.getHours() | ||
}else{ | ||
hourStr = date.getHours() | ||
} | ||
if(date.getMinutes() < 10) | ||
{ | ||
minStr = "0" + date.getMinutes() | ||
}else{ | ||
minStr = date.getMinutes() | ||
} | ||
if(date.getSeconds() < 10) | ||
{ | ||
secStr = "0" + date.getSeconds() | ||
}else{ | ||
secStr = date.getSeconds() | ||
} | ||
that.setData({ time_label : { value : hourStr + ":" + minStr, refresh : true}}); | ||
that.setData({ date_label : { value : date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate(), refresh : true}}) | ||
} | ||
|
||
module.exports = digit_clock; |
Oops, something went wrong.