This is a quick example of how to create a fading actionbar effect like this in Appcelerator Titanium
The MIT License (MIT)
This is a quick example of how to create a fading actionbar effect like this in Appcelerator Titanium
The MIT License (MIT)
/** | |
* We're going to create an infinite scrollable list. In this case, we're going to show a date. When you swipe left, | |
* you'll see yesterday. Then the day before yesterday, and so on. Swiping right shows you tomorrow, and so on. | |
*/ | |
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
var isAndroid = Ti.Platform.osname === 'android'; | |
/** | |
* Track where we are in the infinite scrollable views, and define how large of a step goes between each view. | |
*/ | |
var currentDate = new Date(), msIntervalBetweenViews = 1000/*ms*/ * 60/*s*/ * 60/*m*/ * 24/*h*/; |
Alloy.createWidget = function(id, name, args) { | |
Ti.Analytics.featureEvent("widget." + id, args); | |
return new (require("alloy/widgets/" + id + "/controllers/" + (name || "widget")))(args); | |
}; | |
Alloy.createController = function(name, args) { | |
Ti.Analytics.featureEvent("controller." + name, args); | |
return new (require("alloy/controllers/" + name))(args); | |
}; |
<!-- note the ONLY change to this is the additional module="tabIndicator" | |
attribute + properties to override indicator defaults //--> | |
<Alloy> | |
<TabGroup module="tabIndicator" tabsBackgroundColor="#000" tabIndicatorHeight="1" tabIndicatorColor="white" tabIndicatorWidth="75%"> | |
<Tab title="Tab 1" icon="/images/icons/519-tools-1.png" activeIcon="/images/icons/519-tools-1_active.png" color="#555" activeColor="#fff"> | |
<Window title="Tab 1" barColor="black" navTextColor = "#fff"> | |
<Label onClick="openWin1">Tab 1</Label> | |
</Window> | |
</Tab> | |
<Tab title="Tab 2" icon="/images/icons/516-archive-box.png" activeIcon="/images/icons/516-archive-box_active.png" color="#555" activeColor="#fff"> |
// Animated start. Comments for code here: http://www.tidev.io/2015/01/06/how-to-re-use-the-launch-image-in-the-app | |
var img = Ti.UI.createImageView({ | |
// Get the launch image | |
image: (function getImage() { | |
if (OS_IOS) { | |
// Working around orientation-bug | |
if (Ti.Platform.osname === 'ipad' || Math.max(Ti.Platform.displayCaps.platformWidth, Ti.Platform.displayCaps.platformHeight) === 736) { | |
return 'Default-' + (Ti.Gesture.isPortrait() ? 'Portrait' : 'Landscape') + '.png'; | |
} else { | |
return 'Default.png'; |
var rootWin = Ti.UI.createWindow(); | |
var navGroup = Ti.UI.iPhone.createNavigationGroup({ | |
window: rootWin | |
}); | |
var button = Ti.UI.createButton({ | |
title: 'Open ListView Tests' | |
}); | |
button.addEventListener('click', function() { | |
openTestsWindow(); | |
}); |
It is a PITA working with Appecelerator Alloy Models and Collection because you need to create these template files for everything, even of you are not using them. This is a "HACK" that I came up with after a few hours that appears to address the issue.
I am certain that there might be a cleaner way, which would require deeper understand of the underpinnings of Alloy, maybe someone can make a suggestion, maybe it will come to me later.
###Notes This code is using a ACS Sync Adapter customize for cloud services with promises integration
https://github.com/aaronksaunders/Appcelerator-Cloud-Services-Sync-Adapter
var fadeIntro = Titanium.UI.createAnimation(); | |
fadeIntro.opacity = 1.0; | |
fadeIntro.duration = 250; | |
var fadeOutro = Titanium.UI.createAnimation(); | |
fadeOutro.opacity = 0.0; | |
fadeOutro.duration = 250; | |
var fadeOutSlow = Titanium.UI.createAnimation(); |
<Alloy> | |
<NavigationWindow id="nav" formFactor="handheld"> | |
<Window id="win" class="container"> | |
<LeftNavButton> | |
<Button systemButton="Titanium.UI.iPhone.SystemButton.EDIT" onClick="doClick"/> | |
</LeftNavButton> | |
<RightNavButton> | |
<Button systemButton="Titanium.UI.iPhone.SystemButton.ADD" onClick="doClick"/> |