Rework styles for text caption and text body

Now they are reusable and include layout_with and layout_height
attributes.
This commit is contained in:
relan 2015-12-01 15:15:45 +03:00
parent f67527a86e
commit 2ecb519a56
4 changed files with 45 additions and 52 deletions

View File

@ -13,80 +13,56 @@
<!-- URL of this repo --> <!-- URL of this repo -->
<TextView <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/repo_url" android:text="@string/repo_url"
style="@style/RepoDetailsCaption"/> style="@style/CaptionText" />
<TextView <TextView
android:id="@+id/input_repo_url" android:id="@+id/input_repo_url"
android:layout_width="match_parent" style="@style/BodyText" />
android:layout_height="wrap_content"
style="@style/RepoDetailsBody"/>
<!-- Name of this repo --> <!-- Name of this repo -->
<TextView <TextView
android:id="@+id/label_repo_name" android:id="@+id/label_repo_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/repo_name" android:text="@string/repo_name"
style="@style/RepoDetailsCaption"/> style="@style/CaptionText" />
<TextView <TextView
android:id="@+id/text_repo_name" android:id="@+id/text_repo_name"
android:layout_width="match_parent" style="@style/BodyText" />
android:layout_height="wrap_content"
style="@style/RepoDetailsBody"/>
<!-- Description - as pulled from the index file during last update... --> <!-- Description - as pulled from the index file during last update... -->
<TextView <TextView
android:id="@+id/label_description" android:id="@+id/label_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/repo_description" android:text="@string/repo_description"
style="@style/RepoDetailsCaption"/> style="@style/CaptionText" />
<TextView <TextView
android:id="@+id/text_description" android:id="@+id/text_description"
android:layout_width="match_parent" style="@style/BodyText" />
android:layout_height="wrap_content"
style="@style/RepoDetailsBody"/>
<!-- Number of apps belonging to this repo --> <!-- Number of apps belonging to this repo -->
<TextView <TextView
android:id="@+id/label_num_apps" android:id="@+id/label_num_apps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/repo_num_apps" android:text="@string/repo_num_apps"
style="@style/RepoDetailsCaption"/> style="@style/CaptionText" />
<TextView <TextView
android:id="@+id/text_num_apps" android:id="@+id/text_num_apps"
android:layout_width="match_parent" style="@style/BodyText" />
android:layout_height="wrap_content"
style="@style/RepoDetailsBody"/>
<!-- The last time this repo was updated --> <!-- The last time this repo was updated -->
<TextView <TextView
android:id="@+id/label_last_update" android:id="@+id/label_last_update"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/repo_last_update" android:text="@string/repo_last_update"
style="@style/RepoDetailsCaption"/> style="@style/CaptionText" />
<TextView <TextView
android:id="@+id/text_last_update" android:id="@+id/text_last_update"
android:layout_width="match_parent" style="@style/BodyText" />
android:layout_height="wrap_content"
style="@style/RepoDetailsBody"/>
<!-- The credentials used to access this repo (optional) --> <!-- The credentials used to access this repo (optional) -->
<TextView <TextView
android:id="@+id/label_username" android:id="@+id/label_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/login_name" android:text="@string/login_name"
style="@style/RepoDetailsCaption"/> style="@style/CaptionText" />
<TextView <TextView
android:id="@+id/text_username" android:id="@+id/text_username"
android:layout_width="match_parent" style="@style/BodyText" />
android:layout_height="wrap_content"
style="@style/RepoDetailsBody"/>
<Button <Button
android:id="@+id/button_edit_credentials" android:id="@+id/button_edit_credentials"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -97,28 +73,20 @@
<!-- Signature (or "unsigned" if none) --> <!-- Signature (or "unsigned" if none) -->
<TextView <TextView
android:id="@+id/label_repo_fingerprint" android:id="@+id/label_repo_fingerprint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/repo_fingerprint" android:text="@string/repo_fingerprint"
style="@style/RepoDetailsCaption"/> style="@style/CaptionText" />
<TextView <TextView
android:id="@+id/text_repo_fingerprint" android:id="@+id/text_repo_fingerprint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:typeface="monospace" android:typeface="monospace"
style="@style/RepoDetailsBody"/> style="@style/BodyText" />
<TextView <TextView
android:id="@+id/text_repo_fingerprint_description" android:id="@+id/text_repo_fingerprint_description"
android:layout_width="match_parent" style="@style/BodyText" />
android:layout_height="wrap_content"
style="@style/RepoDetailsBody"/>
<TextView <TextView
android:id="@+id/text_not_yet_updated" android:id="@+id/text_not_yet_updated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/repo_not_yet_updated" android:text="@string/repo_not_yet_updated"
style="@style/RepoDetailsBody"/> style="@style/BodyText" />
<ImageView <ImageView
android:id="@+id/qr_code" android:id="@+id/qr_code"

View File

@ -1,8 +1,9 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="RepoDetailsBody"> <style name="BodyTextV16" parent="BodyTextBase">
<item name="android:lineSpacingMultiplier">1.25</item> <item name="android:lineSpacingMultiplier">1.25</item>
</style> </style>
<style name="BodyText" parent="BodyTextV16" />
</resources> </resources>

View File

@ -0,0 +1,14 @@
<?xml version='1.0' encoding='utf-8'?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="CaptionTextV17" parent="CaptionTextBase">
<item name="android:textDirection">locale</item>
</style>
<style name="CaptionText" parent="CaptionTextV17" />
<style name="BodyTextV17" parent="BodyTextV16">
<item name="android:textDirection">locale</item>
</style>
<style name="BodyText" parent="BodyTextV17" />
</resources>

View File

@ -52,14 +52,24 @@
<item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textColor">?android:attr/textColorPrimary</item>
</style> </style>
<style name="RepoDetailsCaption"> <!-- use this style for a text view that is a caption to a paragraph of text -->
<style name="CaptionTextBase">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingTop">16dp</item> <item name="android:paddingTop">16dp</item>
<item name="android:paddingBottom">4dp</item> <item name="android:paddingBottom">4dp</item>
<item name="android:textSize">12sp</item> <item name="android:textAppearance">@style/TextAppearance.AppCompat.Caption</item>
<item name="android:textColor">?android:attr/textColorSecondary</item> <item name="android:textColor">?android:attr/textColorSecondary</item>
</style> </style>
<style name="CaptionText" parent="CaptionTextBase" />
<style name="RepoDetailsBody" /> <!-- use this style for a text views that is a paragraph of text -->
<style name="BodyTextBase">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Body1</item>
</style>
<style name="BodyText" parent="BodyTextBase" />
<style name="AppList"> <style name="AppList">
<item name="android:id">@android:id/list</item> <item name="android:id">@android:id/list</item>