问题
客户需求,阅读模式开关要加到状态栏里面。
代码位置
alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_off.xml | [new file with mode: 0755] | patch | blob |
alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_on.xml | [new file with mode: 0755] | patch | blob |
alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-zh-rCN/xw_strings.xml | [new file with mode: 0755] | patch | blob |
alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml | [changed mode: 0644->0755] | patch | blob | history |
alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/xw_strings.xml | [new file with mode: 0755] | patch | blob |
alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java | [changed mode: 0644->0755] | patch | blob | history |
alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tiles/XwReaderTile.java | [new file with mode: 0755] | patch | blob |
具体代码
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_off.xml b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_off.xml
new file mode 100755 (executable)
index 0000000..082c75c
--- /dev/null
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_off.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<vector android:name="root" android:height="48.0dip" android:width="48.0dip" android:alpha="1.0" android:viewportWidth="1024.0" android:viewportHeight="1024.0"\r
+ xmlns:android="http://schemas.android.com/apk/res/android">\r
+ <group android:name="ic_signal_reader">\r
+ <path android:name="head1" android:fillColor="#ff676f73" android:pathData="M375.466667 477.866667 170.666667 477.866667c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S395.946667 477.866667 375.466667 477.866667zM307.2 648.533333 170.666667 648.533333c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l136.533333 0c20.48 0 34.133333-13.653333 34.133333-34.133333S327.68 648.533333 307.2 648.533333zM375.466667 307.2 170.666667 307.2c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S395.946667 307.2 375.466667 307.2zM853.333333 307.2l-102.4 0c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l102.4 0c20.48 0 34.133333-13.653333 34.133333-34.133333S873.813333 307.2 853.333333 307.2zM955.733333 136.533333 614.4 136.533333c-40.96 0-78.506667 17.066667-102.4 47.786667C488.106667 153.6 450.56 136.533333 409.6 136.533333L68.266667 136.533333C30.72 136.533333 0 167.253333 0 204.8l0 614.4c0 37.546667 30.72 68.266667 68.266667 68.266667l341.333333 0c40.96 0 78.506667-17.066667 102.4-47.786667 23.893333 27.306667 61.44 47.786667 102.4 47.786667l341.333333 0c37.546667 0 68.266667-30.72 68.266667-68.266667L1024 204.8C1024 167.253333 993.28 136.533333 955.733333 136.533333zM477.866667 750.933333c0 37.546667-30.72 68.266667-68.266667 68.266667L102.4 819.2c-20.48 0-34.133333-13.653333-34.133333-34.133333L68.266667 238.933333c0-20.48 13.653333-34.133333 34.133333-34.133333l307.2 0c37.546667 0 68.266667 30.72 68.266667 68.266667L477.866667 750.933333zM955.733333 785.066667c0 20.48-13.653333 34.133333-34.133333 34.133333l-307.2 0c-37.546667 0-68.266667-30.72-68.266667-68.266667L546.133333 273.066667c0-37.546667 30.72-68.266667 68.266667-68.266667l307.2 0c20.48 0 34.133333 13.653333 34.133333 34.133333L955.733333 785.066667zM853.333333 477.866667l-204.8 0c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S873.813333 477.866667 853.333333 477.866667z" />\r
+ </group>\r
+</vector>
\ No newline at end of file
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_on.xml b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_on.xml
new file mode 100755 (executable)
index 0000000..41a7c30
--- /dev/null
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/drawable/ic_qs_reader_on.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<vector android:name="root" android:height="48.0dip" android:width="48.0dip" android:alpha="1.0" android:viewportWidth="1024.0" android:viewportHeight="1024.0"\r
+ xmlns:android="http://schemas.android.com/apk/res/android">\r
+ <group android:name="ic_signal_reader">\r
+ <path android:name="head1" android:fillColor="#ffffffff" android:pathData="M375.466667 477.866667 170.666667 477.866667c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S395.946667 477.866667 375.466667 477.866667zM307.2 648.533333 170.666667 648.533333c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l136.533333 0c20.48 0 34.133333-13.653333 34.133333-34.133333S327.68 648.533333 307.2 648.533333zM375.466667 307.2 170.666667 307.2c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S395.946667 307.2 375.466667 307.2zM853.333333 307.2l-102.4 0c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l102.4 0c20.48 0 34.133333-13.653333 34.133333-34.133333S873.813333 307.2 853.333333 307.2zM955.733333 136.533333 614.4 136.533333c-40.96 0-78.506667 17.066667-102.4 47.786667C488.106667 153.6 450.56 136.533333 409.6 136.533333L68.266667 136.533333C30.72 136.533333 0 167.253333 0 204.8l0 614.4c0 37.546667 30.72 68.266667 68.266667 68.266667l341.333333 0c40.96 0 78.506667-17.066667 102.4-47.786667 23.893333 27.306667 61.44 47.786667 102.4 47.786667l341.333333 0c37.546667 0 68.266667-30.72 68.266667-68.266667L1024 204.8C1024 167.253333 993.28 136.533333 955.733333 136.533333zM477.866667 750.933333c0 37.546667-30.72 68.266667-68.266667 68.266667L102.4 819.2c-20.48 0-34.133333-13.653333-34.133333-34.133333L68.266667 238.933333c0-20.48 13.653333-34.133333 34.133333-34.133333l307.2 0c37.546667 0 68.266667 30.72 68.266667 68.266667L477.866667 750.933333zM955.733333 785.066667c0 20.48-13.653333 34.133333-34.133333 34.133333l-307.2 0c-37.546667 0-68.266667-30.72-68.266667-68.266667L546.133333 273.066667c0-37.546667 30.72-68.266667 68.266667-68.266667l307.2 0c20.48 0 34.133333 13.653333 34.133333 34.133333L955.733333 785.066667zM853.333333 477.866667l-204.8 0c-20.48 0-34.133333 13.653333-34.133333 34.133333s13.653333 34.133333 34.133333 34.133333l204.8 0c20.48 0 34.133333-13.653333 34.133333-34.133333S873.813333 477.866667 853.333333 477.866667z" />\r
+ </group>\r
+</vector>
\ No newline at end of file
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-zh-rCN/xw_strings.xml b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-zh-rCN/xw_strings.xml
new file mode 100755 (executable)
index 0000000..d38a881
--- /dev/null
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-zh-rCN/xw_strings.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2014, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <string name="xw_show_network_speed">"实时网速"</string>
+ <string name="xw_reader">"阅读模式"</string>
+
+</resources>
+
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml
old mode 100644 (file)
new mode 100755 (executable)
index 1a89f12..d590517
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/config.xml
@@ -74,7 +74,7 @@
<!-- The default tiles to display in QuickSettings -->
<string name="quick_settings_tiles_default" translatable="false">
- internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle
+ internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,xwreader
</string>
<!-- The class path of the Safety Quick Settings Tile -->
@@ -87,7 +87,7 @@
<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
<string name="quick_settings_tiles_stock" translatable="false">
- internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction
+ internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,xwreader
</string>
<!-- The tiles to display in QuickSettings -->
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/xw_strings.xml b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/xw_strings.xml
new file mode 100755 (executable)
index 0000000..7381dd3
--- /dev/null
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/xw_strings.xml
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2014, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <string name="usb_insert_on" translatable="false">Charger Is Connected.</string>
+ <string name="usb_insert_off" translatable="false">Charger Has Pulled Up.</string>
+
+ <string name="used_ram">"Used"</string>
+ <string name="free_ram">"Free"</string>
+ <string name="total_ram">"Total"</string>
+ <string name="memery_clean_ram">"Memory optimization to optimal state"</string>
+ <string name="clean_view_string">"Clean"</string>
+ <!-- Suffix added to a number to signify size in bytes. -->
+ <string name="byteShort">B</string>
+ <!-- Suffix added to a number to signify size in kilobytes. -->
+ <string name="kilobyteShort">K</string>
+ <!-- Suffix added to a number to signify size in megabytes. -->
+ <string name="megabyteShort">M</string>
+ <!-- Suffix added to a number to signify size in gigabytes. -->
+ <string name="gigabyteShort">G</string>
+ <!-- Suffix added to a number to signify size in terabytes. -->
+ <string name="terabyteShort">T</string>
+ <!-- Suffix added to a number to signify size in petabytes. -->
+ <string name="petabyteShort">P</string>
+
+ <string name="xw_normal">Sound</string>
+ <string name="xw_vibrate">Vibrate</string>
+ <string name="xw_silent">Silent</string>
+ <string name="xw_data_connection">Mobile data</string>
+ <string name="xw_screen_recorder">Screen Recorder</string>
+
+
+ <string name="speed">%s/s</string>
+ <string name="fileSizeSuffix">%1$s"\n"%2$s</string>
+
+ <string name="xw_show_network_speed">Network Speed</string>
+ <string name="xw_reader">Reader-M</string>
+
+ <string name="xw_low_battery_flashlight_canot_use">Low Battery, Flashlight not available!</string>
+
+ <string name="screenshot" translatable="false">ScreenShot</string>
+
+ <string name="battery_full" translatable="false">battery full</string>
+
+ <!-- Advanced restart menu -->
+ <!-- Button to restart the device, within the Restart Options dialog -->
+ <string name="global_action_restart_system">System</string>
+ <!-- Button to restart the device into recovery mode, within the Restart Options dialog -->
+ <string name="global_action_restart_recovery">Recovery</string>
+ <!-- Button to restart the device into bootloader mode, within the Restart Options dialog -->
+ <string name="global_action_restart_bootloader">Bootloader</string>
+ <!-- Button to restart the device into download mode, within the Restart Options dialog -->
+ <string name="global_action_restart_download">Download</string>
+ <!-- Button to restart the device into fastboot mode, within the Restart Options dialog -->
+ <string name="global_action_restart_fastboot">Fastbootd</string>
+
+ <!-- Restart progress dialog. This is shown if the user chooses to restart the device. -->
+ <string name="global_action_restart_progress">Restarting\u2026</string>
+ <!-- Restart to recovery mode progress dialog. This is shown if the user chooses to restart the device. -->
+ <string name="global_action_restart_recovery_progress">Restarting to recovery mode\u2026</string>
+ <!-- Restart to bootloader mode progress dialog. This is shown if the user chooses to restart the device. -->
+ <string name="global_action_restart_bootloader_progress">Restarting to bootloader mode\u2026</string>
+ <!-- Restart to download mode progress dialog. This is shown if the user chooses to restart the device. -->
+ <string name="global_action_restart_download_progress">Restarting to download mode\u2026</string>
+ <!-- Restart to fastboot mode progress dialog. This is shown if the user chooses to restart the device. -->
+ <string name="global_action_restart_fastboot_progress">Restarting to fastbootd mode\u2026</string>
+
+ <!-- Label for current user in power menu options dialog -->
+ <string name="global_action_current_user">Current</string>
+
+ <!-- Navigation bar dpad -->
+ <string name="accessibility_dpad_left">Cursor left</string>
+ <string name="accessibility_dpad_right">Cursor right</string>
+
+ <!-- Custom QS tiles -->
+ <!-- ADB over network QS tile -->
+ <string name="quick_settings_network_adb_label">ADB over network</string>
+ <string name="quick_settings_network_adb_no_network">no network</string>
+
+ <!-- Ambient display QS tile -->
+ <string name="quick_settings_ambient_display_label">Ambient display</string>
+ <string name="accessibility_quick_settings_ambient_display_off">Ambient display off.</string>
+ <string name="accessibility_quick_settings_ambient_display_on">Ambient display on.</string>
+ <string name="accessibility_quick_settings_ambient_display_changed_off">Ambient display turned off.</string>
+ <string name="accessibility_quick_settings_ambient_display_changed_on">Ambient display turned on.</string>
+
+ <!-- Caffeine QS tile -->
+ <string name="quick_settings_caffeine_label">Caffeine</string>
+ <string name="accessibility_quick_settings_caffeine_off">Caffeine off.</string>
+ <string name="accessibility_quick_settings_caffeine_on">Caffeine on.</string>
+
+ <!-- Heads up QS tile -->
+ <string name="quick_settings_heads_up_label">Heads up</string>
+ <string name="accessibility_quick_settings_heads_up_off">Heads up off.</string>
+ <string name="accessibility_quick_settings_heads_up_on">Heads up on.</string>
+ <string name="accessibility_quick_settings_heads_up_changed_off">Heads up turned off.</string>
+ <string name="accessibility_quick_settings_heads_up_changed_on">Heads up turned on.</string>
+
+ <!-- Reader mode QS tile -->
+ <string name="quick_settings_reading_mode">Reading mode</string>
+ <string name="accessibility_quick_settings_reading_mode_on">Reading mode on.</string>
+ <string name="accessibility_quick_settings_reading_mode_off">Reading mode off.</string>
+ <string name="accessibility_quick_settings_reading_mode_changed_on">Reading mode turned on.</string>
+ <string name="accessibility_quick_settings_reading_mode_changed_off">Reading mode turned off.</string>
+
+ <!-- Sync QS tile -->
+ <string name="quick_settings_sync_label">Sync</string>
+ <string name="accessibility_quick_settings_sync_off">Sync off.</string>
+ <string name="accessibility_quick_settings_sync_on">Sync on.</string>
+ <string name="accessibility_quick_settings_sync_changed_off">Sync turned off.</string>
+ <string name="accessibility_quick_settings_sync_changed_on">Sync turned on.</string>
+
+ <!-- System Profiles QS tile -->
+ <string name="quick_settings_profiles_label">System profiles</string>
+ <string name="accessibility_quick_settings_profiles_off">Profiles off.</string>
+ <string name="accessibility_quick_settings_profiles">Profile: <xliff:g id="profile" example="Default">%s</xliff:g>.</string>
+ <string name="accessibility_quick_settings_profiles_changed_off">Profiles turned off.</string>
+ <string name="accessibility_quick_settings_profiles_changed">Profile changed to <xliff:g id="profile" example="Default">%s</xliff:g>.</string>
+
+ <!-- USB tethering QS tile -->
+ <string name="quick_settings_usb_tether_label">USB tethering</string>
+
+ <!-- Volume panel QS tile -->
+ <string name="quick_settings_volume_panel_label">Volume panel</string>
+
+ <!-- VPN QS tile -->
+ <string name="quick_settings_vpn_label">VPN</string>
+ <string name="quick_settings_vpn_connect_dialog_title">Connect to\u2026</string>
+ <string name="vpn_credentials_hint">Please enter your credentials for connecting to <xliff:g id="name">%s</xliff:g></string>
+ <string name="vpn_credentials_username">Username</string>
+ <string name="vpn_credentials_password">Password</string>
+ <string name="vpn_credentials_dialog_connect">Connect</string>
+
+ <!-- Content description of the location tile in quick settings when on, battery saving mode (not shown on the screen). [CHAR LIMIT=NONE] -->
+ <string name="accessibility_quick_settings_location_battery_saving">Location reporting: battery saving mode.</string>
+ <!-- Content description of the location tile in quick settings when on, sensors only mode (not shown on the screen). [CHAR LIMIT=NONE] -->
+ <string name="accessibility_quick_settings_location_gps_only">Location reporting: sensors only mode.</string>
+ <!-- Content description of the location tile in quick settings when on, high accuracy mode (not shown on the screen). [CHAR LIMIT=NONE] -->
+ <string name="accessibility_quick_settings_location_high_accuracy">Location reporting: high accuracy mode.</string>
+
+ <!-- QuickSettings: Location (On, low-power) [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_location_battery_saving_label">Battery saving</string>
+ <string name="quick_settings_location_battery_saving_label_twoline">Battery\nsaving</string>
+ <!-- QuickSettings: Location (On, gps-only) [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_location_gps_only_label">Device only</string>
+ <string name="quick_settings_location_gps_only_label_twoline">Device\nonly</string>
+ <!-- QuickSettings: Location (On, high-accuracy) [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_location_high_accuracy_label">High accuracy</string>
+ <string name="quick_settings_location_high_accuracy_label_twoline">High\naccuracy</string>
+
+ <!-- QuickSettings: Location detail panel title [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_location_detail_title">Location</string>
+ <!-- QuickSettings: Location detail panel menu title [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_location_detail_menu_title">Select mode:</string>
+ <!-- [CHAR LIMIT=30] Location detail panel, high accuracy location mode -->
+ <string name="quick_settings_location_detail_mode_high_accuracy_title">High accuracy</string>
+ <!-- [CHAR LIMIT=30] Location detail panel, battery saving location mode -->
+ <string name="quick_settings_location_detail_mode_battery_saving_title">Battery saving</string>
+ <!-- [CHAR LIMIT=30] Location detail panel, device only location mode -->
+ <string name="quick_settings_location_detail_mode_sensors_only_title">Device only</string>
+ <!-- [CHAR LIMIT=130] Location detail panel, description for high accuracy mode -->
+ <string name="quick_settings_location_detail_mode_high_accuracy_description">Use GPS, Wi\u2011Fi, Bluetooth, or cellular networks to determine location</string>
+ <!-- [CHAR LIMIT=130] Location detail panel, description for battery saving mode -->
+ <string name="quick_settings_location_detail_mode_battery_saving_description">Use Wi\u2011Fi, Bluetooth, or cellular networks to determine location</string>
+ <!-- [CHAR LIMIT=130] Location detail panel, description for sensors only mode -->
+ <string name="quick_settings_location_detail_mode_sensors_only_description">Use GPS to determine location</string>
+
+ <!-- Name of the battery status bar icon. -->
+ <string name="status_bar_battery">Battery</string>
+
+ <string name="status_bar_settings">Settings</string>
+<string name="qs_media">Media</string>
+
+ <string name="qs_device">Devices</string>
+
+
+ <!-- AOD QS tile -->
+ <string name="quick_settings_aod_label">AOD</string>
+ <string name="quick_settings_aod_off_powersave_label">AOD off\nBattery saver</string>
+
+ <!--20190517 pjz add sim operator -->
+ <string name="operator_cmcc" >"CMCC"</string>
+ <string name="operator_cucc" >"CUCC"</string>
+ <string name="operator_ctcc" >"CTCC"</string>
+
+ <string name="txt_shutdown" >"Power off"</string>
+ <string name="txt_restart" >"Restart"</string>
+ <string name="txt_emergency" >"Emergent mode"</string>
+ <string name="hint_shutdown" >"Tap again to turn off your phone"</string>
+ <string name="hint_restart" >"Tap again to restart your phone"</string>
+
+</resources>
+
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
old mode 100644 (file)
new mode 100755 (executable)
index c987283..d7841a3
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
@@ -71,6 +71,7 @@ import javax.inject.Inject;
import javax.inject.Provider;
import dagger.Lazy;
+import com.android.systemui.qs.tiles.XwReaderTile;
@SysUISingleton
public class QSFactoryImpl implements QSFactory {
@@ -109,6 +110,8 @@ public class QSFactoryImpl implements QSFactory {
private final Lazy<QSHost> mQsHostLazy;
private final Provider<CustomTile.Builder> mCustomTileBuilderProvider;
+
+ private final Provider<XwReaderTile> mXwReaderTileProvider; //lyz add Reading mode
@Inject
public QSFactoryImpl(
@@ -142,7 +145,8 @@ public class QSFactoryImpl implements QSFactory {
Provider<QuickAccessWalletTile> quickAccessWalletTileProvider,
Provider<QRCodeScannerTile> qrCodeScannerTileProvider,
Provider<OneHandedModeTile> oneHandedModeTileProvider,
- Provider<ColorCorrectionTile> colorCorrectionTileProvider) {
+ Provider<ColorCorrectionTile> colorCorrectionTileProvider,
+ Provider<XwReaderTile> xwReaderTileProvider) {
mQsHostLazy = qsHostLazy;
mCustomTileBuilderProvider = customTileBuilderProvider;
@@ -175,6 +179,7 @@ public class QSFactoryImpl implements QSFactory {
mQRCodeScannerTileProvider = qrCodeScannerTileProvider;
mOneHandedModeTileProvider = oneHandedModeTileProvider;
mColorCorrectionTileProvider = colorCorrectionTileProvider;
+ mXwReaderTileProvider = xwReaderTileProvider;
}
/** Creates a tile with a type based on {@code tileSpec} */
@@ -260,6 +265,9 @@ public class QSFactoryImpl implements QSFactory {
return mOneHandedModeTileProvider.get();
case "color_correction":
return mColorCorrectionTileProvider.get();
+ //lyz add Reading mode
+ case "xwreader":
+ return mXwReaderTileProvider.get();
}
// Custom tiles
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tiles/XwReaderTile.java b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tiles/XwReaderTile.java
new file mode 100755 (executable)
index 0000000..1d8608e
--- /dev/null
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/tiles/XwReaderTile.java
@@ -0,0 +1,118 @@
+package com.android.systemui.qs.tiles;\r
+\r
+\r
+import android.content.Intent;\r
+import android.database.ContentObserver;\r
+import android.os.Handler;\r
+import android.provider.Settings;\r
+import android.service.quicksettings.Tile;\r
+\r
+import com.android.internal.logging.nano.MetricsProto;\r
+import com.android.systemui.R;\r
+import com.android.systemui.plugins.qs.QSTile;\r
+import com.android.systemui.qs.QSHost;\r
+import com.android.systemui.qs.tileimpl.QSTileImpl;\r
+\r
+\r
+\r
+import android.view.View;\r
+import androidx.annotation.Nullable;\r
+import android.os.Handler;\r
+\r
+import android.content.BroadcastReceiver;\r
+import com.android.systemui.qs.logging.QSLogger;\r
+import android.os.Looper;\r
+\r
+import com.android.systemui.plugins.ActivityStarter;\r
+import com.android.systemui.plugins.FalsingManager;\r
+import com.android.internal.logging.MetricsLogger;\r
+import com.android.systemui.plugins.statusbar.StatusBarStateController;\r
+import com.android.systemui.broadcast.BroadcastDispatcher;\r
+import com.android.systemui.dagger.qualifiers.Background;\r
+import com.android.systemui.dagger.qualifiers.Main;\r
+\r
+import dagger.Lazy;\r
+import android.net.ConnectivityManager;\r
+import javax.inject.Inject;\r
+import android.util.Log;\r
+\r
+\r
+public class XwReaderTile extends QSTileImpl<QSTile.BooleanState> {\r
+ private static final String TAG = "XwReaderTile";\r
+ private static final String NETWORK_SPEED = "xw_show_network_speed";\r
+ static final int SETTING_VALUE_OFF = 0;\r
+ static final int SETTING_VALUE_ON = 1;\r
+ \r
+ @Inject\r
+ public XwReaderTile(QSHost host,\r
+ @Background Looper backgroundLooper,\r
+ @Main Handler mainHandler,\r
+ FalsingManager falsingManager,\r
+ MetricsLogger metricsLogger,\r
+ StatusBarStateController statusBarStateController,\r
+ ActivityStarter activityStarter,\r
+ QSLogger qsLogger,\r
+ BroadcastDispatcher broadcastDispatcher,\r
+ Lazy<ConnectivityManager> lazyConnectivityManager) {\r
+ super(host, backgroundLooper, mainHandler, falsingManager, metricsLogger,\r
+ statusBarStateController, activityStarter, qsLogger);\r
+ }\r
+\r
+ @Override\r
+ public Intent getLongClickIntent() {\r
+ return new Intent();\r
+ }\r
+\r
+ @Override\r
+ public BooleanState newTileState() {\r
+ return new BooleanState();\r
+ }\r
+\r
+ @Override\r
+ public void handleSetListening(boolean listening) {\r
+ refreshState();\r
+ }\r
+\r
+ @Override\r
+ public CharSequence getTileLabel() {\r
+ return mContext.getString(R.string.xw_reader);\r
+ }\r
+\r
+ @Override\r
+ protected void handleClick(@Nullable View view) {\r
+ boolean isOn = Settings.Secure.getInt(\r
+ mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, SETTING_VALUE_OFF)\r
+ != SETTING_VALUE_OFF;\r
+ if (!isOn) {\r
+ Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,\r
+ SETTING_VALUE_ON);\r
+ Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, 0);\r
+ } else {\r
+ Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,\r
+ SETTING_VALUE_OFF);\r
+ }\r
+ refreshState();\r
+ }\r
+\r
+ @Override\r
+ protected void handleUpdateState(BooleanState state, Object arg) {\r
+\r
+ boolean isOn = Settings.Secure.getInt(\r
+ mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, SETTING_VALUE_OFF)\r
+ != SETTING_VALUE_OFF;\r
+ state.value = isOn ? true : false;\r
+ state.state = state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;\r
+ if(isOn) {\r
+ state.icon = ResourceIcon.get(R.drawable.ic_qs_reader_on);\r
+ } else {\r
+ state.icon = ResourceIcon.get(R.drawable.ic_qs_reader_off);\r
+ }\r
+ state.label = mContext.getString(R.string.xw_reader);\r
+ }\r
+\r
+ @Override\r
+ public int getMetricsCategory() {\r
+ return MetricsProto.MetricsEvent.QS_PANEL;\r
+ }\r
+\r
+}\r
代码分析
添加步骤就是客户提供drawable跟strings,我们在QSFactoryImpl.java中写好接口,在tiles/XXXXXXXXTile.java中实现具体的功能。