Skip to content

Commit

Permalink
Fix rebase conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
philippeauriach committed May 10, 2020
1 parent cc5c7c3 commit 5a4f8da
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -32,6 +32,7 @@
import java.util.List;
import java.util.Map;

import butterknife.OnTextChanged;
import openfoodfacts.github.scrachx.openfood.R;
import openfoodfacts.github.scrachx.openfood.databinding.FragmentAddProductIngredientsBinding;
import openfoodfacts.github.scrachx.openfood.images.PhotoReceiver;
Expand Down Expand Up @@ -289,7 +290,7 @@ public void onError(Exception ex) {
}
String ingredientsText = mOfflineSavedProduct.getIngredients();
if (!TextUtils.isEmpty(ingredientsText)) {
binding.ingredients.setText(ingredientsText);
binding.ingredientsList.setText(ingredientsText);
}
if (productDetails.get(OfflineSavedProduct.KEYS.PARAM_TRACES) != null) {
List<String> chipValues = Arrays.asList(productDetails.get(OfflineSavedProduct.KEYS.PARAM_TRACES).split("\\s*,\\s*"));
Expand Down Expand Up @@ -406,7 +407,7 @@ public void getAllDetails(Map<String, String> targetMap) {
if (activity instanceof AddProductActivity) {
String languageCode = ((AddProductActivity) activity).getProductLanguageForEdition();
String lc = (!languageCode.isEmpty()) ? languageCode : "en";
targetMap.put(OfflineSavedProduct.KEYS.GET_PARAM_INGREDIENTS(lc), ingredients.getText().toString());
targetMap.put(OfflineSavedProduct.KEYS.GET_PARAM_INGREDIENTS(lc), binding.ingredientsList.getText().toString());
List<String> list = binding.traces.getChipValues();
String string = StringUtils.join(list, ",");
targetMap.put(OfflineSavedProduct.KEYS.PARAM_TRACES.substring(4), string);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ public void afterTextChanged(Editable s) {
});
binding.checkboxNoNutritionData.setOnCheckedChangeListener((buttonView, isChecked) -> onCheckedChanged(isChecked));


photoReceiverHandler = new PhotoReceiverHandler(this);
binding.btnAddANutrient.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_add_box_black_18dp, 0, 0, 0);
Bundle b = getArguments();
Expand Down Expand Up @@ -332,7 +331,7 @@ private void preFillValuesFromOffline() {
loadNutritionsImage(path);
}
if (productDetails.get(OfflineSavedProduct.KEYS.PARAM_NO_NUTRITION_DATA) != null) {
binding.checkboxNoNutritionDatanoNutritionData.setChecked(true);
binding.checkboxNoNutritionData.setChecked(true);
binding.nutritionFactsLayout.setVisibility(View.GONE);
}
if (productDetails.get(OfflineSavedProduct.KEYS.PARAM_NUTRITION_DATA_PER) != null) {
Expand Down Expand Up @@ -664,7 +663,8 @@ public void getDetails(Map<String, String> targetMap) {
}
}
if (EditTextUtils.isNotEmpty(binding.servingSize)) {
String servingSizeValue = EditTextUtils.content(binding.servingSize) + ObjectUtils.toString(this.servingSize.getAttachedSpinner().getSelectedItem().toString());
String servingSizeValue = EditTextUtils.content(binding.servingSize) + ObjectUtils
.toString(binding.servingSize.getAttachedSpinner().getSelectedItem().toString());
if (product == null || !servingSizeValue.equals(product.getServingSize())) {
targetMap.put(OfflineSavedProduct.KEYS.PARAM_SERVING_SIZE, servingSizeValue);
}
Expand All @@ -687,10 +687,6 @@ private boolean hasUnit(CustomValidatingEditTextView editTextView) {
return !Nutriments.PH.equals(shortName) && !Nutriments.ALCOHOL.equals(shortName);
}

private boolean isDataPer100() {
return binding.radioGroup.getCheckedRadioButtonId() == R.id.for100g_100ml;
}

/**
* Add nutients to the map by from the text enetered into EditText
*
Expand All @@ -714,6 +710,7 @@ private float getReferenceValueInGram() {
}
return reference;
}

/**
* Add nutrients to the map by from the text entered into EditText, only if the value has been edited
*
Expand Down Expand Up @@ -790,7 +787,7 @@ private void addNutrientToMapIfUpdated(CustomValidatingEditTextView editTextView
}

private boolean isDataPer100() {
return radioGroup.getCheckedRadioButtonId() == R.id.for100g_100ml;
return binding.radioGroup.getCheckedRadioButtonId() == R.id.for100g_100ml;
}

void addNutrient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,13 @@ public class ContinuousScanActivity extends AppCompatActivity {
private Product product;
private ProductFragment productFragment;
private SharedPreferences.Editor editor;
private BeepManager beepManager;
private String lastText;
private SharedPreferences sp;
private boolean mFlash;
private boolean mRing;
private int peekLarge;
private int peekSmall;
private PopupMenu popup;
private Product product;
private ProductFragment productFragment;
private boolean productShowing = false;
private Runnable runnable;
private SharedPreferences sp;
private SummaryProductPresenter summaryProductPresenter;
private BarcodeCallback callback = new BarcodeCallback() {
@Override
Expand Down Expand Up @@ -457,11 +451,11 @@ public void onError(Exception ex) {
binding.quickViewImageProgress.setVisibility(GONE);
}

txtProductCallToAction.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
txtProductCallToAction.setBackground(ContextCompat.getDrawable(ContinuousScanActivity.this, R.drawable.rounded_quick_view_text));
txtProductCallToAction.setText(R.string.product_not_complete);
txtProductCallToAction.setVisibility(VISIBLE);
slideUpIndicator.setVisibility(GONE);
binding.txtProductCallToAction.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
binding.txtProductCallToAction.setBackground(ContextCompat.getDrawable(ContinuousScanActivity.this, R.drawable.rounded_quick_view_text));
binding.txtProductCallToAction.setText(R.string.product_not_complete);
binding.txtProductCallToAction.setVisibility(VISIBLE);
binding.quickViewSlideUpIndicator.setVisibility(GONE);

bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
Expand Down Expand Up @@ -632,7 +626,7 @@ public void onStateChanged(@NonNull View bottomSheet, int newState) {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
}
if (binding.searchByBarcode.getVisibility() == VISIBLE) {
if (binding.quickViewSearchByBarcode.getVisibility() == VISIBLE) {
bottomSheetBehavior.setPeekHeight(peekSmall);
bottomSheet.getLayoutParams().height = bottomSheetBehavior.getPeekHeight();
bottomSheet.requestLayout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,10 +812,9 @@ private void loadPhoto(File photoFile) {
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
photoReceiverHandler.onActivityResult(this, requestCode, resultCode, data);
boolean shouldRefresh = (requestCode == EDIT_REQUEST_CODE && resultCode == Activity.RESULT_OK && data.getBooleanExtra(AddProductActivity.UPLOADED_TO_SERVER, false));
if (ProductImageManagementActivity.isImageModified(requestCode, resultCode)) {
shouldRefresh = true;
}
boolean shouldRefresh = requestCode == EDIT_REQUEST_CODE && resultCode == Activity.RESULT_OK;
shouldRefresh = shouldRefresh || ProductImageManagementActivity.isImageModified(requestCode, resultCode);

if (shouldRefresh && getActivity() instanceof ProductActivity) {
((ProductActivity) getActivity()).onRefresh();
}
Expand Down

0 comments on commit 5a4f8da

Please sign in to comment.