This repository was archived by the owner on Aug 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +14
-8
lines changed
java/com/hossainkhan/android/demo/data
test/java/com/hossainkhan/android/demo/data Expand file tree Collapse file tree 5 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -28,11 +28,11 @@ class LayoutDataStore @Inject constructor(
2828 private val resources : Resources ) {
2929 val supportedLayoutInfos = listOf (
3030 LayoutInformation (
31- layoutResourceId = R .layout.activity_positioning_top_left ,
31+ layoutResourceId = R .layout.preview_positioning_top_left ,
3232 title = " Positioning: Top Left" ,
3333 description = " Top left using constraints." ),
3434 LayoutInformation (
35- layoutResourceId = R .layout.activity_positioning_centered ,
35+ layoutResourceId = R .layout.preview_positioning_centered ,
3636 title = " Positioning: Centered" ,
3737 description = " Centered view using constraints on top-bottom and left-right." )
3838 )
@@ -52,7 +52,7 @@ class LayoutDataStore @Inject constructor(
5252 */
5353 fun getLayoutUrl (@LayoutRes layoutResourceId : Int ): String {
5454 // Containes package name and layout name
55- // com.hossainkhan.android.demo:layout/activity_positioning_top_left
55+ // com.hossainkhan.android.demo:layout/preview_positioning_top_left
5656 val resourceName = resources.getResourceName(layoutResourceId)
5757
5858 if (! resourceName.contains(" layout" )) {
Original file line number Diff line number Diff line change 1+ Constraint Layouts
2+ ==================
3+ All the constraint layout for preview are defined here along with activity layouts.
4+
5+ For quick navigation, all the preview/demo layout should be prefixed with ` preview_ `
6+
7+ All layout should be documented well and minimal style should be added to element.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ package com.hossainkhan.android.demo.data
1919import android.content.res.Resources
2020import org.junit.Assert.assertEquals
2121import org.junit.Assert.assertFalse
22- import org.junit.Assert.assertNull
2322import org.junit.Before
2423import org.junit.Test
2524import org.mockito.Mockito
@@ -46,18 +45,18 @@ class LayoutDataStoreTest {
4645 * Tests conversion from layout file to URL to preview on the web.
4746 *
4847 * Input:
49- * com.hossainkhan.android.demo:layout/activity_positioning_top_left
48+ * com.hossainkhan.android.demo:layout/preview_positioning_top_left
5049 *
5150 * Output:
52- * https://github.com/amardeshbd/android-constraint-layout-cheatsheet/blob/master/app/src/main/res/layout/activity_positioning_top_left.xml
51+ * https://github.com/amardeshbd/android-constraint-layout-cheatsheet/blob/master/app/src/main/res/layout/preview_positioning_top_leftxml
5352 */
5453 @Test
5554 fun getLayoutUrl_givenValidLayout_providesUrlToLayoutResource () {
5655 `when `(resources.getResourceName(anyInt()))
57- .thenReturn(" com.hossainkhan.android.demo:layout/activity_positioning_top_left " )
56+ .thenReturn(" com.hossainkhan.android.demo:layout/preview_positioning_top_left " )
5857
5958
60- assertEquals(" https://github.com/amardeshbd/android-constraint-layout-cheatsheet/blob/master/app/src/main/res/layout/activity_positioning_top_left .xml" ,
59+ assertEquals(" https://github.com/amardeshbd/android-constraint-layout-cheatsheet/blob/master/app/src/main/res/layout/preview_positioning_top_left .xml" ,
6160 sut.getLayoutUrl(1 ))
6261 }
6362
You can’t perform that action at this time.
0 commit comments