Michael Bernier
03/26/2019, 4:08 PMAdam Kirk
03/26/2019, 4:16 PMAdam Kirk
03/27/2019, 1:13 AMmorcerfdumas
03/27/2019, 7:44 AMmorcerfdumas
03/27/2019, 7:48 AMval body: String?
property on the FuelRouting
interfaceAdam Kirk
03/27/2019, 4:02 PMandroid {
defaultConfig {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
}
or
android {
defaultConfig {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner4"
}
}
or
android {
defaultConfig {
testInstrumentationRunner "androidx.test.ext.junit.runners.AndroidJUnit"
}
}
???Adam Kirk
03/27/2019, 5:20 PMLilly
03/27/2019, 5:53 PMproduce
method is available within `scan`:
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
fun scan(filters: List<ScanFilter>?, settings: ScanSettings): ReceiveChannel<ScanResult> {
requireSafeSettings(settings)
return produce(context) { // unresolvable reference
val scanResultsChannel = Channel<ScanResult>(capacity = UNLIMITED)
val scanCallback = ScanCallback(scanResultsChannel)
scanner.startScan(filters, settings, scanCallback)
scanResultsChannel.consumeEach { send(it) }
scanResultsChannel.invokeOnClose { scanner.stopScan(scanCallback) }
if (SDK_INT >= O_MR1 && scanCallback.isScanningTooFrequently()) {
scanResultsChannel.close(ScanFailedException(SCAN_FAILED_SCANNING_TOO_FREQUENTLY))
}
}
}
I call this method within ScannerLiveData
class that extends from LiveData:
fun startScan() {
if (isScanning) {
return
}
scanChannel = scanner.scan(null, settings)
scanChannel.consumeEach { // unresolvable reference
// Todo
}
isScanning = true
}
My ScannerLiveData
object gets injected in my ScannerViewModel
where I simply call startScan()
. I don't know how to provide a scope to use the scan
method. I know there is a predefined viewModelScope
...The only idea I have is to pass this scope down to scan
method. Can someone help?LeoColman
03/27/2019, 8:40 PMLilly
03/27/2019, 8:45 PMShan
03/28/2019, 9:12 AMR
is giving me an unresolved reference error? edit: The solution was to downgrade the Android Gradle Plugin to 3.2.1 from 3.3.0 in Intellij, as there were some breaking changes that were not brought over.paulex
03/28/2019, 11:21 AMButterKnife
for view binding, i wanted to confirm if there is another(better) alternative provided by google itself?ar-g
03/28/2019, 11:28 AMfun ConnectivityManager?.isConnected(): Boolean {
return this != null && activeNetworkInfo != null && activeNetworkInfo.isConnected
}
Fatal Exception: java.lang.IllegalStateException: activeNetworkInfo must not be null
Shan
03/28/2019, 6:30 PMGradle sync failed: Unsupported method: IdeaModuleDependency.getDependencyModule()
. Am I doing something wrong here? It seems like other people are using Gradle v5.0+ .. 🤔jw
03/29/2019, 1:20 AMarchivesBaseName
in each module to something uniquewbertan
03/29/2019, 10:01 AMfun View.setOnClickListenerWithThrottle(@Nullable listener: View.OnClickListener?) {
// body
}
Was planning to use like the Android `setOnClickListener`:
// This is the Android 'public void setOnClickListener(@Nullable OnClickListener l)'
view.setOnClickListener {
//onClick action
}
But I'm getting this error:
/*
Type mismatch.
Required: View.OnClickListener?
Found () -> Unit
*/
view.setOnClickListenerWithThrottle {
//onClick action
}
Any idea or suggestion? Someone knows why or how I could achieve the desired behaviour?Damien O'Reilly
03/30/2019, 7:28 PMonCreateView
called twice, and 2nd time, my mutable live data is blank/freshmaheswar
04/01/2019, 2:07 PMJustin
04/01/2019, 8:51 PMval jobScheduler = context.getSystemService(Context.JOB_SCHEDULER_SERVICE) as android.app.job.JobScheduler
jobScheduler.allPendingJobs
where jobScheduler.allPendingJobs
is property syntax for the abstract method JobScheduler#getAllPendingJobs
Initially I figured I’m just accessing a member variable of the JobScheduler
(apparently abstract) class but when I dive into JobScheduler
, I noticed that allPendingJobs
is actually an abstract method, which, for all I know, is doing some intensive work and has not already done that work
I guess what I’m asking is, why does Kotlin and/or the IDE use property syntax on abstract methods? or am I misunderstanding what “property syntax” means? or…?
Thanks for your time!Slackbot
04/02/2019, 8:59 AMAdam Kirk
04/03/2019, 12:50 AMclass AssetRepositoryImpl(private val assetDao: AssetDao,
private val assetAPIDataSource: AssetAPIDataSource,
userAPIDataSource: UserAPIDataSource,
userDao: UserDao
) : AssetRepository {
private lateinit var currentUser: User
init {
//Check the database first
userDao.getCurrentUserLiveData().observeOnce {
println("ObserverOnce In AssetRepo Impl ${it.token}")
currentUser = it
}
//When there is an update then update here
userAPIDataSource.downloadedCurrentUser.observeForever {
currentUser = createUser(it)
}
assetAPIDataSource.downloadedCurrentAssets.observeForever { newCurrentAssets ->
persistFetchedCurrentAssets(newCurrentAssets)
}
}
I should note that it works. 🙂 but just because something works doesn’t mean its right and yes I am aware that there is lots missing for proper understanding. hopefully most will be able to understand what I am trying to do. In essence I need a way to access the user inside the asset repo.pablisco
04/03/2019, 6:39 AMJan
04/03/2019, 9:53 AMmonicalabbao
04/04/2019, 5:47 AMViewModel
in order to extend a PagedListEpoxyController
? like so: https://github.com/airbnb/epoxy/blob/master/epoxy-pagingsample/src/main/java/com/airbnb/epoxy/pagingsample/PagingSampleActivity.ktAndy Victors
04/04/2019, 7:40 AMgsala
04/04/2019, 11:08 AMval button : Button by lazy {
findViewById(R.id.button)
}
alle.iacob
04/05/2019, 8:46 AMJiri Malina
04/05/2019, 10:14 AMbackgroundDispatcher + job
and pass it into the component and I run GlobalScope.launch(context). Will job.cancel()
cancel it?Heart D
04/05/2019, 12:20 PMfebs
04/05/2019, 1:00 PMfebs
04/05/2019, 1:00 PMrook
04/05/2019, 6:09 PM_*.kt
rule_