1. open class LottieUrlKey(url: String) :ILottieKey{
  2. private var resultKey:String = ""
  3. companion object{
  4. const val KEY_PREFIX = "url_"
  5. }
  6. init {
  7. resultKey = KEY_PREFIX + url
  8. }
  9. override fun getKey(): String {
  10. return resultKey;
  11. }
  12. }

子类

  1. class DoubleClickLottieKey extends LottieUrlKey {
  2. super("http://baidu.com")
  3. }

类似的java代码使用kotlin如何实现呢

  1. class DoubleClickLottieKey : LottieUrlKey {
  2. constructor(url: String) : super(url)
  3. }