Tony
04/15/2020, 3:22 PMCody Engel
04/16/2020, 5:15 PMTypedArray
in Android, I added the following extension function to handling parsing the values:
fun TypedArray.parseStyledAttributes(parse: (typedArray: TypedArray) -> Unit) {
try {
parse(this)
} finally {
recycle()
}
}
However the call-site still gives a lint warning "This typed array should be recycled after use with #recycle()". Is there anything I could do besides adding @SuppressLint("Recycle")
everywhere?iex
04/16/2020, 5:42 PMAhmed Ibrahim
04/16/2020, 6:45 PM@Parcelize
support, but when I look it up at Google I see a bunch of medium articles, and the link that leads to kotlinlang.org pointing to this link [1], which doesn't have a mention for it. Even Jake Wharton's tweet[2] mentioning that it became stable redirects to [1].
{1] https://kotlinlang.org/docs/reference/android-overview.html
[2] https://twitter.com/JakeWharton/status/1116424059162644480Deepti M
04/16/2020, 10:09 PMDaniella Paiva
04/17/2020, 2:07 PMLilly
04/17/2020, 2:57 PMcompileOptions {
sourceCompatibility = JavaVersion.VERSION_12
targetCompatibility = JavaVersion.VERSION_12
}
kotlinOptions {
jvmTarget = "12"
}
I get Unsupported class file version: 56.
AS: 4.1 C5
Gradle: 6.3
Kotlin: 1.3.72
JDK: 14.0.1
When I'm searching for "android java 12/13 support" I find sources that claim gradle/kotlin/IntelliJ is supporting both so did I miss something or is it just not supported yet?kartoffelsup
04/17/2020, 7:32 PME/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
Process: io.github.kartoffelsup.nuntius, PID: 2334
java.lang.NoSuchMethodError: No static method post$default(Lio/github/kartoffelsup/nuntius/client/NuntiusApiService;Ljava/lang/String;Ljava/lang/Object;Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;Ljava/lang/String;ILjava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; in class Lio/github/kartoffelsup/nuntius/client/NuntiusApiService; or its super classes (declaration of 'io.github.kartoffelsup.nuntius.client.NuntiusApiService' appears in /data/app/io.github.kartoffelsup.nuntius-1/base.apk:classes3.dex)
at io.github.kartoffelsup.nuntius.data.user.UserService.login(UserService.kt:27)
at io.github.kartoffelsup.nuntius.ui.user.UserLoginScreenKt$UserLoginScreen$formState$1$1.invokeSuspend(UserLoginScreen.kt:94)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
I'm guessing I need a proguard rule or something? I added this:
-keepclassmembers class io.github.kartoffelsup.nuntius.client.NuntiusApiService {
*;
}
but that didn't help unfortunately. Code is here:
https://github.com/kartoffelsup/nuntius-app/blob/master/app/src/main/java/io/github/kartoffelsup/nuntius/ui/user/UserLoginScreen.kt#L94
https://github.com/kartoffelsup/nuntius/blob/master/client/src/commonMain/kotlin/io/github/kartoffelsup/nuntius/client/NuntiusApiService.kt#L11-L17
Any pointers? Thanks!viralshah
04/18/2020, 2:36 AMval k = "total"
[{"id": "123", "total": "56.00"}, {"id": "456", "total": "55.00"}]
to
map id -> k
{"123": "56.00", "456": "55.00"}
wadva
04/18/2020, 11:22 AMGradle sync failed: Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.4-M1.
jme
04/20/2020, 12:23 AMR.java
using Kotlin's experimental Inline Classes, giving us better compile-time type safety over resource referencing. For example: R.color.red
is of type Int
, whereas K.color.red
is of type ColorRes
.
Is this something that people would be interested in? There's more work to be done to make it production-ready, and it feels like this should be somewhere more central (like AGP), but you can find more examples and the code in this Github repodewildte
04/20/2020, 2:23 PMSystem.console
returns null?codeslubber
04/20/2020, 4:32 PMColton Idle
04/20/2020, 4:41 PM> Task :app:compilePaidDebugKotlin
w: /bitrise/src/app/src/rollertoaster/myview/HealthView.kt: (66, 46): No cast needed
w: /bitrise/src/app/src/rollertoaster/myview/HealthView.kt: (97, 44): Parameter 'dialog' is never used, could be renamed to _
w: /bitrise/src/app/src/rollertoaster/myview/HealthView.kt: (174, 40): Parameter 'dialog' is never used, could be renamed to _
w: /bitrise/src/app/src/rollertoaster/myview/HealthView.kt: (416, 21): The expression is unused
w: /bitrise/src/app/src/rollertoaster/myapp/HealthInitializer.kt: (33, 24): Parameter 'context' is never used
w: /bitrise/src/app/src/rollertoaster/myapp/MyDialog.kt: (48, 27): Condition 'response.yours == null' is always 'false'
w: /bitrise/src/app/src/rollertoaster/myapp/MyDialog.kt: (54, 13): Condition 'actions == null' is always 'false'
w: /bitrise/src/app/src/rollertoaster/myapp/MyDialog.kt: (55, 57): Parameter 'w' is never used, could be renamed to _
...
A lot of these warning a so tiny, is there an easy way to just fix all of them, or just prevent them? Not sure why they even show up honestly.iex
04/21/2020, 7:50 AMprivate fun NavHostFragment.hasDestinationInBackstack(destinationId: Int): Boolean {
for (index in 0 until childFragmentManager.backStackEntryCount) {
if (childFragmentManager.getBackStackEntryAt(index).id == destinationId) {
return true
}
}
return false
}
doesn't work, because id
returns 0, 1, 2... with tag maybe?emmano
04/21/2020, 1:20 PMException
?
java.lang.IllegalArgumentException navigation destination action_loadingFragment_to_fragmentHome is unknown to this NavController
Santiago Oroz17
04/21/2020, 7:16 PMCaused by: java.lang.IllegalArgumentException: View is not a binding layout. Tag: layout/activity_movie_0
but only with DaggerAppCompatActivityJoao Birk
04/21/2020, 8:40 PMlayout formatter
like ktlint
?Derrick Wadek
04/22/2020, 9:17 AMDerrick Wadek
04/22/2020, 9:19 AMclass MainActivity : AppCompatActivity(), KodeinAware {
override val kodein by kodein()
private var notesAdapter: NotesAdapter ?= null
private var mLayout : LinearLayoutManager ?= null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
ft_btn.setOnClickListener {
val intent = Intent(this, AddNoteActivity::class.java)
startActivity(intent)
}
initRecyclerview()
val db = NoteRoomDatabase(this)
val repo = NotesRepository(db)
val factory = NotesViewModelFactory(repo)
val notesViewModel : NotesViewModel = ViewModelProvider(this, factory).get(NotesViewModel::class.java)
notesViewModel.getAllNotesFromDB().observe(this, Observer {
notesAdapter?.submitList(it)
})
}
private fun initRecyclerview(){
recyclerView.setHasFixedSize(true)
mLayout = LinearLayoutManager(this)
recyclerView.layoutManager = mLayout
recyclerView.adapter = notesAdapter
}
}
Jitesh Dedhiya
04/22/2020, 1:39 PMBacho Kurtanidze
04/22/2020, 3:40 PMbinding.registerButton.setOnClickListener{}
we would be able to write binding.onRegisterButtonClick{}
. does it make any sense? or am I talking about data binding right now?Santiago Oroz17
04/22/2020, 7:18 PMlawlorslaw
04/23/2020, 1:10 AMKeith
04/23/2020, 4:27 AMBilal Sohail
04/23/2020, 6:54 AMMohamed Ibrahim
04/23/2020, 7:04 AM@Parcelize
with a class has a generic type like List<T>?
Răzvan Roșu
04/23/2020, 7:12 AM<activity android:name=".ui.login.LoginActivity" android:theme="@style/LoginTheme">
<`intent-filter> <action android:name="android.intent.action.VIEW" />`
<`category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" />`
<`data android:host="service-name" android:path="/oauth-callback" android:scheme="http" /> </intent-filter>`
</`activity>`
Thanks in advance!Ali
04/23/2020, 9:49 AMresponse.some1?.let { some1 -> response.some2?.let { some2 -> some1 + some2 } }
Lilly
04/23/2020, 8:35 PMLilly
04/23/2020, 8:35 PMMark Murphy
04/23/2020, 10:49 PM