Skip to content

Commit

Permalink
Add initial support for styles
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersantos committed Sep 23, 2016
1 parent a4a20e0 commit 86ed8d3
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 51 deletions.
32 changes: 7 additions & 25 deletions library/src/main/res/layout/style_dialog_header_icon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,16 @@
</RelativeLayout>

<TextView
style="@style/MaterialStyledDialogs_Title"
android:id="@+id/md_styled_dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="26dp"
android:layout_marginRight="26dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="-10dp"
android:textColor="@android:color/primary_text_light"
android:textSize="@dimen/md_styled_text_title"
android:textStyle="bold"
android:alpha="0.6" />
android:layout_height="wrap_content" />

<TextView
style="@style/MaterialStyledDialogs_Description"
android:id="@+id/md_styled_dialog_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="26dp"
android:layout_marginRight="26dp"
android:layout_marginTop="20dp"
android:layout_gravity="center_vertical|start"
android:textColor="@android:color/primary_text_light"
android:textSize="@dimen/md_styled_text_description"
android:alpha="0.6" />
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<ScrollView
android:layout_width="match_parent"
Expand All @@ -61,13 +48,8 @@
</ScrollView>

<View
style="@style/MaterialStyledDialogs_Divider"
android:id="@+id/md_styled_dialog_divider"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="24dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@android:color/darker_gray"
android:alpha="0.3" />
android:layout_width="match_parent" />
</LinearLayout>
33 changes: 7 additions & 26 deletions library/src/main/res/layout/style_dialog_header_title.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,18 @@
android:scaleType="centerCrop" />

<TextView
style="@style/MaterialStyledDialogs_TitleHeader"
android:id="@+id/md_styled_dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_centerInParent="true"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:maxLines="2"
android:ellipsize="end"
android:textColor="@android:color/white"
android:textAllCaps="true"
android:textSize="22sp"/>
android:layout_height="wrap_content" />

</RelativeLayout>

<TextView
style="@style/MaterialStyledDialogs_Description"
android:id="@+id/md_styled_dialog_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_marginLeft="26dp"
android:layout_marginRight="26dp"
android:layout_marginTop="20dp"
android:textColor="@android:color/primary_text_light"
android:textSize="@dimen/md_styled_text_description"
android:alpha="0.6" />
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<ScrollView
android:layout_width="match_parent"
Expand All @@ -57,13 +43,8 @@
</ScrollView>

<View
style="@style/MaterialStyledDialogs_Divider"
android:id="@+id/md_styled_dialog_divider"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="24dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@android:color/darker_gray"
android:alpha="0.3" />
android:layout_width="match_parent" />
</LinearLayout>
45 changes: 45 additions & 0 deletions library/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MaterialStyledDialogs_Title">
<item name="android:layout_marginTop">20dp</item>
<item name="android:layout_marginBottom">-10dp</item>
<item name="android:layout_marginLeft">26dp</item>
<item name="android:layout_marginRight">26dp</item>
<item name="android:gravity">start</item>
<item name="android:textColor">@android:color/primary_text_light</item>
<item name="android:textSize">@dimen/md_styled_text_title</item>
<item name="android:textStyle">bold</item>
<item name="android:alpha">0.6</item>
</style>

<style name="MaterialStyledDialogs_TitleHeader">
<item name="android:layout_marginLeft">20dp</item>
<item name="android:layout_marginRight">20dp</item>
<item name="android:gravity">center</item>
<item name="android:layout_centerInParent">true</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">22sp</item>
<item name="android:maxLines">2</item>
<item name="android:ellipsize">end</item>
<item name="android:textAllCaps">true</item>
</style>

<style name="MaterialStyledDialogs_Description">
<item name="android:layout_marginTop">20dp</item>
<item name="android:layout_marginBottom">0dp</item>
<item name="android:layout_marginLeft">26dp</item>
<item name="android:layout_marginRight">26dp</item>
<item name="android:gravity">start|center_vertical</item>
<item name="android:textColor">@android:color/primary_text_light</item>
<item name="android:textSize">@dimen/md_styled_text_description</item>
<item name="android:alpha">0.6</item>
</style>

<style name="MaterialStyledDialogs_Divider">
<item name="android:layout_height">1dp</item>
<item name="android:layout_marginTop">24dp</item>
<item name="android:layout_marginBottom">0dp</item>
<item name="android:layout_marginLeft">20dp</item>
<item name="android:layout_marginRight">20dp</item>
<item name="android:background">@android:color/darker_gray</item>
<item name="android:alpha">0.3</item>
</style>

<style name="MaterialStyledDialogs_DialogAnimationNormal">
<item name="android:windowEnterAnimation">@anim/md_styled_slide_up_normal</item>
<item name="android:windowExitAnimation">@anim/md_styled_slide_down_normal</item>
Expand Down

1 comment on commit 86ed8d3

@javiersantos
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#30

Please sign in to comment.