Skip to content

Commit

Permalink
Add time span switch.
Browse files Browse the repository at this point in the history
  • Loading branch information
vestige committed Oct 7, 2012
1 parent b65db40 commit edd5caa
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 18 deletions.
24 changes: 18 additions & 6 deletions Resources/app.js
Expand Up @@ -29,7 +29,7 @@ var qa = Ti.UI.createLabel({
}); });


var count = Ti.UI.createLabel({ var count = Ti.UI.createLabel({
text: '88:88', text: '00:00',
color: '#444', color: '#444',
top: 20, top: 20,
font:{fontSize: '250%'}, font:{fontSize: '250%'},
Expand All @@ -49,16 +49,24 @@ var toolview = Ti.UI.createView({


var start = Ti.UI.createButton({ var start = Ti.UI.createButton({
title: 'start', title: 'start',
height: 42,
}); });


var stop = Ti.UI.createButton({ var stop = Ti.UI.createButton({
title: 'stop', title: 'stop',
left: 10, left: 10,
height: 42,
}); });


var clear = Ti.UI.createButton({ var clear = Ti.UI.createButton({
title: 'clear', title: 'clear',
left: 10, left: 10,
height: 42,
});

var spanSwitch = Ti.UI.createSwitch({
left: 10,
value: true
}); });


function date_format(counting) { function date_format(counting) {
Expand Down Expand Up @@ -86,8 +94,8 @@ function update () {
if (tmp_time.getSeconds() != past_time.getSeconds()) { if (tmp_time.getSeconds() != past_time.getSeconds()) {
counting -= 1; counting -= 1;
if (counting < 0) { if (counting < 0) {
qa.text = ''; qa.text = 'Finish!';
count.text = "Finish"; count.text = "88888888";
stop.fireEvent('click'); stop.fireEvent('click');
} else { } else {
if (counting == remain) { if (counting == remain) {
Expand All @@ -112,8 +120,12 @@ var pause = 0;
function timerClear(){ function timerClear(){
start_time = new Date(); start_time = new Date();
past_time = start_time; past_time = start_time;
counting = 10; if (spanSwitch.value) {
remain = 5; counting = 25 * 60;
} else {
counting = 15 * 60;
}
remain = 5 * 60;
count.text = date_format(counting); count.text = date_format(counting);
qa.text = ''; qa.text = '';
contents.backgroundColor = '#000'; contents.backgroundColor = '#000';
Expand Down Expand Up @@ -150,7 +162,7 @@ contents.add(count);
toolview.add(start); toolview.add(start);
toolview.add(stop); toolview.add(stop);
toolview.add(clear); toolview.add(clear);

toolview.add(spanSwitch);
footer.add(toolview); footer.add(toolview);


ground.add(top); ground.add(top);
Expand Down
28 changes: 18 additions & 10 deletions build/mobileweb/app.js
@@ -1,7 +1,3 @@
// 10min + 5min(Q&A) 最後に拍手
// 20min + 5min(Q&A) 最後に拍手
//optiondialog , switch

Titanium.UI.setBackgroundColor('#000'); Titanium.UI.setBackgroundColor('#000');


var ground = Ti.UI.createWindow({ var ground = Ti.UI.createWindow({
Expand Down Expand Up @@ -33,7 +29,7 @@ var qa = Ti.UI.createLabel({
}); });


var count = Ti.UI.createLabel({ var count = Ti.UI.createLabel({
text: '88:88', text: '00:00',
color: '#444', color: '#444',
top: 20, top: 20,
font:{fontSize: '250%'}, font:{fontSize: '250%'},
Expand All @@ -53,16 +49,24 @@ var toolview = Ti.UI.createView({


var start = Ti.UI.createButton({ var start = Ti.UI.createButton({
title: 'start', title: 'start',
height: 42,
}); });


var stop = Ti.UI.createButton({ var stop = Ti.UI.createButton({
title: 'stop', title: 'stop',
left: 10, left: 10,
height: 42,
}); });


var clear = Ti.UI.createButton({ var clear = Ti.UI.createButton({
title: 'clear', title: 'clear',
left: 10, left: 10,
height: 42,
});

var spanSwitch = Ti.UI.createSwitch({
left: 10,
value: true
}); });


function date_format(counting) { function date_format(counting) {
Expand Down Expand Up @@ -90,8 +94,8 @@ function update () {
if (tmp_time.getSeconds() != past_time.getSeconds()) { if (tmp_time.getSeconds() != past_time.getSeconds()) {
counting -= 1; counting -= 1;
if (counting < 0) { if (counting < 0) {
qa.text = ''; qa.text = 'Finish!';
count.text = "Finish"; count.text = "88888888";
stop.fireEvent('click'); stop.fireEvent('click');
} else { } else {
if (counting == remain) { if (counting == remain) {
Expand All @@ -116,8 +120,12 @@ var pause = 0;
function timerClear(){ function timerClear(){
start_time = new Date(); start_time = new Date();
past_time = start_time; past_time = start_time;
counting = 10; if (spanSwitch.value) {
remain = 5; counting = 25 * 60;
} else {
counting = 15 * 60;
}
remain = 5 * 60;
count.text = date_format(counting); count.text = date_format(counting);
qa.text = ''; qa.text = '';
contents.backgroundColor = '#000'; contents.backgroundColor = '#000';
Expand Down Expand Up @@ -154,7 +162,7 @@ contents.add(count);
toolview.add(start); toolview.add(start);
toolview.add(stop); toolview.add(stop);
toolview.add(clear); toolview.add(clear);

toolview.add(spanSwitch);
footer.add(toolview); footer.add(toolview);


ground.add(top); ground.add(top);
Expand Down
4 changes: 2 additions & 2 deletions build/mobileweb/titanium/filesystem.registry
@@ -1,10 +1,10 @@
ts 1349606178000 ts 1349608519000
Default-Landscape.jpg 36232 Default-Landscape.jpg 36232
Default-Portrait.jpg 28479 Default-Portrait.jpg 28479
Default.jpg 17184 Default.jpg 17184
KS_nav_ui.png 1158 KS_nav_ui.png 1158
KS_nav_views.png 1074 KS_nav_views.png 1074
app.js 2824 app.js 2939
appicon.png 19109 appicon.png 19109
apple-touch-icon-114x114-precomposed.png 15820 apple-touch-icon-114x114-precomposed.png 15820
apple-touch-icon-57x57-precomposed.png 6790 apple-touch-icon-57x57-precomposed.png 6790
Expand Down

0 comments on commit edd5caa

Please sign in to comment.