"Fossies" - the Fresh Open Source Software Archive

Member "kotlin-1.3.61/plugins/android-extensions/android-extensions-compiler/testData/codegen/android/multiFile/0.kt" (26 Nov 2019, 1749 Bytes) of package /linux/misc/kotlin-1.3.61.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Kotlin source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 package test
    2 
    3 import android.app.Activity
    4 import android.view.View
    5 import android.widget.*
    6 import kotlinx.android.synthetic.main.layout.*
    7 import kotlinx.android.synthetic.main.layout1.*
    8 
    9 class R {
   10     class id {
   11         companion object {
   12             const val item_detail_container = 0
   13             const val textView1 = 1
   14             const val password = 2
   15             const val textView2 = 3
   16             const val passwordConfirmation = 4
   17             const val login = 5
   18             const val passwordField = 6
   19             const val passwordCaption = 7
   20             const val loginButton = 8
   21          }
   22     }
   23 }
   24 
   25 class MyActivity(): Activity() {
   26     val textViewWidget = TextView(this)
   27     val editTextWidget = EditText(this)
   28     val buttonWidget = Button(this)
   29     val textViewWidget2 = TextView(this)
   30     val editTextWidget2 = EditText(this)
   31     val buttonWidget2 = Button(this)
   32 
   33     override fun <T : View> findViewById(id: Int): T? {
   34         return when (id) {
   35             R.id.textView1 -> textViewWidget
   36             R.id.password -> editTextWidget
   37             R.id.login -> buttonWidget
   38             R.id.passwordField -> textViewWidget2
   39             R.id.passwordCaption -> editTextWidget2
   40             R.id.loginButton -> buttonWidget2
   41             else -> null
   42         } as T?
   43     }
   44 
   45 
   46     public fun box(): String{
   47         return if (textView1.toString() == "TextView" &&
   48                    password.toString() == "EditText" &&
   49                    login.toString() == "Button" &&
   50                    passwordField.toString() == "TextView" &&
   51                    passwordCaption.toString() == "EditText" &&
   52                    loginButton.toString() == "Button")
   53             "OK" else ""
   54     }
   55 }
   56 
   57 fun box(): String {
   58     return MyActivity().box()
   59 }