Commit Graph

31 Commits

Author SHA1 Message Date
Tim Peng
aeabfc3050 Add a separate line at the bottom of list area in output switcher
-Bottom divider is not showed when there are more than 7 devices exist in output switcher
-Check panel type in isDividerAllowedBelow()
-Hide the Slice bottom divider of Output switcher panel
-Show divider in panel layout only for output switcher panel

Bug: 159177275
Test: make -j42 RunSettingsRoboTests

Change-Id: I49396a0ee0543b494a2b3d714ec248ebab08e7ba
2020-06-20 03:44:43 +00:00
Tim Peng
9bdeef43fd Refine layout for output switcher panel
1. only make the output switcher tall enough to show 6.5 devices
2. enlarge album art to 52*52 and keep same size on group panel
3. reduce panel header top padding
4. enlarge slice first item top padding
5. update slider bar right padding
6. update panel height
7. align slice title item left with panel title icon
8. enlarge slice end item right padding

Bug: 156045699
Test: manual test
Change-Id: I51321d98ef483665689b7e258d6071df76382759
2020-06-12 15:15:00 +08:00
Yi-Ling Chuang
350affcdfa Fix Talkback annoucement for Media Output panel.
The sound panel and media panel are using the same window, so when it
transit from the sound panel to media panel, no window-change event will
be sent. Therefore, Talkback won't be able to re-focus the panel header
which lead to the lack of the announcement.

Fix this by adding setAccessibilityPanelTitle() to trigger Talkback.

Fixes: 140459762
Test: rebuild and test talkback on the media output panel.
Change-Id: I1442434315374dbbfe1d47ca8638180577c93168
2020-05-25 13:51:06 +08:00
Jason Chiu
4bbc85eb54 Fix the incorrect title of Panel
Since panel activity is singleInstance, a newer panel will reuse the
same fragment as the previous panel when they are displayed one after
another.

Panel fragment has two kinds of exclusive header layout which shouldn't
be showed at the same time, so we have to reset their visible states
when creating panel content.

Fixes: 154668079
Test: robotest
Change-Id: I701a7cde4b43322fbc63ae1cb74c41dd23b37c0c
2020-04-22 06:29:57 +00:00
hughchen
bc5f2fad33 Update customize button title when state changed
- This CL update customize button title when
  onCustomizedButtonStateChanged() is called.
- Add test case

Bug: 152002708
Test: make -j42 RunSettingsRoboTests
Change-Id: I85c9cf90305757e279c058db2875e303b4add437
2020-03-26 10:40:16 +08:00
Tim Peng
650eda307b Close panel when media stop
-Add forceClose callback to finish panel
-Add test cases

Bug: 151396986
Test: make -j50 RunSettingsRoboTests
Change-Id: Ic0ac2880a4ff412382816ccb41b4fbb60dbdf519
2020-03-19 10:02:35 +08:00
Tim Peng
36c4949414 Output switcher header is not updated with the latest media content
-Register media controller callback
-Update panel header when medadata changes
-Add test cases

Bug: 151396986
Test: make -j50 RunSettingsRoboTests
Change-Id: Id0b8f997899a96c0c94ca6bf099e624a9e87795b
2020-03-17 09:02:34 +08:00
Tim Peng
db7d61d0a2 Adjust layout for Slice InputRange
-Make title to slider aligned
-Add test cases

Bug: 147462114
Test: make -j50 RunSettingsRoboTests
Change-Id: Ib1d076f77eae75e4f861a80873117b6254729fe5
2020-03-09 21:50:58 +08:00
Tim Peng
a87985c4ae Add dynamic group panel
-Rename PanelCustomizedButtonCallback to PanelContentCallback
-Add onGroupChanged in PanelContentCallback
-Add test cases

