Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1669] iOS: Text on gradient showing unwanted opacity, sdk 4 & 1.4

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionNeeds more info
Resolution Date2012-07-26T11:43:56.000+0000
Affected Version/sRelease 1.5.0
Fix Version/sn/a
ComponentsiOS
Labelsn/a
Reporterctredway
AssigneeNeeraj Gupta
Created2011-04-15T02:58:55.000+0000
Updated2012-07-26T22:24:07.000+0000

Description

The below code shows the text has a less than 1 opacity when the gradient is behind the text.

http://developer.appcelerator.com/s3/retrieve/ticket/39411/helpdesk.appcelerator.com/ticket:0:37b2b3af9a505c7d5ec10b839ac1f547ef958381%7Cscreen%20shot%202010-08-29%20at%201.10.54%20pm.png"> http://developer.appcelerator.com/s3/retrieve/ticket/39411/helpdesk...

var window = Titanium.UI.createWindow();

var win = Ti.UI.currentWindow;

var xhr = Titanium.Network.createHTTPClient();

xhr.onload = function()
{ var doc = this.responseXML.documentElement;

Ti.API.log(this.responseText);

var prices = doc.getElementsByTagName("prices"); Ti.API.log(doc.getElementsByTagName("goldcurrent").item(0).text); / var goldCurrent = prices.item(0); var goldChange = prices.item(1); var silverCurrent = prices.item(2); var silverChange = prices.item(3); var platinumCurrent = prices.item(4); var platinumChange = prices.item(5); var palladiumCurrent = prices.item(6); var palladiumChange = prices.item(7); /

var goldCurrent = doc.getElementsByTagName("goldcurrent").item(0).text; var goldChange = doc.getElementsByTagName("goldchange").item(0).text; var silverCurrent = doc.getElementsByTagName("silvercurrent").item(0).text; var silverChange = doc.getElementsByTagName("silverchange").item(0).text; var platinumCurrent = doc.getElementsByTagName("platinumcurrent").item(0).text; var platinumChange = doc.getElementsByTagName("platinumchange").item(0).text; var palladiumCurrent = doc.getElementsByTagName("palladiumcurrent").item(0).text; var palladiumChange = doc.getElementsByTagName("palladiumchange").item(0).text;

goldCurrentNumber = goldCurrent; silverCurrentNumber = silverCurrent; platinumCurrentNumber = platinumCurrent; palladiumCurrentNumber = palladiumCurrent;

goldChangeNumber = goldChange; silverChangeNumber = silverChange; platinumChangeNumber = platinumChange; palladiumChangeNumber = palladiumChange;

if (goldChange >= 0) {

goldChangeColor = 'green';

} else if (goldChange < 0 ) {

goldChangeColor = 'red';

}

if (silverChange >= 0) {

silverChangeColor = 'green';

} else if (silverChange < 0) {

silverChangeColor = 'red';

}

if (platinumChange >= 0) {

platinumChangeColor = 'green';

} else if (platinumChange < 0) {

platinumChangeColor = 'red';

}

if (palladiumChange >= 0) {

palladiumChangeColor = 'green';

} else if (palladiumChange < 0) {

palladiumChangeColor = 'red';

}

var goldPriceView = Titanium.UI.createView({

contentWidth:500,
contentHeight:50,
top:90,
height:30,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); window.add(goldPriceView);

var goldCurrentLabel = Ti.UI.createLabel({

font:{fontSize:20, fontFamily:'Courier-BoldOblique'},
color:goldChangeColor,
left:10,
text:'$'+goldCurrentNumber

}); goldPriceView.add(goldCurrentLabel);

var goldChangeLabel = Ti.UI.createLabel({

 font:{fontSize:20, fontFamily:'Courier-BoldOblique'},
color:goldChangeColor,
left:150,
text:goldChangeNumber

});

goldPriceView.add(goldChangeLabel);

var silverPriceView = Titanium.UI.createView({

contentWidth:500,
contentHeight:50,
top:145,
height:30,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); window.add(silverPriceView);

var silverCurrentLabel = Ti.UI.createLabel({

font:{fontSize:20, fontFamily:'Courier-BoldOblique'},
color:silverChangeColor,
left:10,
text:'$'+silverCurrentNumber

}); silverPriceView.add(silverCurrentLabel);

var silverChangeLabel = Ti.UI.createLabel({

font:{fontSize:20, fontFamily:'Courier-BoldOblique'},
color:silverChangeColor,
left:150,
text:silverChangeNumber

}); silverPriceView.add(silverChangeLabel);

var platinumPriceView = Titanium.UI.createView({

contentWidth:500,
contentHeight:50,
top:200,
height:30,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); window.add(platinumPriceView);

var platinumCurrentLabel = Ti.UI.createLabel({

font:{fontSize:20, fontFamily:'Courier-BoldOblique'},
color:platinumChangeColor,  
left:10,
text:'$'+platinumCurrentNumber

}); platinumPriceView.add(platinumCurrentLabel);

var platinumChangeLabel = Ti.UI.createLabel({

font:{fontSize:20, fontFamily:'Courier-BoldOblique'},
color:platinumChangeColor,
left:150,
text:platinumChangeNumber

}); platinumPriceView.add(platinumChangeLabel);

var palladiumPriceView = Titanium.UI.createView({

contentWidth:500,
contentHeight:50,
top:255,
height:30,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); window.add(palladiumPriceView);

var palladiumCurrentLabel = Ti.UI.createLabel({

font:{fontSize:20, fontFamily:'Courier-BoldOblique'},
color:'green',
left:10,
text:'$'+palladiumCurrentNumber

}); palladiumPriceView.add(palladiumCurrentLabel);

var palladiumChangeLabel = Ti.UI.createLabel({

font:{fontSize:20, fontFamily:'Courier-BoldOblique'},
color:'green',
left:150,
text:palladiumChangeNumber

}); palladiumPriceView.add(palladiumChangeLabel);

};

xhr.open('GET','http://m.hayekinstitute.ca/app/freetest.php')">http://m.hayekinstitute.ca/app/freetest.php');
xhr.send();

var title = Titanium.UI.createImageView({
image:'img/metalsmobile.png', bottom:425, right:60 }); window.add(title);

var spotprice = Titanium.UI.createLabel({
bottom:380, left:20, font:{fontSize:16, fontFamily:'Helvetica'}, text:'Spot Price', color:'#ffffff' }); window.add(spotprice);

var info = Titanium.UI.createImageView({
image:"img/infoicon.png", bottom:430, left:250 }); window.add(info);

info.addEventListener('click', function()
{

var t = Titanium.UI.create2DMatrix(); t = t.scale(0);

var w = Titanium.UI.createWindow({

backgroundColor:'#336699',
borderWidth:8,
borderColor:'#999',
height:400,
width:300,
borderRadius:10,
opacity:0.92,
transform:t

});

// create first transform to go beyond normal size var t1 = Titanium.UI.create2DMatrix(); t1 = t1.scale(1.1); var a = Titanium.UI.createAnimation(); a.transform = t1; a.duration = 200;

// when this animation completes, scale to normal size a.addEventListener('complete', function() {

Titanium.API.info('here in complete');
var t2 = Titanium.UI.create2DMatrix();
t2 = t2.scale(1.0);
w.animate({transform:t2, duration:200});

});

// create a button to close window var b = Titanium.UI.createButton({

title:'Close',
height:30,
width:150,
top:25

}); w.add(b); b.addEventListener('click', function() {

var t3 = Titanium.UI.create2DMatrix();
t3 = t3.scale(0);
w.close({transform:t3,duration:300});

});

//create the scroll view

var f = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'info.txt');

var contents = f.read();

var creditsView = Titanium.UI.createScrollView({

bottom:20,
height:310,
width:260,
contentWidth:'auto',
contentHeight:3000,
backgroundColor:'grey',
showVerticalScrollIndicator:true

}); w.add(creditsView);

var creditsLabel = Titanium.UI.createLabel({

text:contents.text,
color:'#ffffff'

}); creditsView.add(creditsLabel);

w.open(a);

});

var change = Titanium.UI.createLabel({
bottom:380, left:160, font:{fontSize:16, fontFamily:'Helvetica'}, text:'Change', color:'#ffffff' }); window.add(change);

var goldView = Ti.UI.createView({
height:25, width:300, bottom:390, borderRadius:5, backgroundGradient:{

type:'linear',
colors:[{color:'#5b9dc7',position:0.0},{color:'#000000',position:1.0}]

} }); window.add(goldView);

var goldLabel = Titanium.UI.createLabel({
text:'Gold', font:{fontSize:24}, color:'#ffffff', left:10 }); goldView.add(goldLabel);

goldView.addEventListener('click', function()
{ var w = Titanium.UI.createWindow({

height:0,
backgroundColor:'#000',
bottom:0,

});

var goldViewLabel = Titanium.UI.createLabel({

text:'Gold',
font:{fontSize:30},
color:'#ffffff',
left:10,
bottom:360

}); w.add(goldViewLabel);

var goldCurrentLabel = Titanium.UI.createLabel({

text:'Current Price',
font:{fontSize:24},
color:'#ffffff',
left:10,
bottom:275

}); w.add(goldCurrentLabel);

var goldChangeLabel = Titanium.UI.createLabel({

text:'Price Change',
font:{fontSize:24},
color:'#ffffff',
left:10,
top:30

}); w.add(goldChangeLabel);

// create window open animation var a = Titanium.UI.createAnimation(); a.height = 440; a.duration = 300;

// create a button to close window var b = Titanium.UI.createButton({

title:'Close',
height:30,
width:150,
bottom:20

}); w.add(b); b.addEventListener('click', function() {

a.height = 0;
w.close(a);

});

//TODO: var xml variables -> prices in this window

var goldCurrentView = Titanium.UI.createView({

top:100,
height:100,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); w.add(goldCurrentView);

var goldCurrentLabel = Ti.UI.createLabel({

font:{fontSize:50, fontFamily:'Courier-BoldOblique'},
color:goldChangeColor,
left:10,
text:'$'+goldCurrentNumber

}); goldCurrentView.add(goldCurrentLabel);

var goldChangeView = Titanium.UI.createView({

top:250,
height:100,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); w.add(goldChangeView);

var goldChangeLabel = Ti.UI.createLabel({

font:{fontSize:50, fontFamily:'Courier-BoldOblique'},
color:goldChangeColor,
text:goldChangeNumber

}); goldChangeView.add(goldChangeLabel);

var timeLabel = Titanium.UI.createLabel({

font:{fontSize:14},
left:10,
top:300,
color:'#ffffff',
text:'Prices updated every 15 minutes'

}); w.add(timeLabel);

w.open(a); });

var silverView = Ti.UI.createView({
height:25, width:300, bottom:335, borderRadius:5, backgroundGradient:{

type:'linear',
colors:[{color:'#6cac42',position:0.0},{color:'#000000',position:1.0}]

} }); window.add(silverView);

silverView.addEventListener('click', function()
{ var w = Titanium.UI.createWindow({

height:0,
backgroundColor:'#000',
bottom:0

});

var silverViewLabel = Titanium.UI.createLabel({

text:'Silver',
font:{fontSize:30},
color:'#ffffff',
left:10,
bottom:360

}); w.add(silverViewLabel);

var silverCurrentLabel = Titanium.UI.createLabel({

text:'Current Price',
font:{fontSize:24},
color:'#ffffff',
left:10,
bottom:275

}); w.add(silverCurrentLabel);

var silverChangeLabel = Titanium.UI.createLabel({

text:'Price Change',
font:{fontSize:24},
color:'#ffffff',
left:10,
top:30

}); w.add(silverChangeLabel);

// create window open animation var a = Titanium.UI.createAnimation(); a.height = 440; a.duration = 300;

// create a button to close window var b = Titanium.UI.createButton({

title:'Close',
height:30,
width:150,
bottom:20

}); w.add(b); b.addEventListener('click', function() {

a.height = 0;
w.close(a);

});

//TODO: var xml variables -> prices in this window

var silverCurrentView = Titanium.UI.createView({

top:100,
height:100,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); w.add(silverCurrentView);

var silverCurrentLabel = Ti.UI.createLabel({

font:{fontSize:50, fontFamily:'Courier-BoldOblique'},
color:'green',
left:10,
text:'$'+silverCurrentNumber
//text:'$'+'1101.31'

}); silverCurrentView.add(silverCurrentLabel);

var silverChangeView = Titanium.UI.createView({

top:250,
height:100,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); w.add(silverChangeView);

var silverChangeLabel = Ti.UI.createLabel({

font:{fontSize:50, fontFamily:'Courier-BoldOblique'},
//color:silverChangeColor,
color:'green',
text:silverChangeNumber

}); silverChangeView.add(silverChangeLabel);

var timeLabel = Titanium.UI.createLabel({

font:{fontSize:14},
left:10,
top:300,
color:'#ffffff',
text:'Prices updated every 15 minutes'

}); w.add(timeLabel);

w.open(a); });

var silverLabel = Titanium.UI.createLabel({
text:'Silver', font:{fontSize:24}, color:'#ffffff', left:10 }); silverView.add(silverLabel);

var platinumView = Titanium.UI.createView({
height:25, width:300, bottom:280, borderRadius:5, backgroundGradient:{

type:'linear',
colors:[{color:'#9b3c41',position:0.0},{color:'#000000',position:1.0}]

} }); window.add(platinumView);

platinumView.addEventListener('click', function()
{ var w = Titanium.UI.createWindow({

height:0,
backgroundColor:'#000',
bottom:0

});

var platinumViewLabel = Titanium.UI.createLabel({

text:'Platinum',
font:{fontSize:30},
color:'#ffffff',
left:10,
bottom:360

}); w.add(platinumViewLabel);

var platinumCurrentLabel = Titanium.UI.createLabel({

text:'Current Price',
font:{fontSize:24},
color:'#ffffff',
left:10,
bottom:275

}); w.add(platinumCurrentLabel);

var platinumChangeLabel = Titanium.UI.createLabel({

text:'Price Change',
font:{fontSize:24},
color:'#ffffff',
left:10,
top:30

}); w.add(platinumChangeLabel);

// create window open animation var a = Titanium.UI.createAnimation(); a.height = 440; a.duration = 300;

// create a button to close window var b = Titanium.UI.createButton({

title:'Close',
height:30,
width:150,
bottom:20

}); w.add(b); b.addEventListener('click', function() {

a.height = 0;
w.close(a);

});

//TODO: var xml variables -> prices in this window

var platinumCurrentView = Titanium.UI.createView({

top:100,
height:100,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); w.add(platinumCurrentView);

var platinumCurrentLabel = Ti.UI.createLabel({

font:{fontSize:50, fontFamily:'Courier-BoldOblique'},
color:platinumChangeColor,
left:10,
text:'$'+platinumCurrentNumber

}); platinumCurrentView.add(platinumCurrentLabel);

var platinumChangeView = Titanium.UI.createView({

top:250,
height:100,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); w.add(platinumChangeView);

var platinumChangeLabel = Ti.UI.createLabel({

font:{fontSize:50, fontFamily:'Courier-BoldOblique'},
color:platinumChangeColor,
text:platinumChangeNumber

}); platinumChangeView.add(platinumChangeLabel);

var timeLabel = Titanium.UI.createLabel({

font:{fontSize:14},
left:10,
top:300,
color:'#ffffff',
text:'Prices updated every 15 minutes'

}); w.add(timeLabel);

w.open(a); });

