kotlin

kotlinx.android.synthetic unused android studio issue

吃可爱长大的小学妹 提交于 2021-02-04 11:12:05
问题 I am working one project using kotlin + Rxjava + MVVM. During development facing issue of importing view ids in Fragment or viewholder. import kotlinx.android.synthetic.main.layout.* unused with kotlin. Normaly view id should used from kotlin synthetic layout imports but it directly import it from R.id that should not happen. Kotlin plugin version : org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.40 My gradle file : apply plugin: 'com.android.feature' apply plugin: 'kotlin-android' apply plugin

Simple Kotlin Project does not show any UI

瘦欲@ 提交于 2021-02-04 08:40:21
问题 I have a very simple Android Project in Kotlin. Just to dig in Kodein. I can not see the two TextViews in the main_layout? I have used MVP pattern for the only MainActivity I have there.. The app starts without a crash and is show a blank white screen. Any hints? BaseActivity: abstract class BaseActivity<V : BasePresenter.View> : AppCompatActivity(), BasePresenter.View { protected abstract val layoutResourceId : Int protected abstract val presenter : BasePresenter<V> val kodeinMu = LazyKodein

Keep State RecyclerView When Keyboard Open

老子叫甜甜 提交于 2021-02-04 08:30:11
问题 I have a case where the RecyclerView has 5 data Horizontal , when I was in the 5th data and clicked on EditText then the Keyboard appeared immediately scrolling back to the 1st Data which was very disturbing when I wanted to fill in the 5th data on th EditText , how to prevent that, so that the RecyclerView doesn't scroll automatically to the 1st data? AndroidManifest.xml <activity android:name=".MainActivity" android:screenOrientation="portrait" android:theme="@style/AppTheme.NoActionBar"

Keep State RecyclerView When Keyboard Open

我的梦境 提交于 2021-02-04 08:30:08
问题 I have a case where the RecyclerView has 5 data Horizontal , when I was in the 5th data and clicked on EditText then the Keyboard appeared immediately scrolling back to the 1st Data which was very disturbing when I wanted to fill in the 5th data on th EditText , how to prevent that, so that the RecyclerView doesn't scroll automatically to the 1st data? AndroidManifest.xml <activity android:name=".MainActivity" android:screenOrientation="portrait" android:theme="@style/AppTheme.NoActionBar"

Navigation drawer unlock mode ignored

眉间皱痕 提交于 2021-02-04 08:23:30
问题 So I have this app with one activity ( MainActivity ) and I'm using the navigation architecture component. So it has DrawerLayout which is wrapping the fragment view. These are two methods in the Activity class which are responsible for Locking and Unlocking of the drawerLayout . ... fun lockNavDrawer() { drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED) } fun unLockNavDrawer() { drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED) } ... There are some fragments

startActivity skips onCreate()

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-04 08:16:45
问题 I have a simple case of Activity1 -> Activity2 . In the past when I've used startActivity(Intent(this, Activity2::class.java)) there have been no issues and the onCreate() method of Activity2 would be called. In my current case this is not happening. I have logs in the onCreate() method and they are never hit. But if I create a onStart() method it enters there. However, never in my logs for the lifetime of the application does onCreate() of Activity2 ever get hit. How is this possible.

Print float with two decimals unless number is a mathematical integer

北城余情 提交于 2021-02-04 08:10:21
问题 Is there a simple way of printing a floating value as a string with decimals if the value has decimals, other wise print it like an int without decimals? 12.5 would print 12.50 15.0 would print 15 Is there a simple way to do this? I can think of ways which includes parse floats to strings to ints but it doesn't seem optimal. EDIT: This answer does not do what I want: Show decimal of a double only when needed This answers only shows one decimal if the value only has one decimal. What I need is

Chaquopy problems with nltk and download

六眼飞鱼酱① 提交于 2021-02-04 08:08:48
问题 According to Chaquopy Not able to download Resource i'm not sure if the problem got solved. So here is question in the nltk context. After including one of the nltk.download line: nltk.download('popular') or nltk.download('punkt') or nltk.download('all') I get this stack trace: 2020-08-26 13:33:45.742 19765-19765/com.pro.useyournotes E/ExceptionTag: com.chaquo.python.PyException: BadZipFile: File is not a zip file com.chaquo.python.PyException: BadZipFile: File is not a zip file at <python>

The 'kotlin-android-extensions' Gradle plugin is deprecated

做~自己de王妃 提交于 2021-02-04 05:38:32
问题 with the Gradle version 6.2 and Android studio version 4.0.1, I have the deprecation message for the Kotlin-android-extention . any body has any idea how to fix it. 回答1: It's deprecated Base on the google document Kotlin Android Extensions is deprecated, which means that using Kotlin synthetics for view binding is no longer supported. for those who's wonder what the synthetic is. I should say a simple way to access to UI view id with kotlin which was possible by adding 'kotlin-android

Spring源码搭建

余生长醉 提交于 2021-02-02 16:32:34
第一步:下载Spring源码 从github上下载Spring源码。我们可以下载release版本,也可以 git clone 相应的版本。这里下载的是当前最新版本: spring-framework-5.2.1.RELEASE 第二步:配置与源码相匹配的环境 Spring 5版本是用Gradle进行构建的,因此我们进入到 gradle/wrapper 目录,打开 gradle-wrapper.properties 文件,我们可以看到如下信息: distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists 配置属性信息描述: distributionUrl :要下载的gradle的地址,使用哪个版本的gradle通过这里来指定 distributionBase 和 distributionPath :两个属性组合在一起,指定 distributionUrl 属性下载下来的文件的解压后的存放位置。 distributionPath 是