kotlin-android-extensions

Dark theme configuration change in Android Q

吃可爱长大的小学妹 提交于 2020-02-02 11:19:06
问题 I want to implement android 10 dark theme in my app , I have these following cases: SYSTEM_DEFAULT, NIGHT_MODE, LIGHT_MODE The problem is when I change theme from night or light to system_default from inside the app and it can not understand whether the system is in light mode or dark mode. so the theme won't be updated. I've tried the dark theme by google https://developer.android.com/guide/topics/ui/look-and-feel/darktheme and implementing the configuration still won't be good for me

Class X is not abstract and does not implement fun writeToParcel() defined in android.os.Parcelable

你离开我真会死。 提交于 2020-01-13 08:18:10
问题 In my Android app, I want to add a Bundle including a Place object described below to my Intent. Since serializable was slow and not recommended, I preferred Parcelable. Althoug I use Kotlin 1.3.31, I have problems parcelizing some data classes. Example: import android.os.Parcelable import kotlinx.android.parcel.Parcelize @Parcelize data class Place(val street: String, val postal: String, val city: String) : Parcelable and Android Studio complains: Class 'Place' is not abstract and does not

Kotlin RC NoClassDefFoundError

怎甘沉沦 提交于 2020-01-11 11:22:11
问题 After updating kotlin to RC-1036 i'm facing a weird issue: my code is not even compiled and packed. When build passes and the app is launched i'm getting ClassNotFoundException: Didn't find class "example.myapplication.MainActivity" . I have tried to decompile apk with apktool and didn't find my classes inside the archive. There are no classes in build/intermediates dir either. This is my project: app/build.gradle : apply plugin: 'com.android.application' apply plugin: 'kotlin-android

how does onAuthStateChange() works and it's code in kotlin?

余生长醉 提交于 2020-01-06 06:10:46
问题 I am trying to log a message when there is a change in state, but apparently it's not working, I am not sure where I am going wrong. I want to update the UI when the state is changed to user logged in, but for starters I am only trying to log a message. I also don't quiet understand the registering it and unregistering it. This is my login activity's code. val TAG = "LoginActivity" //private var mDatabaseReference: DatabaseReference? = null //private var mDatabase: FirebaseDatabase? = null //

ListAdapter not updating when editing content

爱⌒轻易说出口 提交于 2020-01-06 05:43:08
问题 Every time content is added to the recyclerview and it happens the title is misspelled when I go to fix the mistake, the update/edit does not take effect. The goal is fixing the update error so when I go back to fix it, the content title would be updated companion object { //THIS THE ADAPTER CLASS private val DIFF_CALLBACK: DiffUtil.ItemCallback<Book> = object:DiffUtil.ItemCallback<Book>() { @Override override fun areItemsTheSame(oldItem: Book, newItem: Book):Boolean { return oldItem.id ==

'ViewModelProviders' is deprecated. After upgrading lifecycle-extensions:2.1.0 to 2.2.0-alpha05

十年热恋 提交于 2020-01-04 20:45:03
问题 Android Studio -> New Project -> Choice "Tabbed Activity". After upgrading lifecycle-extensions from 2.1.0 to 2.2.0-alpha05 ViewModelProviders is deprecated. In simple cases it replaceable by "by viewModels()" for example: plHlFrModel = ViewModelProviders.of(this).get(PlHlFrModel::class.java) replaced by: private val plHlFrModel by viewModels<PlHlFrModel>() But I can't figure out how to replace this one: pageViewModel = ViewModelProviders.of(this) .get(PageViewModel::class.java).apply {

“projections are not allowed for immediate arguments of a supertype” Kotlin Android Studio

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 11:02:56
问题 I am getting this error when I converted Java to Kotlin: Java public class HeaderTab extends ExpandableGroup { private String header; public HeaderTab(String title, List items) { super(title, items); } } Kotlin class HeaderTab(title: String, items: List<*>) : ExpandableGroup<*>(title, items) { private val header: String? = null } Android Studio says this: projections are not allowed for immediate arguments of a supertype What do I need to modify here? 回答1: Use Any for a quick fix, or

“projections are not allowed for immediate arguments of a supertype” Kotlin Android Studio

橙三吉。 提交于 2020-01-03 11:02:02
问题 I am getting this error when I converted Java to Kotlin: Java public class HeaderTab extends ExpandableGroup { private String header; public HeaderTab(String title, List items) { super(title, items); } } Kotlin class HeaderTab(title: String, items: List<*>) : ExpandableGroup<*>(title, items) { private val header: String? = null } Android Studio says this: projections are not allowed for immediate arguments of a supertype What do I need to modify here? 回答1: Use Any for a quick fix, or

Kotlin,Java,multidex,Dagger 2,Butterknife and Realm: transformClassesWithJarMergingForDebug: duplicate entry: org/jetbrains/annotations/NotNull.class

不想你离开。 提交于 2020-01-02 04:49:14
问题 We have existing Java Android code. We want to painlessly slowly start moving to Kotlin. We use Dagger 2, Butterknife and Realm. We use Java 8 compiler (but our targetCompatibility and sourceCompatibility are 1.7). I've been roaming the web for hours, seen SO, GitHub conversations and so on, and managed to solve all problems except one: The build is successful, but when trying to debug, we get: Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build

Kotlin synthetic extension and several include same layout

孤者浪人 提交于 2020-01-01 04:28:04
问题 How to access to view using kotlin synthetic extension if I have a layout like below: file:two_days_view.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <include android:id="@+id/day1" layout="@layout/day_row" android:layout_width="match_parent" android:layout_height="wrap_content" /> <include android:id="@+id/day2