Skip to content

Commit

Permalink
feat: font size of network speed
Browse files Browse the repository at this point in the history
  • Loading branch information
MonwF committed Jan 1, 2023
1 parent 0cdb2d9 commit 1455a66
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ public void handleLoadPackage(final LoadPackageParam lpparam) {
if (mPrefs.getBoolean("system_nodrawerbackground")) System.RemoveDrawerBackgroundHook(lpparam);
if (mPrefs.getBoolean("system_nonetspeedseparator")) System.NoNetworkSpeedSeparatorHook(lpparam);
if (mPrefs.getBoolean("system_detailednetspeed_secunit") && !mPrefs.getBoolean("system_detailednetspeed")) System.HideNetworkSpeedUnitHook(lpparam);
if (mPrefs.getInt("system_netspeed_fontsize", 17) > 17 && !mPrefs.getBoolean("system_detailednetspeed")) System.NetSpeedFontHook(lpparam);
if (mPrefs.getBoolean("system_snoozedmanager")) System.MoreSnoozeOptionsHook(lpparam);
if (mPrefs.getBoolean("system_taptounlock")) System.TapToUnlockHook(lpparam);
if (mPrefs.getBoolean("system_nosos")) System.NoSOSHook(lpparam);
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/name/mikanoshi/customiuizer/mods/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -6365,6 +6365,20 @@ protected void after(MethodHookParam param) throws Throwable {
});
}

public static void NetSpeedFontHook(LoadPackageParam lpparam) {
Helpers.hookAllConstructors("com.android.systemui.statusbar.views.NetworkSpeedView", lpparam.classLoader, new MethodHook() {
@Override
protected void after(MethodHookParam param) throws Throwable {
TextView meter = (TextView)param.thisObject;
if (meter == null) return;
if (meter.getTag() == null || !"slot_text_icon".equals(meter.getTag())) {
int fontSize = MainModule.mPrefs.getInt("system_netspeed_fontsize", 17);
meter.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize * 0.5f);
}
}
});
}

public static void ToastTimeHook(LoadPackageParam lpparam) {
Helpers.findAndHookMethod("com.android.server.notification.NotificationManagerService", lpparam.classLoader, "showNextToastLocked", new MethodHook() {
@Override
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@
<string name="system_detailednetspeed_lowlevel_summ">网速值低于该水平时将被认为慢,并会显示不同的指示器图标</string>
<string name="system_detailednetspeed_zero_title">不活动时降低可见性</string>
<string name="system_detailednetspeed_zero_summ">速值均为0时指示器透明</string>
<string name="system_detailednetspeed_secunit_title">隐藏 B/s 单位</string>
<string name="system_detailednetspeed_secunit_title">网速隐藏 B/s 单位</string>
<string name="system_netspeed_fontsize_title">网速字体大小</string>
<string name="system_statusbarcontrols_title">手势控制</string>
<string name="system_statusbarcontrols_summ">滑动双击时执行所选动作</string>
<string name="system_statusbarcontrols_sens_title">调整灵敏度</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
<string name="system_detailednetspeed_zero_title">Reduce visibility when inactive</string>
<string name="system_detailednetspeed_zero_summ">Make indicator semitransparent when both speeds are zero</string>
<string name="system_detailednetspeed_secunit_title">Hide Byte per second suffix(B/s)</string>
<string name="system_netspeed_fontsize_title">Network speed\'s font size</string>
<string name="system_statusbarcontrols_title">Gesture controls</string>
<string name="system_statusbarcontrols_summ">Perform selected actions on slide and double tap</string>
<string name="system_statusbarcontrols_sens_title">Adjustment sensitivity</string>
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/xml/prefs_system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,17 @@
miuizer:stepValue="1"
miuizer:format="@string/format_d_s" />

<name.mikanoshi.customiuizer.prefs.SeekBarPreference
android:key="pref_key_system_netspeed_fontsize"
android:title="@string/system_netspeed_fontsize_title"
android:defaultValue="17"
miuizer:minValue="17"
miuizer:maxValue="30"
miuizer:stepValue="1"
miuizer:offtext="@string/array_default"
miuizer:displayDividerValue="2"
miuizer:format="%s dip" />

<name.mikanoshi.customiuizer.prefs.CheckBoxPreferenceEx
android:key="pref_key_system_detailednetspeed_secunit"
android:title="@string/system_detailednetspeed_secunit_title"
Expand Down

0 comments on commit 1455a66

Please sign in to comment.