Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix binding diff with prop group #347

Merged
merged 4 commits into from
Nov 21, 2017
Merged

Fix binding diff with prop group #347

merged 4 commits into from
Nov 21, 2017

Conversation

elihart
Copy link
Contributor

@elihart elihart commented Nov 20, 2017

Fix for #345

The generated logic for determining which props to update on a view now looks like this

if (assignedAttributes_epoxyGeneratedModel.get(3)) {
      if ((paddingRes_Int != that.paddingRes_Int)) {
        object.setPaddingRes(paddingRes_Int);
      }
    }
    else if (assignedAttributes_epoxyGeneratedModel.get(4)) {
      if ((paddingDp_Int != that.paddingDp_Int)) {
        object.setPaddingDp(paddingDp_Int);
      }
    }
    // A value was not set so we should use the default value, but we only need to set it if the previous model had a custom value set.
    else if (that.assignedAttributes_epoxyGeneratedModel.get(3) || that.assignedAttributes_epoxyGeneratedModel.get(4)) {
      object.setPaddingDp(paddingDp_Int);
    }

    if ((hasFixedSize_Boolean != that.hasFixedSize_Boolean)) {
      object.setHasFixedSize(hasFixedSize_Boolean);
    }

    if (assignedAttributes_epoxyGeneratedModel.get(1)) {
      if ((Float.compare(that.numViewsToShowOnScreen_Float, numViewsToShowOnScreen_Float) != 0)) {
        object.setNumViewsToShowOnScreen(numViewsToShowOnScreen_Float);
      }
    }
    else if (assignedAttributes_epoxyGeneratedModel.get(2)) {
      if ((initialPrefetchItemCount_Int != that.initialPrefetchItemCount_Int)) {
        object.setInitialPrefetchItemCount(initialPrefetchItemCount_Int);
      }
    }
    // A value was not set so we should use the default value, but we only need to set it if the previous model had a custom value set.
    else if (that.assignedAttributes_epoxyGeneratedModel.get(1) || that.assignedAttributes_epoxyGeneratedModel.get(2)) {
      object.setNumViewsToShowOnScreen(numViewsToShowOnScreen_Float);
    }

    if ((models_List != null ? !models_List.equals(that.models_List) : that.models_List != null)) {
      object.setModels(models_List);
    }

This example comes from the CarouselModel_ code.

@elihart elihart merged commit ba6fd27 into master Nov 21, 2017
@elihart elihart deleted the eli-bind_diff_fix branch November 21, 2017 18:45
@elihart elihart mentioned this pull request Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant