It’s 21st century – Stop using EVENTBUS!

Do you still use it!? Have you used it? I mean the EventBus. If the answer is NO, then you are either a new developer who started Android recently or you had the wonderful opportunity to not meet this three-headed monster. What I am talking about? Let’s make a brieft visit of the Android development history.

Continue reading “It’s 21st century – Stop using EVENTBUS!”

Mockito verify input parameter was called with a given value

Edit 23.04.2018
According to this issue, Mockito cannot capture var-args still.

There is a very easy way to verify a method has been called with the right parameter in Mockito. All you need to do is use captors, to capture the actual argument. Here is how you can use them:

 
ArgumentCaptor argument = ArgumentCaptor.forClass(RuleEntity.class);
 verify(mRulesRepository).createRule(argument.capture());
 assertEquals(1,argument.getValue().getRules().get(0).getTriggers().size())

Simple it is, just a quick reminder for starters.

EditText in CollapsingToolbar with NestedScrollView won’t scroll when the keyboard is open

The problem

What we currently have

  • CoordinatorLayout with CollapsingToolbar inside
  • The CollapsingToolbar has an ordinary Toolbar inside that displays text
  • A NestedScrollView with multiple EditText fields inside of it which actually pushes the CollapsingToolbar to collapse when you try to enter something in the EditText
Continue reading “EditText in CollapsingToolbar with NestedScrollView won’t scroll when the keyboard is open”

textAppearance does not work on custom TextView

Having a custom TextView is a totally normal thing these days. The problem comes when you try the following:

<com.test.view.MyCustomTextView 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:textAppearance="@style/MyCustomTextAppearance" />

If your custom TextView extends from the TextView class then this textAppearance that you have set will probably not work. It works in the Preview but it is never displayed correctly on the emulator or on a real device.

Continue reading “textAppearance does not work on custom TextView”