B4a Listview TwoLines Vertical Centering - android-listview

i need to use ListView1.TwoLinesAndBitmap
and i have strange problem to set lable,SecondLabel,imageview in center Vertically
as i see all examples set the itemheight to something like : 60dip
but when i test listview in some Hight resolution and density Device like Lenovo 10 inch tablet the height of itemheight will be very small
so i decide to use percent of Y as itemheight
here is my code : **********
ListView1.TwoLinesAndBitmap.ItemHeight = 10%y
ListView1.TwoLinesAndBitmap.ImageView.Height = ListView1.TwoLinesAndBitmap.ItemHeight - 20dip
ListView1.TwoLinesAndBitmap.ImageView.Width = ListView1.TwoLinesAndBitmap.ImageView.Height
ListView1.TwoLinesAndBitmap.ImageView.Gravity = Gravity.CENTER
ListView1.TwoLinesAndBitmap.Label.TextColor = Colors.Black
ListView1.TwoLinesAndBitmap.Label.Left = ListView1.Left
ListView1.TwoLinesAndBitmap.Label.Width = ListView1.Width
ListView1.TwoLinesAndBitmap.Label.Height = ListView1.TwoLinesLayout.ItemHeight/2
ListView1.TwoLinesAndBitmap.Label.Gravity = Gravity.CENTER + Gravity.CENTER_VERTICAL
ListView1.TwoLinesAndBitmap.Label.TextSize = ListView1.TwoLinesAndBitmap.ItemHeight * 170/1000dip
ListView1.TwoLinesAndBitmap.SecondLabel.Left = ListView1.Left
ListView1.TwoLinesAndBitmap.SecondLabel.Width = ListView1.Width
ListView1.TwoLinesAndBitmap.SecondLabel.Height = ListView1.TwoLinesLayout.ItemHeight/2
ListView1.TwoLinesAndBitmap.SecondLabel.Gravity = Gravity.CENTER + Gravity.CENTER_VERTICAL
ListView1.TwoLinesAndBitmap.SecondLabel.TextSize = ListView1.TwoLinesAndBitmap.ItemHeight * 150/1000dip
i try to center all items in center verticaly but as i attach an image blow there is problems in all three devices ( Sony V , Lenovo tablet , AVD ) and none of them load nice
in sony V :
-lable load on top
-SecondLabel load on bottom
- imageview not Center in vertical
in Lenovo Yoga :
-lable load on top
-SecondLabel load right after label on top
- imageview not center vertical
in avd Emulator :
-lable load on top with a little nicer space from top
-SecondLabel on the bottom (0 position) !!
i`m very confused and try to change various options but no luck at all
Here is the screenshot i take of all 3 devices :
http://i58.tinypic.com/650k1u.jpg

Try this replacements and additions;
ListView1.TwoLinesAndBitmap.ImageView.Left = (ListView1.Width - ListView1.TwoLinesAndBitmap.ImageView.Width)/2
ListView1.TwoLinesAndBitmap.Label.Left = 0
ListView1.TwoLinesAndBitmap.SecondLabel.Left = 0
ListView1.TwoLinesAndBitmap.SecondLabel.Top = ListView1.TwoLinesLayout.ItemHeight/2

Related

TYPO3 GIFBUILDER with image from FLUID

I want to use the GIFBUILDER to make an image with an overlay. The image should therefore be delivered via FLUID.
This is what I have so far:
FLUID
<f:for each="{product.images}" as="image">
<f:cObject typoscriptObjectPath="lib.overlay" data="{image: image.uid}" />
</f:for>
TypoScript
lib.overlay = IMAGE
lib.overlay {
file = GIFBUILDER
file {
XY = 300,500
format = jpg
quality = 80
10 = IMAGE
10 {
file.import = {field:image}
file.import.insertData = 1
file.import.treatReferenceAsId = 1
}
20 = TEXT
20 {
text = Copyright
fontColor= #dddddd
fontSize = 30
offset = 100,100
align = left
antiAlias = 1
}
}
}
At the moment, I only get a white Background with the label Copyright on it. However if I do somethinge like
10 = IMAGE
10.file = fileadmin/path/to/file
all works just fine.
So my question is: How do I pass the Image from FLUID correctly to TypoScript?
And as addition to this, how do I pass a value from the Contentelement via FLUID to make the overlay text dynamic too?
Best regards and Thanks in advance
UPDATE:
output of {image} (one image):
Replace
10 = IMAGE
10 {
file.import = {field:image}
file.import.insertData = 1
file.import.treatReferenceAsId = 1
}
with
10 = IMAGE
10 {
file.import.field = image
file.treatIdAsReference = 1
}
treatReferenceAsId should be treatIdAsReference. It's also a property of file, not of file.import. I'm not sure why file.import = {field:image} and insertData = 1 doesn't work, but file.import.field = image does. It's cleaner anyway, which is why I tried it.
You might also want to add a width and height or maxW and maxH to the image, unless you're 100% sure they're always 300x500 pixels.

Left axis for HorizontalBarChart of Charts are clipped from the top

When setting up a horizontal bar chart, I'm actually getting a weird issue where the labels of the leftAxis are clipped.
See screenshot:
Here's the code I've used to set up my horizontal bar
func prepareHorizontalBarChart() {
horizontalBarChartView.zoomOut()
horizontalBarChartView.fitBars = true
horizontalBarChartView.xAxis.drawGridLinesEnabled = false // disable horizontal grid lines
horizontalBarChartView.chartDescription?.enabled = false
horizontalBarChartView.xAxis.labelPosition = .bottom
horizontalBarChartView.leftAxis.spaceTop = 0.0
horizontalBarChartView.rightAxis.enabled = false
horizontalBarChartView.leftAxis.axisMinimum = 0
horizontalBarChartView.leftAxis.labelPosition = .insideChart
horizontalBarChartView.leftAxis.granularity = 1.0
horizontalBarChartView.leftAxis.granularityEnabled = true
horizontalBarChartView.extraRightOffset = 10.0
horizontalBarChartView.legend.enabled = false
horizontalBarChartView.xAxis.avoidFirstLastClippingEnabled = true
horizontalBarChartView.xAxis.granularity = 1.0
horizontalBarChartView.xAxis.granularityEnabled = true
horizontalBarChartView.xAxis.drawLabelsEnabled = true
horizontalBarChartView.rightAxis.labelFont = UIFont.systemFont(ofSize: 20)
reloadData()
}
I think in Horizontal Bar chart label is cliping on top edges so for that we need to add extra space in Chart view port with below property.
horiBarChartView.extraTopOffset = 10
will add 10px extra space from top.
Before extra space (default behaviour):
After 10px extra space:
Hope this will help you to solve your problem.

How do I maximize the window to multiple monitors in awesome wm?

I have three monitors in a horizontal line. Sometimes i want to maximize a window to three monitors at once, by pressing a combination of keys (and then returning it all back if necessary). How can I do that?
Untested, but the basic idea is to make the window floating and resize it to cover everything:
function(c)
c.floating = true
local geo = screen[1].geometry
geo.x2 = geo.x + geo.width
geo.y2 = geo.y + geo.height
for s in screen do
local geo2 = s.geometry
geo.x = math.min(geo.x, geo2.x)
geo.y = math.min(geo.y, geo2.y)
geo.x2 = math.max(geo.x2, geo2.x + geo2.width)
geo.y2 = math.max(geo.y2, geo2.y + geo2.height)
end
c:geometry{
x = geo.x,
y = geo.y,
width = geo.x2 - geo.x,
height = geo.y2 - geo.y
}
end
To undo the above, make the client no longer floating, i.e. c.floating = false.
Wiring the above to a keybinding is left as an exercise for the reader.

How do i stop clipping of limit line text in ios-charts?

I have a requirement for drawing the limit line which is near to the top of the chart and I want to keep limit line label on top right. Is there any way, it can not be truncated. Please see my output.
enter image description here
try limitline.labelPosition = ChartLimitLabelPositionRightBottom;
if you want keep labelPosition on top right,
you may can try set yourYAxis.spaceTop = x;
if x == 0, the maxValue will match the top of the chart,
if x == 1, the maxValue will match the centerY of the chart,
sorry, I can't express myself well, but, just try it.
hope it works.
The default renderer is little bit messed up. Subclass it (YAxisRenderer) and override method: renderLimitLines. Copy the content from original renderer and replace lines:
var clippingRect = viewPortHandler.contentRect
clippingRect.origin.y -= l.lineWidth / 2.0
clippingRect.size.height += l.lineWidth
with:
var clippingRect = viewPortHandler.contentRect
clippingRect.origin.y -= l.lineWidth / 2.0 + l.valueFont.lineHeight
clippingRect.size.height += l.lineWidth + l.valueFont.lineHeight
Now, as you have it prepared, you need to set your new axis renderer for
let yAxisRenderer = CenteredLimitLineYAxisRenderer(
viewPortHandler: chart.viewPortHandler,
yAxis: chart.leftAxis,
transformer: chart.getTransformer(forAxis: .left)
)
chart.leftYAxisRenderer = yAxisRenderer

as3 air for ios get screen device resolution

I am trying to set my mc to the exact screen size on an iPhone using air in as3.
I have tired:
import flash.display.Screen;
import flash.geom.Rectangle;
var mainScreen:Screen = Screen.mainScreen;
var screenBounds:Rectangle = mainScreen.bounds;
/// Does not work - comes out 320 by 480
w.text = ""+screenBounds.width+"";
h.text = ""+screenBounds.height+"";
BG.height = screenBounds.height;
BG.width = screenBounds.width;
/// Does not work - comes out 320 by 480
w.text = ""+Capabilities.screenResolutionX+"";
h.text = ""+Capabilities.screenResolutionY+"";
BG.height = Capabilities.screenResolutionY;
BG.width = Capabilities.screenResolutionX;
/// Does not work - comes out 320 by 480
w.text = ""+stage.fullScreenwidth+"";
h.text = ""+stage.fullScreenHeight+"";
BG.height = stage.fullScreenHeight;
BG.width = stage.fullScreenWidth;
/// Works BUT... it does NOT stretch to fit the stage.
/// I am starting with android screen size and it shrinks it proportionally
/// which means there is space on top or bottom or left side.
w.text = ""+stage.stageWidth+"";
h.text = ""+stage.stageHeight+"";
BG.height = stage.stageHeight;
BG.width= stage.stageWidth;
You can try to play around with stage.scaleMode :
stage.scaleMode = StageScaleMode.SHOW_ALL;
or
stage.scaleMode = StageScaleMode.EXACT_FIT;
If it is coming out 320x480 and you are saying that is wrong, can I assume you are using an iPhone 4S? If so, go into the App Descriptor XML file. Toward the bottom (generally one of the last items in the file), there should be this line.
<requestedDisplayResolution>standard</requestedDisplayResolution>
If it is commented out or set to "standard", this would be your issue. Change it to say "high" and that will enable Retina support. "standard" scales the non-retina display (320x480 on iPhone, 1024x768 on iPad) up. "high" will give you the correct display resolution.
Here is a detailed explanation:
http://www.adobe.com/devnet/air/articles/multiple-screen-sizes.html
if someone else is having issues getting the screen resolution for ios. What is happening is that there is no enough time between the completed loaded swf and the time you call the screen size.
For my app I need the swf with no scale because I am setting all my clips size and positions by setting a relative value to screen size in percent.
if my stage is 800x1280 and I have a clip with height = 100, width = 100;
then is the same to say that my clips.height = int(stage.stageWidth * 0.125);
as 100 * 100 / 800 = 12.5; | 100 is the 12.5% from 800;
The trick is that for your first frame (if you are using flash)
just set the stage scale and wait for full load the swf, and just that.
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
var loadTimer:Timer = new Timer(10);
loadTimer.addEventListener(TimerEvent.TIMER, loading);
loadTimer.start();
function loading(evt){
if(root.loaderInfo.bytesLoaded == root.loaderInfo.bytesTotal){
loadTimer.stop();
loadTimer.removeEventListener(TimerEvent.TIMER, loading);
gotoAndPlay(2);
}
}
then in the frame 2 you can call the stage.stageWidth and it will give you the real size, as you have give enough time to the app get that value.
var stageW:int = stage.stageWidth;
var stageH:int = stage.stageHeight;
I hope it can help, thanks