This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun testReset() { | |
countView.reset() | |
assertThat(countView.countValue).isEqualTo(0) | |
assertThat(textViewValue.text.toString()).isEqualTo("0") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mobtiso.test.customview | |
import androidx.test.core.app.ApplicationProvider | |
import com.google.common.truth.Truth.assertThat | |
import org.junit.Test | |
import org.junit.runner.RunWith | |
import org.robolectric.RobolectricTestRunner | |
import org.robolectric.annotation.Config | |
@RunWith(RobolectricTestRunner::class) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CountView @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0, | |
defStyleRes: Int = 0 | |
) : LinearLayout(context, attrs, defStyleAttr, defStyleRes) { | |
private val buttonSubtract: Button | |
private val buttonAdd: Button | |
private val textViewCount: TextView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="horizontal" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:gravity="center" | |
android:padding="10dp" | |
android:background="#50000000"> | |
<Button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
defaultConfig { | |
... | |
} | |
testOptions { | |
unitTests.includeAndroidResources = true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<string name="count_content">Count: %d</string> | |
<string name="button_subtract">-</string> | |
<string name="button_add">+</string> | |
<string name="button_reset">Reset</string> | |
<dimen name="count_text_size">30sp</dimen> | |
<dimen name="button_size">60dp</dimen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright (c) 2019 - Bui Minh Triet - [email protected] - http://fluttervn.com */ | |
double _sigmaX = 0.0; // from 0-10 | |
double _sigmaY = 0.0; // from 0-10 | |
double _opacity = 0.1; // from 0-1.0 | |
double _width = 350; | |
double _height = 300; | |
double _blurWidth = _width / 2; | |
double _blurHeight = _height / 2; | |
Stack( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright (c) 2019 - Bui Minh Triet - [email protected] - http://fluttervn.com */ | |
double _sigmaX = 0.0; // from 0-10 | |
double _sigmaY = 0.0; // from 0-10 | |
double _opacity = 0.1; // from 0-1.0 | |
double _width = 350; | |
double _height = 300; | |
Stack( | |
children: <Widget>[ | |
Image.asset( |
NewerOlder