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

View File

@ -1,8 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<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>
</style>
<style name="BodyText" parent="BodyTextV16" />
</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>
</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: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>
</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">
<item name="android:id">@android:id/list</item>