Add primary and secondary buttons

This commit is contained in:
Alex Sytnyk 2018-06-26 21:29:38 +03:00
parent 4c553ac008
commit 5c87061d29
8 changed files with 82 additions and 0 deletions

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctrl_active_light"/>
<corners android:radius="3dp"/>
</shape>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctrl_light"/>
<corners android:radius="3dp"/>
</shape>

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/primary_btn_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/primary_btn_bg">
<TextView
android:id="@+id/primary_btn"
android:layout_width="match_parent"
android:layout_height="@dimen/dialog_button_height"
android:layout_gravity="center"
android:background="?attr/selectableItemBackgroundBorderless"
android:ellipsize="end"
android:gravity="center"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:maxLines="1"
android:textColor="?attr/primary_btn_text_color"
android:textSize="@dimen/text_button_text_size"
tools:ignore="UnusedAttribute"
tools:text="Primary button"/>
</FrameLayout>

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/secondary_btn_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/secondary_btn_bg">
<TextView
android:id="@+id/secondary_btn"
android:layout_width="match_parent"
android:layout_height="@dimen/dialog_button_height"
android:layout_gravity="center"
android:background="?attr/selectableItemBackgroundBorderless"
android:ellipsize="end"
android:gravity="center"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:maxLines="1"
android:textColor="?attr/ctrl_active_color"
android:textSize="@dimen/text_button_text_size"
tools:ignore="UnusedAttribute"
tools:text="Secondary button"/>
</FrameLayout>

View file

@ -8,5 +8,8 @@
<attr name="ctrl_active_color" format="reference" /> <attr name="ctrl_active_color" format="reference" />
<attr name="ctrl_color" format="reference" /> <attr name="ctrl_color" format="reference" />
<attr name="bottom_nav_shadow" format="reference" /> <attr name="bottom_nav_shadow" format="reference" />
<attr name="primary_btn_bg" format="reference" />
<attr name="primary_btn_text_color" format="reference" />
<attr name="secondary_btn_bg" format="reference" />
</declare-styleable> </declare-styleable>
</resources> </resources>

View file

@ -31,4 +31,7 @@
<color name="card_divider_light">#f0f0f0</color> <color name="card_divider_light">#f0f0f0</color>
<color name="card_divider_dark">#2d3133</color> <color name="card_divider_dark">#2d3133</color>
<color name="primary_btn_text_light">#ffffff</color>
<color name="primary_btn_text_dark">#cccccc</color>
</resources> </resources>

View file

@ -36,6 +36,8 @@
<dimen name="search_box_height">48dp</dimen> <dimen name="search_box_height">48dp</dimen>
<dimen name="text_button_letter_spacing" format="float">0.01</dimen>
<!-- Text sizes --> <!-- Text sizes -->
<dimen name="dialog_title_text_size">22sp</dimen> <dimen name="dialog_title_text_size">22sp</dimen>
@ -43,4 +45,6 @@
<dimen name="title_text_size">18sp</dimen> <dimen name="title_text_size">18sp</dimen>
<dimen name="descr_text_size">16sp</dimen> <dimen name="descr_text_size">16sp</dimen>
<dimen name="text_button_text_size">15sp</dimen>
</resources> </resources>

View file

@ -22,6 +22,10 @@
<item name="ctrl_active_color">@color/ctrl_active_light</item> <item name="ctrl_active_color">@color/ctrl_active_light</item>
<item name="ctrl_color">@color/ctrl_light</item> <item name="ctrl_color">@color/ctrl_light</item>
<item name="primary_btn_bg">@drawable/primary_btn_bg_light</item>
<item name="primary_btn_text_color">@color/primary_btn_text_light</item>
<item name="secondary_btn_bg">@drawable/secondary_btn_bg_light</item>
<item name="bottom_nav_shadow">@drawable/bg_bottom_bar_shadow_with_line_day</item> <item name="bottom_nav_shadow">@drawable/bg_bottom_bar_shadow_with_line_day</item>
</style> </style>