Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee7657f1 authored by tmfang's avatar tmfang
Browse files

Fix partically truncated problem for bar chart

- We fix height of detail view, so we see partially
truncated when the text wraps to next line.
For now, we set the height of detail view to wrap_content.
And then we initilize title and detail view earlier
so that we won't get a jankey problem.

- We enlarge the max height of bar view so that we
won't get truncated problem when user sets display and
font size to largest.
We will still see truncated problem in language, display size,
font size combo. But we only optimize for majority use cases.

Fixes: 126266231
Fixes: 126720230
Fixes: 126726034
Test: See bar chart in Settings app and Permission controller.

Change-Id: I08965c715d868cee055b89c6d56930f3c2ae6714
parent 7233ef9c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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>

+1 −1
Original line number Diff line number Diff line
@@ -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>
+5 −5
Original line number Diff line number Diff line
@@ -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);
    }