Fix updating stack config props. (#231)

When some of config props change or new header items are added we need to perform a header update. This diff adds logic to trigger updating header props when that happens.
This commit is contained in:
Krzysztof Magiera
2019-11-22 13:03:11 +01:00
committed by GitHub
parent 0a2336d005
commit 2c5f95cea6
5 changed files with 53 additions and 5 deletions

View File

@@ -207,6 +207,12 @@ public class ScreenStackHeaderConfig extends ViewGroup {
}
}
private void maybeUpdate() {
if (getParent() != null) {
onUpdate();
}
}
public ScreenStackHeaderSubview getConfigSubview(int index) {
return mConfigSubviews[index];
}
@@ -220,6 +226,7 @@ public class ScreenStackHeaderConfig extends ViewGroup {
mSubviewsCount--;
}
mConfigSubviews[index] = null;
maybeUpdate();
}
public void addConfigSubview(ScreenStackHeaderSubview child, int index) {
@@ -227,6 +234,7 @@ public class ScreenStackHeaderConfig extends ViewGroup {
mSubviewsCount++;
}
mConfigSubviews[index] = child;
maybeUpdate();
}
private TextView getTitleTextView() {