Skip to content

Commit

Permalink
Extract list item styles to styles.xml resource file
Browse files Browse the repository at this point in the history
  • Loading branch information
nishantkp committed Dec 21, 2017
1 parent 31e1203 commit 16b5ca9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
19 changes: 3 additions & 16 deletions app/src/main/res/layout/list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,15 @@

<TextView
android:id="@+id/list_item_item_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/list_item_category_margin"
android:background="@drawable/category_text_background"
android:padding="@dimen/list_item_category_padding"
android:fontFamily="sans-serif"
android:text="Stationary"
android:textSize="@dimen/secondary_text_size"
android:textColor="@color/primaryWhiteColor"
android:textStyle="bold" />
style="@style/catalog_activity_category_style"
tools:text="Stationary" />

<TextView
android:id="@+id/list_item_item_quantity"
style="@style/catalog_activity_product_quantity"
tools:text="155" />

<ImageView
android:layout_width="@dimen/list_item_icon_height"
android:layout_height="@dimen/list_item_icon_height"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/list_item_icon_margin_left"
android:src="@drawable/ic_info_outline_black_24dp"
android:tint="@color/colorAccent" />
style="@style/catalog_activity_info_icon_style" />
</LinearLayout>
23 changes: 23 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,29 @@
<!-- <item name="android:layout_marginRight">12dp</item>-->
</style>

<!-- Catalog activity item category style -->
<style name="catalog_activity_category_style">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">center</item>
<item name="android:layout_margin">@dimen/list_item_category_margin</item>
<item name="android:background">@drawable/category_text_background</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:padding">@dimen/list_item_category_padding</item>
<item name="android:textColor">@color/primaryWhiteColor</item>
<item name="android:textSize">@dimen/secondary_text_size</item>
<item name="android:textStyle">bold</item>
</style>

<!-- Catalog activity info icon style -->
<style name="catalog_activity_info_icon_style">
<item name="android:layout_width">@dimen/list_item_icon_height</item>
<item name="android:layout_height">@dimen/list_item_icon_height</item>
<item name="android:layout_gravity">center</item>
<item name="android:layout_marginLeft">@dimen/list_item_icon_margin_left</item>
<item name="android:tint">@color/colorAccent</item>
</style>

<!-- Editor activity section divider style-->
<style name="editor_activity_section_divider">
<item name="android:layout_width">match_parent</item>
Expand Down

0 comments on commit 16b5ca9

Please sign in to comment.