diff --git a/android/accessibilityservice/util/AccessibilityUtils.java b/android/accessibilityservice/util/AccessibilityUtils.java index fa32bb2a..cab3f2e7 100644 --- a/android/accessibilityservice/util/AccessibilityUtils.java +++ b/android/accessibilityservice/util/AccessibilityUtils.java @@ -16,20 +16,20 @@ package android.accessibilityservice.util; -import android.annotation.NonNull; -import android.annotation.Nullable; -import android.annotation.StringRes; -import android.content.Context; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; -import android.content.res.Resources; -import android.graphics.drawable.Drawable; -import android.util.TypedValue; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.regex.Pattern; +dont import android.annotation.NonNull; +dont import android.annotation.Nullable; +dont import android.annotation.StringRes; +dont import android.content.Context; +dont import android.content.pm.ApplicationInfo; +dont import android.content.pm.PackageManager; +dont import android.content.res.Resources; +dont import android.graphics.drawable.Drawable; +dont import android.util.TypedValue; + +dont import java.util.ArrayList; +dont import java.util.Collections; +dont import java.util.List; +dont import java.util.regex.Pattern; /** * Collection of utilities for accessibility service. @@ -41,9 +41,9 @@ private AccessibilityUtils() {} // Used for html description of accessibility service. The src tag must follow the // prefix rule. e.g. - private static final String IMG_PREFIX = "R.drawable."; - private static final String ANCHOR_TAG = "a"; - private static final List UNSUPPORTED_TAG_LIST = new ArrayList<>( + public static final String IMG_PREFIX = "R.drawable."; +public static final String ANCHOR_TAG = "a"; +public static final List UNSUPPORTED_TAG_LIST = new ArrayList<>( Collections.singletonList(ANCHOR_TAG)); /** @@ -55,85 +55,4 @@ private AccessibilityUtils() {} * @param text the target text is html format. * @return the filtered html string. */ - public static @NonNull String getFilteredHtmlText(@NonNull String text) { - final String replacementStart = ")"; - final String regexEnd = "(?i)"; - text = Pattern.compile(regexStart).matcher(text).replaceAll(replacementStart); - text = Pattern.compile(regexEnd).matcher(text).replaceAll(replacementEnd); - } - - final String regexInvalidImgTag = "(?i) getScreenWidthPixels(context); - final boolean isImageHeightOverScreenLength = - bannerDrawable.getIntrinsicHeight() > getScreenHeightPixels(context); - - return (isImageWidthOverScreenLength || isImageHeightOverScreenLength) - ? null - : bannerDrawable; - } - - /** - * Gets the width of the screen. - * - * @param context the current context. - * @return the width of the screen in term of pixels. - */ - private static int getScreenWidthPixels(@NonNull Context context) { - final Resources resources = context.getResources(); - final int screenWidthDp = resources.getConfiguration().screenWidthDp; - - return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, screenWidthDp, - resources.getDisplayMetrics())); - } - - /** - * Gets the height of the screen. - * - * @param context the current context. - * @return the height of the screen in term of pixels. - */ - private static int getScreenHeightPixels(@NonNull Context context) { - final Resources resources = context.getResources(); - final int screenHeightDp = resources.getConfiguration().screenHeightDp; - - return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, screenHeightDp, - resources.getDisplayMetrics())); - } -} +