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

sub-detail fixes #2303

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

sub-detail fixes #2303

wants to merge 2 commits into from

Conversation

shubham1g5
Copy link
Contributor

  • Retain EntitySubnodeDetailFragment to avoid reloading data on configuration changes
  • Fixes the crash : This crash happens when the user moves out of the sub detail fragment before the EntityLoaderTask completes resulting in the deliverLoadResult to operate on a changed session scope. The PR just discards the result of the EntityLoaderTask if fragment is not visible.

@@ -73,11 +73,9 @@ public void setRoot(ViewGroup root) {

mMenu = root.findViewById(R.id.tabbed_detail_menu);
mViewPager = root.findViewById(R.id.tabbed_detail_pager);
mViewPager.setId(AndroidUtil.generateViewId());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this already has an id set in xml and setting dynamic ids result in fragment not getting re-attached to the activity.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. It seems really strange that the original line was set at all, do you have a sense of what was trying to be accomplished with it? The only reason I can think you'd set the ID manually would be if you intended to have two ViewPagers within the same Activity.

I went back to check on the git blames and it does look like that is explicitly why that change was made:
d2eab7c

The only context where I can think this occurs is with persistent case tiles which do have their own view pager. The previous commit from the one I linked above is

a5b7f23

which does discuss persistent case tiles, and it's in the persistent case tile PR
#81

I think the key thing to test is loading a case list screen with a view pager, along with a persistent case tile that has its own view pager. I think both end up in the same general view hierarchy, so they need distinct ID's just based on how the views work but it's possible that other refactors have made that unecessary.

mViewPageTabStrip = root.findViewById(R.id.pager_tab_strip);

mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no-op change since setOnPageChangeListener is deprecated.

@@ -73,11 +73,9 @@ public void setRoot(ViewGroup root) {

mMenu = root.findViewById(R.id.tabbed_detail_menu);
mViewPager = root.findViewById(R.id.tabbed_detail_pager);
mViewPager.setId(AndroidUtil.generateViewId());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. It seems really strange that the original line was set at all, do you have a sense of what was trying to be accomplished with it? The only reason I can think you'd set the ID manually would be if you intended to have two ViewPagers within the same Activity.

I went back to check on the git blames and it does look like that is explicitly why that change was made:
d2eab7c

The only context where I can think this occurs is with persistent case tiles which do have their own view pager. The previous commit from the one I linked above is

a5b7f23

which does discuss persistent case tiles, and it's in the persistent case tile PR
#81

I think the key thing to test is loading a case list screen with a view pager, along with a persistent case tile that has its own view pager. I think both end up in the same general view hierarchy, so they need distinct ID's just based on how the views work but it's possible that other refactors have made that unecessary.

@shubham1g5
Copy link
Contributor Author

@ctsims thanks for the context. I tested that this PR does break the persistent case tiles when present along with a viewpager. I am going to investigate if there is a better way to handle these both together.

@ctsims
Copy link
Member

ctsims commented Aug 4, 2020

Is there a regression test somewhere that would have caught this change in QA? If not, we should make sure to add one, given how close we were to missing this. I was very close to not catching the issue and only remembered what was going on because it seemed really strange that we would have been doing the original behavior.

@shubham1g5
Copy link
Contributor Author

@ctsims took another look at it and it doesn't seem possible today for a single screen to contain both the viewpagers. the reason being -

  1. On HQ, there doesn't seem to be a way currently to configure the case list with both an expanding persistent tile and a detail-confirm screen. Checking the "Embed case details in case tile pull-down from the menu" over here results into detail-confirm being skipped from the datum definition.

  2. On mobile, we don't allow the persistent case tile to be expanded on the case detail screen. Only once a case has been selected and confirmed, the persistent tile can be expanded. This UX makes a lot of sense as well since there is no need to see the expand the tile to see the detail when it's already present on the screen.

@shubham1g5
Copy link
Contributor Author

@ctsims bumping this up for the repro of the edge case this PR breaks.

@ctsims
Copy link
Member

ctsims commented Sep 11, 2020

Hi Shubham, I offlined with a replication for the state I was describing, as seen below
2020-09-11 09 54 10

@shubham1g5
Copy link
Contributor Author

@ctsims thanks I can repro the issue with this. I will followup with some test on it either with QA or Espresso.

@shubham1g5 shubham1g5 modified the milestones: 2.50, 2.51 Sep 14, 2020
@shubham1g5 shubham1g5 modified the milestones: 2.51, 2.52 Jan 25, 2021
@shubham1g5 shubham1g5 removed the bug label Jun 10, 2021
@damagatchi
Copy link

Can one of the admins verify this patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants