diff --git a/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/common/controllers/ContentController.kt b/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/common/controllers/ContentController.kt index 2189402..5c4d53b 100644 --- a/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/common/controllers/ContentController.kt +++ b/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/common/controllers/ContentController.kt @@ -1,9 +1,9 @@ package nl.sogeti.android.gpstracker.ng.common.controllers import android.content.Context -import android.databinding.Observable -import android.databinding.ObservableField import android.net.Uri +import android.os.Handler +import android.os.Looper /** * Control the observing and monitoring for a observable uri value @@ -21,7 +21,7 @@ class ContentController(val context: Context, val listener: ContentListener) { contentObserver.unregister() } - private inner class ContentObserver: android.database.ContentObserver(null) { + private inner class ContentObserver : android.database.ContentObserver(Handler(Looper.getMainLooper())) { var registeredUri: Uri? = null @@ -36,12 +36,13 @@ class ContentController(val context: Context, val listener: ContentListener) { fun unregister() { if (registeredUri != null) { context.contentResolver.unregisterContentObserver(contentObserver) - registeredUri = null + registeredUri = null4 } } override fun onChange(selfChange: Boolean, changedUri: Uri) { registeredUri?.let { listener.onChangeUriContent(it, changedUri) } + } } diff --git a/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/trackedit/TrackEditPresenter.kt b/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/trackedit/TrackEditPresenter.kt index 5d0563e..665833a 100644 --- a/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/trackedit/TrackEditPresenter.kt +++ b/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/trackedit/TrackEditPresenter.kt @@ -61,7 +61,6 @@ class TrackEditPresenter(val model: TrackEditModel, val listener: TrackEditModel } val trackType = model.trackTypes[position] viewHolder.textView.text = context?.getString(trackType.stringId) - viewHolder.imageView.setImageDrawable(context?.getDrawable(trackType.drawableId)) context?.let { viewHolder.imageView.setImageDrawable(AppCompatResources.getDrawable(it, trackType.drawableId)) } return itemView