Android RTL form API 10 to API 21 - android-layout

I have to build an app with both support for english and arabic layouts, the working range is from api 10 (2.3.3) to api 21 (5.0).
Following this document I configured the app, but I cannot use "start" and "end" because the range of support is too wide.
I thought I can create a layout folder like "layout-16" where to put all layouts with "start" and "end" for versions from 4.2, and another like "layout-ar" where to put all the mirrored layouts for versions before api16.
It could work like that? Or the "layouts-ar" will override the "layout-16"?
Thank you

Since the language is has a bigger priority than the app version, I should advice to have several folder like:
layout-v16 for all your layout that support start/end
layout-ar-v16 empty folder to force the system to use layouts-16.
layout-ar for arabic and android under the version 16.
layout for standard layouts.
Good luck !

Related

Image resize for PrimeFaces p:textEditor

I am using a <p:textEditor>. The user says it's better than the <h:inputTextarea> I was using before. However, the (large) images he pastes into the editor come out too big when the component's value is displayed elsewhere in the application.
<p:textEditor> uses Quill behind the scenes. The user uses another web site that also has a text editor that looks the same, so is probably also using Quill though with some other back end. That site allows the images to be resized, probably using a module for allowing resizing of images such as the Quill ImageResize Module.
So my question is: How can I convince the <p:textEditor> to use the Quill module to allow resizing of images? Is there some bit of JavaScript magic I can add to get the module applied as it is being created or immediately after the fact?
FWIW, I am still on Java 8 and JSF 2.3 and PrimeFaces 8.0 running under Tomcat 8.5.x.

rid3, shadow-cljs & drag; different behavior in dev and prod

I'm creating an application which can be used to make an overview of your IT-Landscape. Currently it can show a table with the interfaces in your environment and their connected applications. It is also capable of creating an SVG image from this data. The data it self can be added via API calls.
I started with a project via:
leiningen new luminus versiontracker +h2 +shadow-cljs +kee-frame +swagger +(some other)
To be able to generate the SVG file with drag-and-drop support I added rid3 to the project .clj file.
When I run the application in development mode:
lein repl
and
lein shadow-cljs watch app
I can drag any item in the SVG file that is generated. I can click on a circle and drag it to any place I want.
However when I create the 'production' version with:
lein uberjar
and then run this application using:
java -Dconf=config.edn -jar versiontracker.jar
Dragging an object is not working properly. The whole SVG is selected instead of a single object within the SVG image; which result in strange drag-and-drop behavior.
Looking at the event through the console window I can see different behavior.
In the development environment if I grab a circle (which has the drag function attached) the srcElement in the sourceEvent is the text that is displayed on top of this circle. Although not the circle is selected dragging works as expected. The selected item follows the mouse while dragging.
In the 'production' environment if I grab a circle the srcElement in the sourceEvent is the complete svg; which result in strange drag-and-drop behavior. The selected item does not follow the mouse but the items do start moving around in an unpredictable way.
Go to Version Tracker download the release with tag V0.3.0 for the production version (there is also an H2 database with some sample data) and compare it to the development version by checking out the project.
Any help is appreciated
Your error description is a bit lacking and the project is far too complex to quickly reproduce.
Do you get any externs inference warnings when building? Do you get any errors/warnings in the Browser console with a production build?
The most likely cause here is externs. Meaning that property names such as in this (set! (.-fx d) (.-x event)) may end up getting renamed or stripped. As such it would break any behavior that relies in picking the correct names. See the documentation for further info on the subject. It might be enough to add a couple ^js hints in the proper places.
You are also using a rather old shadow-cljs version (current as of today is 2.16.10). So you need to opt-in to get externs inference warnings via :compiler-options {:infer-externs :auto} in your build config. The newer versions have this enabled by default.

Vaadin layout using CSS flex-box?

