From fe9a5d673e5e2f060d1d8e058e516d9193d25092 Mon Sep 17 00:00:00 2001 From: Hossain Khan Date: Fri, 5 Apr 2019 19:01:25 -0400 Subject: [PATCH 1/3] [ADDED] [#49] Preview for visual guidelines. Fixes #49 --- README.md | 2 +- .../android/demo/data/LayoutDataStore.kt | 11 +- .../res/drawable/ic_dotted_line_overlay.xml | 27 +++ .../thumb_visual_helper_guideline.xml | 193 ++++++++++++++++++ app/src/main/res/layout/.README.md | 8 +- .../preview_visual_helper_guideline.xml | 145 +++++++++++++ 6 files changed, 380 insertions(+), 6 deletions(-) create mode 100644 app/src/main/res/drawable/ic_dotted_line_overlay.xml create mode 100644 app/src/main/res/drawable/thumb_visual_helper_guideline.xml create mode 100644 app/src/main/res/layout/preview_visual_helper_guideline.xml diff --git a/README.md b/README.md index 4a8f2a3..e6047bc 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ See https://github.com/googlesamples/android-ConstraintLayoutExamples * [x] Weighted chains * [ ] Margins and chains _(Added in 1.1)_ - [ ] Virtual Helpers objects - * [ ] Guideline + * [x] Guideline * [ ] Barrier * [ ] Group - [ ] Optimizer _(Added in 1.1)_ diff --git a/app/src/main/java/com/hossainkhan/android/demo/data/LayoutDataStore.kt b/app/src/main/java/com/hossainkhan/android/demo/data/LayoutDataStore.kt index c47c109..904dc98 100644 --- a/app/src/main/java/com/hossainkhan/android/demo/data/LayoutDataStore.kt +++ b/app/src/main/java/com/hossainkhan/android/demo/data/LayoutDataStore.kt @@ -117,7 +117,16 @@ class LayoutDataStore @Inject constructor( title = "Dimension: Percent dimension", description = "To use percent, you need to set the following:\n\n" + "* The dimension should be set to MATCH_CONSTRAINT (0dp)\n" + - "* Then set the `layout_constraintWidth_percent` or `layout_constraintHeight_percent` attributes to a value between 0.0 and 1.0") + "* Then set the `layout_constraintWidth_percent` or `layout_constraintHeight_percent` attributes to a value between 0.0 and 1.0"), + LayoutInformation( + layoutResourceId = R.layout.preview_visual_helper_guideline, + thumbnailResourceId = R.drawable.thumb_visual_helper_guideline, + title = "Virtual Helper: Guideline", + description = "The Guideline object allows you to create Horizontal and Vertical guidelines which " + + "are positioned relative to the ConstraintLayout container." + + "Widgets can then be positioned by constraining them to such guidelines. ") + + /* Next item template (easy to copy and paste) LayoutInformation( diff --git a/app/src/main/res/drawable/ic_dotted_line_overlay.xml b/app/src/main/res/drawable/ic_dotted_line_overlay.xml new file mode 100644 index 0000000..b96ad38 --- /dev/null +++ b/app/src/main/res/drawable/ic_dotted_line_overlay.xml @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/thumb_visual_helper_guideline.xml b/app/src/main/res/drawable/thumb_visual_helper_guideline.xml new file mode 100644 index 0000000..3515368 --- /dev/null +++ b/app/src/main/res/drawable/thumb_visual_helper_guideline.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/.README.md b/app/src/main/res/layout/.README.md index 68c6e4d..9c38812 100644 --- a/app/src/main/res/layout/.README.md +++ b/app/src/main/res/layout/.README.md @@ -28,10 +28,10 @@ Each layout must also be named based on sub features. Use following convention t * Prefix: **`_TBD_`** | Chain Style * Prefix: **`_TBD_`** | Weighted chains * Prefix: **`_TBD_`** | Margins and chains _(Added in 1.1)_ -- Prefix: **`_TBD_`** | Virtual Helpers objects - * Prefix: **`_TBD_`** | Guideline - * Prefix: **`_TBD_`** | Barrier - * Prefix: **`_TBD_`** | Group +- Prefix: **`_visual_helper_`** | Virtual Helpers objects + * Prefix: **`_guideline_`** | Guideline + * Prefix: **`_barrier_`** | Barrier + * Prefix: **`_group_`** | Group - Prefix: **`_TBD_`** | Optimizer _(Added in 1.1)_ > NOTE: The list of feature set is taken from original [readme](https://github.com/amardeshbd/android-constraint-layout-cheatsheet/blob/master/README.md). \ No newline at end of file diff --git a/app/src/main/res/layout/preview_visual_helper_guideline.xml b/app/src/main/res/layout/preview_visual_helper_guideline.xml new file mode 100644 index 0000000..642c5d6 --- /dev/null +++ b/app/src/main/res/layout/preview_visual_helper_guideline.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + +