Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Include Chip and ChipGroup material components
Refactor resource values
  • Loading branch information
Unknown committed Apr 15, 2019
1 parent 3c4087f commit da80316
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 55 deletions.
9 changes: 9 additions & 0 deletions .idea/dictionaries/unknown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="br.com.caiodev.newmaterialdesigntest">

<application
Expand All @@ -8,7 +9,8 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -17,5 +19,4 @@
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package br.com.caiodev.newmaterialdesigntest

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
}
5 changes: 5 additions & 0 deletions app/src/main/res/color/chip_selector.xml
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="@color/colorPrimaryDark" android:state_checked="true" />
<item android:color="@color/lighterGreen" />
</selector>
72 changes: 55 additions & 17 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
android:id="@+id/materialCardView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_16dp"
android:layout_margin="@dimen/margin_8dp"
android:clickable="true"
android:focusable="true"
app:cardCornerRadius="@dimen/generic_8dp"
app:cardElevation="@dimen/generic_8dp"
app:cardCornerRadius="@dimen/radius_8dp"
app:cardElevation="@dimen/elevation_8dp"
app:cardPreventCornerOverlap="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down Expand Up @@ -61,54 +61,92 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/materialButton"
android:layout_width="match_parent"
android:layout_height="@dimen/view_64dp"
android:layout_margin="@dimen/margin_16dp"
android:background="@color/darkGreen"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_8dp"
android:background="@color/colorAccent"
android:text="@string/material_button_text"
android:textAllCaps="false"
android:textColor="@android:color/white"
android:textSize="@dimen/text_size_20sp"
app:cornerRadius="@dimen/generic_8dp"
app:cornerRadius="@dimen/radius_4dp"
app:layout_constraintEnd_toEndOf="@+id/materialCardView"
app:layout_constraintStart_toStartOf="@+id/materialCardView"
app:layout_constraintTop_toBottomOf="@+id/materialCardView"
app:rippleColor="@color/lighterGreen" />

<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/materialCheckBox"
style="@style/margin_left_16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_16dp"
android:text="@string/material_check_box_text"
android:textSize="@dimen/text_size_16sp"
app:layout_constraintStart_toStartOf="@+id/materialButton"
app:layout_constraintStart_toStartOf="@id/materialButton"
app:layout_constraintTop_toBottomOf="@+id/materialButton" />

<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/materialRadioButton"
style="@style/margin_left_8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_16dp"
android:text="@string/material_radio_button_text"
android:textSize="@dimen/text_size_16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/materialCheckBox" />
app:layout_constraintTop_toBottomOf="@id/materialCheckBox" />

<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchMaterial"
style="@style/margin_right_16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_16dp"
android:text="@string/material_switch_text"
android:textSize="@dimen/text_size_16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/materialRadioButton"
app:layout_constraintEnd_toEndOf="@id/materialButton"
app:layout_constraintTop_toBottomOf="@id/materialRadioButton"
app:switchPadding="@dimen/padding_8dp" />

<com.google.android.material.chip.Chip
android:id="@+id/materialChip"
style="@style/ChipTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/single_material_chip_text"
app:chipBackgroundColor="@color/chip_selector"
app:layout_constraintStart_toStartOf="@id/materialCheckBox"
app:layout_constraintTop_toBottomOf="@id/switchMaterial" />

<com.google.android.material.chip.ChipGroup
android:id="@+id/materialChipGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_8dp"
android:layout_marginLeft="@dimen/margin_8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/materialChip"
app:singleSelection="true">

<com.google.android.material.chip.Chip
style="@style/ChipTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/first_material_chip_text"
app:chipBackgroundColor="@color/chip_selector" />

<com.google.android.material.chip.Chip
style="@style/ChipTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/second_material_chip_text"
app:chipBackgroundColor="@color/chip_selector" />

<com.google.android.material.chip.Chip
style="@style/ChipTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/third_material_chip_text"
app:chipBackgroundColor="@color/chip_selector" />

</com.google.android.material.chip.ChipGroup>

</androidx.constraintlayout.widget.ConstraintLayout>

</ScrollView>
7 changes: 3 additions & 4 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorAccent">#D81B60</color>

<!--Shades of green-->
<color name="colorAccent">#1B5E20</color>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="darkGreen">#1B5E20</color>

<!--Shades of green-->
<color name="lighterGreen">#81C784</color>

</resources>
14 changes: 7 additions & 7 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
<!--Margin values-->
<dimen name="margin_8dp">8dp</dimen>
<dimen name="margin_16dp">16dp</dimen>
<dimen name="margin_64dp">64dp</dimen>

<!--Padding values-->
<dimen name="padding_8dp">8dp</dimen>
<dimen name="padding_16dp">16dp</dimen>

<!--View sizes-->
<dimen name="view_64dp">64sp</dimen>

<!--Text sizes-->
<dimen name="text_size_16sp">16sp</dimen>
<dimen name="text_size_20sp">20sp</dimen>

<!--Generic values-->
<dimen name="generic_8dp">8dp</dimen>
<dimen name="generic_16dp">16dp</dimen>
<!--Radius values-->
<dimen name="radius_4dp">4dp</dimen>
<dimen name="radius_8dp">8dp</dimen>

<!--Elevation values-->
<dimen name="elevation_8dp">8dp</dimen>

</resources>
22 changes: 21 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
<resources>

<string name="app_name">NewMaterialDesignTest</string>

<!--TextView value-->
<string name="material_card_text_view">Long click me!</string>

<!--MaterialButton value-->
<string name="material_button_text">Click me!</string>

<!--MaterialCheckBox value-->
<string name="material_check_box_text">Check me!</string>

<!--MaterialRadioButton value-->
<string name="material_radio_button_text">Tap me!</string>

<!--MaterialSwitch value-->
<string name="material_switch_text">Switch me!</string>
</resources>

<!--Chip value-->
<string name="single_material_chip_text">I\'m a chip</string>

<!--ChipGroup values-->
<string name="first_material_chip_text">We are</string>
<string name="second_material_chip_text">part of a</string>
<string name="third_material_chip_text">chip group</string>

</resources>
23 changes: 5 additions & 18 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,11 @@
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="margin_left_8dp" parent="AppTheme">
<item name="android:layout_marginStart">@dimen/margin_8dp</item>
<item name="android:layout_marginLeft">@dimen/margin_8dp</item>
</style>

<style name="margin_left_16dp" parent="AppTheme">
<item name="android:layout_marginStart">@dimen/margin_16dp</item>
<item name="android:layout_marginLeft">@dimen/margin_16dp</item>
</style>

<style name="margin_right_8dp" parent="AppTheme">
<item name="android:layout_marginEnd">@dimen/margin_8dp</item>
<item name="android:layout_marginRight">@dimen/margin_8dp</item>
</style>

<style name="margin_right_16dp" parent="AppTheme">
<item name="android:layout_marginEnd">@dimen/margin_16dp</item>
<item name="android:layout_marginRight">@dimen/margin_16dp</item>
<style name="ChipTheme" parent="AppTheme">
<!-- Customize your theme here. -->
<item name="android:checkable">true</item>
<item name="android:clickable">true</item>
<item name="android:focusable">true</item>
</style>

</resources>
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ buildscript {

ext {
//AppCompat
appCompat = '1.1.0-alpha03'
appCompat = '1.1.0-alpha04'

//ConstraintLayout
constraintLayout = '2.0.0-alpha3'
constraintLayout = '2.0.0-alpha4'

//Espresso
espresso = '3.1.1-alpha01'
Expand All @@ -19,10 +19,10 @@ buildscript {
junit = '4.12'

//Kotlin
kotlin_version = '1.3.21'
kotlin_version = '1.3.30'

//MaterialDesign
materialDesign = '1.1.0-alpha04'
materialDesign = '1.1.0-alpha05'

//TestRunner
testRunner = '1.1.1-alpha01'
Expand Down

0 comments on commit da80316

Please sign in to comment.