hesam
12/12/2019, 10:10 PM[<content://com.android.providers.media.documents/document/image%3A38>]
However, when I take a photo and store it in MediaStore.Images, then its uri looks like this: [<content://media/external/images/media/51>]
. Is there anyway that I get a uri like the first uri? [code in the comment]Rishabh Harit
12/13/2019, 8:19 AMcarlos cdmp
12/13/2019, 10:41 AMfun getModel() : Either<Model, APIError>
Ive Vasiljevic
12/13/2019, 12:22 PMSubhrajyoti Sen
12/13/2019, 1:13 PMBryan Lee
12/13/2019, 4:20 PMSebi Sheldin Sebastian
12/14/2019, 1:15 PMCake
12/14/2019, 9:52 PMAyden
12/15/2019, 4:25 AMobject Constant {
URL = ""
}
OR
class Constant {
companion object {
URL = ""
}
}
deactivateduser
12/15/2019, 9:23 AMdave
12/16/2019, 1:18 PMAndy Gibel
12/16/2019, 4:59 PMalex.tavella
12/17/2019, 12:54 AMdagger-android
. I personally don't like it, just want to know more about the problems community faced with it and possibly advocating against it on my company (we use it for every feature).Timo Obereder
12/17/2019, 11:32 AMAshutosh Panda
12/17/2019, 1:58 PMDiego Almeida de Oliveira
12/17/2019, 3:16 PMinterface IntentInterface {
fun getStringExtra(name: String?): String
fun getIntExtra(name: String?): Int
...
}
class CustomIntent : Intent, IntentInterface {
constructor() : super()
constructor(intent: Intent?) : super(intent)
constructor(packageContext: Context?, cls: Class<*>?) : super(packageContext, cls)
...
}
class SampleActivity: AppCompatActivity() {
...
fun handleIntent() {
viewModel.processReceivedData(CustomIntent(intent))
}
...
}
class SampleViewModel: ViewModel() {
...
fun processReceivedData(data: IntentInterface) {
val sampleValue = data.getStringExtra("sample_key")
...
}
...
}
rattleshirt
12/18/2019, 11:05 AMFailed resolution of: Lkotlin/internal/ir/Intrinsic;
Anyone experienced this before?Will Nixon
12/18/2019, 10:45 PM"@drawable/${formatString(entry)}"
Any thoughts on the best way to do this?Serhii K.
12/19/2019, 9:22 PMPagedListAdapter
I populate it using LivePagedListBuilder
. Each list item has Favorite button
. How it would be better to handle Favorite button
state? I need to know if an item is already added to favorites and when the button is pressed I need to update Favorites database
to delete or add this item. (I'm using architecture components in my app). Thank you.
My solution:
Inside onBindViewHolder
I call the callback to my activity and pass an item and its position. ViewModel checks if this item is favorited or not and returns a result back to the activity, the activity calls adapter.notifyItemChanged(position)
. Same goes for Favorite button
click listener. I need to pass an adapter position to ViewModel I don't like it. I think this solution is really bad but I can't come up with something better.Daniele Segato
12/20/2019, 9:47 AMval map = mapOf<String, String>()
map.getOrDefault("foo", "bar")
This gives no warning from either the compiler or lint and crashes at runtime (on Lollipop) with Fatal Exception: java.lang.NoSuchMethodError
Am I missing something?Slackbot
12/20/2019, 3:48 PMByron Woodfork
12/20/2019, 3:54 PMAyden
12/21/2019, 9:06 AMprivate val retrofit = Retrofit.Builder()
// .baseUrl(Constant.URL + Constant.VERSION)
.baseUrl("<http://192.168.1.128:5000/api/>")
.addConverterFactory(GsonConverterFactory.create())
.build()
interface RegisterRepository {
@FormUrlEncoded
@POST("/api/register")
suspend fun register(
@Field("email") email: String,
@Field("password") password: String
)User
}
object RegisterApi {
val retrofitService : RegisterRepository by lazy {
retrofit.create(RegisterRepository::class.java)
}
}
sreich
12/23/2019, 4:45 PMtseisel
12/24/2019, 9:19 AMService
and a Worker
. For that matter I introduced a Repository
. Because the service needs to know when data from the repository have changed, the repository exposes data as Flow<List<Foo>>
(making it a reactive repository).
Since database access can be expensive i'd like to introduce some memory cache so that either the Service
or the Worker
can query the current List<Foo>
faster.
Where would you put that cache ?
1. As a field in the repository itself.
2. As a field in a decorator that wraps the Repository
.
3. In the Service
, by consuming the flow with broadcastIn
.
4. You wouldn't use a memory cache, as Room
loads fast enough.Stefan Kanev
12/24/2019, 2:11 PMObservable<[Thing]>
, and I'd really like to pass a Observable<Thing>
to the second fragment. However, I cannot figure out how. I have the list observable in the first fragment's view model and my intuition is that when making the transition, there should be a way to prepare the view model for the second fragment and then it can find it via ViewModelProvider
. Can't figure out how to do it, though. Maybe there's a totally different way. Any clues?Dylan
12/27/2019, 12:08 PMFlowable.interval()
(see the docs below), but I would like to use Kotlin Coroutines for that. Do you have any idea on how to do that?
http://reactivex.io/RxJava/javadoc/io/reactivex/Flowable.html#interval-long-java.util.concurrent.TimeUnit-genovich
12/27/2019, 5:04 PMMike Nakhimovich
12/28/2019, 1:56 AMJérôme Gully
12/28/2019, 11:33 AMclass MyApp : Application() {
val database: AppDatabase by lazy { AppDatabase.getInstance(this) }
val dataRepository: DataRepository by lazy { DataRepository(database.documentDao) }
}
Jérôme Gully
12/28/2019, 11:33 AMclass MyApp : Application() {
val database: AppDatabase by lazy { AppDatabase.getInstance(this) }
val dataRepository: DataRepository by lazy { DataRepository(database.documentDao) }
}
Brendan Weinstein
12/28/2019, 8:42 PMJérôme Gully
12/28/2019, 10:04 PMthis
, how can I pass application instance (for context) in the companion object ?Brendan Weinstein
12/28/2019, 10:10 PMclass App : Application {
companion object {
lateinit var appInstance: App
val dateabase: AppDatabase by lazy { AppDatabase.getInstance(appInstance) }
}
onCreate {
appInstance = this
}
}
Jérôme Gully
12/28/2019, 10:11 PM