Bug: 146813761
Test: make -j42 RunSettingsRoboTests
Change-Id: I60888efbbd0fc2878467418e55c70887a9d3f405
2020-02-27 06:29:01 +00:00
hughchen
201b48b885 Add stop casting button for output switch
This CL add a customize button to stop casting when media
is transferred to info device.

This CL include following change:
- Add new methods to PanelContent.java. Let panels to
  customize "see more button".
- MediaOutputPanel will check which device is used to
  transfer media currently. The customize button will
  shown on when transfer device is info device.
  Then user can use this button to stop casting.
- Add test case.

Bug: 147856563
Test: make -j42 RunSettingsRoboTests
Change-Id: I8b201a10339f39f1d938d99b5659a82014e5bb89
2020-02-19 10:05:44 +08:00
timhypeng
cc0069e42f Add listener for panel header icon
Bug: 146813761
Test: make -j42 RunSettingsRoboTests
Change-Id: I473b535593d4ecb445027d6c7dafbb235a70ffcf
2020-02-14 10:38:27 +08:00
timhypeng
0c4db3170d Add title and icon in output switcher panel header
-title shows artist
-subtitle shows album
-add test cases

Bug: 147776885
Test: make -j42 RunSettingsRoboTests
Change-Id: Ib33e5550e668d8cc5d70051ea2e7dd74d61c767a
2020-02-05 21:52:03 +08:00
timhypeng
0206434667 Define ICON_UNAVAILABLE for no icon status
Bug: 147776885
Test: make -j42 RunSettingsRoboTests
Change-Id: I0fd0e203bb7590955d0caf2679ebc78be68b4e50
2020-01-20 13:57:02 +08:00
timhypeng
adae7475b0 Add title and icon in panel header
- Add getIcon() and getSubTitle() in PanelContent
- Check icon avalibility to decide header layout
- Add test cases

Bug: 147776885
Test: make -j42 RunSettingsRoboTests
Change-Id: Idb51e81359b6037ca9b90965dd9b370fc5e22c84
2020-01-20 13:43:19 +08:00
Raff Tsai
dfba9a0f6d Change Panels creation interface to take a bundle
Fixes: 124399577
Test: robolectric
adb shell am start -a android.settings.panel.action.WIFI
adb shell am start -a android.settings.panel.action.VOLUME

Change-Id: I9e13357444e4ebeee50fb8cc68fbc974ce5fffb6
2019-10-18 13:21:18 +08:00
TreeHugger Robot
62aa86145c Merge "Fix volume panel hang" 2019-09-18 06:04:53 +00:00
Raff Tsai
d9cfbaf3b5 Fix volume panel hang
SliceLiveData changed its behavior, if slice is null, it will not
notify LiveData observer but callback to onErrorListener. We only
reduce PanelSlicesLoaderCountdownLatch in LiveData observer.
Therefore the error slice caused PanelSlicesLoaderCountdownLatch
never count to 0, the UI was not displayed. It is solved by reducing
PanelSlicesLoaderCountdownLatch in onErrorListener and also not return
null in MediaOutputIndicatorSlice.

Test: manual
Fixes: 141084035
Change-Id: Iddb2dbdc0e0d2ac3e26071960bb667937f181121
2019-09-18 11:40:46 +08:00
Tsung-Mao Fang
b455d58c03 Only add divider in recyclerView once
Only add divider in recyclerView once or more and more dividers
will be set in recyclerView.

Change-Id: I765ed888d460be221341dafe3521a849b8dd3889
Fix: 139452947
Test: Show panel many times and see the divider.
2019-09-16 15:31:42 +08:00
Raff Tsai
ad004e9beb Fix media switch slice doesn't display in panel
Fixes: 140396725
Test: manual
Change-Id: Idf0b766ce5f4316ff90a23faf3083cdee9854562
2019-09-04 11:34:23 +08:00
lindatseng
be70aaa6c4 Add null check to precent crash in monkey test
Fixes: 133259172
Test: manual
Change-Id: Ib4dd24965fda40a7a917397bf558309e0424bf16
2019-05-22 10:36:50 -07:00
lindatseng
2943c1de7a Set panel launch mode to singleInstance and fix animation
Set panel launch mode to singleInstance to avoid panel can show up
infinite time when user keep launching panels (Easy repro by
pressing volume hard key > settings again and again).

