ReactiveNetwork – release v. 0.9.0 with RxJava2.x support

2017-04-11 Android, DSP2017, Java, Open source, RxJava No comments

This time, I upgraded my another reactive Android open-source project called ReactiveNetwork to RxJava2.x. Many thanks goes to @tushar-acharya who performed initial migration to the newer version of RxJava. During migration, I’ve also created new package rx2 to avoid potential import conflicts during migration inside Android apps. Besides migration, I’ve updated sample apps, documentation & JavaDocs on Github pages. You can still use RxJava1.x version and it’s available on the branch with that name.

To use brand new ReactiveNetwork compatible with RxJava2.x, add the following dependency to your build.gradle file:

dependencies {
  compile 'com.github.pwittchen:reactivenetwork-rx2:0.9.0'

If you still want or need to use RxJava1.x, use the following dependency:

dependencies {
  compile 'com.github.pwittchen:reactivenetwork:0.9.0'

New updates and bug-fixes are on the way. Right now I have a few issues in the project backlog.

Feel free to contribute to this project and report new issues! Any constructive feedback will be appreciated.

ReactiveBeacons – release of v. 0.6.0 with support for RxJava2

2017-04-03 Android, Bluetooth Low Energy, DSP2017, Java, Open source, RxJava No comments

Thanks to @BugsBunnyBR I released new version of ReactiveBeacons library with the RxJava2.x support. It’s an Android library scanning BLE (Bluetooth Low Energy) beacons nearby with RxJava Observables. I also kept backward compatibility with RxJava1.x. Different versions of the libraries are located on the separate git branches. It’s a similar approach to original RxJava project. I have separate builds on Travis CI, separate artifacts and JavaDocs. Such approach generates more overhead, but in such case, RxJava1.x can be kept in a maintenance mode and RxJava2.x can be a subject of the future development.

What has been done in this version?

  • migrated library to RxJava2.x on RxJava2.x branch and released it as reactivebeacons-rx2 artifact
  • kept library compatible with RxJava1.x on a RxJava1.x branch and released it as reactivebeacons artifact
  • removed master branch
  • bumped library dependencies
  • added permission annotations
  • organized Gradle configuration
  • transformed instrumentation unit tests to pure java unit tests
  • started executing unit tests on Travis CI server
  • created separate JavaDoc for RxJava1.x and RxJava2.x

If you want to add RxJava2.x version to your Android project, add the following dependency to build.gradle file:

dependencies {
  compile 'com.github.pwittchen:reactivebeacons-rx2:0.6.0'

For RxJava1.x you can use old artifact id:

dependencies {
  compile 'com.github.pwittchen:reactivebeacons:0.6.0'

This library was one of the first experiments with my migrations to RxJava2.x. I have plans to migrate rest of my libraries soon.
Thanks to the awesome open-source community on GitHub, this process goes faster and I don’t have to do everything by myself.

SJUG updates – March 2017

2017-03-05 DSP2017, Java, Meetups No comments

SJUG aka Silesia Java Users Group meetups were reactivated one year ago and it’s still alive! I think it’s a great success of the community of Java developers who are located there. It’s not an easy thing to gather people from different cities in the region in one place every month, but it’s possible! During the year we gathered a few sponsors and partners, discounts for software tools and tickets for the conferences. Moreover, we had guests outside the Silesian region. There were really interesting presentations and discussions. Recently, I updated the website of the SJUG, so it automatically downloads information about the latest meetup. Now, we don’t have to do it manually every time.
Next meetup is planned for this Friday (10.03.2017) and if you’re interested in it, feel free to join.

More details about the group:

JDD 2016 Conference

2016-08-21 Conferences, Java No comments


This year in the beginning of the October is highly recommended to be in Kraków, Poland in order to attend JDD (Java Developers Days) Conference.

jdd_logoJDD is an unusual conference. You can hear the presentations of both experienced people and those who are starting their adventure in the IT industry. You meet speakers from Poland and all around the world. There’s also a wide range of presentation topics concerning not only technical trends and practices but also work methodology, communication, how to talk with people, etc. what has the same importance as coding proficiency.

JDD_4  JDD_1  JDD_7

Besides the presentations, you can meet a lot of interesting people from IT industry in Poland and abroad including programmers, QAs, managers, leaders, etc. There’s a great possibility to establish new contacts and meet old friends. If you are looking for new job opportunities or want to make a market research, you can also do that because there’s a lot of companies looking for new employees. I’ve attended this conference in the last years and I can tell that atmosphere is really great and you can learn a lot. Moreover, Kraków is a very nice city to spend some time, visit the old town, sightseeing, and go to the pubs in the night. Not to mention, there’s party after conference days :-).


Discount for the blog readers!

All blog readers have 15% discount for the conference tickets with the code JDD_wittblog. I hope, it’ll encourage you to fill in the registration form.

See you at the conference!

Dockerizing Hybris

2016-07-27 Docker, Hybris, Java 1 comment


A few months ago, I started work at Hybris, which was acquired by SAP, so our “division” is officially called SAP Hybris. I work in a team developing an extension for Hybris platform with assisting extensions and internal framework. There are many teams around the world developing their own extensions, which are finally integrated and packed into Commerce Suite provided to the clients and partners. We have our own development environment, but sometimes there’s need to build and run whole Commerce Suite in the case of system tests, bug reproduction, verification, etc. It’s not really hard, but you have to know what to do and you have to perform a lot of steps manually. This is kind of old approach in present days. Moreover, it’s really big project, so build and initialization process takes time. You have to download huge zipped package, unpack it, run Gradle script with installation recipe, compile project, run initialization and finally start the server.

Automating work

I wondered if it’s possible to automate mentioned process. Moreover, I wanted to learn more about Docker and create more advanced Dockerfile than “hello world”, which will be real life use case. That’s why I decided to dockerize SAP Hybris Commerce Suite. I called this project ydocker and you can find it at Before you start doing anything, you need to remember to install Docker on your system. You can check out my notes about installation Docker on Linux in learning-docker repository.

Note #1: It’s not official company solution yet. Right now it’s just my personal proof of concept.

Note #2: I had problems with building and running this Docker container on OS X and I haven’t tested it on MS Windows. These systems need to use boot2docker, Docker Toolbox or another approach like that. I had no problems with it on Linux (Ubuntu 14.04 LTS), so this system is recommended if you want to build and run this container successfully. Probably other Linux distributions or Ubuntu versions will handle this as well.

Note #3 (update from 01.10.2016): Guys working on Docker improved their software for Mac, so it should work without any problems on this system now. It was tested on OS X El Capitan 10.11.6 and works fine. We just need to get Docker for Mac.

Building Docker container

Except for Dockerfile, ydocker repository also contains helper script ydocker, which has the following parameters:

-b    building Docker container
-r    running Hybris Server in Docker container
-c    running Docker container with CLI
-i    showing info about Docker container
-u    showing Commerce Suite Download Url
-d    deleting Docker container
-h    showing help

This script uses configuration file ydocker.conf, which has the following contents:


You can customize this configuration. E.g. choose a different version of the suite, different recipe or change server port.

To build container, you can just type:

./ydocker -b

Then, provide your credentials and Docker will:

  1. create container based on Ubuntu
  2. install Java 8
  3. set Java 8 as default Java version
  4. install wget
  5. download SAP Hybris Commerce Suite via wget
  6. unpack downloaded SAP Hybris Commerce Suite
  7. remove downloaded zipped package to save some disk space
  8. run configured installation recipe
  9. compile the project
  10. run system initialization

It may take some time. If you have good hardware setup it may take about 30 minutes.

Running Docker container

When everything is done, you can run docker image, with the command:

./ydocker -r

After that, Docker will start the server at localhost ( and port 9002, which is exposed.
Commerce Suite will be started in a default configuration, which is not production ready, but is good for testing and demonstration purposes.
You need to wait for a few minutes to let the server warm up and then you can open administration console from the browser at

In addition, if you want to browse generated configuration or unpacked suite, you can run Docker container with CLI with the following command:

./ydocker -c

It won’t start the server, but allow you to take a look around container via terminal.


That’s it! This proof of concept shows that we can get, build and run complicated and a huge project like SAP Hybris Commerce Suite inside Docker container, automate a lot of manual work and transform old school manual deployment and build process into elegant and standardized Docker container.

ReactiveNetwork – release v. 0.5.0

2016-07-24 Android, Java, Open source No comments

I have never thought that seemingly tiny thing like monitoring network connectivity on a mobile device can be subject to development for at least about one year!

I’ve recently released a new version of my project – ReactiveNetwork library – v. 0.5.0.

Highlights of this release are as follows:

  • added support for the new network monitoring strategy with NetworkCallback available since Android Lollipop (API 21)
  • kept backward compatibility of network monitoring with pre-Lollipop devices
  • added possibility to implement custom network monitoring strategy
  • made methods responsible for creating Observables static like in original RxJava project
  • added Preconditions class verifying correctness of the input parameters
  • changed API of Observable responsible for monitoring network from Observable<ConnectivityStatus> observeNetworkConnectivity(context) to Observable<Connectivity> observeNetworkConnectivity(context)
  • replaced ConnectivityStatus enum with Connectivity class containing info about network state, type and name
  • added more unit tests

You can read detailed release notes on GitHub.

I hope, this project will make your apps more robust and you won’t be surprised by incorrect network monitoring when your users will upgrade their devices to Android N. The newest Android version is not officially released to all Android devices yet, but it’s already supported by ReactiveNetwork library.

ReactiveNetwork – new releases & roadmap

2016-06-10 Android, Java, Open source, RxJava No comments

Recent updates

I’ve recently released version 0.3.0 of ReactiveNetwork library for Android. As you can see in the release notes, it contains a lot of updates.

  • Deprecated methods related to monitoring WiFi Access Points and WiFi Singal level in favor of ReactiveWiFi project, which has this functionality extracted from ReactiveNetwork
  • Deprecated methods and enums related to monitoring connectivity with The Internet
  • Added Observables, which allows monitoring Internet connectivity basing on socket connection with a remote host (we can also monitor specific host with given parameters)

Roadmap for the future versions

Updates planned for 0.4.0:

  • Removing deprecated methods
  • Removing unused permissions from AndroidManifest.xml

Track progress of releasing 0.4.0 on GitHub

Updates planned for 0.5.0:

  • Updating library code with respect to the updates in Android 5 and 6 (especially ConnectivityManager) related to monitoring network connectivity mentioned in issue #62 on GitHub
  • Creating strategy interface to keep backward compatibility with Pre-Lollipop devices, so we’ll be able to monitor network in a different way depending on the given Android version

Track progress of releasing 0.5.0 on GitHub

Another future updates (not related to any version):
These updates are also important, but they’re not related to library API

  • Adding example of library usage with Retrofit (without breaking reactive stream chain)

Track progress of resolving this issue on GitHub

Final thoughts

Currently, it’s my most popular open-source project and people rely on it in production apps, so I’m trying to keep it as simple and as good as I can with respect to the recent updates of Android SDK. I’m getting really good feedback from people on GitHub and seriously considering it during the development process. If something bothers you in that project, don’t hesitate to create an Issue or new Pull Request on GitHub.

Silesia Java Users Group – re-activation

2016-06-05 Java, Meetups No comments

In the beginning of this year, after a very long break, small group of Java and JVM enthusiasts re-activated Silesia Java Users Group (SJUG) in the upper Silesia region of southern Poland. There were four meetings this year up to now. The fifth meeting is planned for this Friday (10th of June 2016 at 17:30) in Katowice, ul. Jesionowa 9a, Biurowiec Budrol, piętro 1, sala 102. The topic is Thinking Immutably About Pipelines and will be presented by David Pollak. If you are in Katowice or somewhere around on this Friday afternoon, don’t hesitate to come to this meeting!

More information

Everyone interested in software development, Java and JVM is invited to these meetings. Doesn’t matter if you’re an expert or a newbie. New speakers are also welcome.

There’ll be free pizza, licenses for IntelliJ and JProfiler to give . 🙂

Handle swipe events in reactive style

2016-03-11 Android, Java, Open source, RxJava No comments


Initial Swipe Detector project was created on 24th of December 2014 on GitHub, so more than one year ago. I also wrote an article about that on my blog. I needed that to detect moment when user is swiping horizontally, to block vertical scroll on the ListView while deleting item with “swipe to delete” functionality. This gives better UX and apps from Google works in the same way. Mentioned project was just a simple proof of concept showing how can we detect whether user is swiping on the screen of mobile device and in which direction. Recently, I thought that it would be cool if we had a separate generic library to do the same thing. It would be even cooler if this library will provide RxJava Observable to handle such events in a reactive way. That’s why I’ve decided to take this project, extract generic code to library and write an Observable wrapping listener, which handles swipe events. Please, take a look at the outcome of that work.



New library is called swipe. If we want to use it, we need to add proper dependencies to our build.gradle file:

dependencies {
  compile 'com.github.pwittchen:swipe:0.0.1'

Next, we need to create Swipe attribute in our Activity:

private Swipe swipe;

We also need to remember to call dispatchTouchEvent(MotionEvent) method:

We need to perform things described above both for listener and RxJava Observable.

Imperative way

If we are not familiar with RxJava, we can handle swipe events in an imperative way with listener:

Reactive way

If we want to use the power of RxJava and code our app in a reactive style, we need to add Subscription attribute.

private Subscription subscription;

Now, we can subscribe an Observable:

Please note, there’s much less code than in the case of listener.

We need to remember to unsubscribe our Observable, when it’s no longer needed:

That’s it! I hope it will help you to detect and handle swipe events in your apps.

Source code of the library is available on GitHub:

Infinite scroll for RecyclerView in Android

2016-02-28 Android, Java, Open source, UI 5 comments


Three years ago I wrote short article about Endless ListView in Android. This solution was dedicated to ListView, wasn’t perfect and generic. Moreover, lot of people asked questions about this solution and they weren’t sure how to use it properly. I also had some problems with implementing endless scroll AKA infinite scroll in Android apps. In addition, in the newest Android SDK it’s recommended to use RecyclerView instead of ListView. For a long time I couldn’t find the right implementation of the infinite scroll AKA endless scroll for Android. A few solutions I’ve found weren’t production ready, weren’t working correctly or had too many features. I wanted to have small, easy and flexible solution to implement infinite scroll for Android, which works with RecyclerView from the newest Android API. That’s why I created new project called InfiniteScroll, which helps to implement infinite scroll on Android. Library is tested and its behavior is documented by appropriate unit tests. If you would like to see it in action, check out gif animation presenting how sample app works. Library is very tiny, but does its job.

How to use it?

First of all, we need to add library dependency to our build.gradle file:

dependencies {
  compile 'com.github.pwittchen:infinitescroll:0.0.1'

We also need to create necessary fields in our Activity:

public RecyclerView recyclerView;
private LinearLayoutManager layoutManager;

Next, we need to create new InfiniteScrollListener:

Then, we need to initialize RecyclerView and LinearLayoutManager in our Activity and add previously created listener to RecyclerView:

If we want to display loading progress, we should add additional view for it, show it while loading starts and hide it when loading is finished.

That’s it!

Please note: We can also implement “Load more” button with that library. Instead of loading items immediately, we can display such button when user scrolled to the end of the list.

Exemplary apps

You can see how, library can be implemented in the following places:

  • Sample app from main repository, which loads Strings into RecyclerView
  • Search Twitter app, which allows to search tweets and scroll them infinitely


I think, this time infinite scroll is implemented in the right and re-usable way. I hope, it will make your life easier while developing your apps.

Source code of the library can be found at: