Browse Source

App icon and label in toasts

Fix for Lock device action
UI fixes
sense5
Mikanoshi 6 years ago
parent
commit
895469d4e6
12 changed files with 599 additions and 430 deletions
  1. +3
    -3
      OneToolbox/AndroidManifest.xml
  2. +15
    -9
      OneToolbox/TODO.txt
  3. BIN
      OneToolbox/assets/Roboto-Light.ttf
  4. +258
    -244
      OneToolbox/res/values/arrays.xml
  5. +7
    -0
      OneToolbox/res/values/strings.xml
  6. +7
    -0
      OneToolbox/res/xml/preferences.xml
  7. +15
    -15
      OneToolbox/src/com/langerhans/one/AboutScreen.java
  8. +2
    -2
      OneToolbox/src/com/langerhans/one/MainActivity.java
  9. +49
    -18
      OneToolbox/src/com/langerhans/one/PrefsFragment.java
  10. +80
    -1
      OneToolbox/src/com/langerhans/one/mods/SysUIMods.java
  11. +3
    -0
      OneToolbox/src/com/langerhans/one/mods/XMain.java
  12. +160
    -138
      OneToolbox/src/com/langerhans/one/utils/GlobalActions.java

+ 3
- 3
OneToolbox/AndroidManifest.xml View File

@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.langerhans.one"
android:versionCode="36"
android:versionName="2.9.6.1" >
android:versionCode="37"
android:versionName="2.9.7" >
<uses-sdk
android:minSdkVersion="17"
@@ -12,7 +12,7 @@
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:allowBackup="false"
allowSkinChange="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"


+ 15
- 9
OneToolbox/TODO.txt View File

@@ -8,15 +8,11 @@ See Sense 6 Toolbox TODO
Current changelog
=================
2.9.6.1
[Fixed] Translucent horizontal EQS
[Fixed] Some mods compatibility with 4.2.2
2.9.6
[New] Translucent EQS
[New] Translucent horizontal EQS
[New] Remove frames with corners from contact photos
[Fixed] Translucent notifications background and icons scaling
2.9.7
[New] Add application's icon and label to its toasts
[Fixed] Lock device action wasn't locking device with set timeout
[Fixed] Wrong labels for some apps in Toolbox list preferences
[Fixed] Some UI fixes
===========
@@ -42,6 +38,16 @@ http://forum.xda-developers.com/member.php?u=5379502
Old Changelogs
==============
2.9.6.1
[Fixed] Translucent horizontal EQS
[Fixed] Some mods compatibility with 4.2.2
2.9.6
[New] Translucent EQS
[New] Translucent horizontal EQS
[New] Remove frames with corners from contact photos
[Fixed] Translucent notifications background and icons scaling
2.9.5
[New][4.3+] Translucent notifications background
[New] LED notifications during charge (not working on some devices)


BIN
OneToolbox/assets/Roboto-Light.ttf View File


+ 258
- 244
OneToolbox/res/values/arrays.xml View File

@@ -1,73 +1,73 @@
<resources>
<string-array name="availTiles">
<item >0</item>
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
<item >5</item>
<item >6</item>
<item >7</item>
<item >8</item>
<item >9</item>
<item >10</item>
<item >11</item>
<item >12</item>
<item >15</item>
<item >18</item>
<item >19</item>
</string-array>
<string-array name="cam_actions">
<item >@string/array_cam_actions_shutter</item>
<item >@string/array_cam_actions_focus</item>
<item >@string/array_cam_actions_focusshutter</item>
<item >@string/array_cam_actions_video</item>
<item >@string/array_cam_actions_zoom_in</item>
<item >@string/array_cam_actions_zoom_out</item>
<item >@string/array_cam_actions_nothing</item>
</string-array>
<string-array name="cam_actions_val">
<item >1</item>
<item >2</item>
<item >5</item>
<item >3</item>
<item >6</item>
<item >7</item>
<item >4</item>
</string-array>
<string-array name="cleanbeam_battery">
<item >@string/array_default</item>
<item >@string/array_batt_icon_percentage</item>
<item >@string/array_batt_icon_white</item>
<item >@string/array_batt_icon_white_percent</item>
<item >@string/array_batt_icon_circle</item>
<item >@string/array_batt_icon_kitkat</item>
<item >@string/array_batt_icon_kitkat_p</item>
<item >@string/array_batt_icon_none</item>
</string-array>
<string-array name="cleanbeam_battery_val">
<item >1</item>
<item >2</item>
<item >7</item>
<item >8</item>
<item >3</item>
<item >5</item>
<item >6</item>
<item >4</item>
</string-array>
<string-array name="availTiles">
<item >0</item>
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
<item >5</item>
<item >6</item>
<item >7</item>
<item >8</item>
<item >9</item>
<item >10</item>
<item >11</item>
<item >12</item>
<item >15</item>
<item >18</item>
<item >19</item>
</string-array>
<string-array name="cam_actions">
<item >@string/array_cam_actions_shutter</item>
<item >@string/array_cam_actions_focus</item>
<item >@string/array_cam_actions_focusshutter</item>
<item >@string/array_cam_actions_video</item>
<item >@string/array_cam_actions_zoom_in</item>
<item >@string/array_cam_actions_zoom_out</item>
<item >@string/array_cam_actions_nothing</item>
</string-array>
<string-array name="cam_actions_val">
<item >1</item>
<item >2</item>
<item >5</item>
<item >3</item>
<item >6</item>
<item >7</item>
<item >4</item>
</string-array>
<string-array name="cleanbeam_battery">
<item >@string/array_default</item>
<item >@string/array_batt_icon_percentage</item>
<item >@string/array_batt_icon_white</item>
<item >@string/array_batt_icon_white_percent</item>
<item >@string/array_batt_icon_circle</item>
<item >@string/array_batt_icon_kitkat</item>
<item >@string/array_batt_icon_kitkat_p</item>
<item >@string/array_batt_icon_none</item>
</string-array>
<string-array name="cleanbeam_battery_val">
<item >1</item>
<item >2</item>
<item >7</item>
<item >8</item>
<item >3</item>
<item >5</item>
<item >6</item>
<item >4</item>
</string-array>
<string-array name="cleanbeam_wifi">
<item >@string/array_default</item>
<item >@string/array_wifi_icon_style1</item>
<item >@string/array_wifi_icon_style2</item>
</string-array>
<string-array name="cleanbeam_wifi_val">
<item >1</item>
<item >2</item>
<item >3</item>
</string-array>
<array name="cleanbeam_wifi_images">
<item >@string/array_default</item>
<item >@string/array_wifi_icon_style1</item>
<item >@string/array_wifi_icon_style2</item>
</string-array>
<string-array name="cleanbeam_wifi_val">
<item >1</item>
<item >2</item>
<item >3</item>
</string-array>
<array name="cleanbeam_wifi_images">
<item >@drawable/stat_sys_wifi_signal_default</item>
<item >@drawable/stat_sys_wifi_signal_4</item>
<item >@drawable/b_stat_sys_wifi_signal_4</item>
@@ -77,63 +77,63 @@
<item >0</item>
<item >1</item>
</array>
<string-array name="systemui_clockstyle">
<item >@string/array_default</item>
<item >@string/array_clock_style_center</item>
<item >@string/array_clock_style_none</item>
</string-array>
<string-array name="systemui_clockstyle_val">
<item >1</item>
<item >2</item>
<item >3</item>
</string-array>
<string-array name="global_actions">
<item >@string/array_global_actions_none</item>
<item >@string/array_global_actions_notif</item>
<item >@string/array_global_actions_eqs</item>
<item >@string/array_global_actions_lock</item>
<item >@string/array_global_actions_sleep</item>
<item >@string/array_global_actions_screenshot</item>
<item >@string/array_global_actions_launch</item>
<item >@string/array_global_actions_shortcut</item>
<item >@string/array_global_actions_toggle</item>
</string-array>
<string-array name="global_actions_val">
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
<item >5</item>
<item >6</item>
<item >7</item>
<item >12</item>
<item >8</item>
</string-array>
<string-array name="global_toggles">
<item >@string/array_global_toggle_wifi</item>
<item >@string/array_global_toggle_bt</item>
<item >@string/array_global_toggle_gps</item>
<item >@string/array_global_toggle_nfc</item>
<item >@string/array_global_toggle_sound</item>
<item >@string/array_global_toggle_brightness</item>
<item >@string/array_global_toggle_rotation</item>
<item >@string/array_global_toggle_torch</item>
<item >@string/array_global_toggle_mobiledata</item>
</string-array>
<string-array name="global_toggles_val">
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
<item >5</item>
<item >6</item>
<item >7</item>
<item >8</item>
<item >9</item>
</string-array>
<string-array name="systemui_clockstyle">
<item >@string/array_default</item>
<item >@string/array_clock_style_center</item>
<item >@string/array_clock_style_none</item>
</string-array>
<string-array name="systemui_clockstyle_val">
<item >1</item>
<item >2</item>
<item >3</item>
</string-array>
<string-array name="global_actions">
<item >@string/array_global_actions_none</item>
<item >@string/array_global_actions_notif</item>
<item >@string/array_global_actions_eqs</item>
<item >@string/array_global_actions_lock</item>
<item >@string/array_global_actions_sleep</item>
<item >@string/array_global_actions_screenshot</item>
<item >@string/array_global_actions_launch</item>
<item >@string/array_global_actions_shortcut</item>
<item >@string/array_global_actions_toggle</item>
</string-array>
<string-array name="global_actions_val">
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
<item >5</item>
<item >6</item>
<item >7</item>
<item >12</item>
<item >8</item>
</string-array>
<string-array name="global_toggles">
<item >@string/array_global_toggle_wifi</item>
<item >@string/array_global_toggle_bt</item>
<item >@string/array_global_toggle_gps</item>
<item >@string/array_global_toggle_nfc</item>
<item >@string/array_global_toggle_sound</item>
<item >@string/array_global_toggle_brightness</item>
<item >@string/array_global_toggle_rotation</item>
<item >@string/array_global_toggle_torch</item>
<item >@string/array_global_toggle_mobiledata</item>
</string-array>
<string-array name="global_toggles_val">
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
<item >5</item>
<item >6</item>
<item >7</item>
<item >8</item>
<item >9</item>
</string-array>
<array name="battery_images">
<item >@drawable/stat_sys_battery_100</item>
<item >@drawable/b_stat_sys_battery_95</item>
@@ -145,124 +145,138 @@
<item ></item>
</array>
<string-array name="home_menu">
<item >@string/array_home_menu_apps</item>
<item >@string/array_home_menu_personalize</item>
<item >@string/array_home_menu_settings</item>
<item >@string/array_home_menu_wifi</item>
<item >@string/array_home_menu_apm</item>
<item >@string/array_home_menu_draglock</item>
</string-array>
<string-array name="recents_menu">
<item >@string/array_recents_menu_info</item>
<item >@string/array_recents_menu_playstore</item>
<item >@string/array_recents_menu_close</item>
<item >@string/array_recents_menu_closeothers</item>
</string-array>
<string-array name="various_screenon">
<item >@string/array_screen_anim_none</item>
<item >@string/array_screen_anim_fade</item>
</string-array>
<string-array name="various_screenon_val">
<item >0</item>
<item >2</item>
</string-array>
<string-array name="various_screenoff">
<item >@string/array_screen_anim_none</item>
<item >@string/array_screen_anim_fade</item>
<item >@string/array_screen_anim_crt</item>
</string-array>
<string-array name="various_screenoff_val">
<item >0</item>
<item >2</item>
<item >1</item>
</string-array>
<string-array name="theme_colors">
<item >@string/array_color_blue</item>
<item >@string/array_color_green</item>
<item >@string/array_color_red</item>
<item >@string/array_color_orange</item>
<item >@string/array_color_white</item>
</string-array>
<string-array name="theme_colors_val">
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
<item >5</item>
</string-array>
<string-array name="media_action">
<item >@string/array_media_none</item>
<item >@string/array_media_playpause</item>
<item >@string/array_media_next</item>
<item >@string/array_media_prev</item>
</string-array>
<string-array name="media_action_val">
<item >0</item>
<item >85</item>
<item >87</item>
<item >88</item>
</string-array>
<string-array name="various_largephoto">
<item >@string/array_large_photo_default</item>
<item >@string/array_large_photo_rectangular</item>
<item >@string/array_large_photo_max</item>
</string-array>
<string-array name="various_largephoto_val">
<item >1</item>
<item >2</item>
<item >3</item>
</string-array>
<string-array name="systemui_statusheaderclick">
<item >@string/array_global_actions_none</item>
<item >@string/array_header_click_clock</item>
<item >@string/array_header_click_sysinfo</item>
</string-array>
<string-array name="systemui_statusheaderclick_val">
<item >1</item>
<item >2</item>
<item >3</item>
</string-array>
<string-array name="hideicons">
<item >@string/cleanbeam_headphone_title</item>
<item >@string/cleanbeam_beats_title</item>
<item >@string/cleanbeam_alarm_title</item>
<item >@string/cleanbeam_sync_title</item>
<item >@string/cleanbeam_gps_title</item>
<item >@string/cleanbeam_bt_title</item>
<item >@string/cleanbeam_screenshot_title</item>
<item >@string/cleanbeam_usb_title</item>
<item >@string/cleanbeam_powersave_title</item>
<item >@string/cleanbeam_nfc_title</item>
<item >@string/cleanbeam_dnd_title</item>
</string-array>
<string-array name="hideicons_val">
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
<item >5</item>
<item >6</item>
<item >7</item>
<item >8</item>
<item >9</item>
<item >10</item>
<item >11</item>
</string-array>
<string-array name="various_keyslight">
<item >@string/array_default</item>
<item >@string/array_keyslight_dim</item>
<item >@string/array_keyslight_extradim</item>
<item >@string/array_keyslight_alwaysoff</item>
</string-array>
<string-array name="various_keyslight_val">
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
</string-array>
<item >@string/array_home_menu_apps</item>
<item >@string/array_home_menu_personalize</item>
<item >@string/array_home_menu_settings</item>
<item >@string/array_home_menu_wifi</item>
<item >@string/array_home_menu_apm</item>
<item >@string/array_home_menu_draglock</item>
</string-array>
<string-array name="recents_menu">
<item >@string/array_recents_menu_info</item>
<item >@string/array_recents_menu_playstore</item>
<item >@string/array_recents_menu_close</item>
<item >@string/array_recents_menu_closeothers</item>
</string-array>
<string-array name="various_screenon">
<item >@string/array_screen_anim_none</item>
<item >@string/array_screen_anim_fade</item>
</string-array>
<string-array name="various_screenon_val">
<item >0</item>
<item >2</item>
</string-array>
<string-array name="various_screenoff">
<item >@string/array_screen_anim_none</item>
<item >@string/array_screen_anim_fade</item>
<item >@string/array_screen_anim_crt</item>
</string-array>
<string-array name="various_screenoff_val">
<item >0</item>
<item >2</item>
<item >1</item>
</string-array>
<string-array name="theme_colors">
<item >@string/array_color_blue</item>
<item >@string/array_color_green</item>
<item >@string/array_color_red</item>
<item >@string/array_color_orange</item>
<item >@string/array_color_white</item>
</string-array>
<string-array name="theme_colors_val">
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
<item >5</item>
</string-array>
<string-array name="media_action">
<item >@string/array_media_none</item>
<item >@string/array_media_playpause</item>
<item >@string/array_media_next</item>
<item >@string/array_media_prev</item>
</string-array>
<string-array name="media_action_val">
<item >0</item>
<item >85</item>
<item >87</item>
<item >88</item>
</string-array>
<string-array name="various_largephoto">
<item >@string/array_large_photo_default</item>
<item >@string/array_large_photo_rectangular</item>
<item >@string/array_large_photo_max</item>
</string-array>
<string-array name="various_largephoto_val">
<item >1</item>
<item >2</item>
<item >3</item>
</string-array>
<string-array name="systemui_statusheaderclick">
<item >@string/array_global_actions_none</item>
<item >@string/array_header_click_clock</item>
<item >@string/array_header_click_sysinfo</item>
</string-array>
<string-array name="systemui_statusheaderclick_val">
<item >1</item>
<item >2</item>
<item >3</item>
</string-array>
<string-array name="hideicons">
<item >@string/cleanbeam_headphone_title</item>
<item >@string/cleanbeam_beats_title</item>
<item >@string/cleanbeam_alarm_title</item>
<item >@string/cleanbeam_sync_title</item>
<item >@string/cleanbeam_gps_title</item>
<item >@string/cleanbeam_bt_title</item>
<item >@string/cleanbeam_screenshot_title</item>
<item >@string/cleanbeam_usb_title</item>
<item >@string/cleanbeam_powersave_title</item>
<item >@string/cleanbeam_nfc_title</item>
<item >@string/cleanbeam_dnd_title</item>
</string-array>
<string-array name="hideicons_val">
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
<item >5</item>
<item >6</item>
<item >7</item>
<item >8</item>
<item >9</item>
<item >10</item>
<item >11</item>
</string-array>
<string-array name="various_keyslight">
<item >@string/array_default</item>
<item >@string/array_keyslight_dim</item>
<item >@string/array_keyslight_extradim</item>
<item >@string/array_keyslight_alwaysoff</item>
</string-array>
<string-array name="various_keyslight_val">
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
</string-array>
<string-array name="various_iconlabletoasts">
<item >@string/array_default</item>
<item >@string/array_toasts_icon</item>
<item >@string/array_toasts_label</item>
<item >@string/array_toasts_both</item>
</string-array>
<string-array name="various_iconlabletoasts_val">
<item >1</item>
<item >2</item>
<item >3</item>
<item >4</item>
</string-array>
</resources>

