Beginners Guide to Landscape Photography

Tips, settings, compositions   Last Light Besides passion & patient, to photograph great landscapes photos, it takes a fair amount of preparation and skill in basic photography technique. This article focuses on some important, but not all, aspects of landscape photography that photographers need to master when photographing landscape. Don’t leave home without them. We are referring to gear other than the obvious two, your camera and lenses.

Continue reading Beginners Guide to Landscape Photography

The most efficient way to listen for a resize

In Android when the keyboard shows up, the size of the window will change triggering a resize event on the window.
When the resize event would get fired on a mobile device?

  • When the keyboard shows up
  • When rotating the device
  • When the browser window shrinks because the user uses a multiwindow view

Now we want to listen to this event just once and then act, avoiding to do too much because it would impact on the frame-rate of our application. I could argue here that the keyboard component will only fire one window resize event however this cannot be guaranteed; In the Android market there are literally thousands of different keyboards and might be that one of them is going to fire the resize event more than once, causing difficult to debug behaviors once they get reported by a user.

Also another scenario would be that two resize events are quite close for example when the user does some operations it will hide and show the keyboard quite quickly, firing the event at least twice in few milliseconds.

We need to use setTimeout and clearTimeout in a clever way:


function actionOnResize (e) {
  // do stuff
  console.log('do something');
};
var action;
window.addEventListener('resize', function (e) {
  clearTimeout(action);
  action = setTimeout(function () {
    actionOnResize(e);
  }, 50);
}, false);

A perfect delay

Depending on the application specifications you need to find a good delay for this to fire accordingly. In my scenario a delay of 50ms has been what I needed for.

Chrome leaves the autocorrect underline when tapping on different elements in a content editable element

I found this weird bug in Chrome for Android: in a content editable, using a keyboard with autocorrect capabilities such as the Google Keyboard or SwyftKey etc, the marking of the current word, made with an underline is left behind when the user taps different elements.
Continue reading Chrome leaves the autocorrect underline when tapping on different elements in a content editable element

Using Gradle Deamon for faster build projects in Android

I wish my Android builds were faster. How can I achieve this? Simple, by using a gradle deamon!
It is quite safe to use and it will make your building tasks much faster, mine went from 18 seconds to just a little bit more than 2 seconds.
Continue reading Using Gradle Deamon for faster build projects in Android

How to add crosswalk project or any library to an Android Studio Project

How do you add a library to an Android Studio project?

In my case I need to add Crosswalk-project to the application I am working on (this example is about CrossWalk but it can be applied to any other library). So first of all I download CrossWalk and extracted it.
The next step is to import it into our application.
Continue reading How to add crosswalk project or any library to an Android Studio Project

How to add a JavaScript interface to an Android CrossWalk project

A JavaScript interface allows us to have a bridge between Android and the JavaScript when working using WebViews.

How do we add support for a JavaScript interface then?

First of all we have our XWalkView object from the layout in our onCreate method:

mWebView = (XWalkView) findViewById(R.id.activity_main_webview);
mWebView.load(“http://maurizionapoleoni.de”, null);

mWebView.addJavascriptInterface(new WebAppInterface(this), "Android");

In Continue reading How to add a JavaScript interface to an Android CrossWalk project

Inserting images from the camera into the document using a WebView

The steps a user follows to insert images into the document are:

  • Tap on a file input button
  • Choose to use the camera roll
  • Read the image
  • Insert the image into the document.

Continue reading Inserting images from the camera into the document using a WebView

Opening a window.open in Android without killing the content of the main WebView

Preparation of the smaller problem

Problem: inside the webview we have a piece of code that calls window.open to make a popup containing some information. How does this information can be opened?

  • In the default browser for the device
  • Inside a new window in the same webview.

Continue reading Opening a window.open in Android without killing the content of the main WebView

There is no default constructor available in ‘org.domain.ClassName’

Java 101. Why am I getting There is no default constructor available in Class? Because we need to duplicate our constructor signatures, by calling the superclass constructor with the same arguments required. For example:


public MyClass (String x, Int y) {
    super (x, y);
}

Using IntelliJ or Android Studio, which is where I am learning all these things, what you can do to fix this is to use a simple shortcut: ctrl+o (at least on Mac) and then insert the contructor.

Implementing a file input with Camera support in Android with CrossWalk

So we need a file input in our Android WebView powered by CrossWalk.
First step it is to add CrossWalk into our project:


repositories {
    maven {
        url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
    }
}

Continue reading Implementing a file input with Camera support in Android with CrossWalk