From 44d1c7a093932012982b680aed4ee3945a750264 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Wed, 20 May 2026 16:29:13 +0200 Subject: [PATCH] chore: format java code --- .../capacitorjs/plugins/app/AppPlugin.java | 24 ++++---- .../LocalNotificationsPlugin.java | 2 +- .../PushNotificationsPlugin.java | 2 +- .../plugins/splashscreen/SplashScreen.java | 59 ++++++++----------- 4 files changed, 37 insertions(+), 50 deletions(-) diff --git a/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java b/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java index f14286f26..51c5d01b7 100644 --- a/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java +++ b/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java @@ -33,20 +33,16 @@ public class AppPlugin extends Plugin { public void load() { boolean disableBackButtonHandler = getConfig().getBoolean("disableBackButtonHandler", false); - bridge - .getApp() - .setStatusChangeListener((isActive) -> { - Logger.debug(getLogTag(), "Firing change: " + isActive); - JSObject data = new JSObject(); - data.put("isActive", isActive); - notifyListeners(EVENT_STATE_CHANGE, data, false); - }); - bridge - .getApp() - .setAppRestoredListener((result) -> { - Logger.debug(getLogTag(), "Firing restored result"); - notifyListeners(EVENT_RESTORED_RESULT, result.getWrappedResult(), true); - }); + bridge.getApp().setStatusChangeListener((isActive) -> { + Logger.debug(getLogTag(), "Firing change: " + isActive); + JSObject data = new JSObject(); + data.put("isActive", isActive); + notifyListeners(EVENT_STATE_CHANGE, data, false); + }); + bridge.getApp().setAppRestoredListener((result) -> { + Logger.debug(getLogTag(), "Firing restored result"); + notifyListeners(EVENT_RESTORED_RESULT, result.getWrappedResult(), true); + }); this.onBackPressedCallback = new OnBackPressedCallback(!disableBackButtonHandler) { @Override public void handleOnBackPressed() { diff --git a/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationsPlugin.java b/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationsPlugin.java index 197de4ae6..fa5352ee8 100644 --- a/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationsPlugin.java +++ b/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationsPlugin.java @@ -32,7 +32,7 @@ @CapacitorPlugin( name = "LocalNotifications", - permissions = @Permission(strings = { Manifest.permission.POST_NOTIFICATIONS }, alias = LocalNotificationsPlugin.LOCAL_NOTIFICATIONS) + permissions = @Permission(strings = {Manifest.permission.POST_NOTIFICATIONS}, alias = LocalNotificationsPlugin.LOCAL_NOTIFICATIONS) ) public class LocalNotificationsPlugin extends Plugin { diff --git a/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java b/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java index 6d339d6df..3c652cf4a 100644 --- a/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java +++ b/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java @@ -26,7 +26,7 @@ @CapacitorPlugin( name = "PushNotifications", - permissions = @Permission(strings = { Manifest.permission.POST_NOTIFICATIONS }, alias = PushNotificationsPlugin.PUSH_NOTIFICATIONS) + permissions = @Permission(strings = {Manifest.permission.POST_NOTIFICATIONS}, alias = PushNotificationsPlugin.PUSH_NOTIFICATIONS) ) public class PushNotificationsPlugin extends Plugin { diff --git a/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreen.java b/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreen.java index af87b3ecf..30aa8f3ae 100644 --- a/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreen.java +++ b/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreen.java @@ -138,17 +138,14 @@ public boolean onPreDraw() { if (!isVisible && !isHiding) { isVisible = true; - new Handler(context.getMainLooper()).postDelayed( - () -> { - // Splash screen is done... start drawing content. - if (settings.isAutoHide()) { - isVisible = false; - onPreDrawListener = null; - content.getViewTreeObserver().removeOnPreDrawListener(this); - } - }, - settings.getShowDuration() - ); + new Handler(context.getMainLooper()).postDelayed(() -> { + // Splash screen is done... start drawing content. + if (settings.isAutoHide()) { + isVisible = false; + onPreDrawListener = null; + content.getViewTreeObserver().removeOnPreDrawListener(this); + } + }, settings.getShowDuration()); } // Not ready to dismiss splash screen @@ -225,16 +222,13 @@ private void showDialog( isVisible = true; if (settings.isAutoHide()) { - new Handler(context.getMainLooper()).postDelayed( - () -> { - hideDialog(activity, isLaunchSplash); + new Handler(context.getMainLooper()).postDelayed(() -> { + hideDialog(activity, isLaunchSplash); - if (splashListener != null) { - splashListener.completed(); - } - }, - settings.getShowDuration() - ); + if (splashListener != null) { + splashListener.completed(); + } + }, settings.getShowDuration()); } else { // If no autoHide, call complete if (splashListener != null) { @@ -344,12 +338,12 @@ private void buildViews() { Integer spinnerBarColor = config.getSpinnerColor(); if (spinnerBarColor != null) { int[][] states = new int[][] { - new int[] { android.R.attr.state_enabled }, // enabled - new int[] { -android.R.attr.state_enabled }, // disabled - new int[] { -android.R.attr.state_checked }, // unchecked - new int[] { android.R.attr.state_pressed } // pressed + new int[] {android.R.attr.state_enabled}, // enabled + new int[] {-android.R.attr.state_enabled}, // disabled + new int[] {-android.R.attr.state_checked}, // unchecked + new int[] {android.R.attr.state_pressed} // pressed }; - int[] colors = new int[] { spinnerBarColor, spinnerBarColor, spinnerBarColor, spinnerBarColor }; + int[] colors = new int[] {spinnerBarColor, spinnerBarColor, spinnerBarColor, spinnerBarColor}; ColorStateList colorStateList = new ColorStateList(states, colors); spinnerBar.setIndeterminateTintList(colorStateList); } @@ -397,16 +391,13 @@ public void onAnimationEnd(Animator animator) { isVisible = true; if (settings.isAutoHide()) { - new Handler(context.getMainLooper()).postDelayed( - () -> { - hide(settings.getFadeOutDuration(), isLaunchSplash); + new Handler(context.getMainLooper()).postDelayed(() -> { + hide(settings.getFadeOutDuration(), isLaunchSplash); - if (splashListener != null) { - splashListener.completed(); - } - }, - settings.getShowDuration() - ); + if (splashListener != null) { + splashListener.completed(); + } + }, settings.getShowDuration()); } else { // If no autoHide, call complete if (splashListener != null) {