+ 7
- 0
OneToolbox/res/values/strings.xml View File

@@ -23,6 +23,8 @@
<string name="storage_cannot_restore">No settings backup found</string>
<string name="backup_ok">Settings were backed up successfully!</string>
<string name="restore_ok">Settings were successfully restored!</string>
<string name="no_root_summ">Root is required for this mod to work</string>
<string name="no_busybox_summ">BusyBox is required for this mod to work</string>
<string name="warning">Warning!</string>
<string name="xposed_not_installed">Xposed Framework is not properly installed, you must install app_process and XposedBridge.jar from Xposed Installer, then activate Sense 5 Toolbox module there and reboot.</string>
@@ -356,6 +358,8 @@
<string name="various_contactsnocorner_summ">Remove a frame with bottom right corner from contacts\' photos.</string>
<string name="various_oldtoasts_title">Jelly Bean styled toasts</string>
<string name="various_oldtoasts_summ">Bring back JB toast design on Android 4.4.</string>
<string name="various_iconlabletoasts_title">Enhanced toasts</string>
<string name="various_iconlabletoasts_summ">Add application\'s icon and label to its toasts.</string>
<string name="various_securelock_title">Enhanced screen lock</string>
<string name="various_securelock_summ">Disable power menu and hardware reset notification while screen lock is active.</string>
<string name="various_keyslight_title">Hardware buttons backlight</string>
@@ -516,5 +520,8 @@
<string name="array_keyslight_dim">Dim</string>
<string name="array_keyslight_extradim">Extra dim</string>
<string name="array_keyslight_alwaysoff">Always off</string>
<string name="array_toasts_icon">Icon</string>
<string name="array_toasts_label">Label</string>
<string name="array_toasts_both">Icon and label</string>
</resources>

