Skip to content

Commit

Permalink
Fix scrolling issue in Product page
Browse files Browse the repository at this point in the history
  • Loading branch information
itchix committed Jan 12, 2017
1 parent cfecbbd commit f35b5d1
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 111 deletions.
13 changes: 9 additions & 4 deletions app/src/main/res/layout/fragment_ingredients_product.xml
@@ -1,9 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollViewIngredientProduct"
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:isScrollContainer="false"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<LinearLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -97,4 +102,4 @@

</LinearLayout>

</ScrollView>
</android.support.v4.widget.NestedScrollView>
88 changes: 50 additions & 38 deletions app/src/main/res/layout/fragment_nutrition_info_product.xml
@@ -1,43 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:isScrollContainer="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/activity_vertical_margin">

<TextView
android:id="@+id/textPerPortion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textIsSelectable="true"
android:textSize="@dimen/font_large" />

<ImageButton
android:id="@+id/imageViewNutritionFullNut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textPerPortion"
android:layout_centerHorizontal="true"
android:maxHeight="250dp" />

<GridView
android:id="@+id/gridView"
android:layout_gravity="fill_vertical"
android:clipToPadding="false"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/imageViewNutritionFullNut"
android:layout_centerHorizontal="true"
android:layout_marginTop="18dp"
android:columnWidth="150dp"
android:gravity="center"
android:horizontalSpacing="10dp"
android:numColumns="auto_fit"
android:stretchMode="spacingWidthUniform"
android:verticalSpacing="24dp">

</GridView >




</RelativeLayout>
android:padding="@dimen/activity_vertical_margin">

<TextView
android:id="@+id/textPerPortion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textIsSelectable="true"
android:textSize="@dimen/font_large" />

<ImageButton
android:id="@+id/imageViewNutritionFullNut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textPerPortion"
android:layout_centerHorizontal="true"
android:maxHeight="250dp" />

<GridView
android:id="@+id/gridView"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imageViewNutritionFullNut"
android:layout_centerHorizontal="true"
android:layout_marginTop="18dp"
android:columnWidth="150dp"
android:gravity="center"
android:horizontalSpacing="10dp"
android:numColumns="auto_fit"
android:stretchMode="spacingWidthUniform"
android:verticalSpacing="24dp">

</GridView >

</RelativeLayout>

</android.support.v4.widget.NestedScrollView>
141 changes: 76 additions & 65 deletions app/src/main/res/layout/fragment_nutrition_product.xml
@@ -1,74 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:orientation="vertical"
android:weightSum="1">

<ImageView
android:id="@+id/imageGrade"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="true"
android:layout_marginBottom="@dimen/spacing_tiny"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_normal"
android:gravity="center" />
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:isScrollContainer="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:clipToPadding="false"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<TextView
android:id="@+id/textServingSize"
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_tiny"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_tiny"
android:background="@drawable/textview_full"
android:padding="@dimen/spacing_small"
android:textIsSelectable="true"
android:textSize="@dimen/font_normal" />
android:layout_height="fill_parent"
android:orientation="vertical">

<TextView
android:id="@+id/textCarbonFootprint"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_tiny"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_tiny"
android:background="@drawable/textview_full"
android:padding="@dimen/spacing_small"
android:textIsSelectable="true"
android:textSize="@dimen/font_normal" />
<ImageView
android:id="@+id/imageGrade"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="true"
android:layout_marginBottom="@dimen/spacing_tiny"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_normal"
android:gravity="center" />

<TextView
android:id="@+id/textNutrientTxt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_tiny"
android:background="@drawable/textview_full"
android:padding="@dimen/spacing_small"
android:text="@string/txtNutrientLevel100g"
android:textIsSelectable="true"
android:textSize="@dimen/font_normal"
android:textStyle="bold" />
<TextView
android:id="@+id/textServingSize"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_tiny"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_tiny"
android:background="@drawable/textview_full"
android:padding="@dimen/spacing_small"
android:textIsSelectable="true"
android:textSize="@dimen/font_normal" />

<ListView
android:id="@+id/listNutrientLevels"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="@dimen/spacing_tiny"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:background="@drawable/textview_full"
android:divider="@color/white"
android:dividerHeight="0dp"
android:padding="@dimen/spacing_small" />
<TextView
android:id="@+id/textCarbonFootprint"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_tiny"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_tiny"
android:background="@drawable/textview_full"
android:padding="@dimen/spacing_small"
android:textIsSelectable="true"
android:textSize="@dimen/font_normal" />

<TextView
android:id="@+id/textNutrientTxt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_tiny"
android:background="@drawable/textview_full"
android:padding="@dimen/spacing_small"
android:text="@string/txtNutrientLevel100g"
android:textIsSelectable="true"
android:textSize="@dimen/font_normal"
android:textStyle="bold" />

<ListView
android:id="@+id/listNutrientLevels"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"
android:layout_marginBottom="@dimen/spacing_tiny"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:background="@drawable/textview_full"
android:divider="@color/white"
android:dividerHeight="0dp"
android:padding="@dimen/spacing_small" />

</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
13 changes: 9 additions & 4 deletions app/src/main/res/layout/fragment_summary_product.xml
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollViewSummaryProduct"
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:isScrollContainer="false"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<LinearLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -174,4 +179,4 @@

</LinearLayout>

</ScrollView>
</android.support.v4.widget.NestedScrollView>

0 comments on commit f35b5d1

Please sign in to comment.