Skip to content

Commit

Permalink
Clean layout on ingredient product
Browse files Browse the repository at this point in the history
  • Loading branch information
Scot SCRIVEN authored and Scot SCRIVEN committed Apr 19, 2016
1 parent e5a8835 commit 74165b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

palmOilProduct = (TextView) rootView.findViewById(R.id.textPalmOilProduct);
mayBeFromPalmOilProduct = (TextView) rootView.findViewById(R.id.textMayBeFromPalmOilProduct);
imageOkNo = (ImageView) rootView.findViewById(R.id.imageOkNo);

if(state.getProduct().getIngredientsFromPalmOilN() == 0 && state.getProduct().getIngredientsFromOrThatMayBeFromPalmOilN() == 0){
imageOkNo.setImageResource(R.drawable.ok);
palmOilProduct.setVisibility(View.VISIBLE);
palmOilProduct.setText(getString(R.string.txtPalm));
} else {
imageOkNo.setImageResource(R.drawable.no);
if(!state.getProduct().getIngredientsFromPalmOilTags().toString().replace("[", "").replace("]", "").isEmpty()) {
palmOilProduct.setVisibility(View.VISIBLE);
palmOilProduct.setText(Html.fromHtml("<b>" + getString(R.string.txtPalmOilProduct) + "</b>" + ' ' + state.getProduct().getIngredientsFromPalmOilTags().toString().replace("[", "").replace("]", "")));
Expand Down
17 changes: 5 additions & 12 deletions app/src/main/res/layout/fragment_ingredients_product.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content">

<ImageView
android:layout_width="match_parent"
Expand Down Expand Up @@ -75,20 +75,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageOkNo"
android:scaleType="fitStart"
android:padding="10dp"
android:layout_marginEnd="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:layout_gravity="center_horizontal"
android:layout_weight="4" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:maxWidth="42dp"
android:maxHeight="42dp"
android:scaleType="fitCenter"
android:textSize="@dimen/font_normal"
android:layout_marginTop="@dimen/spacing_tiny"
android:layout_marginBottom="@dimen/spacing_tiny"
Expand Down

0 comments on commit 74165b7

Please sign in to comment.