Browse Source

[New] Disable media stream muting in Do not disturb mode; resolves #119

[New] Toggle DND instead of Silent mode from collapsed volume dialog; resolves #117
[New] Volume dialog autohide delay
[New] Google Keyboard's bottom padding
[New][MIUI 12] Allow floating window to be opened from any notification that has an appropriate click action defined
[Improved][Compact notifications][MIUI12] Increased height of action buttons
[Fixed][Display next alarm on lock screen] Compatibility with super wallpaper clock style
[Fixed][Custom lock screen actions] Compatibility with some ancient Android versions
[Fixed][Popup notification swipe down] Ignore notifications with floating windows
[Fixed] Show seconds in status bar clock; resolves #136
[Fixed] Hide No SIM card icon
master v3.0.2
Mikanoshi 1 year ago
parent
commit
6c13177433
21 changed files with 452 additions and 70 deletions
  1. +4
    -0
      .idea/inspectionProfiles/Project_Default.xml
  2. +13
    -0
      CHANGELOG_EN
  3. +13
    -0
      CHANGELOG_RU
  4. +3
    -3
      app/build.gradle
  5. +1
    -1
      app/src/main/java/name/mikanoshi/customiuizer/MainApplication.java
  6. +8
    -1
      app/src/main/java/name/mikanoshi/customiuizer/MainModule.java
  7. +2
    -2
      app/src/main/java/name/mikanoshi/customiuizer/PreferenceFragmentBase.java
  8. +1
    -0
      app/src/main/java/name/mikanoshi/customiuizer/crashreport/Dialog.java
  9. +3
    -3
      app/src/main/java/name/mikanoshi/customiuizer/mods/Controls.java
  10. +1
    -0
      app/src/main/java/name/mikanoshi/customiuizer/mods/GlobalActions.java
  11. +3
    -2
      app/src/main/java/name/mikanoshi/customiuizer/mods/Launcher.java
  12. +252
    -38
      app/src/main/java/name/mikanoshi/customiuizer/mods/System.java
  13. +19
    -3
      app/src/main/java/name/mikanoshi/customiuizer/mods/Various.java
  14. +1
    -0
      app/src/main/java/name/mikanoshi/customiuizer/subs/Launcher.java
  15. +9
    -0
      app/src/main/java/name/mikanoshi/customiuizer/subs/System.java
  16. +24
    -16
      app/src/main/java/name/mikanoshi/customiuizer/utils/Helpers.java
  17. +12
    -0
      app/src/main/res/values-ru-rRU/strings.xml
  18. +12
    -0
      app/src/main/res/values/strings.xml
  19. +47
    -0
      app/src/main/res/xml/prefs_system.xml
  20. +23
    -0
      app/src/main/res/xml/prefs_various.xml
  21. +1
    -1
      last_build

+ 4
- 0
.idea/inspectionProfiles/Project_Default.xml View File

@ -6,6 +6,10 @@
<inspection_tool class="AndroidNonConstantResIdsInSwitch" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="BooleanMethodIsAlwaysInverted" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CatchMayIgnoreException" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConstantConditions" enabled="true" level="WARNING" enabled_by_default="true">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</inspection_tool>
<inspection_tool class="Convert2Diamond" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="Convert2Lambda" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DeprecatedClassUsageInspection" enabled="true" level="INFORMATION" enabled_by_default="true" />


+ 13
- 0
CHANGELOG_EN View File

@ -1,3 +1,16 @@
3.0.2
[New] Disable media stream muting in Do not disturb mode
[New] Toggle DND instead of Silent mode from collapsed volume dialog
[New] Volume dialog autohide delay
[New] Google Keyboard's bottom padding
[New][MIUI 12] Allow floating window to be opened from any notification that has an appropriate click action defined
[Improved][Compact notifications][MIUI12] Increased height of action buttons
[Fixed][Display next alarm on lock screen] Compatibility with super wallpaper clock style
[Fixed][Custom lock screen actions] Compatibility with some ancient Android versions
[Fixed][Popup notification swipe down] Ignore notifications with floating windows
[Fixed] Show seconds in status bar clock
[Fixed] Hide No SIM card icon
3.0.0
[New] Increase limit of active notifications from a single app
[New] Increase/remove notification icons limit in status bar


+ 13
- 0
CHANGELOG_RU View File

@ -1,3 +1,16 @@
3.0.2
[Новое] Отключить заглушение музыки в режиме Не беспокоить
[Новое] Переключение режима Не беспокоить вместо Бесшумного режима из свёрнутого диалога громкости
[Новое] Время перед автоскрытием диалога громкости
[Новое] Нижний отступ в Google Клавиатуре
[Новое][MIUI 12] Разрешить плавающее окно по свайпу вниз, если у уведомления задано подходящее действие на нажатие
[Улучшено][Компактные уведомления][MIUI12] Увеличена высота кнопок действий
[Исправлено][Показ будильника на локскрине] Совместимость со стилем часов от супер обоев
[Исправлено][Пользовательские действия на локскрине] Совместимость с некоторыми древними версиями Андроида
[Исправлено][Свайп вниз по всплывающим уведомлениям] Игнорировать уведомления с плавающими окнами
[Исправлено] Показ секунд на часах в строке состояния
[Исправлено] Скрытие иконки отстутствия SIM карты
3.0.0
[Новое] Увеличение лимита активных уведомлений от одного приложения
[Новое] Увеличение/отключение лимита на количество иконок уведомлений в строке состояния


+ 3
- 3
app/build.gradle View File

