Commit Graph

16 Commits

Author SHA1 Message Date
tmfang
7007e7947e Fix talkback issue on bar chart
We set content description on icon view,
so this is why talkback speaks the permission name twice.

Test: open talkback, and click bar chart.
Fixes: 130842756
Change-Id: I2ed4916de0a249f61d97dc00fa95193560b3d74c
2019-04-25 10:47:00 +08:00
tmfang
dce047fba2 Tweak bar chart measurement.
Test: visual
Fixes: 129480652
Fixes: 129481095
Change-Id: Ie08a31c487477aeaa40e06b8df9cb7571dd5d15f
2019-04-03 16:32:18 +08:00
Evan Severson
e13165a417 Extract resources for BarChartPreference
Move hardcoded values from the layout into resources that
can be overlaid

Test: Build and check appearance isn't changed
      Overlay worked
Bug: 129532538

Change-Id: Ie26818722339443d71a8b9692b55ac6f5980884e
2019-03-29 09:13:33 -07:00
Joel Galenson
6486605525 Modify the bar chart for new graph design
- Allow passing a custom string as the label for each bar.
- Also allow passing a CharSequence as the bar summary instead of a
resource id.
- Change barchar style for new graph design. ex: color, font size,
margin size

Test: View graph.
Test: atest BarChartInfoTest BarChartPreferenceTest
Change-Id: I6f31ece4fe61811420cf2458219452862e8d04c2
2019-03-27 11:51:35 +08:00
tmfang
ee7657f12d 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
2019-03-09 17:10:39 +08:00
Joel Galenson
9842425fd8 Add content description to bar chart icons.
Allow setting a content description on the bar chart icons so screen
readers can speak information about them.

Bug: 127237805
Test: Use new API.
Test: atest the two modified tests
Change-Id: I97c3693459bd1d916a66d834434be6ef3ab405d7
2019-03-05 14:14:14 -08:00
tmfang
b052cfaf26 Fix janky on permission bar chart
In old design, the height of bar view is wrap_content.
So, it may have additional space after we normalized the
height for each bar view.
As a result, the button moves down when permission chart
gets filled.

For now, we fix the height which is max normalized height
for bar view. So, it won't have additional space while widget
is rendering the chart.

Test: See bar chart in privacy settings and permission dashboard.
Fixes: 123539793
Change-Id: Idb2619e21606248079715e055cb26ff366c71ad3
2019-02-26 13:13:38 +08:00
tmfang
4a2cd66fb8 Bar chart shows blank view during loading state
We'd expect that bar chart can show blank view
during loading state.

If user doesn't change its loading state, preference
draws view directly.

But if user changes its loading state to true explicitly,
if means bar chart needs to take some time to load
data. So, we won't initialize view now.

Once the state is updated to false, we will start to
initialize view again.

Test: visual, robotest
Bug: 123539793
Change-Id: I5fc9e5a48e49c43ade6fd5a4dc7ba3458cf7c07d
2019-02-14 15:29:34 +08:00
tmfang
c6338cf7bd Change visibility modifiers of MAXIMUM_BAR_VIEWS
In Settings app, we need to use MAXIMUM_BAR_VIEWS,
so change the visibility modifiers to be pulbic.

Test: robotest
Bug: 122478755
Change-Id: Ibba1b7ef2f7d39132a5efabddf866c8daf0edf7f
2019-01-08 11:48:28 +08:00
tmfang
ff3ba83410 Add an empty text when there is no bar view
Bar chart only shows title and empty text in
this BarChartPreference when user didn't
add any bar view for bar chart.

Test: visual and robotest
Change-Id: I66f7fc5376cd7f996f3cbe7a36455127c4e4d81b
Fixes: 117623686
2019-01-04 11:01:16 +08:00
tmfang
d8551b11be Create a BarChartInfo builder
Since number of parameters are increasing quickly in
BarChartPreference#initializeBarChart,
we decide to create a builder class as constructor's
parameter.

Therefore, we don't need to keep updating constructor
and clients all the time.

- Create a BarchartInfo builder.
- BarChartInfo is responsible for storing bar view
information.

Test: robotest
Change-Id: I91b1d524b2986fc228a74d30fdab0f5b9c79c544
Bugs: 117623686
2019-01-03 16:10:53 +08:00
Joel Galenson
418137e5ef Show the bar chart detail after hiding it.
In a previous commit I made the bar chart detail text GONE when no
text was provided to avoid a crash.  But I forgot to mark it visible
when text is passed afterwards.  This fixes that bug.

Test: Create bar chart with an empty detail text, set some text, and
then see the detail text.
Test: atest com.android.settingslib.widget.BarChartPreferenceTest

Change-Id: I4a352245c3dc7b02ab3d1de21c348f2d431e95cf
2018-12-27 09:56:26 -08:00
Joel Galenson
919f6ea428 Hide the bar chart details text when no string is provided.
Currently the bar chart crashes when no detail text is passed.  This
instead hides the text in that case.

Bug: 117623686
Test: View chart with and without detail string.
Change-Id: I227201af9615b6ec190c8688151cd93cfe058bfb
2018-12-21 17:41:39 +08:00
tmfang
7081e7f5b7 Add click listener for each bar view.
Per spec, each bar view can launch different page.

Test: manual test, robotest
Change-Id: I26f05ee7417fcb8bc1048f680795ee759ea1c30b
Fixes: 117623686
2018-12-20 15:08:27 +08:00
Fan Zhang
7989dfc627 Clean up javadoc on BarView widget.
Bug: 117623686
Test: rebuild
Change-Id: I2889be6a0d5506492ae81710890ae1a836a4bd0c
2018-12-20 14:49:54 +08:00
tmfang
2badb3e13b Create a bar char preference widget
- Per Q design, we will show a bar chart in Settings > Privacy page.
  Permission team also needs this bar chart in their page.
- Create a new library named SettingsLibBarChartPreference

Test: visual, robotest
Change-Id: Iff5a1233357a6aa6a667c0059f542a1b444b59a2
Fixes: 117623686
2018-12-18 18:09:10 +08:00