Usually to fully customize visual representation of a view needs a lot of attributes and resources. Such as in this example. we added background, gravity, maxLines, padding and textSize, which is a lot of code.
And if we want to create another TextView with exactly same visual representation, we need to copy all the values again:
Obviously, in this piece of code, there are a lot of duplications. We need to compare all the values to figure out the 2 TextViews have the same visual. If we want to change the style, we need to update 2 TextViews. And the last, if we want to create the 3rd TextView or even more ones, we need copy the code again and again, which makes the issue become more troublsome.
In a short word, the code has bad readability, bad maintainability, bad reusability. In the book Refactor, we know that code redundancy is bad smell. To mitigate the issue, we need to extract the shared code into another “unit”, and replace all the occurrences with the reference.
In Android layout xml, the extract “unit”, which represents the shared attributes, are called Style. After introduced Style, we have:
There is a fascinating idea that inflates UI according to an android layout xml downloaded from server. According to the Android API, it looks quite feasible.
One of LayoutInflate.inflatemethod overloads accept Layout Xml as XmlPullParser.
And XmlPullParser can wrap around an input stream, so as consequence, following code seems to be working:
The code looks great, compiling looks fine, but when the code excuted, an exception is thrown by the inflater.
According to the LayoutInflater document, this approach won’t work(at least for now, it won’t).
For performance reasons, view inflation relies heavily on pre-processing of XML files that is done at build time. Therefore, it is not currently possible to use LayoutInflater with an XmlPullParser over a plain XML file at runtime.
Actually, Android compiler compiles the layout xml files into binary xml block, which has convert attributes into some special format. And in Android SDK, the LayoutInflater uses XmlResourceParser instead of plain XmlPullParser, which is created by XmlBlock.
XmlBlock is an internal class used in Resources to cache the binary xml document.
And there is no way to create XmlResourceParser or other classes to inject custom behavior into this process. Personally assume that it is pretty much related to the Android Resource and Theming mechanism, there are quite a number cross references between resources. To make it works in a efficient way, Android Runtime did a lot work, such as cache and pre-processing. To override this behavior require quite a number of work and need to aware of potential performance issue. Since the inflating could happen quite often during navigation.
As a not that fansy alternative, UI based on HTML hosted in WebView could be considered.
CCTray.xml is an RSS-like CI server build status xml feed, which is originally developed for CruiseControl.net. ThoughtWorks declared it in a standard called “Multiple Project Summary Reporting Standard”, which now have become some kind of unofficial standard of CI server feed that is widely supported by all kind of popular CI servers.
And according to cc_dashboard, there are some exceptions that are not included in the document.
An additional “Pending” activity
An additional “Unknown” status. I’ve seen Unknown reported by CruiseControl.rb when project builds are serialized (“Configuration.serialize_builds = true” set in .cruise/site_config.rb) and one build is waiting for another build to finish. I’ve seen Unknown reported by Hudson when a project is disabled.
These tools work by polling Continuous Integration servers for summary information and presenting it appropriately to users.
If a Continuous Integration server can offer a standard summary format, and a reporting tool can consume the same, then we get interoperability between reporting tools and CI Servers.
Description
Summary information will be available as a plain XML string retrievable through an http GET request.
The format of the XML will be as follows:
Summary
A single node, the document root, which contains 0 or many node.