Profile cover photo
Profile photo
Ralph Bergmann
141 followers -
ich bin ich :-)
ich bin ich :-)

141 followers
About
Ralph Bergmann's posts

How does Room notifies the UI that the data has changed?

I have this query:

@Query("SELECT * FROM Movie")
LiveData<List<Movie>> getAll();

This is my ViewModel:

public class MainActivityViewModel extends ViewModel {

@Inject AppDatabase db;
private LiveData<List<Movie>> data;

public MainActivityViewModel() {
MovieApp.graph().inject(this);
data = db.movieDao().getAll();
}

LiveData<List<Movie>> getData() {
return data;
}
}

And in onCreate of my Activity I call:

viewModel.getData().observe(this, adapter::setMovies);

In a JobService I download a Json and convert it to Room objects and call

db.movieDao().insertAll(movies.results);

but nothing happens :-(

Do I have to trigger a Room refresh manually or will Room it for me automatically? Do I miss something?

Post has attachment
Currently only Room queries can return a Publisher / Flowable. Are there any plans that insert, update, delete can return a Publisher / Flowable too?

Post has attachment
Try out Msync for Android. Sync your Meetup events into your Android calendar.

Post has attachment
When I create a new "Scrolling Activity" I get an Activity with a NestedScrollView and a FAB at the bottom. When I scroll up and down the FAB fades in and out.

But I can't find the reason for this fading. And I can't find a way to disable it :-(

Is it possible to disable the FAB fading animation?


https://drive.google.com/open?id=0B7PnmR9Iza92T3NxWjc1MmVLZzA

Hi all,

what is the state of the art to hold downloaded api responses that this data survives device rotation changes?

The api uses pages to provide chunks of 25 entries. My first approach is to use a Service which holds all downloaded data in a ArrayList. I think the data are to much to put them in the onSavedInstantState bundle.

Post has attachment

Öffi kann man nicht mehr vom Kalender aus öffnen :-(

Ich weiß nicht, seit wann es ist, ob es mit Android 6 oder einem Google Kalender / Maps update gekommen ist. Früher konnte ich im Kalender auf die Adresse klicken und wurde gefragt, ob ich den Eintrag in Maps oder Öffi öffnen möchte, neuerdings geht immer sofort Maps auf. Dies Einstellung "immer öffnen mit" ist nicht gesetzt.

Post has shared content
Here's the slides from +Ben Weiss & my talk from #droidconuk15 on Building Meaningful Motion.

We provide a whistle-stop tour of Android's animation APIs & share our experience on getting the most out of them.

The talk was recorded so hopefully a video will be available soon. Until then; each slide has speaker notes in the description.

#AndroidDev #AndroidDesign
PhotoPhotoPhotoPhotoPhoto
Building Meaningful Motion
121 Photos - View album

Post has shared content
Android pro tip: One-line custom fonts in XML with data binding!

I started playing with data binding last night for real, and I'm amazed by the power it gives you.  Check out this one-liner to set a custom font on a TextView:

@BindingAdapter({"bind:font"})
public static void setFont(TextView textView, String fontName){
 textView.setTypeface(Typeface.createFromAsset(textView.getContext().getAssets(), "fonts/" + fontName));
}

In XML:
<TextView
app:font="@{`Source-Sans-Pro-Regular.ttf`}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

Previously, this used to take endless lines of repetitive Java code (one for each TextView!). The missing custom typeface support in TextView has been a grievance held against the Android platform for years.  There's even an inventive library to address it[2]. Data binding makes all of that obselete.  If you can't tell, I'm in love!!  It's terse, powerful, and one of the biggest leaps forward I've seen for Android productivity.

As usual, you need to put your font file in assets/fonts/, and make sure to include the data binding framework.

[1] https://developer.android.com/tools/data-binding/guide.html
[2] Calligraphy: https://github.com/chrisjenx/Calligraphy
Photo

Post has attachment
Has someone experiences with RecyclerView + SortedList + SortedList.BatchedCallback?
Wait while more posts are being loaded