var platinumLabel = Titanium.UI.createLabel({
text:'Platinum', font:{fontSize:24}, color:'#ffffff', left:10 }); platinumView.add(platinumLabel);

var palladiumView = Titanium.UI.createView({
height:25, width:300, bottom:225, borderRadius:5, backgroundGradient:{

type:'linear',
colors:[{color:'#e26820',position:0.0},{color:'#000000',position:1.0}]

} }); window.add(palladiumView);

palladiumView.addEventListener('click', function()
{ var w = Titanium.UI.createWindow({

height:0,
backgroundColor:'#000',
bottom:0

});

var palladiumViewLabel = Titanium.UI.createLabel({

text:'Palladium',
font:{fontSize:30},
color:'#ffffff',
left:10,
bottom:360

}); w.add(palladiumViewLabel);

var palladiumCurrentLabel = Titanium.UI.createLabel({

text:'Current Price',
font:{fontSize:24},
color:'#ffffff',
left:10,
bottom:275

}); w.add(palladiumCurrentLabel);

var palladiumChangeLabel = Titanium.UI.createLabel({

text:'Price Change',
font:{fontSize:24},
color:'#ffffff',
left:10,
top:30

}); w.add(palladiumChangeLabel);

// create window open animation var a = Titanium.UI.createAnimation(); a.height = 440; a.duration = 300;

// create a button to close window var b = Titanium.UI.createButton({

title:'Close',
height:30,
width:150,
bottom:20

}); w.add(b); b.addEventListener('click', function() {

a.height = 0;
w.close(a);

});

//TODO: var xml variables -> prices in this window

var palladiumCurrentView = Titanium.UI.createView({

top:100,
height:100,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); w.add(palladiumCurrentView);

var palladiumCurrentLabel = Ti.UI.createLabel({

font:{fontSize:50, fontFamily:'Courier-BoldOblique'},
color:palladiumChangeColor,
left:10,
text:'$'+palladiumCurrentNumber

}); palladiumCurrentView.add(palladiumCurrentLabel);

var palladiumChangeView = Titanium.UI.createView({

top:250,
height:100,
width:300,
borderWidth:'2px',
borderColor:'#1b1e19',
borderRadius:10,
backgroundColor:'#000000'

}); w.add(palladiumChangeView);

var palladiumChangeLabel = Ti.UI.createLabel({

font:{fontSize:50, fontFamily:'Courier-BoldOblique'},
color:palladiumChangeColor,
text:palladiumChangeNumber

}); palladiumChangeView.add(palladiumChangeLabel);

var timeLabel = Titanium.UI.createLabel({

font:{fontSize:14},
left:10,
top:300,
color:'#ffffff',
text:'Prices updated every 15 minutes'

}); w.add(timeLabel);

w.open(a); });

var palladiumLabel = Titanium.UI.createLabel({
text:'Palladium', font:{fontSize:24}, color:'#ffffff', left:10 }); palladiumView.add(palladiumLabel);

var news = Titanium.UI.createWebView({

url:"http://hayekinstitute.ca/kitcoiphone/kitco.php",
bottom:0,
height:160,
width:320,
borderRadius:10,
backgroundColor:'#99b7e9'

});

news.addEventListener('click',function(e){

Ti.Platform.openURL(e.source.url);

});

window.add(news);

window.open({
fullscreen:true, modal:true });

Comments

  1. Stephen Tramer 2012-07-25

    Bug is inadequately described and also did not witness any obvious opacity issues when running sample code in SDK 2.2.0.f9e938d, iPhone Sim 5.1.

JSON Source