Skip to content

Commit

Permalink
Release (#39)
Browse files Browse the repository at this point in the history
* rename TextInputHighlight to ValueTextHighlight

* fix button styles

* update unit test config (#37)

Co-authored-by: Bianca Letti <[email protected]>
Co-authored-by: Rodrigo Nunes <[email protected]>

* bump version (#38)

Co-authored-by: Rodrigo Nunes <[email protected]>

Co-authored-by: Rodrigo Nunes <[email protected]>
Co-authored-by: Bianca Letti <[email protected]>
Co-authored-by: Rodrigo Souza <[email protected]>
  • Loading branch information
4 people authored Mar 16, 2020
1 parent fd204b3 commit de01b02
Show file tree
Hide file tree
Showing 20 changed files with 86 additions and 99 deletions.
2 changes: 2 additions & 0 deletions designsystem/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ android {
targetSdkVersion rootProject.targetSdkVersion
vectorDrawables.useSupportLibrary = true
consumerProguardFiles 'consumer-rules.pro'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {}
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import android.view.LayoutInflater
import android.widget.TextView
import com.natura.android.R

class TextInputHighlight @JvmOverloads constructor(
class ValueTextHighlight @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?colorPrimary" android:state_enabled="true"/>
<item android:alpha="0.12" android:color="@android:color/black"/>
</selector>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@android:color/black" android:state_enabled="true"/>
<item android:color="@color/colorHighEmphasis" android:state_enabled="true"/>
<item android:color="@color/mtrlBtnTextColorDisabled"/>
</selector>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

20 changes: 9 additions & 11 deletions designsystem/src/main/res/values/button_styles.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Widget.Natura.Button" parent="Widget.MaterialComponents.Button">
<style name="Widget.Natura.Button" parent="Widget.MaterialComponents.Button"/>

<style name="Widget.Natura.Button.DarkText" parent="Widget.Natura.Button">
<item name="android:textColor">@color/ds_mtrl_default_btn_text_color_selector</item>
</style>

<style name="Widget.Natura.Button.Secondary" parent="Widget.Natura.Button">
<item name="backgroundTint">@color/ds_mtrl_sec_btn_background_selector</item>
<style name="Widget.Natura.Button.Outlined.DarkText" parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="android:textColor">@color/ds_mtrl_default_btn_text_color_selector</item>
</style>

<style name="Widget.Natura.Button.Outlined" parent="Widget.MaterialComponents.Button.OutlinedButton"/>

<style name="Widget.Natura.Button.Outlined.Secondary" parent="Widget.Natura.Button.Outlined">
<item name="android:textColor">@color/ds_mtrl_sec_colored_btn_text_color_selector</item>
<item name="rippleColor">@color/ds_mtrl_sec_colored_ripple_color_selector</item>
<style name="Widget.Natura.Button.Outlined.StrokeColored" parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="strokeColor">@color/ds_mtrl_colored_stroke_color_selector</item>
</style>

<style name="Widget.Natura.Button.TextButton" parent="Widget.MaterialComponents.Button.TextButton"/>

<style name="Widget.Natura.Button.TextButton.Secondary" parent="Widget.Natura.Button.TextButton">
<item name="android:textColor">@color/ds_mtrl_sec_colored_btn_text_color_selector</item>
<item name="rippleColor">@color/ds_mtrl_sec_colored_ripple_color_selector</item>
<style name="Widget.Natura.Button.TextButton.DarkText" parent="Widget.MaterialComponents.Button.TextButton">
<item name="android:textColor">@color/ds_mtrl_default_btn_text_color_selector</item>
</style>

</resources>
10 changes: 10 additions & 0 deletions designsystem/src/main/res/values/custom_theme_attrs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<!-- To be replaced with default attr from google:material lib -->
<!-- Style to use for Material Outlined Buttons in this theme. -->
<!-- Since it's not available in support:design lib -->
<attr name="materialButtonOutlinedStyle" format="reference"/>
<attr name="materialBorderlessButtonStyle" format="reference"/>

</resources>
23 changes: 22 additions & 1 deletion designsystem/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,31 @@

<!--Remap legacy AppCompat attributes to MaterialComponent attributes-->
<item name="colorAccent">?colorPrimary</item>

<!--Material buttons style-->
<item name="materialButtonStyle">@style/Widget.Natura.Button.DarkText</item>
<item name="materialButtonOutlinedStyle">@style/Widget.Natura.Button.Outlined.DarkText</item>
<item name="materialBorderlessButtonStyle">@style/Widget.Natura.Button.TextButton.DarkText</item>
</style>

<!--Not supported officialy-->
<style name="Theme.Avon" parent="Theme.Natura">
<item name="colorPrimary">#DE0085</item>
<item name="colorSecondary">#A70058</item>
<item name="colorSecondary">#E9E9E9</item>

<!--Material buttons style-->
<item name="materialButtonStyle">@style/Widget.Natura.Button</item>
<item name="materialButtonOutlinedStyle">@style/Widget.Natura.Button.Outlined.StrokeColored</item>
<item name="materialBorderlessButtonStyle">@style/Widget.Natura.Button.TextButton</item>
</style>

<!--Not supported officialy-->
<style name="Theme.BodyShop" parent="Theme.Natura">
<item name="colorPrimary">#004236</item>
<item name="colorSecondary">#A55F53</item>

<item name="materialButtonStyle">@style/Widget.Natura.Button</item>
<item name="materialButtonOutlinedStyle">@style/Widget.Natura.Button.Outlined.StrokeColored</item>
<item name="materialBorderlessButtonStyle">@style/Widget.Natura.Button.TextButton</item>
</style>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class TextInputHighlightActivityTest {
class ValueTextHighlightActivityTest {

@Before
fun setup() {
ActivityScenario.launch(TextInputHighlightActivity::class.java)
ActivityScenario.launch(ValueTextHighlightActivity::class.java)
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
android:name=".components.LoadingActivity"
android:theme="@style/Theme.Natura" />
<activity
android:name=".components.TextInputHighlightActivity"
android:name=".components.ValueTextHighlightActivity"
android:theme="@style/Theme.Natura" />
<activity
android:name=".components.StyleButtonActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MainActivity : AppCompatActivity() {
}

findViewById<Button>(R.id.btn_input_text_highlight).setOnClickListener {
startActivity(Intent(this, TextInputHighlightActivity::class.java))
startActivity(Intent(this, ValueTextHighlightActivity::class.java))
}

findViewById<Button>(R.id.btn_style_buttons).setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,12 @@ class StyleButtonActivity : AppCompatActivity() {
startActivity(intent)
finish()
}

findViewById<View>(R.id.bodyShopThemeBtn).setOnClickListener {
val intent = Intent(baseContext, StyleButtonActivity::class.java)
intent.putExtra("theme", R.style.Theme_BodyShop)
startActivity(intent)
finish()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package com.natura.android.sample.components
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.natura.android.sample.R
import com.natura.android.widget.TextInputHighlight
import com.natura.android.widget.ValueTextHighlight

class TextInputHighlightActivity: AppCompatActivity() {
class ValueTextHighlightActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_text_input_highlight)

val inputHighlight = findViewById<TextInputHighlight>(R.id.highlightInitViaCode)
val inputHighlight = findViewById<ValueTextHighlight>(R.id.highlightInitViaCode)
inputHighlight.setDescription("Add description via code")
inputHighlight.setHighlightedInfo("$ 00.00")
}
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
android:id="@+id/btn_input_text_highlight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Input Text Highlight"
android:text="Value Text Highlight"
android:textColor="@color/colorBrdNatGray" />

</LinearLayout>
Expand Down
68 changes: 17 additions & 51 deletions sample/src/main/res/layout/activity_styled_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,97 +15,63 @@
android:orientation="vertical">

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button"
style="?materialButtonStyle"
android:text="Default Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button"
style="?materialButtonStyle"
android:text="Default Button Disabled"
android:enabled="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button.Secondary"
android:text="Secondary Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button.Secondary"
android:text="Secondary Button Disabled"
android:enabled="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button.Outlined"
style="?materialButtonOutlinedStyle"
android:text="Outlined Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button.Outlined"
style="?materialButtonOutlinedStyle"
android:text="Outlined Button Disabled"
android:enabled="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button.Outlined.Secondary"
android:text="Secondary Outlined"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button.Outlined.Secondary"
android:text="Secondary Outlined Disabled"
android:enabled="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button.TextButton"
style="?materialBorderlessButtonStyle"
android:text="Text Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button.TextButton"
style="?materialBorderlessButtonStyle"
android:text="Text Button Disabled"
android:enabled="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button.TextButton.Secondary"
android:text="Secondary Text Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>

<android.support.design.button.MaterialButton
style="@style/Widget.Natura.Button.TextButton.Secondary"
android:text="Secondary Text Button Disabled"
android:enabled="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"/>
</LinearLayout>
</ScrollView>

<android.support.design.widget.FloatingActionButton
android:id="@+id/bodyShopThemeBtn"
android:layout_width="24dp"
android:layout_height="24dp"
app:fabSize="mini"
app:backgroundTint="#004236"
android:layout_marginRight="40dp"
android:layout_marginBottom="40dp"
app:layout_constraintBottom_toTopOf="@id/naturaThemeBtn"
app:layout_constraintRight_toRightOf="parent"/>

<android.support.design.widget.FloatingActionButton
android:id="@+id/avonThemeBtn"
android:layout_width="24dp"
Expand Down
5 changes: 3 additions & 2 deletions sample/src/main/res/layout/activity_text_input_highlight.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
android:theme="@style/Theme.Natura">

<com.natura.android.widget.TextInputHighlight
<com.natura.android.widget.ValueTextHighlight
android:id="@+id/highlightInitOnXml"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -18,7 +19,7 @@
android:layout_width="0dp"
android:layout_height="20dp"/>

<com.natura.android.widget.TextInputHighlight
<com.natura.android.widget.ValueTextHighlight
android:id="@+id/highlightInitViaCode"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
Expand Down
2 changes: 1 addition & 1 deletion tools/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (file("github_credentials.properties").file) {
}

def getVersionName = { ->
return "0.0.9"
return "0.0.10"
}

def getGroupId = { ->
Expand Down

0 comments on commit de01b02

Please sign in to comment.