43 lines
1.3 KiB
Kotlin
43 lines
1.3 KiB
Kotlin
|
/*
|
||
|
* Copyright (c) 2020 Proton Technologies AG
|
||
|
*
|
||
|
* This file is part of ProtonMail.
|
||
|
*
|
||
|
* ProtonMail is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* ProtonMail is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with ProtonMail. If not, see https://www.gnu.org/licenses/.
|
||
|
*/
|
||
|
|
||
|
package ch.protonmail.android
|
||
|
|
||
|
import android.content.Context
|
||
|
import android.os.Bundle
|
||
|
import android.view.View
|
||
|
import android.widget.FrameLayout
|
||
|
import androidx.appcompat.app.AppCompatActivity
|
||
|
|
||
|
class ViewTestActivity : AppCompatActivity() {
|
||
|
|
||
|
private val frameLayout by lazy { FrameLayout(this) }
|
||
|
|
||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||
|
super.onCreate(savedInstanceState)
|
||
|
setContentView(frameLayout)
|
||
|
}
|
||
|
|
||
|
fun <V : View> setView(buildView: (Context) -> V): V {
|
||
|
val view = buildView(this)
|
||
|
frameLayout.addView(view)
|
||
|
return view
|
||
|
}
|
||
|
}
|