Skip to content

Commit

Permalink
- Text style name labels were added to the feed
Browse files Browse the repository at this point in the history
- Horizontal margin was removed from the custom view section
  • Loading branch information
MikeHudov committed Oct 3, 2023
1 parent 524e7b0 commit 922973d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import com.cube.styleguide.R
import com.cube.styleguide.databinding.TextItemViewBinding

class TextItemViewHolder(private val binding: TextItemViewBinding) : RecyclerView.ViewHolder(binding.root) {

fun populate(pair: Pair<String, Int>) {

val context = itemView.context
binding.apply {
headerTitle.text = context.getString(R.string.guidestyle_textstyle_name,pair.first )
sectionLabel.text = pair.first
headerTitle.text = context.getString(R.string.guidestyle_textstyle_name)
headerTitle.setTextAppearance(pair.second)
}
}
Expand Down
9 changes: 6 additions & 3 deletions library/src/main/res/layout/fragment_style_guide.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,17 @@
android:orientation="vertical"
android:visibility="gone"
app:header="@string/guidestyle_custom_views"
tools:visibility="visible">
tools:visibility="visible"
android:clipChildren="false"
android:clipToPadding="false">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/custom_views"
android:layout_marginHorizontal="@dimen/guidestyle_xlarge_spacing"
android:orientation="vertical">
android:orientation="vertical"
android:clipChildren="false"
android:clipToPadding="false">
</LinearLayout>
</com.cube.styleguide.views.ExpandableView>
</LinearLayout>
Expand Down
38 changes: 29 additions & 9 deletions library/src/main/res/layout/text_item_view.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/header_title"
style="@style/GuideStyleBody"
android:layout_marginVertical="8dp"
tools:text="100" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/section_label"
style="@style/GuideStyleCaption"
android:background="@color/guidestyle_black"
android:layout_gravity="start"
android:layout_marginTop="@dimen/guidestyle_largest_spacing"
tools:text="@string/guidestyle_enabled" />

<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="1dp"
app:dividerColor="@color/guidestyle_grey" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/header_title"
style="@style/GuideStyleBody"
android:layout_marginVertical="8dp"
tools:text="100" />
</LinearLayout>

2 changes: 1 addition & 1 deletion library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<string name="guidestyle_radiobuttons">RadioButtons</string>
<string name="guidestyle_checkbox">Checkbox</string>
<string name="guidestyle_ui_style_guide">UI Style Guide</string>
<string name="guidestyle_textstyle_name">%s: The quick brown fox jumps over the lazy dog</string>
<string name="guidestyle_textstyle_name">The quick brown fox jumps over the lazy dog</string>
<string name="guidestyle_custom_views">Custom Views</string>
<string name="guidestyle_failed_to_load_the_package">Failed to load the package: %s</string>
<string name="guidestyle_switch">Switch Buttons</string>
Expand Down

0 comments on commit 922973d

Please sign in to comment.