After changing launch mode to singleInstance, we will need to do
some refactors, to avoid weirdness when adding/changing/closing
panels:
1. Move and refactor logic in SettingsPanelActivity#onCreate.
   We will need onNewIntent here to handle Panel launching, since
   we only have one instance of SettingsPanelActivity now.

   Also do refactor here to reuse the PanelFragment instead of
   creating one every single time, to better handle the exit
   animation, avoid janky exit behavior from the old PanelFragment

2. Move logic from PanelFragment#onCreateView, to reuse it when
   updating panel content.

   Also add exiting animation when we are transitioning the panel
   from one to another.  Also add alpha animation to make it move
   more smoothly.

3. Adding flags to launch see more intent in settings.

Fixes: 131225920
Fixes: 131254399
Test: manual
Change-Id: I93d3708bd02a2d736e38685475f2d9988ef62d31
2019-05-10 07:14:13 +00:00
Matthew Fritze
b6fdd25c23 Add entry animation to Settings Panels.
Settings Panels as a dialog have a default animation for entering the
screen, but Slices complicate the animation. While the dialog enters the
screen, Slices begin to bind, thus changing the height of the dialog as
it enters, causing perceived bounce / jank in the animation.

This CL is cherry-picked/based on ag/6671083 but do the following modification:
(See the original commit message for the whole concept)

When trying to load all the Slices, there are few possible situations:
1. Slice starts loading slowly, starting at state LOADED_NONE
2. Slice is loading in progress, having state LOADED_PARTIAL
3. Slice is loaded, but there's error return from the Slice data (We don't
need to show the Slice in this case)
4. Slice is loaded, progress to state LOADED_ALL
5. Slice starts from state LOADED_NONE, but never progress to the next state
because it crashes at setting backend.

Notice that there are two cases that the state will stay at LOADED_NONE and
we can't distinguish them.

Hence, we decide to do the following:

If Slice is with error (case 3) we remove the slice from the list and mark it
loaded.

If Slice is loaded with LOADED_ALL (case 4, which is the ideal case), we mark
it as loaded.

In the other cases, we fire a handler to mark the slice loaded anyway after
250ms timeout.