+ 7
- 0
OneToolbox/res/xml/preferences.xml View File

@@ -697,6 +697,13 @@
android:summary="@string/various_oldtoasts_summ"
android:title="@string/various_oldtoasts_title"
android:defaultValue="false" />
<com.htc.preference.HtcListPreference
android:key="pref_key_other_iconlabletoasts"
android:summary="@string/various_iconlabletoasts_summ"
android:title="@string/various_iconlabletoasts_title"
android:entries="@array/various_iconlabletoasts"
android:entryValues="@array/various_iconlabletoasts_val"
android:defaultValue="1"/>
<com.htc.preference.HtcCheckBoxPreference
android:key="pref_key_other_securelock"
android:summary="@string/various_securelock_summ"


+ 15
- 15
OneToolbox/src/com/langerhans/one/AboutScreen.java View File

@@ -22,8 +22,8 @@ public class AboutScreen extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.about_screen);
Typeface face = Typeface.createFromAsset(getAssets(), "Roboto-Light.ttf");
Typeface face = Typeface.create("sans-serif-condensed", Typeface.NORMAL);
TextView iv2 = (TextView)findViewById(R.id.textView2);
iv2.setPaintFlags(iv2.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
iv2.setTypeface(face);
@@ -52,13 +52,13 @@ public class AboutScreen extends Activity {
iv5.setText(Helpers.l10n(this, R.string.about_l10n_data_right));
ActionBarExt actionBarExt = new ActionBarExt(this, getActionBar());
ActionBarContainer actionBarContainer = actionBarExt.getCustomContainer();
ActionBarText actionBarText = new ActionBarText(this);
actionBarText.setPrimaryText(Helpers.l10n(this, R.string.app_about));
actionBarContainer.addCenterView(actionBarText);
ActionBarContainer actionBarContainer = actionBarExt.getCustomContainer();
ActionBarText actionBarText = new ActionBarText(this);
actionBarText.setPrimaryText(Helpers.l10n(this, R.string.app_about));
actionBarContainer.addCenterView(actionBarText);
actionBarContainer.setBackUpEnabled(true);
View homeBtn = actionBarContainer.getChildAt(0);
View homeBtn = actionBarContainer.getChildAt(0);
if (homeBtn != null) {
View.OnClickListener goBackFromEQS = new View.OnClickListener() {
@Override
@@ -70,18 +70,18 @@ public class AboutScreen extends Activity {
}
//Add version name
try {
TextView versionTv = (TextView)findViewById(R.id.textViewVersion);
try {
TextView versionTv = (TextView)findViewById(R.id.textViewVersion);
versionTv.setText(String.format(Helpers.l10n(this, R.string.about_version), getPackageManager().getPackageInfo(getPackageName(), 0).versionName, Helpers.buildVersion));
versionTv.setTypeface(face);
versionTv.setPaintFlags(iv02.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
OnLongClickListener olcl = new OnLongClickListener(){
public boolean onLongClick(View v) {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.StartEasterEgg");
sendBroadcast(intent);
return true;
}
public boolean onLongClick(View v) {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.StartEasterEgg");
sendBroadcast(intent);
return true;
}
};
versionTv.setLongClickable(true);
versionTv.setOnLongClickListener(olcl);


+ 2
- 2
OneToolbox/src/com/langerhans/one/MainActivity.java View File

@@ -25,7 +25,7 @@ public class MainActivity extends HtcPreferenceActivity {
ActionBarExt actionBarExt = new ActionBarExt(this, getActionBar());
ActionBarContainer actionBarContainer = actionBarExt.getCustomContainer();
ActionBarText actionBarText = new ActionBarText(this);
ActionBarText actionBarText = new ActionBarText(this);
actionBarText.setPrimaryText(Helpers.l10n(this, R.string.app_name));
actionBarContainer.addCenterView(actionBarText);
actionBarContainer.setBackUpEnabled(false);
@@ -52,7 +52,7 @@ public class MainActivity extends HtcPreferenceActivity {
}
}
getFragmentManager().beginTransaction().replace(android.R.id.content, new PrefsFragment()).commit();
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Helpers.processResult(this, requestCode, resultCode, data);


+ 49
- 18
OneToolbox/src/com/langerhans/one/PrefsFragment.java View File

@@ -24,6 +24,7 @@ import java.util.Set;
import android.app.ActionBar;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -118,27 +119,33 @@ public class PrefsFragment extends HtcPreferenceFragment {
showRestoreInfoDialog();
}
if ((new Version(senseVer)).compareTo(new Version("5.5")) >= 0) {
if ((new Version(senseVer)).compareTo(new Version("5.5")) >= 0) {
if (findPreference("pref_key_eqs") != null) getPreferenceScreen().removePreference(findPreference("pref_key_eqs"));
if (findPreference("pref_key_prism_bfremove") != null) ((HtcPreferenceCategory) findPreference("pref_key_sense_homescreen")).removePreference(findPreference("pref_key_prism_bfremove"));
if (findPreference("pref_key_prism_infiniscroll") != null) ((HtcPreferenceCategory) findPreference("pref_key_sense_homescreen")).removePreference(findPreference("pref_key_prism_infiniscroll"));
removePrefFromCat(this, "pref_key_prism_bfremove", "pref_key_sense_homescreen");
removePrefFromCat(this, "pref_key_prism_infiniscroll", "pref_key_sense_homescreen");
} else {
if (findPreference("pref_key_eqs") != null && (MainActivity.isRootAccessGiven == false)) findPreference("pref_key_eqs").setEnabled(false);
if (findPreference("pref_key_persist_bypasslock") != null) ((HtcPreferenceScreen) findPreference("pref_key_persist")).removePreference(findPreference("pref_key_persist_bypasslock"));
if (MainActivity.isRootAccessGiven == false) disablePref(this, "pref_key_eqs", R.string.no_root_summ);;
removePrefFromScr(this, "pref_key_persist_bypasslock", "pref_key_persist");
}
if (Build.VERSION.SDK_INT < 19) {
if (findPreference("pref_key_other_oldtoasts") != null) ((HtcPreferenceScreen) findPreference("pref_key_other")).removePreference(findPreference("pref_key_other_oldtoasts"));
removePrefFromScr(this, "pref_key_other_oldtoasts", "pref_key_other");
}
if (Build.VERSION.SDK_INT < 18) {
if (findPreference("pref_key_sysui_tnsb") != null) ((HtcPreferenceScreen) findPreference("pref_key_sysui")).removePreference(findPreference("pref_key_sysui_tnsb"));
if (findPreference("pref_key_sysui_hqthumbs") != null) ((HtcPreferenceScreen) findPreference("pref_key_sysui")).removePreference(findPreference("pref_key_sysui_hqthumbs"));
removePrefFromScr(this, "pref_key_sysui_tnsb", "pref_key_sysui");
removePrefFromScr(this, "pref_key_sysui_hqthumbs", "pref_key_sysui");
}
if (Helpers.isNotM7()) {
if (findPreference("pref_key_other_keyslight") != null) ((HtcPreferenceScreen) findPreference("pref_key_other")).removePreference(findPreference("pref_key_other_keyslight"));
if (findPreference("pref_key_other_keyslight_auto") != null) ((HtcPreferenceScreen) findPreference("pref_key_other")).removePreference(findPreference("pref_key_other_keyslight_auto"));
removePrefFromScr(this, "pref_key_other_keyslight", "pref_key_other");
removePrefFromScr(this, "pref_key_other_keyslight_auto", "pref_key_other");
} else if (!RootTools.isRootAvailable()) {
disablePref(this, "pref_key_other_keyslight", R.string.no_root_summ);
disablePref(this, "pref_key_other_keyslight_auto", R.string.no_root_summ);
} else if (!RootTools.isBusyboxAvailable()) {
disablePref(this, "pref_key_other_keyslight", R.string.no_busybox_summ);
disablePref(this, "pref_key_other_keyslight_auto", R.string.no_busybox_summ);
}
//Add version name to support title
@@ -446,6 +453,11 @@ public class PrefsFragment extends HtcPreferenceFragment {
}
});
if (!RootTools.isRootAvailable())
disablePref(this, "pref_key_controls_vol2wake", R.string.no_root_summ);
else if (!RootTools.isBusyboxAvailable())
disablePref(this, "pref_key_controls_vol2wake", R.string.no_busybox_summ);
HtcCheckBoxPreference.OnPreferenceClickListener openLang = new HtcCheckBoxPreference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(HtcPreference preference) {
@@ -507,6 +519,24 @@ public class PrefsFragment extends HtcPreferenceFragment {
toolboxLanguagePreference.setOnPreferenceClickListener(openLang);
}
private static void removePrefFromCat(HtcPreferenceFragment frag, String prefName, String catName) {
if (frag.findPreference(prefName) != null)
((HtcPreferenceCategory) frag.findPreference(catName)).removePreference(frag.findPreference(prefName));
}
private static void removePrefFromScr(HtcPreferenceFragment frag, String prefName, String scrName) {
if (frag.findPreference(prefName) != null)
((HtcPreferenceScreen) frag.findPreference(scrName)).removePreference(frag.findPreference(prefName));
}
private static void disablePref(HtcPreferenceFragment frag, String prefName, int reasonText) {
HtcPreference pref = frag.findPreference(prefName);
if (pref != null) {
pref.setEnabled(false);
pref.setSummary(reasonText);
}
}
static boolean isWaitingForCmd = false;
static boolean setButtonBacklightTo(final int pref_keyslight, final boolean applyNoMatterWhat) {
if (applyNoMatterWhat) isWaitingForCmd = false;
@@ -687,17 +717,18 @@ public class PrefsFragment extends HtcPreferenceFragment {
String[] pkgActArray = pkgActName.split("\\|");
ApplicationInfo ai = null;
if (pkgActArray.length >= 1)
if (!pkgActArray[0].trim().equals(""))
if (pkgActName.equals(not_selected))
ai = null;
else try {
ai = pm.getApplicationInfo(pkgActArray[0], 0);
if (!pkgActName.equals(not_selected))
if (pkgActArray.length >= 1 && pkgActArray[0] != null) try {
if (pkgActArray.length >= 2 && pkgActArray[1] != null && !pkgActArray[1].trim().equals("")) {
return pm.getActivityInfo(new ComponentName(pkgActArray[0], pkgActArray[1]), 0).loadLabel(pm).toString();
} else if (!pkgActArray[0].trim().equals("")) {
ai = pm.getApplicationInfo(pkgActArray[0], 0);
return (ai != null ? pm.getApplicationLabel(ai) : not_selected);
}
} catch (Exception e) {
e.printStackTrace();
ai = null;
}
return (ai != null ? pm.getApplicationLabel(ai) : not_selected);
return not_selected;
}
@Override


+ 80
- 1
OneToolbox/src/com/langerhans/one/mods/SysUIMods.java View File

@@ -82,6 +82,7 @@ import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.ImageView.ScaleType;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
@@ -1827,7 +1828,7 @@ public class SysUIMods {
nView.invalidate();
}
if (sbn != null && name.contains("icon")) {
if (sbn != null && name.contains("icon") && nView.getClass() == ImageView.class) {
ImageView icon = (ImageView)nView;
Context ctx = icon.getContext();
icon.setBackground(null);
@@ -1895,4 +1896,82 @@ public class SysUIMods {
}
});
}
private static ImageView createIcon(Context ctx, int baseSize) {
float density = ctx.getResources().getDisplayMetrics().density;
ImageView iv = new ImageView(ctx);
try {
iv.setImageDrawable(ctx.getPackageManager().getApplicationIcon(ctx.getPackageName()));
} catch (Throwable t) {
XposedBridge.log(t);
}
iv.setScaleType(ScaleType.CENTER_INSIDE);
int size = Math.round(baseSize * density);
LinearLayout.LayoutParams lpi = new LinearLayout.LayoutParams(size, size);
if (baseSize > 30)
lpi.setMargins(0, Math.round(1 * density), Math.round(8 * density), 0);
else
lpi.setMargins(0, 0, Math.round(8 * density), 0);
lpi.gravity = Gravity.CENTER;
iv.setLayoutParams(lpi);
return iv;
}
private static TextView createLabel(Context ctx, TextView toastText) {
TextView tv = new TextView(ctx);
tv.setText(ctx.getApplicationInfo().loadLabel(ctx.getPackageManager()) + ":");
tv.setTextColor(Color.WHITE);
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, toastText.getTextSize());
tv.setTypeface(toastText.getTypeface());
tv.setAlpha(0.6f);
return tv;
}
public static void execHook_IconLabelToasts() {
XResources.hookSystemWideLayout("android", "layout", "transient_notification", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
XMain.pref.reload();
int option = Integer.parseInt(XMain.pref.getString("pref_key_other_iconlabletoasts", "1"));
if (option == 1) return;
Context ctx = liparam.view.getContext();
float density = ctx.getResources().getDisplayMetrics().density;
TextView toastText = (TextView)liparam.view.findViewById(android.R.id.message);
LinearLayout.LayoutParams lpt = (LinearLayout.LayoutParams)toastText.getLayoutParams();
lpt.gravity = Gravity.CENTER;
LinearLayout toast = ((LinearLayout)liparam.view);
toast.setGravity(Gravity.CENTER);
toast.setPadding(toast.getPaddingLeft() - Math.round(5 * density), toast.getPaddingTop(), toast.getPaddingRight(), toast.getPaddingBottom());
switch (option) {
case 2:
ImageView iv = createIcon(ctx, 30);
toast.setOrientation(LinearLayout.HORIZONTAL);
toast.addView(iv, 0);
break;
case 3:
TextView tv = createLabel(ctx, toastText);
toast.setOrientation(LinearLayout.VERTICAL);
toast.addView(tv, 0);
break;
case 4:
LinearLayout textLabel = new LinearLayout(ctx);
textLabel.setOrientation(LinearLayout.VERTICAL);
ImageView iv2 = createIcon(ctx, 45);
TextView tv2 = createLabel(ctx, toastText);
((LinearLayout)toastText.getParent()).removeAllViews();
textLabel.addView(tv2);
textLabel.addView(toastText);
toast.setOrientation(LinearLayout.HORIZONTAL);
toast.addView(iv2);
toast.addView(textLabel);
break;
}
}
});
}
}

+ 3
- 0
OneToolbox/src/com/langerhans/one/mods/XMain.java View File

@@ -100,6 +100,9 @@ public class XMain implements IXposedHookInitPackageResources, IXposedHookZygote
if (pref.getBoolean("pref_key_other_contactsnocorner", false))
OtherMods.execHook_ContactsNoCornerSystem();
if (Integer.parseInt(pref.getString("pref_key_other_iconlabletoasts", "1")) != 1)
SysUIMods.execHook_IconLabelToasts();
GlobalActions.easterEgg();
}



+ 160
- 138
OneToolbox/src/com/langerhans/one/utils/GlobalActions.java View File

@@ -52,9 +52,22 @@ import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
public class GlobalActions {
public static Object mPWM = null;
public static Object mDMS = null;
//public static Handler mHandler = null;
private static int mCurrentLEDLevel = 0;
private static BroadcastReceiver mBRLock = new BroadcastReceiver() {
public void onReceive(final Context context, Intent intent) {
try {
String action = intent.getAction();
if (action.equals("com.sensetoolbox.six.mods.action.LockDevice"))
if (mDMS != null) XposedHelpers.callMethod(mDMS, "lockNowUnchecked");
} catch (Throwable t) {
XposedBridge.log(t);
}
}
};
private static BroadcastReceiver mBR = new BroadcastReceiver() {
public void onReceive(final Context context, Intent intent)
{
@@ -65,9 +78,6 @@ public class GlobalActions {
if (action.equals("com.langerhans.one.mods.action.GoToSleep")) {
((PowerManager)context.getSystemService(Context.POWER_SERVICE)).goToSleep(SystemClock.uptimeMillis());
}
if (action.equals("com.langerhans.one.mods.action.LockDevice")) {
if (mPWM != null) XposedHelpers.callMethod(mPWM, "lockNow", new Object[]{ null });
}
if (action.equals("com.langerhans.one.mods.action.TakeScreenshot")) {
if (mPWM != null) XposedHelpers.callMethod(mPWM, "takeScreenshot");
}
@@ -87,12 +97,12 @@ public class GlobalActions {
}
if (action.equals("com.langerhans.one.mods.action.SimulateMenu")) {
new Thread(new Runnable() {
public void run() {
Instrumentation inst = new Instrumentation();
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_MENU);
}
}).start();
new Thread(new Runnable() {
public void run() {
Instrumentation inst = new Instrumentation();
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_MENU);
}
}).start();
}
if (action.equals("com.langerhans.one.mods.action.OpenRecents")) {
@@ -113,7 +123,7 @@ public class GlobalActions {
}
}
if (action.equals("com.langerhans.one.mods.action.ToggleBluetooth")) {
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter.isEnabled()) {
mBluetoothAdapter.disable();
Toast.makeText(context, Helpers.xl10n(modRes, R.string.toggle_bt_off), Toast.LENGTH_SHORT).show();
@@ -290,7 +300,7 @@ public class GlobalActions {
} else if (isAllowed) {
// Removes from recents also
removeTask.invoke(am, Integer.valueOf(taskInfo.get(0).id), Integer.valueOf(1));
// Force closes all package parts
// Force closes all package parts
forceStopPackage.invoke(am, thisPkg);
}
@@ -300,7 +310,7 @@ public class GlobalActions {
Method getFunc = clsSP.getDeclaredMethod("get", String.class);
String haptic = (String)getFunc.invoke(null, "sys.psaver.haptic");
if (haptic.equals("false")) {
if (haptic.equals("false")) {
Vibrator vibe = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
vibe.vibrate(30);
}
@@ -320,7 +330,7 @@ public class GlobalActions {
newSet = String.format("%s,%s", beforeEnable, LocationManager.GPS_PROVIDER);
try {
Settings.Secure.putString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, newSet);
Settings.Secure.putString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, newSet);
} catch(Throwable t) {
XposedBridge.log(t);
}
@@ -332,7 +342,7 @@ public class GlobalActions {
String str = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
if (str == null)
str = "";
else {
else {
String[] list = str.split (",");
str = "";
@@ -387,9 +397,9 @@ public class GlobalActions {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Context mPWMContext = (Context)XposedHelpers.getObjectField(param.thisObject, "mContext");
IntentFilter intentfilter = new IntentFilter();
intentfilter.addAction("com.langerhans.one.mods.action.StartEasterEgg");
mPWMContext.registerReceiver(mBREgg, intentfilter);
IntentFilter intentfilter = new IntentFilter();
intentfilter.addAction("com.langerhans.one.mods.action.StartEasterEgg");
mPWMContext.registerReceiver(mBREgg, intentfilter);
}
});
} catch (Throwable t) {
@@ -406,34 +416,46 @@ public class GlobalActions {
mPWM = param.thisObject;
//mHandler = (Handler)XposedHelpers.getObjectField(param.thisObject, "mHandler");
Context mPWMContext = (Context)XposedHelpers.getObjectField(param.thisObject, "mContext");
IntentFilter intentfilter = new IntentFilter();
// Actions
intentfilter.addAction("com.langerhans.one.mods.action.GoToSleep");
intentfilter.addAction("com.langerhans.one.mods.action.LockDevice");
intentfilter.addAction("com.langerhans.one.mods.action.TakeScreenshot");
intentfilter.addAction("com.langerhans.one.mods.action.killForegroundApp");
//intentfilter.addAction("com.langerhans.one.mods.action.killForegroundAppShedule");
intentfilter.addAction("com.langerhans.one.mods.action.SimulateMenu");
intentfilter.addAction("com.langerhans.one.mods.action.OpenRecents");
// Toggles
intentfilter.addAction("com.langerhans.one.mods.action.ToggleWiFi");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleBluetooth");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleGPS");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleNFC");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleSoundProfile");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleAutoBrightness");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleAutoRotation");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleFlashlight");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleMobileData");
//APM
intentfilter.addAction("com.langerhans.one.mods.action.APMReboot");
intentfilter.addAction("com.langerhans.one.mods.action.APMRebootRecovery");
intentfilter.addAction("com.langerhans.one.mods.action.APMRebootBootloader");
mPWMContext.registerReceiver(mBR, intentfilter);
IntentFilter intentfilter = new IntentFilter();
// Actions
intentfilter.addAction("com.langerhans.one.mods.action.GoToSleep");
intentfilter.addAction("com.langerhans.one.mods.action.LockDevice");
intentfilter.addAction("com.langerhans.one.mods.action.TakeScreenshot");
intentfilter.addAction("com.langerhans.one.mods.action.killForegroundApp");
//intentfilter.addAction("com.langerhans.one.mods.action.killForegroundAppShedule");
intentfilter.addAction("com.langerhans.one.mods.action.SimulateMenu");
intentfilter.addAction("com.langerhans.one.mods.action.OpenRecents");
// Toggles
intentfilter.addAction("com.langerhans.one.mods.action.ToggleWiFi");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleBluetooth");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleGPS");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleNFC");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleSoundProfile");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleAutoBrightness");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleAutoRotation");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleFlashlight");
intentfilter.addAction("com.langerhans.one.mods.action.ToggleMobileData");
//APM
intentfilter.addAction("com.langerhans.one.mods.action.APMReboot");
intentfilter.addAction("com.langerhans.one.mods.action.APMRebootRecovery");
intentfilter.addAction("com.langerhans.one.mods.action.APMRebootBootloader");
mPWMContext.registerReceiver(mBR, intentfilter);
}
});
final Class<?> clsDMS = findClass("com.android.server.DevicePolicyManagerService", null);
XposedBridge.hookAllConstructors(clsDMS, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
mDMS = param.thisObject;
Context mDMSContext = (Context)XposedHelpers.getObjectField(param.thisObject, "mContext");
IntentFilter intentfilter = new IntentFilter();
intentfilter.addAction("com.sensetoolbox.six.mods.action.LockDevice");
mDMSContext.registerReceiver(mBRLock, intentfilter);
}
});
} catch (Throwable t) {
@@ -480,9 +502,9 @@ public class GlobalActions {
public static boolean lockDevice(Context context) {
try {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.LockDevice");
context.sendBroadcast(intent);
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.LockDevice");
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
@@ -491,15 +513,15 @@ public class GlobalActions {
}
public static boolean goToSleep(Context context) {
try {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.GoToSleep");
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
try {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.GoToSleep");
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
}
public static boolean launchApp(Context context, int action) {
@@ -559,76 +581,76 @@ public class GlobalActions {
}
public static boolean takeScreenshot(Context context) {
try {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.TakeScreenshot");
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
try {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.TakeScreenshot");
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
}
public static boolean killForegroundApp(Context context) {
try {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.killForegroundApp");
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
try {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.killForegroundApp");
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
}
public static boolean simulateMenu(Context context) {
try {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.SimulateMenu");
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
try {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.SimulateMenu");
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
}
public static boolean openRecents(Context context) {
try {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.OpenRecents");
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
try {
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.OpenRecents");
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
}
public static boolean toggleThis(Context context, int what) {
try {
String whatStr = "WiFi";
switch (what) {
case 1: whatStr = "WiFi"; break;
case 2: whatStr = "Bluetooth"; break;
case 3: whatStr = "GPS"; break;
case 4: whatStr = "NFC"; break;
case 5: whatStr = "SoundProfile"; break;
case 6: whatStr = "AutoBrightness"; break;
case 7: whatStr = "AutoRotation"; break;
case 8: whatStr = "Flashlight"; break;
case 9: whatStr = "MobileData"; break;
default: return false;
}
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.Toggle" + whatStr);
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
try {
String whatStr = "WiFi";
switch (what) {
case 1: whatStr = "WiFi"; break;
case 2: whatStr = "Bluetooth"; break;
case 3: whatStr = "GPS"; break;
case 4: whatStr = "NFC"; break;
case 5: whatStr = "SoundProfile"; break;
case 6: whatStr = "AutoBrightness"; break;
case 7: whatStr = "AutoRotation"; break;
case 8: whatStr = "Flashlight"; break;
case 9: whatStr = "MobileData"; break;
default: return false;
}
Intent intent = new Intent();
intent.setAction("com.langerhans.one.mods.action.Toggle" + whatStr);
context.sendBroadcast(intent);
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
}
public static ColorFilter createColorFilter(boolean fromModule) {
@@ -646,7 +668,7 @@ public class GlobalActions {
if (PrefsFragment.prefs != null) {
brightness = PrefsFragment.prefs.getInt("pref_key_colorfilter_brightValue", 100) - 100;
saturation = PrefsFragment.prefs.getInt("pref_key_colorfilter_satValue", 100) - 100;
hue = PrefsFragment.prefs.getInt("pref_key_colorfilter_hueValue", 180) - 180;
hue = PrefsFragment.prefs.getInt("pref_key_colorfilter_hueValue", 180) - 180;
}
}
@@ -661,23 +683,23 @@ public class GlobalActions {
public static void sendMediaButton(KeyEvent keyEvent)
{
try {
// Get binder from ServiceManager.checkService(String)
IBinder iBinder = (IBinder) Class.forName("android.os.ServiceManager")
.getDeclaredMethod("checkService", String.class)
.invoke(null, Context.AUDIO_SERVICE);
// Get binder from ServiceManager.checkService(String)
IBinder iBinder = (IBinder) Class.forName("android.os.ServiceManager")
.getDeclaredMethod("checkService", String.class)
.invoke(null, Context.AUDIO_SERVICE);
// get audioService from IAudioService.Stub.asInterface(IBinder)
Object audioService = Class.forName("android.media.IAudioService$Stub")
.getDeclaredMethod("asInterface", IBinder.class)
.invoke(null, iBinder);
// get audioService from IAudioService.Stub.asInterface(IBinder)
Object audioService = Class.forName("android.media.IAudioService$Stub")
.getDeclaredMethod("asInterface", IBinder.class)
.invoke(null, iBinder);
// Dispatch keyEvent using IAudioService.dispatchMediaKeyEvent(KeyEvent)
Class.forName("android.media.IAudioService")
.getDeclaredMethod("dispatchMediaKeyEvent", KeyEvent.class)
.invoke(audioService, keyEvent);
} catch (Throwable t) {
XposedBridge.log(t);
}
// Dispatch keyEvent using IAudioService.dispatchMediaKeyEvent(KeyEvent)
Class.forName("android.media.IAudioService")
.getDeclaredMethod("dispatchMediaKeyEvent", KeyEvent.class)
.invoke(audioService, keyEvent);
} catch (Throwable t) {
XposedBridge.log(t);
}
}
public static void buttonBacklight(){
@@ -687,8 +709,8 @@ public class GlobalActions {
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Context mContext = (Context)XposedHelpers.getObjectField(param.thisObject, "mContext");
Intent intent = new Intent();
intent.setAction("com.langerhans.one.UPDATEBACKLIGHT");
intent.setAction("com.langerhans.one.UPDATEBACKLIGHT");
int sysUiVis = (Integer)param.args[0];
if (sysUiVis == 67108864 || sysUiVis == 0) return;
//XposedBridge.log("statusBarVisibilityChanged: " + String.valueOf(sysUiVis));
@@ -714,9 +736,9 @@ public class GlobalActions {
int newFlags = mWindowAttributes.flags & ~j | i & j;
if (newFlags != 0 &&
(newFlags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != WindowManager.LayoutParams.FLAG_FULLSCREEN &&
(newFlags & WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN) == WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN &&
(newFlags & WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR) == WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR) {
(newFlags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != WindowManager.LayoutParams.FLAG_FULLSCREEN &&
(newFlags & WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN) == WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN &&
(newFlags & WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR) == WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR) {
//XposedBridge.log("setFlags FLAG_LAYOUT_*: " + String.valueOf(newFlags));
Context mContext = (Context)XposedHelpers.getObjectField(param.thisObject, "mContext");
Intent intent = new Intent();
@@ -735,8 +757,8 @@ public class GlobalActions {
int newFlags = act.getWindow().getAttributes().flags;
//XposedBridge.log("onResume flags: " + String.valueOf(newFlags));
Intent intent = new Intent();
intent.setAction("com.langerhans.one.UPDATEBACKLIGHT");
if (newFlags != 0 && (newFlags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN && !act.getPackageName().equals("com.android.systemui"))
intent.setAction("com.langerhans.one.UPDATEBACKLIGHT");
if (newFlags != 0 && (newFlags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN && !act.getPackageName().equals("com.android.systemui"))
intent.putExtra("forceDisableBacklight", true);
act.sendBroadcast(intent);
}


Loading…
Cancel
Save