</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
<name>json.validation.builder</name>
<arguments>
</arguments>
</dictionary>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.tizen.web.privilege.nature.PrivilegeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.tizen.web.editor.css.nature.CSSBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>json.validation.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.tizen.web.project.builder.WebNature</nature>
+ <nature>org.tizen.web.privilege.nature.PrivilegeNature</nature>
+ <nature>org.tizen.web.editor.css.nature.CSSNature</nature>
</natures>
</projectDescription>
<tizen:application id="QmwDyrmOzO.BluetoothChat" package="QmwDyrmOzO" required_version="2.2"/>
<content src="index.html"/>
<icon src="icon.png"/>
- <name>BluetoothChat</name>
+ <name>Bluetooth chat</name>
<tizen:privilege name="http://tizen.org/privilege/application.launch"/>
<tizen:privilege name="http://tizen.org/privilege/bluetooth.admin"/>
<tizen:privilege name="http://tizen.org/privilege/bluetooth.gap"/>
}
#chat-header .ui-btn-footer-down {
- width: 45px;
+ top: 19px;
right: 0px;
}
}
#keyboard-ok-button {
- position: absolute;
- right: 5px;
- bottom: 15px;
- width: 40px;
+ width: 30%;
}
#ui-textArea {
font-size: 1.4em;
}
+#chat-header {
+ min-height: 2.5em;
+}
+
#chat-header-type {
font-size: 0.5em;
position: absolute;
}
#discovering {
- right: 17px;
- top: 17px;
+ right: 8px;
+ top: 8px;
}
-.focus {}
\ No newline at end of file
+.focus {}
+
+.ui-btn-back {
+ visibility:hidden;
+}
</head>
<body>
- <div id="start" data-role="page" data-add-back-btn="header">
+ <div id="start" data-role="page">
<div id="start-header" data-role="header" data-position="fixed">
<h1>Bluetooth chat</h1>
</div>
<div data-role="button" class="ui-btn-start" id="clientButton" style="display: none;">Join server</div>
<div data-role="button" class="ui-btn-start" id="turnOnButton" style="display: none;">Turn bluetooth on</div>
<div id="start-monit" style="display: none;">
- <p>... waiting for bluetooth radio ...</p>
+ <p>Waiting for Bluetooth radio...</p>
</div>
</div>
</div>
setTimeout(function () { $('#keyboard-text').focus(); }, 500);
});
- $('#keyboard-header').on('tap', '#keyboard-back-button', function (event) {
- event.preventDefault();
- app.setDoNotSendBye(true);
- $.mobile.changePage('#start');
- });
-
- $('#keyboard-header').on('tap', '#keyboard-ok-button', function (event) {
+ $('#keyboard-ok-button').on('tap', function (event) {
event.preventDefault();
var value = $('#keyboard-text').val(), mode;
if (value.length !== 0) {
self.ui.checkSendButtonState();
});
+ $('#text').on('focus', function () {
+ var content = $('#chat-content');
+ if (self.ui.scrolltimeout !== null) {
+ clearTimeout(self.ui.scrolltimeout);
+ }
+ self.ui.scrolltimeout = setTimeout(function () {
+ self.ui.scrolltimeout = null;
+ self.ui.scrollToBottom(content);
+ }, 1000);
+ });
+
+ $('#text').on('blur', function () {
+ var content = $('#chat-content');
+ if (self.ui.scrolltimeout !== null) {
+ clearTimeout(self.ui.scrolltimeout);
+ }
+ self.ui.scrolltimeout = setTimeout(function () {
+ self.ui.scrolltimeout = null;
+ self.ui.scrollToBottom(content);
+ }, 700);
+ });
+
$('#ui-mySend').on('tap', function (event) {
event.stopPropagation();
var message = $('#text').val();
$('#visibilityOK').trigger('tap');
});
- document.addEventListener('tizenhwkey', function(e) {
+ $('#chat-content').on('touchstart', function () {
+ if (self.ui.scrolltimeout !== null) {
+ clearTimeout(self.ui.scrolltimeout);
+ self.ui.scrolltimeout = null;
+ }
+ });
+
+ window.addEventListener('tizenhwkey', function(e) {
if (e.keyName == "back") {
+ event.preventDefault();
+ app.setDoNotSendBye(true);
if ($.mobile.activePage.attr('id') === 'start') {
tizen.application.getCurrentApplication().exit();
+ } else if ($.mobile.activePage.attr('id') === 'chat') {
+ $.mobile.changePage('#start');
} else {
history.back();
}
uiEvents: null,
/**
+ * Timeout for chat scroll.
+ */
+ scrolltimeout: null,
+
+ /**
* UI module initialisation
*/
init: function Ui_init(callback) {
}
},
- moveMessagesListDown: function Ui_moveMessagesListDown(content, listHeight) {
- var delta = content.height() - listHeight;
- if (delta < 0) {
- content.scrollview('scrollTo', 0, delta, 500);
- }
+ scrollToBottom: function Ui_scrollToBottom(element) {
+ var bottom = element.children().first().outerHeight(true) - element.height();
+ element.scrollview('scrollTo', 0, -Math.max(0, bottom), 0);
},
displaySentMessage: function Ui_displaySentMessage(message) {
ul.append(listElement);
ul.listview('refresh');
this.checkSendButtonState();
- setTimeout(function () { self.moveMessagesListDown(content, ul.height()); }, 200);
+ this.scrolltimeout = setTimeout(function () {
+ self.scrolltimeout = null;
+ self.scrollToBottom(content);
+ }, 700);
},
setDiscoveringProgress: function Ui_setDiscoveringProgress(boolean) {
-<div id="chat" data-role="page" data-add-back-btn="header" data-footer-exist="true">
+<div id="chat" data-role="page" data-footer-exist="true">
<div id="chat-header" data-role="header" data-position="fixed">
<h1><span id="chat-header-type"></span><span id="chat-header-name"></span></h1>
</div>
-<div data-role="page" id="choose" data-add-back-btn="footer" data-footer-exist="true">
+<div data-role="page" id="choose">
<div data-role="header" id="choose-header" data-position="fixed">
<h1>Choose your server</h1>
<div data-role="progress" data-style="circle" id="discovering"></div>
<div data-role="content" id="choose-content">
<ul data-role="listview"></ul>
</div>
-
- <div data-role="footer" data-position="fixed" id="choose-footer"></div>
</div>
\ No newline at end of file
<div data-role="page" id="keyboard" data-add-back-btn="none">
<div data-role="header" id="keyboard-header" data-position="fixed">
<h1></h1>
- <a data-role="button" id="keyboard-ok-button">OK</a>
- <a data-role="button" id="keyboard-back-button">Back</a>
</div>
<div data-role="content" id="keyboard-content">
<input type="text" id="keyboard-text" maxlength="20"/>
+ <div data-role="button" class="ui-btn-start" id="keyboard-ok-button">OK</div>
</div>
</div>
\ No newline at end of file