Is there a Layout in Vaadin 8 (Vaadin Framework) or Vaadin 10 (Vaadin Flow) that uses the newer CSS flex-box (a.k.a. flexbox) feature?
This excellent tutorial makes it look like flex-box could be used to implement Vaadin’s GridLayout, VerticalLayout, and HorizontalLayout.
Vaadin 8
If you want to use flex-box in Vaadin 8, there are following options
If you prefer server side java API, there is add-on in directory https://vaadin.com/directory/component/flexlayout-add-on that has that.
You can always use CssLayout, and define CSS flex-box rules in your theme
The Board (https://vaadin.com/directory/component/vaadin-board) component is implemented using flex-box
Vaadin 10 (Flow)
All Layouts in Flow are implemented using Flex-box, making them function better together. There is also a FlexLayout in Flow, that gives Java API of flex-box in similar fashion than the add-on mentioned above. HorizontalLayout and VerticalLayout are special cases flex-box, so there is less side effects when combining these (see: https://vaadin.com/docs/v10/flow/components/tutorial-flow-components-setup.html).

Images do not show up when I run my app on iOS device

I have images titled like so in my app:
image~iPhone.png
image#2x~iPhone.png
In interface builder I am loading image.png into my UIImageView. I also programatically load some images into a different view using imageWithContentsOfFile. The images all load fine when I run in the simulator but I get no images when I run on the device. If I use the full name of the image in interface builder it works but I want iOS to distinguish between high res and lower res. I have tried a lot of different things but can't figure this out. I see this error in the debugger as well:
Could not load the "image.png" image referenced from a nib in the bundle with identifier "com.mycompany.myproject"
Xcode 4
Deployment Target 4.1
Base SDK 4.3
Thanks for any help.
Ok...so after much experimenting I got it working.
I had two images named:
image#2x~iPhone.png
image~iPhone.png
and I was trying to load them using IB or imageWithContentsOfFile using
image.png
This worked fine in the simulator but not on my device. I just got a blank white screen where the image should be.
I finally renamed the high resolution image to:
image~iPhone#2x.png
Moving the '#2x' modifier after the device modifier(~iPhone) when referencing my images allowed it to work the way I understood that it should from reading Apple's docs. I was under the impression that you didn't need to include the device modifier when referencing images but I had to.
To sum up, I am now using
- image~iPhone.png
to reference my images in IB and programatically for some images. I now get iOS recognizing that I am on a retina screen and loading the #2x images accordingly. So the #2x modifier had to go at the end and the ~iPhone modifier had to be included in the name of the '.png'.
That is what worked for me. Hope it helps someone else. Note that I am only building my app for iOS4.1 and above so there might be some issues with this if you are supporting previous version.
iOS does not automatically pick the right image for the device like that. You are going to have to write code to check which device it is, and set the image by full name.
e.g. if ([[UIScreen mainScreen] scale] == 2) // set hi res image
Or, you can just use the same image in both, and set the content mode to scale to fill. It will look the same.
EDIT: Try writing either ~iphone (lowercase), or just don't write ~iPhone at all on the file name. If your app is not universal, then writing the ~iphone suffix is completely pointless.
iOS file system is case sensitive and device modifiers should be lowercase, it should be
image~iphone.png
image#2x~iphone.png
The #2x comes before the device modifier.
See the resource programming guide

Richfaces and chart

One big piece missing on richfaces is a chart support. In my case what I need is a simple bar chart, with no interactivity to put into a jsf (richfaces 3) page, into a javaEE 6 web-application that must run only with opensource libraries
Anyone can give me some options?
thanks in advance!
note: I'm thinking on jfreechart, obviously, but what I need is something skinnable fast, with no pain
you could have a look on JSFlot .People say it works well with richfaces.
The JSFlot JSF chart library builds on top of the JavaScript Open
Source Project Flotr (a javascript plotting library based on the
Prototype Javascript Framework) to create stunning interactive charts
purely using JavaScript. The JSFlot charting library is simple to
install, easy to configure and easy to use in your custom application.
All of the applications dependencies (purely JavaScript related) are
included in the Jar file.
The goal of the JSFlot project is to support all the main features of
Flotr (Flotr has its own project page set up at
http://code.google.com/p/flotr/), while remaining easy and simple to
install and use.
We used JQPlot for charting in our project. Pluggable, Interactive and look good. Check them out:
JQPlot Bar Charts

Resources