Mobile

State of Web Development 2014

Lammert Westerhoff

On the 5th of June, we (Lammert Westerhoff and Freek Wielstra) presented the State of Web Development 2014 at our yearly conference, XebiCon on the SS Rotterdam. It was a great success and we had some great feedback. We'd like to share the same presentation we gave there with everyone who couldn't make it to the conference in this blog post.

We started the presentation by showing an overwhelming tag cloud:

WebXebiCon.006

 

 

When you’re new to web development or when you haven’t done any web development for a long time, you’re likely to get lost in this jungle of web technologies. Don’t worry if you are overwhelmed with this, because that’s intentional. This tag cloud contains many languages and web frameworks that modern web applications consist of. But it also contains a number of development tools that are used during development. The goal of this post is to guide you through this jungle by explaining to you which technologies you can use to build a modern web application and which tools you need during the full development lifecycle.

 Read more

Mattt Thompson visits Xebia

Jeroen Leenarts

Mattt Thompson visited Xebia Netherlands.

For three days Mattt presented on various topics of interest. On the 15th Mattt presented to a group of Xebians. On the 16th he did a similar day at my current project at the Dutch ING bank. Finally on the 17th Mattt hosted an open roster training for anybody interested. During the three days Mattt talked about AFNetworking, ReactiveCocoa, Heroku, general tips and tricks related to iOS and ... a preview on the content of the pub quiz he was giving the next week in Amsterdam. No worries we respected Mattt's request to not spoil the fun during the real event by participating with advance knowledge.

In between Mattt and me found some time to go to a CocoaHeadsNL meet-up and have a great diner with a couple of colleagues. As a bonus surprise the ING surprised Mattt with a museum visit as well.
 Read more

A day with Mattt Thompson @ Xebia

Jeroen Leenarts

On thursday the 17th of October, Xebia is hosting a day long public session with Mattt Thompson.
Mattt is best known as the creator of AFNetworking and Postgres.App, he also maintains the website NSHipster. He is the Mobile Lead at Heroku, a premier cloud hosting platform.

As such, Mattt is an expert iOS developer and speaker. He is also well versed in other technologies, but the focus of the day will be software development on the iOS platform. Mattt will be talking about AFNetworking 2.0 internals, Objective-C API design latest NSHipster and ReactiveCocoa for sure. The rest of the content highly depends on the input of those attending.

We are looking for experienced iOS developers to join us on the 17th. If you are interested please contact us for more details or leave a reply on this blog post.

How to run Android Instrumentation tests with ProGuard

Barend Garvelink

The app I'm working on has an extensive, automated test suite built using Instrumentation and Robotium. These are white-box tests; they know about the Java classes that make up the tested app. This means that we were unable to run the tests after ProGuarding our application. I've never seen ProGuard break any working code after setting up the right exclusions. Nevertheless, it's a bit questionable to have a huge automated test suite and not run it on the APK that we deliver to the Play Store.

ProGuard and Instrumentation Tests

One possible work-around is to use the UIAutomator framework, which does not have this limitation. There are several reason's why we couldn't: it requires API level 16 (Jelly Bean), our app supports API 8 (Froyo) as its minimum SDK version. Furthermore, we already had our test suite in place and rewriting it from scratch didn't seem like a very good use of time. Here's what we did instead.

 Read more

A better custom ViewGroup

Barend Garvelink

Jerome P. commented on my earlier post denouncing the ViewHolder pattern. He suggested an improvement to the ViewGroup approach that inverts the direction of dependency between the ContactView and its layout XML file. Instead of referencing the custom class from XML, the Java code now references the layout file using a standard resource reference. This adds further type safety and it means your view class can be completely ProGuarded.
 Read more

ViewHolder considered harmful

Barend Garvelink

The ListView is the most complicated, common view widget in the Android SDK. It is part of a family of widgets known as Adapter Views. These are views that use an Adapter class to mediate between the view widget and the list data it is showing.

ListView, ListAdapter and List of DataType.

The adapter's job is to prepare the views to be shown in the ListView for each element in the dataset. This tends to involve many findViewById(int) lookups, which are quite costly in CPU time. The standing Best Practices for Android dictate that adapters use something called the ViewHolder Pattern to mitigate the cost of these lookups.

Adapter classes tend to be a hotspot of smelly program code in Android, because they straddle the View and Controller responsibilities of the MVC model (1). In my part of the Clean Code in Android Apps talk at XebiCon 2013 I demonstrated why adapters get smelly, why ViewHolder doesn't help and how to use a custom view to alleviate this problem. Read on for the reprise.

 Read more

iOS - Pixel misalignment, why it's bad, how to fix it...

Jeroen Leenarts

One of the common things I see going wrong is pixel alignment.

What is pixel mis-alignment, what’s causing it, and how to fix it?

Fractions when logging in Xcode. .5 values are not always a problem though.

Read on for more details.

 Read more

Anatomy of a Looper

Barend Garvelink

There's an intersting low-level class in the Android SDK called Looper. Each app has at least one, because it powers the UI Thread. You can create Android apps perfectly fine without ever using Looper yourself, but it's an interesting thing, so let's take a look under the bonnet.

 Read more

iOS - Just a quick way to create a shadow on any view

Jeroen Leenarts

Sometimes you would want a shadow on a view.

Easiest and quickest way is to just add it on the view's layer:

-(void)loadView {
    CGRect frame = [[UIScreen mainScreen] applicationFrame];
    
    self.view = [[UIView alloc] initWithFrame:frame];
    self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    self.view.backgroundColor = [UIColor blackColor];
    
    UIView *glowView = [[UIView alloc] initWithFrame:CGRectMake(frame.size.width /2 -10, frame.size.height /2 -30, 20, 60)];
    glowView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | 
                                    UIViewAutoresizingFlexibleTopMargin |
                                    UIViewAutoresizingFlexibleLeftMargin |
                                    UIViewAutoresizingFlexibleRightMargin;
    
    glowView.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:glowView];
    
    //Setup the shadow on the view's CALayer.
    CALayer *viewLayer = glowView.layer;
    viewLayer.shadowOffset = CGSizeMake(0, 0);
    viewLayer.shadowColor = [[UIColor yellowColor] CGColor];
    viewLayer.shadowPath = [UIBezierPath bezierPathWithRect:glowView.bounds].CGPath;
    viewLayer.shadowRadius = 10.0f;
    viewLayer.shadowOpacity = 1.0f;
 
    //Let's animate it while we're at it.
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"shadowOpacity"];
    animation.duration = 0.5f;
    animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    animation.fromValue = [NSNumber numberWithFloat:1.0];
    animation.toValue = [NSNumber numberWithFloat:0.0];
    animation.autoreverses = YES;
    animation.repeatCount = HUGE_VALF;
    [viewLayer addAnimation:animation forKey:@"shadowOpacity"];
}

I must admit, this is kind of basic stuff. But it seems a lot of people actually forget about the fact that all UIView subclasses are based on Core Animation CALayers.

See the source code https://github.com/xebia/ios-DemoForBlog and try the example, the interesting bits about this example are all contained within the fourth tab of the application, it's the XSDFourthViewController in the code.

iOS - Voiceover and view picking

Jeroen Leenarts

Something that might interest the developers out there working with accessibility on iOS.

If you have strange behavior, as in, being unable to (partially) pick an accessibility frame by just dragging your finger over the screen, I might be able to answer just why.

As it turns out. VoiceOver and sub views being out of bounds of their parent's view bounds don't really mix. Read more