When all the slices are marked loaded (which should happen after 250ms timeout,
we will animate the panel out.  Although there might be slices which are still
partial loaded, we can still have the slice in the panel once it is ready.
The panel might bounce/jank in this case, but at least it will still showing
correctly, and should show up smoothly in most cases.

The solution to this problem is twofold:
1. Load all Slices first
2. Create a custom animation to draw the panel once the recyclerview has
been laid out.

Test: Manual/Visual inspection
Test: make -j40 RunSettingsRobotests
Bug: 123942159

Change-Id: I639a707aa4ba3f906bd6f9752c92727aaba28142
2019-04-16 16:29:04 +00:00
lindatseng
79957c3217 Update panel logging to include all hide page cases
The old logging only include see_more, done, and clicked_out when hiding
the panel page.  We were missing many cases that user might use back
button, app switch button to close the page.

Update the hide page keys to change the clicked_out to others to
include all the other cases which hide the page.

Test: Manual verification
Test: atest PanelFragmentTest SettingsPanelActivityTest
Fixes: 130169553
Change-Id: Icede9a8dcb84565cba183963c9fb554507631c98
2019-04-12 11:33:41 -07:00
lindatseng
cf93c8bc92 Remove divider above device switcher in panel
Remove the divider above the media device switcher Slice per the request.

Do a little refactor in Panel View, to use DividerItemDecoration instead of adding
divider views in layout file as the recycler view items divider.

Since dividers should be shown in most cases, we are setting DividerCondition to
DIVIDER_CONDITION_BOTH and default true to allow divider.  For the slice we don't
need divider (media device switch in this case) we are setting the the target
direction of isDividerAllowed (above in this case) to false.  Since we have
DIVIDER_CONDITION_BOTH, if one of the item view set the divider not allow, the
divider won't be shown.

Test: Visual/Manual inspection
Fixes: 126205139
Change-Id: Ic857705c90819ef9375f877a44bb32987b5d4438
2019-04-05 14:15:16 -07:00
Matthew Fritze
e435b062a0 Fix NPE in constructor
Move getActivity() call and fetching of metrics feature provider into
onCreateView rathre than the Constructor of the fragment (where Activity
is not yet created).

Test: manual
Test: existing robotests
Fixes: 128808444
Change-Id: I88586b0ca3ebda60f8933041322541cc5911de68
2019-03-20 08:29:23 -07:00
Matthew Fritze
b197110f71 Add logging for SettingsPanels
The 3 main categories are:
- Panel Opened
- Panel Closed
- Panel Slice interaction

There are 3 close events:
- See more button
- Done button
- Clicking outside the panel

Slice interactions will log the Uri of the Slice and the ActionType,
such as Toggle, Slider, Content (intent).

Change-Id: Iecad948f39f50dd12ae1bcb23a5d523e0df8bb98
Fixes: 117804231
Test: robotests
2019-02-13 16:06:24 -08:00
hughchen
2177813531 Add entry point to launch media output slice
Add media output panel type to launch media output slice.

Bug: 121083246
Test: make -j RunSettingsRoboTests
Change-Id: Ibf706146430e309fef6cbf0e1e86c2d5b78b50d5
2019-01-28 12:02:08 +08:00
Fan Zhang
31b210017b Migrate all MetricsProto enums to SettingsEnums
Bug: 122855168
Test: rebuild
Change-Id: I962d9a71179f86b7cae9dc5e9a00e0aa1557dc76
2019-01-17 14:55:42 -08:00
Matthew Fritze
735d6ef195 Move Panel to public API
Change the SettingsPanelActivity to reference the
public API.

Bug: 117804442
Test: robolectric, manual app
Change-Id: I4b128ae9d97c1000fdaa0c3fb5b94f8dc096055f
2018-12-13 13:58:07 -08:00
Matthew Fritze
c14316c4a9 Update SettingsPanel UI
UI changes include:
- RecyclerView to host slices
- Font family to headline font
- Title is now centered
- Added SeeMore & Done buttons
- Horizontal Dividers between slices
- Indented Slices
- Landscape layout is fullscreen

Change-Id: I3549c847fc88edd81f670ddfa2907dd3741441e0
Screenshot: https://screenshot.googleplex.com/RzWktzOZJkc
Test: Robolectric
Test: Manual app
Bug: 118622007
2018-11-30 13:26:50 -08:00
Matt Fritze
90899e08f0 First commit for settings panels
Establish the Activity which hosts Settings panels through the
PanelFragment. The Activity's purpose is to validate the intent
data coming in, including:
- Called with startActivityForResult (so we can log who is calling)
- Intent has the proper intent extra to link to a Panel

The fragment takes the Panelable data and builds a Settings Panel.
Each panel will have:
- Title
- List of Slices
- Link to underlying content

The Panelable interface is created to provide all of those datums, and
the new FetureProvider provides the Panelables by linking them with
keys. The keys will eventually become public APIs with CTS tests.For
now, we store them locally.

I included an exmaple panel, the InternetConnectivityPanel which
currently shows Wifi and Airplane mode.

Screenshot: https://screenshot.googleplex.com/c6sv7ZzQ5OJ
Bug: 117804089
Test: make -j40 RunSettingsRobotest
Test: Manual app
Change-Id: I1932f7179cc32088acd6413a736901ddf9651892
2018-11-26 15:26:02 -08:00