Merge pull request #5564 from ByteHamster/fix-stats-flash

Fix short flash of long stats table when showing short one
This commit is contained in:
ByteHamster 2021-11-21 21:03:32 +01:00 committed by GitHub
commit 071a611126
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -43,6 +43,16 @@ public class FeedStatisticsFragment extends Fragment {
@Nullable Bundle savedInstanceState) { @Nullable Bundle savedInstanceState) {
feedId = getArguments().getLong(EXTRA_FEED_ID); feedId = getArguments().getLong(EXTRA_FEED_ID);
viewBinding = FeedStatisticsBinding.inflate(inflater); viewBinding = FeedStatisticsBinding.inflate(inflater);
if (!getArguments().getBoolean(EXTRA_DETAILED)) {
for (int i = 0; i < viewBinding.getRoot().getChildCount(); i++) {
View child = viewBinding.getRoot().getChildAt(i);
if ("detailed".equals(child.getTag())) {
child.setVisibility(View.GONE);
}
}
}
loadStatistics(); loadStatistics();
return viewBinding.getRoot(); return viewBinding.getRoot();
} }
@ -71,15 +81,6 @@ public class FeedStatisticsFragment extends Fragment {
viewBinding.totalDurationLabel.setText(Converter.shortLocalizedDuration(getContext(), s.time)); viewBinding.totalDurationLabel.setText(Converter.shortLocalizedDuration(getContext(), s.time));
viewBinding.onDeviceLabel.setText(String.format(Locale.getDefault(), "%d", s.episodesDownloadCount)); viewBinding.onDeviceLabel.setText(String.format(Locale.getDefault(), "%d", s.episodesDownloadCount));
viewBinding.spaceUsedLabel.setText(Formatter.formatShortFileSize(getContext(), s.totalDownloadSize)); viewBinding.spaceUsedLabel.setText(Formatter.formatShortFileSize(getContext(), s.totalDownloadSize));
if (!getArguments().getBoolean(EXTRA_DETAILED)) {
for (int i = 0; i < viewBinding.getRoot().getChildCount(); i++) {
View child = viewBinding.getRoot().getChildAt(i);
if ("detailed".equals(child.getTag())) {
child.setVisibility(View.GONE);
}
}
}
} }
@Override @Override