Month: December 2014

Blog Summary of 2014

2014-12-31 Uncategorized No comments

Short blog summary of 2014:

  • 28 748 sessions
  • 24 400 users
  • 35 212 page views
  • 1.22 pages per session
  • 00:00:41 was average session duration
  • about 115 unique visitors everyday
  • The greatest amount of blog visitors was from India
  • I also had a lot of visitors from USA, Poland (my home country), Germany, Vietnam, South Korea and other countries
  • I had 881 visitors from Bengaluru, 601 visitors from Chennai (Hello, India!) and 587 visitors from Seoul (Hello, South Korea!)
  • I had visitors from every country in the Europe, Asia, North America, South America, Australia, New Zeland and about half of the countries from Africa
  • Most of keywords in search traffic were connected with Android
  • I started using Linux (Ubuntu) on daily basis and wrote few articles about it
  • I still use Windows at work
  • I graduated from my university and started working full-time
  • I released my own mobile Android application created during writing my Master Thesis which has been downloaded by 1603 people and has 815 active users up to now

Numbers were retrieved from Google Analytics and Google Play Console.

I learnt a lot and still have to learn more.
Thanks for visiting my blog. I hope that New Year will bring new challenges and opportunities for all of us!

Synapse Indicator – Spotlight for Ubuntu

2014-12-27 Linux, Ubuntu 3 comments

Introduction

If you were using Ubuntu for some time, you might have noticed that Ubuntu Dash from Unity is working quite slow. We can disable on-line search or a few other elements, but it’s still very slow. If we want to have fast search, we can use external software like synapse.

Synapse

Synapse is searching really fast and we don’t have to wait a few seconds like in Ubuntu Dash or disable some search options.

synapse

Synapse can be installed with the following commands:

sudo add-apt-repository ppa:synapse-core/ppa
sudo apt-get update
sudo apt-get install synapse

After installing it, in Synapse Preferences we can set appropriate shortcut for opening Synapse.

Synapse Indicator

If we want to have “Mac OS-like” experience, we can use Synapse Indicator which is similar to Spotlight from OS provided by Apple.

spotlightsynapse

Synapse Indicator (AKA indicator-synapse) can be installed with the following commands:

sudo add-apt-repository ppa:noobslab/apps
sudo apt-get update
sudo apt-get install indicator-synapse

Drawback of Synapse Indicator is the fact that it does not have shortcut for search. We can set it by doing some “hack” described at Nerd Answer page.

Adding keyboard shortcut for Synapse Indicator (hack)

Step 1: Install xdtool.

sudo apt-get install xdotool

Step 2: Move your mouse over the synapse icon and get mouse location

xdotool getmouselocation

You should get output like this:

x:1568 y:9 screen:0 window:62914568

Step 3: Add keyboard shortcut for indicator

Go to System Settings -> Keyboard -> Shortcuts -> Custom Shortcuts.

Click add and for the command type (replace x and y with the ones from the previous command):

xdotool mousemove <x> <y> click 1 mousemove restore

Then add the shortcut you want.

It’s not pretty and elegant way, but I don’t know any other solution. If you know, how to do it better, leave a comment, below this article.

Additional note

Please remember that if you change your screen resolution or switch between two screens (e.g. laptop screen and external, bigger screen), your mouse click coordinates will have to be updated in the shortcut.

Detecting swipe gesture in mobile application

2014-12-25 Android No comments

Introduction

Update: Swipe Detector project is now called swipe.

Some time ago, I needed to detect moment when user is swiping finger on the screen horizontally (from left to right or opposite) or when user swiped horizontally. I’ve decided to spend some time for analyzing onTouch(MotionEvent event) and dispatchTouchEvent(MotionEvent event) method. We can read more about differences between triggering onTouch eventes on StackOverflow thread. Method like onTouch(MotionEvent event) allows to trigger any touch event, but it doesn’t allow to detect type of that event. Android API has GestureDetector class, which allows to detect long press and double tap events. There is also GestureDetector.OnGestureListener interface, which has the following methods:

  • onDown(MotionEvent e)
  • onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
  • onLongPress(MotionEvent e)
  • onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
  • onShowPress(MotionEvent e)
  • onSingleTapUp(MotionEvent e)

There is also GestureDetector.SimpleOnGestureListener class implementing GestureDetector.OnGestureListener and GestureDetector.OnDoubleTapListener interface. I also found an interesting project extending Android API called better-gesture-detector.

Detecting swipe gesture

swiped_right

swiped_up

swiping_horizontal

swiping_vertical

Unfortunately, all of these solutions doesn’t allow to detect swipe gestures (swipe left, right, up and down). That’s why I’ve decided to create my own project, which allows to detect, whether user is currently swiping in a specific direction or if user already swiped. We can implement SwipeListener interface and do whatever we want, when desired event occurs. Check out SwipeDetector project on GitHub. If you want to see how swipe events are detected, browse source of SwipeDetector class. If you want to see exemplary usage of this class, check out SwipeDetectorActivity.
SwipeDetector.SwipeListener interface allows to implement the following methods:

  • onSwipingLeft(MotionEvent e)
  • onSwipedLeft(MotionEvent e)
  • onSwipingRight(MotionEvent e)
  • onSwipedRight(MotionEvent e)
  • onSwipingUp(MotionEvent e)
  • onSwipedUp(MotionEvent e)
  • onSwipingDown(MotionEvent e)
  • onSwipedDown(MotionEvent e)

Moreover, we can take a look on a similar project called better-gesture-detector, which recognizes more types of gestures and also can be useful.

That’s it. I hope, it will be useful in your projects as well.

Installing release and debug version of app on a single device

2014-12-25 Android, Gradle No comments

Introduction

During software development process developers and QAs may want to have installed release and debug version of the app on a single device, what can be very helpful when they want to develop and use application at the same time. Another advantage is the fact that debug and release version of the app may need different configuration. It this post I will show you an example in which we are changing application name and launcher icon, but we can also change different values during compilation in the same way (e.g. address of the webservice). Some time ago, I’ve created similar template, but it was using older version of Build Tools, Android SDK and Android Studio. I’ve created new template, with the newest version of Android Studio (1.0.2) and newest version of Build Tools (1.0.0), so in that case, build.gradle file is smaller and simpler, but does its work correctly.

Exemplary repository

You can find exemplary project template at: https://github.com/FutureProcessing/android-debug-release-template.
All important information are included in README.md file and build.gradle file with project configuration.

Important files:

Source of essential build.gradle file presenting main idea is as follows: