From c1a0d6deff053aea7e6bbc9db11d19fee645a207 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Thu, 6 Jan 2022 03:05:05 +0500 Subject: [PATCH] Changed: Rename ActivityUtilsErrno to ActivityErrno --- .../{ActivityUtilsErrno.java => ActivityErrno.java} | 6 +++--- .../java/com/termux/shared/activity/ActivityUtils.java | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) rename termux-shared/src/main/java/com/termux/shared/activity/{ActivityUtilsErrno.java => ActivityErrno.java} (77%) diff --git a/termux-shared/src/main/java/com/termux/shared/activity/ActivityUtilsErrno.java b/termux-shared/src/main/java/com/termux/shared/activity/ActivityErrno.java similarity index 77% rename from termux-shared/src/main/java/com/termux/shared/activity/ActivityUtilsErrno.java rename to termux-shared/src/main/java/com/termux/shared/activity/ActivityErrno.java index 3c77cba9..96a0e9ce 100644 --- a/termux-shared/src/main/java/com/termux/shared/activity/ActivityUtilsErrno.java +++ b/termux-shared/src/main/java/com/termux/shared/activity/ActivityErrno.java @@ -2,9 +2,9 @@ package com.termux.shared.activity; import com.termux.shared.errors.Errno; -public class ActivityUtilsErrno extends Errno { +public class ActivityErrno extends Errno { - public static final String TYPE = "ActivityUtils Error"; + public static final String TYPE = "Activity Error"; /* Errors for starting activities (100-150) */ @@ -13,7 +13,7 @@ public class ActivityUtilsErrno extends Errno { public static final Errno ERRNO_STARTING_ACTIVITY_WITH_NULL_CONTEXT = new Errno(TYPE, 102, "Cannot start \"%1$s\" activity with null Context"); - ActivityUtilsErrno(final String type, final int code, final String message) { + ActivityErrno(final String type, final int code, final String message) { super(type, code, message); } diff --git a/termux-shared/src/main/java/com/termux/shared/activity/ActivityUtils.java b/termux-shared/src/main/java/com/termux/shared/activity/ActivityUtils.java index 89f2205e..0ff28126 100644 --- a/termux-shared/src/main/java/com/termux/shared/activity/ActivityUtils.java +++ b/termux-shared/src/main/java/com/termux/shared/activity/ActivityUtils.java @@ -34,7 +34,6 @@ public class ActivityUtils { * in addition to logging a message. The {@code context} must not be * {@code null}. * @return Returns the {@code error} if starting activity was not successful, otherwise {@code null}. - */ public static Error startActivity(Context context, @NonNull Intent intent, boolean logErrorMessage, boolean showErrorMessage) { @@ -42,7 +41,7 @@ public class ActivityUtils { String activityName = intent.getComponent() != null ? intent.getComponent().getClassName() : "Unknown"; if (context == null) { - error = ActivityUtilsErrno.ERRNO_STARTING_ACTIVITY_WITH_NULL_CONTEXT.getError(activityName); + error = ActivityErrno.ERRNO_STARTING_ACTIVITY_WITH_NULL_CONTEXT.getError(activityName); if (logErrorMessage) error.logErrorAndShowToast(null, LOG_TAG); return error; @@ -51,7 +50,7 @@ public class ActivityUtils { try { context.startActivity(intent); } catch (Exception e) { - error = ActivityUtilsErrno.ERRNO_START_ACTIVITY_FAILED_WITH_EXCEPTION.getError(e, activityName, e.getMessage()); + error = ActivityErrno.ERRNO_START_ACTIVITY_FAILED_WITH_EXCEPTION.getError(e, activityName, e.getMessage()); if (logErrorMessage) error.logErrorAndShowToast(showErrorMessage ? context : null, LOG_TAG); return error; @@ -97,7 +96,6 @@ public class ActivityUtils { * used instead. * Note that later is deprecated. * @return Returns the {@code error} if starting activity was not successful, otherwise {@code null}. - */ public static Error startActivityForResult(Context context, int requestCode, @NonNull Intent intent, boolean logErrorMessage, boolean showErrorMessage, @@ -109,7 +107,7 @@ public class ActivityUtils { activityResultLauncher.launch(intent); } else { if (context == null) { - error = ActivityUtilsErrno.ERRNO_STARTING_ACTIVITY_WITH_NULL_CONTEXT.getError(activityName); + error = ActivityErrno.ERRNO_STARTING_ACTIVITY_WITH_NULL_CONTEXT.getError(activityName); if (logErrorMessage) error.logErrorAndShowToast(null, LOG_TAG); return error; @@ -127,7 +125,7 @@ public class ActivityUtils { } } } catch (Exception e) { - error = ActivityUtilsErrno.ERRNO_START_ACTIVITY_FOR_RESULT_FAILED_WITH_EXCEPTION.getError(e, activityName, e.getMessage()); + error = ActivityErrno.ERRNO_START_ACTIVITY_FOR_RESULT_FAILED_WITH_EXCEPTION.getError(e, activityName, e.getMessage()); if (logErrorMessage) error.logErrorAndShowToast(showErrorMessage ? context : null, LOG_TAG); return error;