Merge "Fix partically truncated problem for bar chart"

This commit is contained in:
TreeHugger Robot
2019-03-12 13:18:33 +00:00
committed by Android (Google) Code Review
3 changed files with 7 additions and 7 deletions

View File

@@ -66,7 +66,7 @@
android:id="@+id/bar_chart_details"
style="@android:style/Widget.DeviceDefault.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_height="wrap_content"
android:gravity="center"/>
</LinearLayout>

View File

@@ -18,7 +18,7 @@
<resources>
<style name="BarViewStyle">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">226dp</item>
<item name="android:layout_height">250dp</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_marginStart">8dp</item>
<item name="android:layout_marginEnd">8dp</item>

View File

@@ -158,6 +158,11 @@ public class BarChartPreference extends Preference {
holder.setDividerAllowedAbove(true);
holder.setDividerAllowedBelow(true);
// We bind title and details early so that we can preserve the correct height for chart
// view.
bindChartTitleView(holder);
bindChartDetailsView(holder);
// If the state is loading, we just show a blank view.
if (mIsLoading) {
holder.itemView.setVisibility(View.INVISIBLE);
@@ -165,9 +170,6 @@ public class BarChartPreference extends Preference {
}
holder.itemView.setVisibility(View.VISIBLE);
// We must show title of bar chart.
bindChartTitleView(holder);
final BarViewInfo[] barViewInfos = mBarChartInfo.getBarViewInfos();
// If there is no any bar view, we just show an empty text.
if (barViewInfos == null || barViewInfos.length == 0) {
@@ -175,8 +177,6 @@ public class BarChartPreference extends Preference {
return;
}
setEmptyViewVisible(holder, false /* visible */);
bindChartDetailsView(holder);
updateBarChart(holder);
}