@ -20,10 +20,10 @@ android {
defaultConfig {
applicationId "name.mikanoshi.customiuizer"
minSdkVersion 24
//noinspection OldTargetApi
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 27
versionCode 55
versionName "3.0.0"
versionCode 56
versionName "3.0.2"
signingConfig signingConfigs.dev
}
buildTypes {


+ 1
- 1
app/src/main/java/name/mikanoshi/customiuizer/MainApplication.java View File

@ -55,7 +55,7 @@ public class MainApplication extends Application {
pContext = Helpers.getProtectedContext(base);
Helpers.prefs = pContext.getSharedPreferences(Helpers.prefsName, Context.MODE_PRIVATE);
String locale = Helpers.prefs.getString("pref_key_miuizer_locale", "auto");
if (!"auto".equals(locale) && !"1".equals(locale)) Locale.setDefault(Locale.forLanguageTag(locale));
if (locale != null && !"auto".equals(locale) && !"1".equals(locale)) Locale.setDefault(Locale.forLanguageTag(locale));
} catch (Throwable t) {
pContext = base;
Log.e("miuizer", "Failed to use protected storage!");


+ 8
- 1
app/src/main/java/name/mikanoshi/customiuizer/MainModule.java View File

@ -74,6 +74,7 @@ public class MainModule implements IXposedHookZygoteInit, IXposedHookLoadPackage
if (mPrefs.getStringAsInt("system_rotateanim", 1) > 1) System.RotationAnimationRes();
if (mPrefs.getInt("system_betterpopups_delay", 0) > 0 && !mPrefs.getBoolean("system_betterpopups_nohide")) System.BetterPopupsHideDelaySysHook();
if (mPrefs.getInt("various_gboardpadding_port", 0) > 0 || mPrefs.getInt("various_gboardpadding_land", 0) > 0) Various.GboardPaddingHook();
if (mPrefs.getBoolean("system_colorizenotiftitle")) System.ColorizedNotificationTitlesHook();
if (mPrefs.getBoolean("system_nopassword")) System.NoPasswordHook();
if (mPrefs.getBoolean("system_epm")) System.ExtendedPowerMenuHook();
@ -92,11 +93,13 @@ public class MainModule implements IXposedHookZygoteInit, IXposedHookLoadPackage
if (mPrefs.getBoolean("system_resizablewidgets")) System.ResizableWidgetsHook();
if (mPrefs.getBoolean("system_hidelowbatwarn")) System.NoLowBatteryWarningHook();
if (mPrefs.getBoolean("system_screenshot_overlay")) System.TempHideOverlayHook();
if (mPrefs.getBoolean("system_nomediamute")) System.NoMediaMuteInDNDHook();
if (mPrefs.getBoolean("controls_volumecursor")) Controls.VolumeCursorHook();
if (mPrefs.getBoolean("controls_fsg_horiz")) Controls.FSGesturesHook();
if (mPrefs.getBoolean("various_alarmcompat")) Various.AlarmCompatHook();
if (mPrefs.getStringAsInt("system_iconlabletoasts", 1) > 1) System.IconLabelToastsHook();
if (mPrefs.getStringAsInt("system_blocktoasts", 1) > 1) System.SelectiveToastsHook();
//System.AudioSilencerHook();
hideIconsActive =
mPrefs.getBoolean("system_statusbaricons_alarm") ||
@ -203,6 +206,8 @@ public class MainModule implements IXposedHookZygoteInit, IXposedHookLoadPackage
if (mPrefs.getInt("system_volumeblur_collapsed", 0) > 0 || mPrefs.getInt("system_volumeblur_expanded", 0) > 0) System.BlurVolumeDialogBackgroundHook(lpparam);
if (mPrefs.getInt("system_lstimeout", 9) > 9) System.LockScreenTimeoutHook(lpparam);
if (mPrefs.getInt("system_screenshot_floattime", 0) > 0) System.ScreenshotFloatTimeHook(lpparam);
if (mPrefs.getInt("system_volumedialogdelay_collapsed", 0) > 0 ||
mPrefs.getInt("system_volumedialogdelay_expanded", 0) > 0) System.VolumeDialogAutohideDelayHook(lpparam);
if (mPrefs.getInt("controls_fsg_coverage", 60) != 60) Controls.BackGestureAreaHeightHook(lpparam, true);
if (mPrefs.getInt("controls_fsg_width", 100) > 100) Controls.BackGestureAreaWidthHook(lpparam, true);
if (mPrefs.getInt("controls_navbarleft_action", 1) > 1 ||
@ -223,6 +228,7 @@ public class MainModule implements IXposedHookZygoteInit, IXposedHookLoadPackage
if (mPrefs.getBoolean("system_popupnotif")) System.PopupNotificationsHook(lpparam);
if (mPrefs.getBoolean("system_betterpopups_nohide")) System.BetterPopupsNoHideHook(lpparam);
if (mPrefs.getBoolean("system_betterpopups_swipedown")) System.BetterPopupsSwipeDownHook(lpparam);
if (mPrefs.getBoolean("system_betterpopups_allowfloat") && Helpers.is12()) System.BetterPopupsAllowFloatHook(lpparam);
if (mPrefs.getBoolean("system_hidemoreicon")) System.NoMoreIconHook(lpparam);
if (mPrefs.getBoolean("system_notifafterunlock")) System.ShowNotificationsAfterUnlockHook(lpparam);
if (mPrefs.getBoolean("system_notifrowmenu")) System.NotificationRowMenuHook(lpparam);
@ -257,6 +263,7 @@ public class MainModule implements IXposedHookZygoteInit, IXposedHookLoadPackage
if (mPrefs.getBoolean("system_nosos")) System.NoSOSHook(lpparam);
if (mPrefs.getBoolean("system_usenativerecents")) System.UseNativeRecentsHook(lpparam);
if (mPrefs.getBoolean("system_morenotif")) System.MoreNotificationsHook(lpparam);
if (mPrefs.getBoolean("system_dndtoggle")) System.VolumeDialogDNDSwitchHook(lpparam);
if (mPrefs.getBoolean("launcher_nounlockanim")) System.NoUnlockAnimationHook(lpparam);
if (mPrefs.getBoolean("system_statusbaricons_battery1")) System.HideIconsBattery1Hook(lpparam);
if (mPrefs.getBoolean("system_statusbaricons_battery2")) System.HideIconsBattery2Hook(lpparam);
@ -278,7 +285,7 @@ public class MainModule implements IXposedHookZygoteInit, IXposedHookLoadPackage
if (mPrefs.getStringAsInt("system_inactivebrightness", 1) > 1) System.InactiveBrightnessSliderHook(lpparam);
if (mPrefs.getStringAsInt("system_mobiletypeicon", 1) > 1) System.HideNetworkTypeHook(lpparam);
if (mPrefs.getStringAsInt("system_statusbaricons_bluetooth", 1) > 1) System.HideIconsBluetoothHook(lpparam);
if (mPrefs.getStringAsInt("system_maxsbicons", 0) != 0) System.MaxNotificationIconsHook(lpparam);
if (mPrefs.getStringAsInt("system_maxsbicons", 0) != 0 && Helpers.is12()) System.MaxNotificationIconsHook(lpparam);
if (hideIconsActive) System.HideIconsHook(lpparam);
}


+ 2
- 2
app/src/main/java/name/mikanoshi/customiuizer/PreferenceFragmentBase.java View File

@ -169,9 +169,9 @@ public class PreferenceFragmentBase extends PreferenceFragment {
private void setupImmersiveMenu() {
ActionBar actionBar = getActionBar();
if (Helpers.is12()) {
if (Helpers.is12()) try {
if (actionBar != null) actionBar.setExpandState(ActionBar.STATE_COLLAPSE, false);
}
} catch (Throwable ignore) {}
if (supressMenu) return;
if (actionBar != null) actionBar.showSplitActionBar(false, false);


+ 1
- 0
app/src/main/java/name/mikanoshi/customiuizer/crashreport/Dialog.java View File

@ -534,6 +534,7 @@ public class Dialog extends Activity {
final AlertDialog alertDlg = alert.show();
alertDlg.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new OnClickListener() {
@Override
@SuppressWarnings("ConstantConditions")
public void onClick(View v) {
if (desc != null && desc.getText().toString().trim().equals("")) {
Toast.makeText(Dialog.this, R.string.crash_needs_desc, Toast.LENGTH_LONG).show();


+ 3
- 3
app/src/main/java/name/mikanoshi/customiuizer/mods/Controls.java View File

@ -344,7 +344,7 @@ public class Controls {
} else if (action == 1) {
try {
Toast.makeText(Helpers.getModuleContext(context), R.string.controls_navbar_noaction, Toast.LENGTH_SHORT).show();
} catch (Throwable t) {}
} catch (Throwable ignore) {}
return false;
} else {
return GlobalActions.handleAction(context, key);
@ -398,7 +398,7 @@ public class Controls {
if (kbrCls != null) try {
Drawable lripple = (Drawable)kbrCls.getConstructor(Context.class, View.class).newInstance(mContext, leftbtn);
leftbtn.setBackground(lripple);
} catch (Throwable t) {}
} catch (Throwable ignore) {}
leftbtn.setClickable(true);
leftbtn.setHapticFeedbackEnabled(true);
leftbtn.setOnClickListener(new View.OnClickListener() {
@ -441,7 +441,7 @@ public class Controls {
if (kbrCls != null) try {
Drawable rripple = (Drawable)kbrCls.getConstructor(Context.class, View.class).newInstance(mContext, rightbtn);
rightbtn.setBackground(rripple);
} catch (Throwable t) {}
} catch (Throwable ignore) {}
rightbtn.setClickable(true);
rightbtn.setHapticFeedbackEnabled(true);
rightbtn.setOnClickListener(new View.OnClickListener() {


+ 1
- 0
app/src/main/java/name/mikanoshi/customiuizer/mods/GlobalActions.java View File

@ -307,6 +307,7 @@ public class GlobalActions {
};
private static final BroadcastReceiver mGlobalReceiver = new BroadcastReceiver() {
@SuppressWarnings("ConstantConditions")
@SuppressLint({"MissingPermission", "WrongConstant", "NewApi"})
public void onReceive(final Context context, Intent intent) {
try {


+ 3
- 2
app/src/main/java/name/mikanoshi/customiuizer/mods/Launcher.java View File

@ -333,6 +333,7 @@ public class Launcher {
}
private static Class<?> wallpaperUtilsCls = null;
@SuppressWarnings("ConstantConditions")
private static void applyFolderShade(View folder) {
int opt = Integer.parseInt(Helpers.getSharedStringPref(folder.getContext(), "pref_key_launcher_foldershade", "1"));
int level = Helpers.getSharedIntPref(folder.getContext(), "pref_key_launcher_foldershade_level", 40);
@ -340,7 +341,7 @@ public class Launcher {
MainModule.mPrefs.put("pref_key_launcher_foldershade_level", level);
if (opt == 2) {
boolean isLight = false;
if (wallpaperUtilsCls != null) try { isLight = (boolean)XposedHelpers.callStaticMethod(wallpaperUtilsCls, "hasAppliedLightWallpaper"); } catch (Throwable t) {}
if (wallpaperUtilsCls != null) try { isLight = (boolean)XposedHelpers.callStaticMethod(wallpaperUtilsCls, "hasAppliedLightWallpaper"); } catch (Throwable ignore) {}
int bgcolor = (isLight ? 0x00ffffff : 0x00000000) | (Math.round(255 * level / 100f) * 0x1000000);
folder.setBackground(new ColorDrawable(bgcolor));
} else if (opt == 3) {
@ -350,7 +351,7 @@ public class Launcher {
@Override
public Shader resize(int width, int height) {
boolean isLight = false;
if (wallpaperUtilsCls != null) try { isLight = (boolean)XposedHelpers.callStaticMethod(wallpaperUtilsCls, "hasAppliedLightWallpaper"); } catch (Throwable t) {}
if (wallpaperUtilsCls != null) try { isLight = (boolean)XposedHelpers.callStaticMethod(wallpaperUtilsCls, "hasAppliedLightWallpaper"); } catch (Throwable ignore) {}
int bgcolor1 = (isLight ? 0x00ffffff : 0x00000000) | (Math.round(255 / 6f * level / 100f) * 0x1000000);
int bgcolor2 = (isLight ? 0x00ffffff : 0x00000000) | (Math.round(255 * level / 100f) * 0x1000000);
return new LinearGradient(0, 0, 0, height,


+ 252
- 38
app/src/main/java/name/mikanoshi/customiuizer/mods/System.java View File

@ -7,10 +7,12 @@ import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.Application;
import android.app.Dialog;
import android.app.KeyguardManager;
import android.app.MiuiNotification;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.TaskStackBuilder;
import android.app.WallpaperManager;
import android.appwidget.AppWidgetProviderInfo;
@ -49,7 +51,10 @@ import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.hardware.usb.UsbManager;
import android.media.AudioManager;
import android.media.MediaDataSource;
import android.media.MediaMetadata;
import android.media.MediaPlayer;
import android.media.SoundPool;
import android.media.session.MediaController;
import android.media.session.PlaybackState;
import android.net.ConnectivityManager;
@ -74,13 +79,17 @@ import android.os.UserHandle;
import android.provider.Settings;
import android.telephony.PhoneStateListener;
import android.text.Layout;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.TypefaceSpan;
import android.util.ArrayMap;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Pair;
import android.util.SparseArray;
import android.util.SparseIntArray;
import android.util.TypedValue;
import android.view.Display;
@ -146,6 +155,7 @@ import static java.lang.System.currentTimeMillis;
import static java.lang.System.nanoTime;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import de.robv.android.xposed.callbacks.XCallback;
import de.robv.android.xposed.XC_MethodHook.MethodHookParam;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedBridge;
@ -173,7 +183,7 @@ public class System {
try {
XposedHelpers.setObjectField(param.thisObject, "mColorFadeEnabled", true);
XposedHelpers.setObjectField(param.thisObject, "mColorFadeFadesConfig", true);
} catch (Throwable t) {}
} catch (Throwable ignore) {}
}
@Override
@ -859,6 +869,7 @@ public class System {
//noinspection ResultOfMethodCallIgnored
Helpers.findAndHookMethodSilently("com.android.server.audio.AudioService", lpparam.classLoader, "shouldZenMuteStream", int.class, new MethodHook() {
@SuppressWarnings("ConstantConditions")
protected void after(MethodHookParam param) throws Throwable {
int mStreamType = (int)param.args[0];
if (mStreamType == 5 && !(boolean)param.getResult()) {
@ -956,6 +967,7 @@ public class System {
String clockStrLower = clockStr.toLowerCase();
int colons = clockStr.length() - clockStr.replace(":", "").length();
if (colons >= 2) return clockStr;
//return clockStr.replaceAll("(\\d{1,2}:\\d{1,2}:)\\d{1,2}(?i)(\\s?)((am|pm)?)", "$1" + df.format(Calendar.getInstance().get(Calendar.SECOND)) + "$2$3").trim();
if (clockStrLower.endsWith("am") || clockStrLower.endsWith("pm"))
return clockStr.replaceAll("(?i)(\\s?)(am|pm)", ":" + df.format(Calendar.getInstance().get(Calendar.SECOND)) + "$1$2").trim();
else
@ -963,7 +975,7 @@ public class System {
}
public static void ClockSecondsHook(LoadPackageParam lpparam) {
Helpers.findAndHookMethod("com.android.systemui.statusbar.policy.Clock", lpparam.classLoader, "updateClock", new MethodHook() {
Helpers.findAndHookMethod("com.android.systemui.statusbar.policy.Clock", lpparam.classLoader, "updateClock", new MethodHook(XCallback.PRIORITY_HIGHEST) {
@Override
protected void after(MethodHookParam param) throws Throwable {
TextView clock = (TextView)param.thisObject;
@ -972,11 +984,12 @@ public class System {
}
});
Helpers.findAndHookConstructor("com.android.systemui.statusbar.policy.Clock", lpparam.classLoader, Context.class, AttributeSet.class, int.class, new MethodHook(10) {
Helpers.hookAllConstructors("com.android.systemui.statusbar.policy.Clock", lpparam.classLoader, new MethodHook() {
@Override
protected void after(MethodHookParam param) {
final TextView clock = (TextView)param.thisObject;
if (clock.getId() != clock.getResources().getIdentifier("clock", "id", "com.android.systemui")) return;
if (XposedHelpers.getAdditionalInstanceField(clock, "mSecondsTimer") != null) return;
final Handler mClockHandler = new Handler(clock.getContext().getMainLooper());
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@ -990,6 +1003,7 @@ public class System {
});
}
}, 0, 1000);
XposedHelpers.setAdditionalInstanceField(clock, "mSecondsTimer", timer);
}
});
}
@ -1704,7 +1718,7 @@ public class System {
try {
if (art == null && mAlbumArt == null) return;
if (art != null && art.sameAs(mAlbumArt)) return;
} catch (Throwable t) {}
} catch (Throwable ignore) {}
XposedHelpers.setAdditionalStaticField(utilCls, "mAlbumArtSource", art);
int blur = Helpers.getSharedIntPref(mContext, "pref_key_system_albumartonlock_blur", 0);
@ -1784,9 +1798,23 @@ public class System {
public static void BetterPopupsSwipeDownHook(LoadPackageParam lpparam) {
Helpers.findAndHookMethod("com.android.systemui.statusbar.phone.HeadsUpTouchHelper", lpparam.classLoader, "onInterceptTouchEvent", MotionEvent.class, new MethodHook() {
@Override
@SuppressWarnings("ConstantConditions")
protected void after(final MethodHookParam param) throws Throwable {
MotionEvent me = (MotionEvent)param.args[0];
if (me.getActionMasked() == 2) {
if (me.getActionMasked() == MotionEvent.ACTION_DOWN) {
boolean mAllowSwipingDown = true;
if (Helpers.is12()) {
Object mPickedChild = XposedHelpers.getObjectField(param.thisObject, "mPickedChild");
if (mPickedChild != null) {
View mMiniBar = (View)XposedHelpers.callMethod(mPickedChild, "getMiniWindowBar");
if (mMiniBar != null && mMiniBar.getVisibility() == View.VISIBLE) mAllowSwipingDown = false;
}
}
XposedHelpers.setAdditionalInstanceField(param.thisObject, "mAllowSwipingDown", mAllowSwipingDown);
}
if (me.getActionMasked() == MotionEvent.ACTION_MOVE) {
Object mAllowSwipingDown = XposedHelpers.getAdditionalInstanceField(param.thisObject, "mAllowSwipingDown");
if (mAllowSwipingDown instanceof Boolean && !(boolean)mAllowSwipingDown) return;
boolean mTouchingHeadsUpView = (boolean)XposedHelpers.getObjectField(param.thisObject, "mTouchingHeadsUpView");
if (!mTouchingHeadsUpView) return;
float mTouchSlop = (float)XposedHelpers.getObjectField(param.thisObject, "mTouchSlop");
@ -1921,7 +1949,7 @@ public class System {
}
public static void CompactNotificationsRes() {
int height = Helpers.is12() ? 26 : 39;
int height = 39;
MainModule.resHooks.setDensityReplacement("android", "dimen", "notification_action_height", height);
MainModule.resHooks.setDensityReplacement("android", "dimen", "android_notification_action_height", height);
MainModule.resHooks.setDensityReplacement("android", "dimen", "notification_action_list_height", height);
@ -1940,23 +1968,33 @@ public class System {
//if (mView.getId() != mView.getResources().getIdentifier("status_bar_latest_event_content", "id", "android")) return;
FrameLayout container = mView.findViewById(mView.getResources().getIdentifier("actions_container", "id", "android"));
if (container == null) return;
container.setPadding(0, 0, 0, 0);
float density = mView.getResources().getDisplayMetrics().density;
int height = Math.round(density * (Helpers.is12() ? 26 : 39));
int height = Math.round(density * 39);
ViewGroup actions = (ViewGroup)container.getChildAt(0);
FrameLayout.LayoutParams lp1 = (FrameLayout.LayoutParams)actions.getLayoutParams();
lp1.height = height;
actions.setLayoutParams(lp1);
actions.setPadding(0, 0, 0, 0);
for (int c = 0; c < actions.getChildCount(); c++) {
View button = actions.getChildAt(c);
ViewGroup.MarginLayoutParams lp2 = (ViewGroup.MarginLayoutParams)button.getLayoutParams();
lp2.height = height;
lp2.bottomMargin = 0;
lp2.topMargin = 0;
if (Helpers.is12()) ((Button)button).setGravity(Gravity.BOTTOM);
}
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)actions.getLayoutParams();
lp.height = height;
lp.gravity = Gravity.BOTTOM;
actions.setPadding(0, 0, 0, 0);
actions.setLayoutParams(lp);
}
});
if (Helpers.is12())
Helpers.findAndHookMethod("com.android.systemui.statusbar.notification.NotificationTemplateViewWrapper$GoogleStyleProcessor", lpparam.classLoader, "setGoogleContentMargins", View.class, new MethodHook() {
@Override
protected void after(MethodHookParam param) throws Throwable {
View view = (View)param.args[0];
FrameLayout container = view.findViewById(view.getResources().getIdentifier("actions_container", "id", "android"));
if (container == null || container.getVisibility() != View.VISIBLE) return;
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams)view.getLayoutParams();
lp.bottomMargin = 0;
view.setLayoutParams(lp);
}
});
}
@ -2159,7 +2197,7 @@ public class System {
CharSequence appName = pkgName;
try {
appName = mContext.getPackageManager().getApplicationLabel(mContext.getPackageManager().getApplicationInfo(pkgName, 0));
} catch (Throwable t) {}
} catch (Throwable ignore) {}
Toast.makeText(mContext, Helpers.getModuleRes(mContext).getString(R.string.force_closed, appName), Toast.LENGTH_SHORT).show();
}
}
@ -2472,11 +2510,12 @@ public class System {
try {
ViewGroup mSignalSimpleDualMobileContainer = (ViewGroup)XposedHelpers.getObjectField(param.thisObject, "mSignalSimpleDualMobileContainer");
applyHeight(mSignalSimpleDualMobileContainer);
} catch (Throwable t) {}
} catch (Throwable ignore) {}
}
});
}
@SuppressWarnings("ConstantConditions")
public static void HideMemoryCleanHook(LoadPackageParam lpparam, boolean isInLauncher) {
String raClass = isInLauncher ? "com.miui.home.recents.views.RecentsContainer" : "com.android.systemui.recents.RecentsActivity";
if (isInLauncher && findClassIfExists(raClass, lpparam.classLoader) == null) return;
@ -2916,6 +2955,7 @@ public class System {
});
}
@SuppressWarnings("ConstantConditions")
public static void CustomRecommendedHook(LoadPackageParam lpparam, boolean isInLauncher) {
String rrvClass = isInLauncher ? "com.miui.home.recents.views.RecentsRecommendView" : "com.android.systemui.recents.views.RecentsRecommendView";
if (isInLauncher && findClassIfExists(rrvClass, lpparam.classLoader) == null) return;
@ -2942,6 +2982,7 @@ public class System {
Helpers.findAndHookMethod(rrvClass, lpparam.classLoader, "initItem", int.class, int.class, int.class, new MethodHook() {
@Override
@SuppressLint("WrongConstant")
protected void after(MethodHookParam param) throws Throwable {
LinearLayout view = (LinearLayout)param.thisObject;
Context context = view.getContext();
@ -3124,7 +3165,7 @@ public class System {
boolean hasDual = false;
try {
hasDual = XposedHelpers.callMethod(pm, "getPackageInfoAsUser", resolveInfo.activityInfo.packageName, 0, 999) != null;
} catch (Throwable t) {}
} catch (Throwable ignore) {}
if ((removeOriginal && !hasDual) || removeOriginal && hasDual && removeDual) itr.remove();
}
param.setResult(resolved);
@ -3284,7 +3325,7 @@ public class System {
boolean hasDual = false;
try {
hasDual = XposedHelpers.callMethod(pm, "getPackageInfoAsUser", resolveInfo.activityInfo.packageName, 0, 999) != null;
} catch (Throwable t) {}
} catch (Throwable ignore) {}
if ((isRemove.first && !hasDual) || isRemove.first && hasDual && isRemove.second) itr.remove();
}
@ -3777,8 +3818,13 @@ public class System {
Helpers.findAndHookMethod("com.android.systemui.statusbar.SignalClusterView", lpparam.classLoader, "apply", new MethodHook() {
@Override
protected void after(MethodHookParam param) throws Throwable {
View mNoSimsCombo = (View)XposedHelpers.getObjectField(param.thisObject, "mNoSimsCombo");
if (mNoSimsCombo != null) mNoSimsCombo.setVisibility(View.GONE);
try {
View mNoSimsCombo = (View)XposedHelpers.getObjectField(param.thisObject, "mNoSimsCombo");
if (mNoSimsCombo != null) mNoSimsCombo.setVisibility(View.GONE);
} catch (Throwable t) {
View mNoSims = (View)XposedHelpers.getObjectField(param.thisObject, "mNoSims");
if (mNoSims != null) mNoSims.setVisibility(View.GONE);
}
}
});
}
@ -4164,9 +4210,9 @@ public class System {
private static void initLeftView(final Object thisObject) {
Context mContext = (Context)XposedHelpers.getObjectField(thisObject, "mContext");
try { XposedHelpers.setObjectField(thisObject, "mMiWalletCardNum", new TextView(mContext)); } catch (Throwable t) {}
try { XposedHelpers.setObjectField(thisObject, "mRemoteControllerNum", new TextView(mContext)); } catch (Throwable t) {}
try { XposedHelpers.setObjectField(thisObject, "mSmartHomeNum", new TextView(mContext)); } catch (Throwable t) {}
try { XposedHelpers.setObjectField(thisObject, "mMiWalletCardNum", new TextView(mContext)); } catch (Throwable ignore) {}
try { XposedHelpers.setObjectField(thisObject, "mRemoteControllerNum", new TextView(mContext)); } catch (Throwable ignore) {}
try { XposedHelpers.setObjectField(thisObject, "mSmartHomeNum", new TextView(mContext)); } catch (Throwable ignore) {}
Handler mHandler = (Handler)XposedHelpers.getAdditionalInstanceField(thisObject, "mHandler");
mHandler.removeMessages(1);
@ -4344,7 +4390,7 @@ public class System {
if (modifyCameraImage(mContext, mView, mDarkMode)) {
try {
XposedHelpers.setBooleanField(param.thisObject, "mGetCameraImageSucceed", false);
} catch (Throwable t) {}
} catch (Throwable ignore) {}
param.setResult(null);
}
}
@ -4538,6 +4584,8 @@ public class System {
}
String leftViewCls = "com.android.keyguard.negative.MiuiKeyguardMoveLeftControlCenterView";
if (XposedHelpers.findClassIfExists(leftViewCls, lpparam.classLoader) == null)
leftViewCls = "com.android.keyguard.MiuiKeyguardMoveLeftView";
Helpers.findAndHookConstructor(leftViewCls, lpparam.classLoader, Context.class, AttributeSet.class, new MethodHook() {
@Override
@ -4637,6 +4685,7 @@ public class System {
public static void LockScreenSecureLaunchHook() {
Helpers.findAndHookMethod(Activity.class, "onCreate", Bundle.class, new MethodHook() {
@SuppressWarnings("ConstantConditions")
protected void after(MethodHookParam param) throws Throwable {
Activity act = (Activity)param.thisObject;
if (act == null) return;
@ -4646,7 +4695,7 @@ public class System {
boolean mStartedFromLockScreen = false;
try {
mStartedFromLockScreen = (boolean)XposedHelpers.getAdditionalInstanceField(act.getApplication(), "wasStartedFromLockScreen");
} catch (Throwable t) {}
} catch (Throwable ignore) {}
if (mFromSecureKeyguard || mStartedFromLockScreen) {
XposedHelpers.setAdditionalInstanceField(act.getApplication(), "wasStartedFromLockScreen", true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
@ -5590,36 +5639,51 @@ public class System {
});
}
@SuppressWarnings("ConstantConditions")
private static void hookUpdateTime(Object thisObject) {
try {
TextView mCurrentDate = (TextView)XposedHelpers.getObjectField(thisObject, "mCurrentDate");
if (mCurrentDate == null) return;
mCurrentDate.setTextAlignment(View.TEXT_ALIGNMENT_INHERIT);
mCurrentDate.setLineSpacing(0, 1.0f);
long timestamp = Helpers.getNextMIUIAlarmTime(mCurrentDate.getContext());
TextView mCurrentDate = null;
TextView mCurrentDateLarge = null;
try { mCurrentDate = (TextView)XposedHelpers.getObjectField(thisObject, "mCurrentDate"); } catch (Throwable ignore) {}
try { mCurrentDateLarge = (TextView)XposedHelpers.getObjectField(thisObject, "mCurrentDateLarge"); } catch (Throwable ignore) {}
if (mCurrentDate == null && mCurrentDateLarge == null) return;
Context mContext = mCurrentDate != null ? mCurrentDate.getContext() : mCurrentDateLarge.getContext();
long timestamp = Helpers.getNextMIUIAlarmTime(mContext);
if (timestamp == 0 && MainModule.mPrefs.getBoolean("system_lsalarm_all"))
timestamp = Helpers.getNextStockAlarmTime(mCurrentDate.getContext());
timestamp = Helpers.getNextStockAlarmTime(mContext);
if (timestamp == 0) return;
StringBuilder alarmStr = new StringBuilder();
alarmStr.append(mCurrentDate.getText()).append("\n").append(Helpers.getModuleRes(mCurrentDate.getContext()).getString(R.string.system_statusbaricons_alarm_title)).append(" ");
alarmStr.append("\n").append(Helpers.getModuleRes(mContext).getString(R.string.system_statusbaricons_alarm_title)).append(" ");
int format = MainModule.mPrefs.getStringAsInt("system_lsalarm_format", 1);
if (format == 2) {
StringBuilder timeStr = new StringBuilder(DateUtils.getRelativeTimeSpanString(timestamp, currentTimeMillis(), 0, DateUtils.FORMAT_ABBREV_RELATIVE));
timeStr.setCharAt(0, Character.toLowerCase(timeStr.charAt(0)));
alarmStr.append(timeStr);
} else {
SimpleDateFormat dateFormat = new SimpleDateFormat(DateFormat.getBestDateTimePattern(Locale.getDefault(), DateFormat.is24HourFormat(mCurrentDate.getContext()) ? "EHmm" : "EHmma"), Locale.getDefault());
SimpleDateFormat dateFormat = new SimpleDateFormat(DateFormat.getBestDateTimePattern(Locale.getDefault(), DateFormat.is24HourFormat(mContext) ? "EHmm" : "EHmma"), Locale.getDefault());
dateFormat.setTimeZone(TimeZone.getDefault());
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
calendar.setTimeInMillis(timestamp);
alarmStr.append(dateFormat.format(calendar.getTime()));
}
mCurrentDate.setLineSpacing(0, 1.5f);
mCurrentDate.setText(alarmStr);
int pos = Settings.System.getInt(mCurrentDate.getContext().getContentResolver(), "selected_keyguard_clock_position", 0);
if (pos != 2) mCurrentDate.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
int pos = Settings.System.getInt(mContext.getContentResolver(), "selected_keyguard_clock_position", 0);
if (mCurrentDate != null) {
mCurrentDate.setTextAlignment(View.TEXT_ALIGNMENT_INHERIT);
mCurrentDate.setLineSpacing(0, 1.5f);
mCurrentDate.append(alarmStr);
if (pos != 2 && pos != 4) mCurrentDate.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
}
if (mCurrentDateLarge != null) {
int resId = mCurrentDateLarge.getResources().getIdentifier("miui_clock_date_text_size", "dimen", "com.android.systemui");
int fontSize = resId == 0 ? Math.round(mCurrentDateLarge.getResources().getDisplayMetrics().density * 14.0f) : mCurrentDateLarge.getResources().getDimensionPixelSize(resId);
alarmStr.insert(1, "\n\n ");
SpannableString span = new SpannableString(alarmStr);
span.setSpan(new AbsoluteSizeSpan(fontSize, false), 0, alarmStr.length(), 0);
span.setSpan(new TypefaceSpan("sans-serif"), 0, alarmStr.length(), 0);
mCurrentDateLarge.append(span);
}
} catch (Throwable t) {
XposedBridge.log(t);
}
@ -6271,6 +6335,7 @@ public class System {
public static void TempHideOverlayHook() {
Helpers.hookAllMethods("android.view.WindowManagerGlobal", null, "addView", new MethodHook() {
@Override
@SuppressWarnings("ConstantConditions")
protected void after(final MethodHookParam param) throws Throwable {
if (param.args[0] == null || !(param.args[1] instanceof WindowManager.LayoutParams) || param.getThrowable() != null) return;
WindowManager.LayoutParams params = (WindowManager.LayoutParams)param.args[1];
@ -6298,6 +6363,7 @@ public class System {
public static void ScreenshotFloatTimeHook(LoadPackageParam lpparam) {
Helpers.findAndHookMethod("com.android.systemui.screenshot.GlobalScreenshot", lpparam.classLoader, "startGotoThumbnailAnimation", Runnable.class, new MethodHook() {
@Override
@SuppressWarnings("ConstantConditions")
protected void after(MethodHookParam param) throws Throwable {
boolean mIsShowLongScreenShotGuide = false;
try {
@ -6462,6 +6528,154 @@ public class System {
});
}
public static void VolumeDialogDNDSwitchHook(LoadPackageParam lpparam) {
Helpers.findAndHookMethod("com.android.systemui.miui.volume.MiuiRingerModeLayout.RingerButtonHelper", lpparam.classLoader, "updateState", new MethodHook() {
@Override
protected void after(MethodHookParam param) throws Throwable {
boolean mExpanded = XposedHelpers.getBooleanField(param.thisObject, "mExpanded");
if (mExpanded) return;
View mStandardView = (View)XposedHelpers.getObjectField(param.thisObject, "mStandardView");
View mDndView = (View)XposedHelpers.getObjectField(param.thisObject, "mDndView");
if (mStandardView != null) mStandardView.setVisibility(View.GONE);
if (mDndView != null) mDndView.setVisibility(View.VISIBLE);
}
});
}
public static void NoMediaMuteInDNDHook() {
Helpers.hookAllMethods("android.media.AudioServiceInjector", null, "handleZenModeChangedForMusic", new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
if ((int)param.args[2] == 1 || (int)param.args[3] == 1) param.setResult(null);
}
});
}
public static void VolumeDialogAutohideDelayHook(LoadPackageParam lpparam) {
Helpers.findAndHookMethod("com.android.systemui.miui.volume.MiuiVolumeDialogImpl", lpparam.classLoader, "computeTimeoutH", new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
boolean mHovering = XposedHelpers.getBooleanField(param.thisObject, "mHovering");
if (mHovering) {
param.setResult(16000);
return;
}
Object mSafetyWarning = XposedHelpers.getObjectField(param.thisObject, "mSafetyWarning");
if (mSafetyWarning != null) {
int opt = MainModule.mPrefs.getInt("system_volumedialogdelay_expanded", 0);
param.setResult(opt > 0 ? opt : 5000);
return;
}
boolean mExpanded = XposedHelpers.getBooleanField(param.thisObject, "mExpanded");
int opt = MainModule.mPrefs.getInt(mExpanded ? "system_volumedialogdelay_expanded" : "system_volumedialogdelay_collapsed", 0);
if (opt > 0) param.setResult(opt);
}
});
}
@SuppressWarnings({"unchecked", "unused"})
public static void AudioSilencerHook() {
Helpers.hookAllConstructors(SoundPool.class, new MethodHook() {
@Override
protected void after(MethodHookParam param) throws Throwable {
if (XposedHelpers.getAdditionalInstanceField(param.thisObject, "mSourceHashes") == null) {
SparseArray<String> mSourceHashes = new SparseArray<String>();
XposedHelpers.setAdditionalInstanceField(param.thisObject, "mSourceHashes", mSourceHashes);
}
}
});
Helpers.hookAllMethods(SoundPool.class, "load", new MethodHook() {
@Override
protected void after(MethodHookParam param) throws Throwable {
SparseArray<String> mSourceHashes = (SparseArray<String>)XposedHelpers.getAdditionalInstanceField(param.thisObject, "mSourceHashes");
Application callerContext = (Application)XposedHelpers.callStaticMethod(XposedHelpers.findClass("android.app.ActivityThread", null), "currentApplication");
if (callerContext == null) return;
String caller = callerContext.getPackageName();
if (param.args[0] instanceof Context) {
Context mContext = (Context)param.args[0];
String hash = "res|" + caller + "|" + mContext.getResources().getResourceName((int)param.args[1]);
XposedBridge.log(param.getResult() + " | " + hash);
mSourceHashes.put((int)param.getResult(), hash);
} else if (param.args[0] instanceof String) {
String hash = "file|" + caller + "|" + param.args[0];
XposedBridge.log(param.getResult() + " | " + hash);
mSourceHashes.put((int)param.getResult(), hash);
}
}
});
Helpers.hookAllMethods(SoundPool.class, "play", new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
SparseArray<String> mSourceHashes = (SparseArray<String>)XposedHelpers.getAdditionalInstanceField(param.thisObject, "mSourceHashes");
if (mSourceHashes == null) return;
XposedBridge.log("Playing [" + param.args[0] + "] " + mSourceHashes.get((Integer)param.args[0]));
}
});
Helpers.hookAllMethods(MediaPlayer.class, "setDataSource", new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
if (Modifier.isPrivate(param.method.getModifiers())) return;
Application callerContext = (Application)XposedHelpers.callStaticMethod(XposedHelpers.findClass("android.app.ActivityThread", null), "currentApplication");
if (callerContext == null) return;
String caller = callerContext.getPackageName();
String hash = null;
if (param.args.length > 1 && param.args[0] instanceof Context && param.args[1] instanceof Uri) {
hash = "uri|" + caller + "|" + ((Uri)param.args[1]).getPath();
XposedBridge.log(hash);
} else if (param.args[0] instanceof String) {
hash = "file|" + caller + "|" + param.args[0];
XposedBridge.log(hash);
} else if (param.args[0] instanceof MediaDataSource) {
hash = "mds|" + caller + "|" + param.args[0];
XposedBridge.log(hash);
}
if (hash != null)
XposedHelpers.setAdditionalInstanceField(param.thisObject, "mSourceHash", hash);
}
});
Helpers.hookAllMethods(MediaPlayer.class, "start", new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
String mSourceHash = (String)XposedHelpers.getAdditionalInstanceField(param.thisObject, "mSourceHash");
if (mSourceHash == null) return;
XposedBridge.log("Playing " + mSourceHash);
}
});
}
public static void BetterPopupsAllowFloatHook(LoadPackageParam lpparam) {
Helpers.hookAllConstructors("com.android.systemui.miui.statusbar.policy.AppMiniWindowManager", lpparam.classLoader, new MethodHook() {
@Override
protected void after(MethodHookParam param) throws Throwable {
Context mContext = (Context)XposedHelpers.getObjectField(param.thisObject, "mContext");
Handler mHandler = (Handler)XposedHelpers.getObjectField(param.thisObject, "mHandler");
new Helpers.SharedPrefObserver(mContext, mHandler, "pref_key_system_betterpopups_allowfloat_apps") {
@Override
public void onChange(String name) {
MainModule.mPrefs.put(name, Helpers.getSharedStringSetPref(mContext, name));
}
};
}
});
Helpers.findAndHookMethod("com.android.systemui.miui.statusbar.policy.AppMiniWindowManager", lpparam.classLoader, "canNotificationSlide", Context.class, "com.android.systemui.miui.statusbar.ExpandedNotification", new MethodHook() {
@Override
protected void after(MethodHookParam param) throws Throwable {
Object notification = XposedHelpers.callMethod(param.args[1], "getNotification");
PendingIntent intent = (PendingIntent)XposedHelpers.callMethod(param.thisObject, "getIntent", notification);
if (intent == null) return;
Context mContext = (Context)XposedHelpers.getObjectField(param.thisObject, "mContext");
Set<String> selectedApps = Helpers.getSharedStringSetPref(mContext, "pref_key_system_betterpopups_allowfloat_apps");
if (selectedApps.contains(intent.getCreatorPackage())) param.setResult(true);
}
});
}
// @SuppressWarnings("unchecked")
// public static void MultiWindowHook() {
// HashMap<String, Integer> sAppList = (HashMap<String, Integer>)XposedHelpers.getStaticObjectField(findClass("android.util.MiuiMultiWindowUtils", null), "sAppList");


+ 19
- 3
app/src/main/java/name/mikanoshi/customiuizer/mods/Various.java View File

@ -610,7 +610,7 @@ public class Various {
try {
PackageManager mPm = (PackageManager)XposedHelpers.getObjectField(param.thisObject, "mPm");
mAppInfo = mPm.getPackageInfo(mPkgInfo.packageName, 0);
} catch (Throwable t) {}
} catch (Throwable ignore) {}
Resources modRes = Helpers.getModuleRes(act);
@ -756,7 +756,7 @@ public class Various {
PackageInfo mAppInfo = null;
try {
mAppInfo = act.getPackageManager().getPackageInfo(mPkgInfo.packageName, 0);
} catch (Throwable t) {}
} catch (Throwable ignore) {}
//String size = "";
//String[] texts = version.getText().toString().split("\\|");
@ -788,7 +788,7 @@ public class Various {
public static void MiuiPackageInstallerServiceHook(LoadPackageParam lpparam) {
MethodHook hook = new MethodHook() {
@Override
@SuppressWarnings({"unchecked"})
@SuppressWarnings({"unchecked", "ConstantConditions"})
protected void after(MethodHookParam param) throws Throwable {
try {
if (param.args[0] == null) return;
@ -860,6 +860,22 @@ public class Various {
});
}
public static void GboardPaddingHook() {
Helpers.findAndHookMethod(findClass("android.os.SystemProperties", null), "get", String.class, new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
String key = (String)param.args[0];
if (key.equals("ro.com.google.ime.kb_pad_port_b")) {
int opt = MainModule.mPrefs.getInt("various_gboardpadding_port", 0);
if (opt > 0) param.setResult(String.valueOf(opt));
} else if (key.equals("ro.com.google.ime.kb_pad_land_b")) {
int opt = MainModule.mPrefs.getInt("various_gboardpadding_land", 0);
if (opt > 0) param.setResult(String.valueOf(opt));
}
}
});
}
// public static void LargeCallerPhotoHook(LoadPackageParam lpparam) {
// Helpers.findAndHookMethod("com.android.incallui.CallCardFragment", lpparam.classLoader, "setCallCardImage", Drawable.class, boolean.class, new MethodHook() {
// @Override


+ 1
- 0
app/src/main/java/name/mikanoshi/customiuizer/subs/Launcher.java View File

@ -16,6 +16,7 @@ public class Launcher extends SubFragment {
String sub = "";
@Override
@SuppressWarnings("ConstantConditions")
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);


+ 9
- 0
app/src/main/java/name/mikanoshi/customiuizer/subs/System.java View File

@ -139,6 +139,8 @@ public class System extends SubFragment {
}
});
if (!Helpers.is12()) ((ListPreferenceEx)findPreference("pref_key_system_maxsbicons")).setUnsupported(true);
break;
case "pref_key_system_cat_drawer":
findPreference("pref_key_system_popupnotif_cat").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@ -253,6 +255,13 @@ public class System extends SubFragment {
findPreference("pref_key_system_recommended_second").setOnPreferenceClickListener(openRecentsActions);
findPreference("pref_key_system_recommended_third").setOnPreferenceClickListener(openRecentsActions);
findPreference("pref_key_system_recommended_fourth").setOnPreferenceClickListener(openRecentsActions);
break;
case "pref_key_system_cat_betterpopups":
findPreference("pref_key_system_betterpopups_allowfloat_apps").setOnPreferenceClickListener(openAppsEdit);
if (!Helpers.is12())
((CheckBoxPreferenceEx)findPreference("pref_key_system_betterpopups_allowfloat")).setUnsupported(true);
break;
case "pref_key_system_cat_applock":
findPreference("pref_key_system_applock_list").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {


+ 24
- 16
app/src/main/java/name/mikanoshi/customiuizer/utils/Helpers.java View File

@ -138,24 +138,27 @@ public class Helpers {
public static boolean showNewMods = true;
public static boolean miuizerModuleActive = false;
public static final HashSet<String> newMods = new HashSet<String>(Arrays.asList(
"pref_key_system_maxsbicons",
"pref_key_system_morenotif",
"pref_key_system_nodarkforce",
"pref_key_various_collapsemiuititles"
"pref_key_system_nomediamute",
"pref_key_system_dndtoggle",
"pref_key_system_volumedialogdelay_collapsed",
"pref_key_system_volumedialogdelay_expanded",
"pref_key_system_betterpopups_allowfloat",
"pref_key_various_gboardpadding_port",
"pref_key_various_gboardpadding_land"
));
public static final HashMap<String, String> l10nProgress = new HashMap<String, String>() {{
put("ru-RU", "100.0%");
put("zh-CN", "100.0%");
put("id", "13.3%");
put("tr", "98.6%");
put("it", "98.6%");
put("pt-BR", "97.3%");
put("fr", "26.0%");
put("uk-UK", "98.4%");
put("es", "100.0%");
put("zh-CN", "98.7%");
put("id", "13.1%");
put("tr", "97.4%");
put("it", "97.4%");
put("pt-BR", "96.1%");
put("fr", "25.7%");
put("uk-UK", "97.2%");
put("es", "98.7%");
put("sk", "3.2%");
put("cs", "0.0%");
put("de", "98.6%");
put("de", "97.4%");
}};
public static final ArrayList<String> shortcutIcons = new ArrayList<String>();
@ -222,6 +225,7 @@ public class Helpers {
}
}
@SuppressWarnings("ConstantConditions")
public static void detectHoliday() {
currentHoliday = Holidays.NONE;
String opt = Helpers.prefs.getString("pref_key_miuizer_holiday", "0");
@ -488,6 +492,7 @@ public class Helpers {
}
}
@SuppressWarnings("ConstantConditions")
public static long getNextMIUIAlarmTime(Context context) {
String nextAlarm = Settings.System.getString(context.getContentResolver(), "next_alarm_clock_formatted");
long nextTime = 0;
@ -528,6 +533,7 @@ public class Helpers {
return aci == null ? 0 : aci.getTriggerTime();
}
@SuppressWarnings("ConstantConditions")
public static void updateNewModsMarking(Context context) {
updateNewModsMarking(context, Integer.parseInt(prefs.getString("pref_key_miuizer_marknewmods", "2")));
}
@ -674,7 +680,7 @@ public class Helpers {
return context.getPackageManager().checkPermission("android.permission.INTERACT_ACROSS_USERS", Helpers.modulePkg) == PackageManager.PERMISSION_GRANTED;
}
@SuppressWarnings({"JavaReflectionInvocation"})
@SuppressWarnings({"JavaReflectionInvocation", "ConstantConditions"})
@SuppressLint({"PrivateApi", "DiscouragedPrivateApi"})
public static float getAnimationScale(int type) {
try {
@ -697,7 +703,7 @@ public class Helpers {
}
}
@SuppressWarnings({"JavaReflectionInvocation"})
@SuppressWarnings({"JavaReflectionInvocation", "ConstantConditions"})
@SuppressLint({"PrivateApi", "DiscouragedPrivateApi"})
public static void setAnimationScale(int type, float value) {
try {
@ -1015,6 +1021,7 @@ public class Helpers {
}
}
@SuppressWarnings("ConstantConditions")
public static Pair<String, String> getActionNameLocal(Context context, String key) {
try {
int action = prefs.getInt(key + "_action", 1);
@ -1072,6 +1079,7 @@ public class Helpers {
}
}
@SuppressWarnings("ConstantConditions")
public static Drawable getActionImageLocal(Context context, String key) {
try {
int action = prefs.getInt(key + "_action", 1);
@ -1317,7 +1325,7 @@ public class Helpers {
public static synchronized Context getLocaleContext(Context context) throws Throwable {
if (prefs != null) {
String locale = prefs.getString("pref_key_miuizer_locale", "auto");
if ("auto".equals(locale) || "1".equals(locale)) return context;
if (locale == null || "auto".equals(locale) || "1".equals(locale)) return context;
Configuration config = context.getResources().getConfiguration();
config.setLocale(Locale.forLanguageTag(locale));
return context.createConfigurationContext(config);


+ 12
- 0
app/src/main/res/values-ru-rRU/strings.xml View File

@ -61,6 +61,8 @@
<string name="various_installappinfo_vercode">Код версии</string>
<string name="various_installappinfo_sdk">Поддержка SDK</string>
<string name="various_installappinfo_current">текущая</string>
<string name="various_gboardpadding_port_title">Нижний отступ в портретном режиме</string>
<string name="various_gboardpadding_land_title">Нижний отступ в ландшафтном режиме</string>
<string name="various_showcallui_title">Показывать интерфейс звонка</string>
<string name="various_showcallui_summ">Задаёт когда показывать интерфейс входящего звонка вместо всплывающего уведомления</string>
<string name="various_calluibright_title">Яркость экрана во время звонка</string>
@ -524,6 +526,7 @@
<string name="launcher_privacyapps_gest_summ">Отключает жест двумя пальцами для открытия папки со скрытыми приложениями</string>
<string name="launcher_privacyapps_list_title">Список приложений для скрытия</string>
<string name="launcher_privacyapps_list_summ">Улучшенная версия функции Скрытые приложения, позволяющая скрыть любое установленное приложение. Перезагрузка не требуется.</string>
<string name="gboard">Google Клавиатура</string>
<string name="calls">Звонки</string>
<string name="settings">Настройки</string>
<string name="support_repo_summ">Git репозиторий с исходниками и дистрибутивами модуля</string>
@ -612,6 +615,8 @@
<string name="system_betterpopups_delay_title">Задержка перед скрытием</string>
<string name="system_betterpopups_nohide_title">Не прятать автоматом</string>
<string name="system_betterpopups_nohide_summ">Отключает автоматическое скрытие</string>
<string name="system_betterpopups_allowfloat_title">Разрешить плавающее окно</string>
<string name="system_betterpopups_allowfloat_summ">Открывает приложение в плавающем окне по свайпу вниз, если у уведомления задано подходящее действие на нажатие</string>
<string name="system_betterpopups_swipedown_title">Активировать свайп вниз</string>
<string name="system_betterpopups_swipedown_summ">Открывает панель уведомлений по свайпу вниз</string>
<string name="system_mods_applock">Защита приложений</string>
@ -783,8 +788,15 @@
<string name="system_separatevolume_summ">Позволяет изменить громкость в Настройках отдельно для звонков/уведомлений/системных звуков</string>
<string name="system_separatevolume_slider_title">Ползунок громкости уведомлений</string>
<string name="system_separatevolume_slider_summ">Добавляет ползунок уведомлений в открытую панель громкости</string>
<string name="system_nomediamute_title">Не заглушать музыку</string>
<string name="system_nomediamute_summ">Предотвращает установку громкости музыки на ноль в режиме Не беспокоить</string>
<string name="system_dndtoggle_title">Переключатель режима Не беспокоить</string>
<string name="system_dndtoggle_summ">Кнопка в свёрнутом диалоге громкости переключает режим Не беспокоить вместо режима Без звука</string>
<string name="system_volumetimer_title">Расширенные таймеры</string>
<string name="system_volumetimer_summ">Добавляет больше интервалов в таймеры режимов Без звука и Не беспокоить</string>
<string name="system_volumedialogdelay_collapsed_title">Задержка перед автоскрытием диалога громкости</string>
<string name="system_volumedialogdelay_collapsed_summ">Свёрнутый</string>
<string name="system_volumedialogdelay_expanded_summ">Развёрнутый</string>
<string name="system_volumesteps_title">Множитель шагов громкости</string>
<string name="system_volumesteps_summ">Изменяет количество шагов громкости для всех типов потоков</string>
<string name="system_visualizer_title">Визуализация музыки</string>


+ 12
- 0
app/src/main/res/values/strings.xml View File

@ -186,8 +186,15 @@
<string name="system_separatevolume_summ">Allow to configure separate volume for rings/notifications/system sounds in Settings</string>
<string name="system_separatevolume_slider_title">Notification volume slider</string>
<string name="system_separatevolume_slider_summ">Add notification slider to expanded volume dialog</string>
<string name="system_nomediamute_title">No media mute</string>
<string name="system_nomediamute_summ">Do not set media volume to zero in Do Not Disturb mode</string>
<string name="system_dndtoggle_title">DND mode toggle</string>
<string name="system_dndtoggle_summ">Make button in collapsed volume dialog toggle Do Not Disturb mode instead of Silent mode</string>
<string name="system_volumetimer_title">Extended timers</string>
<string name="system_volumetimer_summ">Add more intervals to timers for Silent and Do Not Disturb modes</string>
<string name="system_volumedialogdelay_collapsed_title">Volume dialog autohide delay</string>
<string name="system_volumedialogdelay_collapsed_summ">Collapsed</string>
<string name="system_volumedialogdelay_expanded_summ">Expanded</string>
<string name="system_volumesteps_title">Volume steps multiplier</string>
<string name="system_volumesteps_summ">Change number of volume steps for each stream type</string>
<string name="system_visualizer_title">Music visualizer</string>
@ -380,6 +387,8 @@
<string name="system_betterpopups_delay_title">Auto hide delay</string>
<string name="system_betterpopups_nohide_title">No auto hide</string>
<string name="system_betterpopups_nohide_summ">Do not dismiss popups automatically</string>
<string name="system_betterpopups_allowfloat_title">Allow floating window</string>
<string name="system_betterpopups_allowfloat_summ">Open app in a floating window on swipe down gesture if notification has an appropriate click action defined</string>
<string name="system_betterpopups_swipedown_title">Enable swipe down</string>
<string name="system_betterpopups_swipedown_summ">Open notification drawer on swipe down gesture</string>
<string name="system_mods_applock">App lock</string>
@ -594,6 +603,8 @@
<string name="various_installappinfo_current">current</string>
<string name="various_alarmcompat_title">Alarm clock compatibility</string>
<string name="various_alarmcompat_summ">Make selected apps display correct next alarm time set by stock MIUI Clock app</string>
<string name="various_gboardpadding_port_title">Bottom padding in portrait</string>
<string name="various_gboardpadding_land_title">Bottom padding in landscape</string>
<string name="various_showcallui_title">Show call UI</string>
<string name="various_showcallui_summ">Define when UI for incoming call should be displayed instead of popup notification</string>
<string name="various_calluibright_title">Screen brightness during call</string>
@ -634,6 +645,7 @@
<string name="appsort_storage">Used storage</string>
<string name="appsort_install">Installation time</string>
<string name="gboard">Google Keyboard</string>
<string name="calls">Calls</string>
<string name="settings">Settings</string>


+ 47
- 0
app/src/main/res/xml/prefs_system.xml View File

@ -141,12 +141,45 @@
android:dependency="pref_key_system_separatevolume"
miuizer:child="true" />
<name.mikanoshi.customiuizer.prefs.CheckBoxPreferenceEx
android:key="pref_key_system_nomediamute"
android:title="@string/system_nomediamute_title"
android:summary="@string/system_nomediamute_summ"
android:defaultValue="false" />
<name.mikanoshi.customiuizer.prefs.CheckBoxPreferenceEx
android:key="pref_key_system_dndtoggle"
android:title="@string/system_dndtoggle_title"
android:summary="@string/system_dndtoggle_summ"
android:defaultValue="false" />
<name.mikanoshi.customiuizer.prefs.CheckBoxPreferenceEx
android:key="pref_key_system_volumetimer"
android:title="@string/system_volumetimer_title"
android:summary="@string/system_volumetimer_summ"
android:defaultValue="false" />
<name.mikanoshi.customiuizer.prefs.SeekBarPreference
android:key="pref_key_system_volumedialogdelay_collapsed"
android:title="@string/system_volumedialogdelay_collapsed_title"
android:summary="@string/system_volumedialogdelay_collapsed_summ"
android:defaultValue="0"
miuizer:minValue="0"
miuizer:maxValue="30000"
miuizer:stepValue="500"
miuizer:format="@string/format_d_ms"
miuizer:offtext="@string/array_default" />
<name.mikanoshi.customiuizer.prefs.SeekBarPreference
android:key="pref_key_system_volumedialogdelay_expanded"
android:summary="@string/system_volumedialogdelay_expanded_summ"
android:defaultValue="0"
miuizer:minValue="0"
miuizer:maxValue="30000"
miuizer:stepValue="500"
miuizer:format="@string/format_d_ms"
miuizer:offtext="@string/array_default" />
<name.mikanoshi.customiuizer.prefs.SeekBarPreference
android:key="pref_key_system_volumesteps"
android:title="@string/system_volumesteps_title"
@ -720,6 +753,20 @@
android:key="pref_key_system_cat_betterpopups"
android:title="@string/system_mods_betterpopups">
<name.mikanoshi.customiuizer.prefs.CheckBoxPreferenceEx
android:key="pref_key_system_betterpopups_allowfloat"
android:title="@string/system_betterpopups_allowfloat_title"
android:summary="@string/system_betterpopups_allowfloat_summ"
android:defaultValue="false" />
<name.mikanoshi.customiuizer.prefs.PreferenceEx
android:title="@string/system_popupnotif_apps_title"
android:key="pref_key_system_betterpopups_allowfloat_apps"
android:dependency="pref_key_system_betterpopups_allowfloat"
miuizer:dynamic="true"
miuizer:child="true"
miuizer:countAsSummary="true" />
<name.mikanoshi.customiuizer.prefs.CheckBoxPreferenceEx
android:key="pref_key_system_betterpopups_swipedown"
android:summary="@string/system_betterpopups_swipedown_summ"


+ 23
- 0
app/src/main/res/xml/prefs_various.xml View File

@ -86,4 +86,27 @@
miuizer:valueAsSummary="true"
miuizer:dynamic="true" />
<PreferenceCategory
android:title="@string/gboard"/>
<name.mikanoshi.customiuizer.prefs.SeekBarPreference
android:key="pref_key_various_gboardpadding_port"
android:title="@string/various_gboardpadding_port_title"
android:defaultValue="0"
miuizer:minValue="0"
miuizer:maxValue="100"
miuizer:stepValue="1"
miuizer:format="%d dip"
miuizer:offtext="@string/array_default" />
<name.mikanoshi.customiuizer.prefs.SeekBarPreference
android:key="pref_key_various_gboardpadding_land"
android:title="@string/various_gboardpadding_land_title"
android:defaultValue="0"
miuizer:minValue="0"
miuizer:maxValue="100"
miuizer:stepValue="1"
miuizer:format="%d dip"
miuizer:offtext="@string/array_default" />
</PreferenceScreen>

+ 1
- 1
last_build View File

@ -1 +1 @@
55
56

Loading…
Cancel
Save