Remove most of Gradle tests with Jack

Jack is deprecated and Kotlin Gradle plugin throws,
so one test checking that build is failing with the exception
is enough.
This commit is contained in:
Alexey Tsvetkov
2017-05-26 00:12:34 +03:00
parent 0cb67b4052
commit c8d05f8485
42 changed files with 3 additions and 851 deletions
@@ -222,176 +222,13 @@ abstract class AbstractKotlinAndroidWithJackGradleTests(
super.defaultBuildOptions().copy(androidHome = File("../../../dependencies/android-sdk-for-tests"),
androidGradlePluginVersion = androidGradlePluginVersion, javaHome = File(getEnvJDK_18()))
@Test
fun testAndroidTestCompilation() {
val project = Project("AndroidJackProject", gradleVersion)
project.build("assembleAndroidTest") {
assertSuccessful()
assertFileExists("Android/build/tmp/kotlin-classes/flavor1Debug.jar")
assertFileExists("Android/build/tmp/kotlin-classes/flavor2Debug.jar")
assertFileExists("Android/build/tmp/kotlin-classes/flavor1DebugAndroidTest.jar")
assertFileExists("Android/build/tmp/kotlin-classes/flavor2DebugAndroidTest.jar")
assertFileExists("Android/build/outputs/apk/Android-flavor1-debug-androidTest.apk")
assertFileExists("Android/build/outputs/apk/Android-flavor2-debug-androidTest.apk")
}
}
@Test
fun testSimpleCompile() {
val project = Project("AndroidJackProject", gradleVersion)
project.build("build", "test") {
assertSuccessful()
assertContains(
":Lib:compileReleaseKotlin",
":compileFlavor1DebugKotlin",
":zipKotlinClassesForFlavor1Debug",
":transformKotlinClassesWithJillForFlavor1Debug",
":compileFlavor2DebugKotlin",
":zipKotlinClassesForFlavor2Debug",
":transformKotlinClassesWithJillForFlavor2Debug",
":compileFlavor1JnidebugKotlin",
":zipKotlinClassesForFlavor1Jnidebug",
":transformKotlinClassesWithJillForFlavor1Jnidebug",
":compileFlavor1ReleaseKotlin",
":zipKotlinClassesForFlavor1Release",
":transformKotlinClassesWithJillForFlavor1Release",
":compileFlavor2JnidebugKotlin",
":zipKotlinClassesForFlavor2Jnidebug",
":transformKotlinClassesWithJillForFlavor2Jnidebug",
":compileFlavor2ReleaseKotlin",
":zipKotlinClassesForFlavor2Release",
":transformKotlinClassesWithJillForFlavor2Release",
":compileFlavor1DebugUnitTestKotlin",
"InternalDummyTest PASSED"
)
checkKotlinGradleBuildServices()
}
// Run the build second time, assert everything is up-to-date
project.build("build") {
assertSuccessful()
assertContains(
":Lib:compileReleaseKotlin UP-TO-DATE",
":compileFlavor1DebugKotlin UP-TO-DATE",
":zipKotlinClassesForFlavor1Debug UP-TO-DATE",
":transformKotlinClassesWithJillForFlavor1Debug UP-TO-DATE",
":compileFlavor2DebugKotlin UP-TO-DATE",
":zipKotlinClassesForFlavor2Debug UP-TO-DATE",
":transformKotlinClassesWithJillForFlavor2Debug UP-TO-DATE",
":compileFlavor1JnidebugKotlin UP-TO-DATE",
":zipKotlinClassesForFlavor1Jnidebug UP-TO-DATE",
":transformKotlinClassesWithJillForFlavor1Jnidebug UP-TO-DATE",
":compileFlavor1ReleaseKotlin UP-TO-DATE",
":zipKotlinClassesForFlavor1Release UP-TO-DATE",
":transformKotlinClassesWithJillForFlavor1Release UP-TO-DATE",
":compileFlavor2JnidebugKotlin UP-TO-DATE",
":zipKotlinClassesForFlavor2Jnidebug UP-TO-DATE",
":transformKotlinClassesWithJillForFlavor2Jnidebug UP-TO-DATE",
":compileFlavor2ReleaseKotlin UP-TO-DATE",
":zipKotlinClassesForFlavor2Release UP-TO-DATE",
":transformKotlinClassesWithJillForFlavor2Release UP-TO-DATE"
)
}
project.build("build", "--rerun-tasks") {
assertSuccessful()
assertContains(
":Lib:compileReleaseKotlin",
":compileFlavor1DebugKotlin",
":zipKotlinClassesForFlavor1Debug",
":transformKotlinClassesWithJillForFlavor1Debug",
":compileFlavor2DebugKotlin",
":zipKotlinClassesForFlavor2Debug",
":transformKotlinClassesWithJillForFlavor2Debug",
":compileFlavor1JnidebugKotlin",
":zipKotlinClassesForFlavor1Jnidebug",
":transformKotlinClassesWithJillForFlavor1Jnidebug",
":compileFlavor1ReleaseKotlin",
":zipKotlinClassesForFlavor1Release",
":transformKotlinClassesWithJillForFlavor1Release",
":compileFlavor2JnidebugKotlin",
":zipKotlinClassesForFlavor2Jnidebug",
":transformKotlinClassesWithJillForFlavor2Jnidebug",
":compileFlavor2ReleaseKotlin",
":zipKotlinClassesForFlavor2Release",
":transformKotlinClassesWithJillForFlavor2Release",
":compileFlavor1DebugUnitTestKotlin",
"InternalDummyTest PASSED"
)
checkKotlinGradleBuildServices()
}
}
@Test
fun testDagger() {
val project = Project("AndroidDaggerJackProject", gradleVersion)
val options = defaultBuildOptions().copy(incremental = false)
project.build("assembleDebug", options = options) {
assertSuccessful()
assertContains(
":kaptDebugKotlin",
":compileDebugKotlin",
":zipKotlinClassesForDebug",
":transformKotlinClassesWithJillForDebug",
":transformJackWithJackForDebug"
)
}
}
@Test
fun testAndroidExtensions() {
val project = Project("AndroidExtensionsJackProject", gradleVersion)
val options = defaultBuildOptions().copy(incremental = false)
project.build("assembleDebug", options = options) {
assertSuccessful()
assertContains(
":compileDebugKotlin",
":zipKotlinClassesForDebug",
":transformKotlinClassesWithJillForDebug",
":transformJackWithJackForDebug"
)
}
}
@Test
fun testIcepick() {
val project = Project("AndroidIcepickJackProject", gradleVersion)
val options = defaultBuildOptions().copy(incremental = false)
project.build("assembleDebug", options = options) {
assertSuccessful()
assertContains(
":kaptDebugKotlin",
":compileDebugKotlin",
":zipKotlinClassesForDebug",
":transformKotlinClassesWithJillForDebug",
":transformJackWithJackForDebug"
)
project.build("assemble") {
assertFailed()
assertContains("Kotlin Gradle plugin does not support the deprecated Jack toolchain")
}
}
}
@@ -1,41 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.dagger.kotlin"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.1.0'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.google.dagger:dagger:2.2'
kapt 'com.google.dagger:dagger-compiler:2.2'
provided 'org.glassfish:javax.annotation:10.0-b28'
}
@@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/yan/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.dagger.kotlin">
<application
android:allowBackup="true"
android:label="app_name"
android:name=".DemoApplication">
<activity
android:label="app_name"
android:name=".ui.HomeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
@@ -1,44 +0,0 @@
/*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.dagger.kotlin
import android.content.Context
import android.content.Context.LOCATION_SERVICE
import android.location.LocationManager
import dagger.Module
import dagger.Provides
import javax.inject.Singleton
/**
* A module for Android-specific dependencies which require a [Context] or
* [android.app.Application] to create.
*/
@Module class AndroidModule(private val application: BaseApplication) {
/**
* Allow the application context to be injected but require that it be annotated with
* [@Annotation][ForApplication] to explicitly differentiate it from an activity context.
*/
@Provides @Singleton @ForApplication
fun provideApplicationContext(): Context {
return application
}
@Provides @Singleton
fun provideLocationManager(): LocationManager {
return application.getSystemService(LOCATION_SERVICE) as LocationManager
}
}
@@ -1,13 +0,0 @@
package com.example.dagger.kotlin
import com.example.dagger.kotlin.ui.HomeActivity
import dagger.Component
import javax.inject.Singleton
@Singleton
@Component(modules = arrayOf(AndroidModule::class))
interface ApplicationComponent {
fun inject(application: BaseApplication)
fun inject(homeActivity: HomeActivity)
fun inject(demoActivity: DemoActivity)
}
@@ -1,11 +0,0 @@
package com.example.dagger.kotlin
import android.app.Application
abstract class BaseApplication : Application() {
protected fun initDaggerComponent(): ApplicationComponent {
return DaggerApplicationComponent.builder().androidModule(AndroidModule(this)).build()
}
}
@@ -1,12 +0,0 @@
package com.example.dagger.kotlin
import android.app.Activity
import android.os.Bundle
abstract class DemoActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Perform injection so that when this call returns all dependencies will be available for use.
(application as DemoApplication).component.inject(this)
}
}
@@ -1,13 +0,0 @@
package com.example.dagger.kotlin
class DemoApplication : BaseApplication() {
lateinit var component: ApplicationComponent
override fun onCreate() {
super.onCreate()
val component = initDaggerComponent()
component.inject(this) // As of now, LocationManager should be injected into this.
this.component = component
}
}
@@ -1,6 +0,0 @@
package com.example.dagger.kotlin
import javax.inject.Qualifier
@Qualifier
annotation class ForApplication
@@ -1,9 +0,0 @@
package com.example.dagger.kotlin
import android.app.Activity
class UseRJavaActivity : Activity() {
fun useRJava() {
val app_name = getResources().getString(R.string.app_name)
}
}
@@ -1,38 +0,0 @@
/*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.dagger.kotlin.ui
import android.location.LocationManager
import android.os.Bundle
import com.example.dagger.kotlin.DemoActivity
import com.example.dagger.kotlin.DemoApplication
import com.example.dagger.kotlin.R
import kotlinx.android.synthetic.main.activity_main.locationInfo
import javax.inject.Inject
class HomeActivity : DemoActivity() {
@Inject
lateinit var locationManager: LocationManager
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
(application as DemoApplication).component.inject(this)
// TODO do something with the injected dependencies here!
locationInfo.text = "Injected LocationManager:\n$locationManager"
}
}
@@ -1,5 +0,0 @@
package com.example.dagger.kotlin
fun useBuildConfigJava() {
if (BuildConfig.APPLICATION_ID != "com.example.dagger.kotlin") throw AssertionError()
}
@@ -1,10 +0,0 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" tools:context=".ui.HomeActivity">
<TextView android:id="@+id/locationInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp" />
</RelativeLayout>
@@ -1,3 +0,0 @@
<resources>
<string name="app_name">kotlin</string>
</resources>
@@ -1,8 +0,0 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
@@ -1,18 +0,0 @@
buildscript {
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.android.tools.build:gradle:$android_tools_version"
}
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
}
}
@@ -1,19 +0,0 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
org.gradle.jvmargs=-Xmx1536M
@@ -1,27 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 23
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.dagger.kotlin"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
jackOptions { enabled true }
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.androidextensions">
<application android:label="app_name">
<activity
android:label="app_name"
android:name="com.example.androidextensions.MyActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
@@ -1,30 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.androidextensions
import android.os.Bundle
import android.app.Activity
import kotlinx.android.synthetic.main.activity_main.textView
class HomeActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
this.textView.setText("Hello, world!")
}
}
@@ -1,9 +0,0 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
@@ -1,3 +0,0 @@
<resources>
<string name="app_name">kotlin</string>
</resources>
@@ -1,20 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.android.tools.build:gradle:$android_tools_version"
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
}
}
@@ -1,43 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
dependencies {
compile "frankiesardo:icepick:3.2.0"
kapt "frankiesardo:icepick-processor:3.2.0"
compile 'org.parceler:parceler-api:1.1.5'
kapt 'org.parceler:parceler:1.1.5'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
android {
compileSdkVersion 23
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.icepick.kotlin"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
jackOptions { enabled true }
}
lintOptions {
abortOnError false
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
repositories {
mavenCentral()
maven {
url "https://clojars.org/repo/"
}
mavenLocal()
}
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.frankiesardo.icepick"
android:versionCode="1"
android:versionName="1.0">
<application
android:allowBackup="true"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light">
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
@@ -1,28 +0,0 @@
package com.github.frankiesardo.icepick
import android.content.Context
import android.os.Parcelable
import android.util.AttributeSet
import com.sample.icepick.lib.BaseCustomView
import icepick.State
class CustomView : BaseCustomView {
@JvmField @State
var textColor: Int? = null
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle)
fun setTextColorWithAnotherMethod(color: Int) {
this.textColor = color
setTextColor(textColor!!)
}
override fun onRestoreInstanceState(state: Parcelable) {
super.onRestoreInstanceState(state)
if (textColor != null) {
setTextColorWithAnotherMethod(textColor!!)
}
}
}
@@ -1,19 +0,0 @@
package com.github.frankiesardo.icepick
import org.parceler.Parcel
@Parcel
class Example {
lateinit var name: String
@JvmField
var age: Int = 0
constructor() { /*Required empty bean constructor*/
}
constructor(age: Int, name: String) {
this.age = age
this.name = name
}
}
@@ -1,18 +0,0 @@
package com.github.frankiesardo.icepick
import android.os.Bundle
import android.os.Parcelable
import org.parceler.Parcels
import icepick.Bundler
class ExampleBundler : Bundler<Any> {
override fun put(s: String, example: Any, bundle: Bundle) {
bundle.putParcelable(s, Parcels.wrap(example))
}
override fun get(s: String, bundle: Bundle): Any {
return Parcels.unwrap<Any>(bundle.getParcelable<Parcelable>(s))
}
}
@@ -1,49 +0,0 @@
package com.github.frankiesardo.icepick
import android.graphics.Color
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import com.sample.icepick.lib.BaseActivity
import icepick.State
class MainActivity : BaseActivity() {
@JvmField @State(MyBundler::class)
var message: String? = null
lateinit var customView: CustomView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
customView = findViewById(R.id.custom_view) as CustomView
updateText()
}
private fun updateText() {
val defaultText = if (message == null || baseMessage == null) {
"Use the menu to add some state"
} else {
baseMessage + message
}
customView.text = defaultText
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.main, menu)
return super.onPrepareOptionsMenu(menu)
}
override fun onMenuItemSelected(featureId: Int, item: MenuItem): Boolean {
if (item.itemId == R.id.action_add_state) {
customView.setBackgroundColorWithAnotherMethod(Color.BLUE)
customView.setTextColorWithAnotherMethod(Color.WHITE)
baseMessage = "This state will be automagically "
message = "saved and restored"
updateText()
return true
}
return super.onMenuItemSelected(featureId, item)
}
}
@@ -1,17 +0,0 @@
package com.github.frankiesardo.icepick
import android.os.Bundle
import icepick.Bundler
class MyBundler : Bundler<String> {
override fun put(key: String, value: String?, bundle: Bundle) {
if (value != null) {
bundle.putString(key, value + "*")
}
}
override fun get(key: String, bundle: Bundle): String? {
return bundle.getString(key)
}
}
@@ -1,24 +0,0 @@
package com.sample.icepick.lib
import android.app.Activity
import android.os.Bundle
import android.os.Parcelable
import icepick.Icepick
import icepick.State
import android.util.Log
open class BaseActivity : Activity() {
@JvmField @State
var baseMessage: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Icepick.restoreInstanceState(this, savedInstanceState)
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
Icepick.saveInstanceState(this, outState)
}
}
@@ -1,34 +0,0 @@
package com.sample.icepick.lib
import android.content.Context
import android.os.Parcelable
import android.util.AttributeSet
import android.widget.TextView
import icepick.Icepick
import icepick.State
open class BaseCustomView : TextView {
@JvmField @State
var backgroundColor: Int? = null
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle)
fun setBackgroundColorWithAnotherMethod(color: Int) {
this.backgroundColor = color
setBackgroundColor(color)
}
override fun onSaveInstanceState(): Parcelable {
return Icepick.saveInstanceState(this, super.onSaveInstanceState())
}
override fun onRestoreInstanceState(state: Parcelable) {
super.onRestoreInstanceState(Icepick.restoreInstanceState(this, state))
if (backgroundColor != null) {
setBackgroundColorWithAnotherMethod(backgroundColor!!)
}
}
}
@@ -1,12 +0,0 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.github.frankiesardo.icepick.CustomView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:id="@+id/custom_view"/>
</LinearLayout>
@@ -1,7 +0,0 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_add_state"
android:title="@string/action_add_state"
android:orderInCategory="100"
android:showAsAction="never" />
</menu>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Icepick</string>
<string name="action_add_state">Add some state</string>
</resources>
@@ -1,11 +0,0 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:$android_tools_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}