Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
157 additions
and
98 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
app/src/main/java/openfoodfacts/github/scrachx/openfood/fragments/CarefulFragment.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
app/src/main/java/openfoodfacts/github/scrachx/openfood/fragments/PalmProductFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package openfoodfacts.github.scrachx.openfood.fragments; | ||
|
||
import android.app.Fragment; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.text.Html; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
import openfoodfacts.github.scrachx.openfood.R; | ||
import openfoodfacts.github.scrachx.openfood.models.State; | ||
|
||
/** | ||
* Created by scotscriven on 09/05/15. | ||
*/ | ||
public class PalmProductFragment extends Fragment { | ||
|
||
private TextView palmOilProduct, mayBeFromPalmOilProduct; | ||
private ImageView imageOkNo; | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
View rootView = inflater.inflate(R.layout.fragment_palm_product,container,false); | ||
|
||
palmOilProduct = (TextView) rootView.findViewById(R.id.textPalmOilProduct); | ||
mayBeFromPalmOilProduct = (TextView) rootView.findViewById(R.id.textMayBeFromPalmOilProduct); | ||
imageOkNo = (ImageView) rootView.findViewById(R.id.imageOkNo); | ||
|
||
Intent intent = getActivity().getIntent(); | ||
State state = (State) intent.getExtras().getSerializable("state"); | ||
|
||
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("]", ""))); | ||
} | ||
if(!state.getProduct().getIngredientsThatMayBeFromPalmOilTags().toString().replace("[", "").replace("]", "").isEmpty()) { | ||
mayBeFromPalmOilProduct.setVisibility(View.VISIBLE); | ||
mayBeFromPalmOilProduct.setText(Html.fromHtml("<b>" + getString(R.string.txtMayBeFromPalmOilProduct) + "</b>" + ' ' + state.getProduct().getIngredientsThatMayBeFromPalmOilTags().toString().replace("[","").replace("]",""))); | ||
} | ||
} | ||
|
||
|
||
return rootView; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" 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="fitXY" | ||
android:padding="10dp" | ||
android:layout_marginEnd="@dimen/spacing_normal" | ||
android:layout_marginStart="@dimen/spacing_normal" | ||
android:layout_gravity="center_horizontal" /> | ||
|
||
<TextView | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:textSize="@dimen/font_normal" | ||
android:layout_marginTop="@dimen/spacing_tiny" | ||
android:layout_marginBottom="@dimen/spacing_tiny" | ||
android:layout_marginLeft="@dimen/spacing_normal" | ||
android:layout_marginRight="@dimen/spacing_normal" | ||
android:padding="@dimen/spacing_small" | ||
android:background="@drawable/textview_full" | ||
android:id="@+id/textPalmOilProduct" | ||
android:visibility="gone"/> | ||
|
||
<TextView | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:textSize="@dimen/font_normal" | ||
android:layout_marginTop="@dimen/spacing_tiny" | ||
android:layout_marginBottom="@dimen/spacing_tiny" | ||
android:layout_marginLeft="@dimen/spacing_normal" | ||
android:layout_marginRight="@dimen/spacing_normal" | ||
android:padding="@dimen/spacing_small" | ||
android:background="@drawable/textview_full" | ||
android:id="@+id/textMayBeFromPalmOilProduct" | ||
android:visibility="gone"/> | ||
|
||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.