Browse files

views enhanced (scroller, nesting), begun detailscreen

  • Loading branch information...
1 parent b7ac1e1 commit 97c6ac9fedb6b805da55872199b22637b65625bd @tauchmi committed May 11, 2012
View
2 buildpackage.bat
@@ -1,5 +1,5 @@
call palm-package src
-call palm-install com.imperialcoder.fuelaustria_1.0.0_all.ipk
+call palm-install com.imperialcoder.fuelaustria_0.1.0_all.ipk
call palm-launch com.imperialcoder.fuelaustria
call palm-log -f com.imperialcoder.fuelaustria
View
BIN com.imperialcoder.fuelaustria_0.1.0_all.ipk
Binary file not shown.
View
BIN com.imperialcoder.fuelaustria_1.0.0_all.ipk
Binary file not shown.
View
4 src/appinfo.json
@@ -1,7 +1,7 @@
{
"id": "com.imperialcoder.fuelaustria",
- "version": "1.0.0",
- "vendor": "Imperialcoder",
+ "version": "0.1.0",
+ "vendor": "ImperialCoder",
"type": "web",
"main": "index.html",
"title": "Fuel Austria",
View
1 src/depends.js
@@ -6,5 +6,6 @@
"source/StationListItem.js",
"source/ErrorDialog.js",
"source/ConnectionView.js",
+ "source/StationDetailView.js",
"css/MainView.css"
);
View
65 src/source/DistrictSelectionView.js
@@ -49,28 +49,24 @@
{kind: "Spacer" }
]
},
- {
- kind: "Scroller",
- flex: 1,
- components: [{
- kind: "VFlexBox",
- className: "box-center",
- components: [
- {kind: "ListSelector", label:'Bundesland', name:'federalStateSelector', popupAlign:'left', contentPack:'middle', onChange: "federalStateChanged", items: [], components: [
- {kind: enyo.Spinner, name: "stateSpinner"}]},
- {kind: "ListSelector", label:'Bezirk', name:'districtSelector', popupAlign:'left', contentPack:'middle', onChange: "districtChanged", items: [], components: [
- {kind: enyo.Spinner, name: "districtSpinner"}]},
- {kind: "ActivityButton", caption: "Bezirkssuche", name: 'searchButton', onclick: "onBezirksAuswahlSucheClick"},
+ {kind: "ListSelector", label:'Bundesland', name:'federalStateSelector', popupAlign:'left', contentPack:'middle', onChange: "federalStateChanged", items: [], components: [
+ {kind: enyo.Spinner, name: "stateSpinner"}]},
+ {kind: "ListSelector", label:'Bezirk', name:'districtSelector', popupAlign:'left', contentPack:'middle', onChange: "districtChanged", items: [], components: [
+ {kind: enyo.Spinner, name: "districtSpinner"}]},
+ {kind: "ActivityButton", caption: "Suche starten", name: 'searchButton', onclick: "onBezirksAuswahlSucheClick"},
+ {kind: "Scroller", flex:1, components: [
+ {kind: "VFlexBox", className: "box-center", components: [
+ {kind: "RowGroup", caption: $L("Stations"), components: [
{kind: "VirtualRepeater", onSetupRow: 'getItem', name: 'priceList', components: [
{kind: "Item", name:'listItem', tapHighlight: true, layoutKind: "HFlexLayout", onclick: "stationSelected", components: [
- {name: "gasStationName", flex: 5},
- {name: "price", flex: 1.2},
+ {name: "gasStationName", flex: 4},
+ {name: "price", flex: 2},
{kind: "Image", flex: 1, name:"open", width:18, height:18}
]}
]}
]}
- ]
- }
+ ]}
+ ]}
],
create: function() {
this.inherited(arguments);
@@ -91,19 +87,26 @@
gotDataFailure: function(sender, response, request) {
enyo.error(enyo.json.stringify(response));
this.showScrim(false);
+ //TODO: error msg
},
gotBezirke: function(sender, response, request){
- this.federalStates = this.getFederalStates(response);
- var items = [];
- enyo.forEach(this.federalStates, function(state){
- items.push({caption: state.bezeichnung, value: state.code, record: state});
- }, this);
- this.$.federalStateSelector.setItems(items);
- this.$.federalStateSelector.setValue(items[0].value);
- this.$.federalStateSelector.itemsChanged();
- this.$.stateSpinner.hide();
- this.$.districtSpinner.show();
- this.federalStateChanged(sender, this.$.federalStateSelector.getValue());
+ if(typeof(response)==='string') {
+ //TODO: display msg
+ } else if(typeof(response)==='object') {
+ this.federalStates = this.getFederalStates(response);
+ var items = [];
+ enyo.forEach(this.federalStates, function(state){
+ items.push({caption: state.bezeichnung, value: state.code, record: state});
+ }, this);
+ this.$.federalStateSelector.setItems(items);
+ this.$.federalStateSelector.setValue(items[0].value);
+ this.$.federalStateSelector.itemsChanged();
+ this.$.stateSpinner.hide();
+ this.$.districtSpinner.show();
+ this.federalStateChanged(sender, this.$.federalStateSelector.getValue());
+ } else {
+ //TODO: else what?
+ }
},
gotBezirkeFailure: function(sender, response, request){
enyo.error('bezirke error');
@@ -163,17 +166,17 @@
getItem: function(sender, index) {
var record = this.getData()[index];
if (record) {
- this.$.listItem.record = record;
this.$.gasStationName.setContent(index + 1 + '. ' + record.gasStationName);
- this.$.price.setContent('' + record.spritPrice[0].amount);
+ this.$.price.setContent(' ' + record.spritPrice[0].amount);
this.$.open.setSrc(this.translateBoolean(record.open));
return true;
}
},
stationSelected: function(sender, mouseEvent, index){
- var record = this.$.listItem.record;
- this.doStationSelected(record);
+ //var record = this.$.listItem.record;
+ var station = this.getData()[index];
+ this.doStationSelected(station);
// enyo.windows.activate(undefined, "OptionView",
// { station: record});
},
View
81 src/source/MainView.js
@@ -8,50 +8,41 @@
{kind: "AppMenu", components: [
{caption: "About", onclick: "openAbout"}
]},
- {kind: "Scroller", flex: 1, components: [
- { kind: "Pane", flex: 1, onSelectView: "viewSelected", components: [
- //TODO: add new pane with retry for network connection
- {
- name: "connectionPane",
- kind: "ConnectionView",
- flex: 1,
- onConnectionEstablished: "connectionEstablished"
- },
- {
- name: "optionPane",
- kind: "OptionView",
- flex: 1,
- lazy: true,
- onDistrictSearchClick: "districtSearchClick",
- onCurrentPositionClick: "currentPositionClick",
- onAddressSearchClick: 'addressSearchClick'
- },
- {
- kind: 'DistrictSelectionView',
- flex: 1,
- name: "districtSelection",
- lazy: true,
- onStationSelected: 'stationSelected',
- onFuelTypeSearch: 'fuelTypeSearch',
- onClosedCheck: 'closedCheck',
- onBackButton: 'backButtonHandler'
- },
- {
- name: "stationDetails",
- kind: "VFlexBox",
- flex: 1,
- lazy: true
- }
- ]}
+ { kind: "Pane", flex: 1, onSelectView: "viewSelected", components: [
+ {
+ name: "connectionPane",
+ kind: "ConnectionView",
+ flex: 1,
+ onConnectionEstablished: "connectionEstablished"
+ },
+ {
+ name: "optionPane",
+ kind: "OptionView",
+ flex: 1,
+ lazy: true,
+ onDistrictSearchClick: "districtSearchClick",
+ onCurrentPositionClick: "currentPositionClick",
+ onAddressSearchClick: 'addressSearchClick'
+ },
+ {
+ kind: 'DistrictSelectionView',
+ flex: 1,
+ name: "districtSelection",
+ lazy: true,
+ onStationSelected: 'stationSelected',
+ onFuelTypeSearch: 'fuelTypeSearch',
+ onClosedCheck: 'closedCheck',
+ onBackButton: 'backButtonHandler'
+ },
+ {
+ kind: 'StationDetailView',
+ flex: 1,
+ name: "stationDetail",
+ lazy: true,
+ onBackButton: 'backButtonHandler'
+ }
]}
],
-// rendered: function() {
-// this.inherited(arguments);
-// this.load();
-// },
-// load: function(){
-// //this.$.optionPane.load();// don't forget to change the setting of the type if getting rid of this method call
-// },
connectionEstablished: function() {
this.$.pane.selectViewByName('optionPane');
@@ -61,8 +52,10 @@
this.$.pane.selectViewByName('districtSelection');
},
- stationSelected: function(station) {//TODO station
- this.$.pane.selectViewByName('stationDetails');
+ stationSelected: function(sender, station) {//TODO station
+ this.$.pane.selectViewByName('stationDetail');
+ this.$.stationDetail.setStation(station);
+ this.$.stationDetail.setStationValues();
},
//helper from now on
View
137 src/source/StationDetailView.js
@@ -0,0 +1,137 @@
+enyo.kind({
+ name: "StationDetailView",
+ kind: enyo.VFlexBox,
+ className: "enyo-bg",
+ events: {
+ onBackButton: ""
+ },
+ published: {
+ station: {}
+ },
+ components: [
+ {kind: "Scrim", layoutKind: "VFlexLayout", align: "center", pack: "center", components: [
+ {kind: "SpinnerLarge"}
+ ]},
+ {
+ kind: "Header",
+ name: "header",
+ className: "enyo-header",
+ pack: "center",
+ components: [
+ {
+ kind: "ToolButton",
+ name: 'back',
+ icon: "images/arrow-left.png",
+ className: "enyo-light-menu-button",
+ onclick: 'backButtonClicked'
+ },
+ {kind: "Spacer" },
+ {
+ kind: "Control",
+ name: "title",
+ content: $L("Fuel Austria"),
+ className: "enyo-text-header page-title"
+ },
+ {kind: "Spacer" }
+ ]
+ },
+ {
+ kind: "Scroller",
+ flex: 1,
+ components: [{
+ kind: "VFlexBox",
+ className: "box-center",
+ components: [
+ {kind: "DividerDrawer", name: "addressDrawer", caption: $L("Address"), open:true, components: [
+ {layoutKind: "HFlexLayout", components:[
+ {layoutKind: "VFlexLayout", flex:2, components:[
+ {kind:"Control", name:"addressContainer", content:""},
+ {kind:"Control", name:"cityContainer", content:""}
+ ]},
+ {kind:"Spacer", flex:0.5},
+ {kind:"Control", name:"priceContainer", flex:1, content:""}
+ ]}
+ ]},
+ {kind: "DividerDrawer", name:"opneningHoursContainer", caption: $L("OpeningHours"), open:false, components: []},
+ {kind: "DividerDrawer", caption: $L("Contact"), open:false, components: [
+ {content: $L("Mail"), flex:1},
+ {kind:"Control", name:"mailContainer", content:""},
+ {kind:"Spacer"},
+ {content: $L("Telephone")},
+ {kind:"Control", name:"telephoneContainer", content:""},
+ {kind:"Spacer"},
+ {content: $L("Fax")},
+ {kind:"Control", name:"faxContainer", content:""},
+ {kind:"Spacer"},
+ {content: $L("URL")},
+ {kind:"Control", name:"urlContainer", content:""}
+ ]},
+ {kind: "DividerDrawer", caption: $L("Offer"), open:false, components: [
+ {kind:"Control", name:"OfferContent", content: ""}
+ ]},
+ {kind: "DividerDrawer", caption: $L("Payment"), open:false, components: [
+ {kind:"Control", name:"paymentContent", content: ""}
+ ]},
+ {kind: "DividerDrawer", caption: $L("Misc"), open:false, components: [
+ {kind:"Control", name:"miscContent", content: ""}
+ ]},
+ {kind: "DividerDrawer", caption: $L("Map"), open:false, components: [
+ {kind:"Control", name:"mapContent", content: ""}
+ ]}
+ ]}
+ ]
+ }
+ ],
+ setStationValues: function(){
+ var station = this.getStation();
+ if(station){
+ //address
+ this.$.addressDrawer.setCaption(station.gasStationName);
+ this.$.addressContainer.setContent(station.address);
+ this.$.cityContainer.setContent(station.city);
+ this.$.priceContainer.setContent('' + station.spritPrice[0].amount);
+ //openinghours
+ enyo.forEach([1,2,3,4,5,6,7,8], function(order){
+ this.getOpeningHoursByOrder(order);
+ }, this);
+ this.$.opneningHoursContainer.render();
+ //contact
+ this.$.mailContainer.setContent(station.mail);
+ this.$.telephoneContainer.setContent(station.telephone);
+ this.$.faxContainer.setContent(station.fax);
+ this.$.urlContainer.setContent(station.url);
+ } else {
+ //TODO:
+ }
+
+ },
+ getOpeningHoursByOrder: function(order){
+ var openingHours = this.getStation().openingHours;
+ if(openingHours){
+ enyo.forEach(openingHours, function(openingHour){
+ if(openingHour.day.order === order){
+ var hours = openingHour.beginn + ' - ' + openingHour.end;
+ this.$.opneningHoursContainer.createComponent({
+ kind: "Control",
+ content: openingHour.day.dayLabel,
+ owner: this
+ });
+ this.$.opneningHoursContainer.createComponent({
+ kind: "Spacer",
+ owner: this
+ });
+ this.$.opneningHoursContainer.createComponent({
+ kind: "Control",
+ content: hours,
+ owner: this
+ });
+ return false;
+ }
+ }, this);
+ }
+ },
+ backButtonClicked: function(sender, mouseEvent) {
+ //this.$.addressDrawer.destroyControls();
+ this.doBackButton();
+ }
+});

0 comments on commit 97c6ac9

Please sign in to comment.