From b3e78419049306eb9df1d44b5390b72b774e20ca Mon Sep 17 00:00:00 2001 From: Pranav Pandey Date: Sun, 8 Aug 2021 03:58:16 +0530 Subject: [PATCH] Refactor `utils` package to `util` --- dynamic-utils/src/main/AndroidManifest.xml | 2 +- .../{utils => util}/DynamicAnimUtils.java | 2 +- .../{utils => util}/DynamicBitmapUtils.java | 15 ++- .../{utils => util}/DynamicColorUtils.java | 4 +- .../{utils => util}/DynamicDeviceUtils.java | 2 +- .../{utils => util}/DynamicDrawableUtils.java | 2 +- .../{utils => util}/DynamicFileUtils.java | 86 ++++++------- .../dynamic/util/DynamicInputUtils.java | 114 ++++++++++++++++++ .../{utils => util}/DynamicIntentUtils.java | 10 +- .../{utils => util}/DynamicLinkUtils.java | 66 +++++++--- .../{utils => util}/DynamicPackageUtils.java | 2 +- .../{utils => util}/DynamicSdkUtils.java | 2 +- .../{utils => util}/DynamicTaskUtils.java | 12 +- .../{utils => util}/DynamicTextUtils.java | 2 +- .../{utils => util}/DynamicUnitUtils.java | 2 +- .../{utils => util}/DynamicViewUtils.java | 2 +- .../{utils => util}/DynamicWindowUtils.java | 2 +- .../{utils => util}/cache/BitmapLruCache.java | 2 +- .../cache/DrawableLruCache.java | 2 +- .../cache/DynamicLruCache.java | 2 +- .../cache/IntegerLruCache.java | 2 +- .../concurrent/DynamicCallable.java | 2 +- .../concurrent/DynamicCallback.java | 2 +- .../concurrent/DynamicConcurrent.java | 2 +- .../concurrent/DynamicExecutor.java | 2 +- .../concurrent/DynamicHandler.java | 6 +- .../concurrent/DynamicResult.java | 2 +- .../concurrent/DynamicRunnable.java | 2 +- .../concurrent/DynamicStatus.java | 2 +- .../concurrent/DynamicTask.java | 4 +- .../concurrent/task/ContextTask.java | 4 +- .../concurrent/task/FileDeleteTask.java | 4 +- .../concurrent/task/FileWriteTask.java | 18 +-- .../{utils => util}/loader/DynamicLoader.java | 14 +-- .../loader/handler/ImageViewHandler.java | 4 +- .../loader/handler/TextViewHandler.java | 4 +- .../watcher/DynamicTextWatcher.java | 2 +- .../res/values/donottranslate-strings.xml | 3 +- 38 files changed, 283 insertions(+), 129 deletions(-) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicAnimUtils.java (96%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicBitmapUtils.java (96%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicColorUtils.java (99%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicDeviceUtils.java (99%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicDrawableUtils.java (99%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicFileUtils.java (93%) create mode 100644 dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicInputUtils.java rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicIntentUtils.java (97%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicLinkUtils.java (87%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicPackageUtils.java (99%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicSdkUtils.java (99%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicTaskUtils.java (89%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicTextUtils.java (97%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicUnitUtils.java (98%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicViewUtils.java (99%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/DynamicWindowUtils.java (99%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/cache/BitmapLruCache.java (95%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/cache/DrawableLruCache.java (97%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/cache/DynamicLruCache.java (97%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/cache/IntegerLruCache.java (95%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/DynamicCallable.java (95%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/DynamicCallback.java (97%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/DynamicConcurrent.java (99%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/DynamicExecutor.java (97%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/DynamicHandler.java (93%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/DynamicResult.java (98%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/DynamicRunnable.java (99%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/DynamicStatus.java (94%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/DynamicTask.java (99%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/task/ContextTask.java (92%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/task/FileDeleteTask.java (92%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/concurrent/task/FileWriteTask.java (79%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/loader/DynamicLoader.java (93%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/loader/handler/ImageViewHandler.java (94%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/loader/handler/TextViewHandler.java (94%) rename dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/{utils => util}/watcher/DynamicTextWatcher.java (98%) diff --git a/dynamic-utils/src/main/AndroidManifest.xml b/dynamic-utils/src/main/AndroidManifest.xml index 039e9e8..494b795 100644 --- a/dynamic-utils/src/main/AndroidManifest.xml +++ b/dynamic-utils/src/main/AndroidManifest.xml @@ -17,7 +17,7 @@ + package="com.pranavpandey.android.dynamic.util"> diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicAnimUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicAnimUtils.java similarity index 96% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicAnimUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicAnimUtils.java index dd534ea..9895774 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicAnimUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicAnimUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.animation.AnimatorInflater; import android.animation.AnimatorSet; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicBitmapUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicBitmapUtils.java similarity index 96% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicBitmapUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicBitmapUtils.java index ac5e9bd..8141abe 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicBitmapUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicBitmapUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.annotation.TargetApi; import android.content.Context; @@ -45,12 +45,12 @@ public class DynamicBitmapUtils { /** - * Retrieve the bitmap from the supplied uri. + * Retrieve the bitmap from the supplied URI. * * @param context The context to get the content resolver. - * @param uri The uri to retrieve the bitmap. + * @param uri The URI to retrieve the bitmap. * - * @return The bitmap from the supplied uri. + * @return The bitmap from the supplied URI. * * @see Context#getContentResolver() */ @@ -156,11 +156,14 @@ public class DynamicBitmapUtils { * * @return The resized bitmap with new width and height. */ - public static @NonNull Bitmap resizeBitmap(@NonNull Bitmap bitmap, + public static @Nullable Bitmap resizeBitmap(@Nullable Bitmap bitmap, int newWidth, int newHeight) { + if (bitmap == null) { + return null; + } + Bitmap resizedBitmap = Bitmap.createBitmap( newWidth, newHeight, Bitmap.Config.ARGB_8888); - float scaleX = newWidth / (float) bitmap.getWidth(); float scaleY = newHeight / (float) bitmap.getHeight(); float pivotX = 0; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicColorUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicColorUtils.java similarity index 99% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicColorUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicColorUtils.java index 0c3ce23..0f4c519 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicColorUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicColorUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.graphics.Color; @@ -25,7 +25,7 @@ import androidx.annotation.Size; import androidx.core.graphics.ColorUtils; -import com.pranavpandey.android.dynamic.utils.cache.IntegerLruCache; +import com.pranavpandey.android.dynamic.util.cache.IntegerLruCache; import java.util.Random; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicDeviceUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicDeviceUtils.java similarity index 99% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicDeviceUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicDeviceUtils.java index 6aaee3d..0525d7f 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicDeviceUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicDeviceUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.Manifest; import android.annotation.TargetApi; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicDrawableUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicDrawableUtils.java similarity index 99% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicDrawableUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicDrawableUtils.java index 79a5d20..9fdd5a2 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicDrawableUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicDrawableUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.annotation.TargetApi; import android.graphics.Color; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicFileUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicFileUtils.java similarity index 93% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicFileUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicFileUtils.java index 2606567..99b3ea9 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicFileUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicFileUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.annotation.TargetApi; import android.app.Activity; @@ -72,12 +72,12 @@ public class DynamicFileUtils { public static final String FILE_PROVIDER = ".FileProvider"; /** - * Constant to match the content uri. + * Constant to match the content URI. */ public static final String URI_MATCHER_CONTENT = "content:"; /** - * Constant to match the file uri. + * Constant to match the file URI. */ public static final String URI_MATCHER_FILE = "file:"; @@ -346,13 +346,13 @@ public static void unzip(@NonNull File zip, @NonNull File extractTo) } /** - * Returns uri from the file. + * Returns URI from the file. *

It will automatically use the @link FileProvider} on API 24 and above. * * @param context The context to get the file provider. - * @param file The file to get the uri. + * @param file The file to get the URI. * - * @return The uri from the file. + * @return The URI from the file. * * @see Uri */ @@ -370,12 +370,12 @@ public static void unzip(@NonNull File zip, @NonNull File extractTo) } /** - * Returns file name from the uri. + * Returns file name from the URI. * * @param context The context to get content resolver. - * @param uri The uri to get the file name. + * @param uri The URI to get the file name. * - * @return The file name from the uri. + * @return The file name from the URI. * * @see Context#getContentResolver() */ @@ -456,11 +456,11 @@ public static boolean writeToFile(@NonNull File source, } /** - * Writes a file uri from the source to destination. + * Writes a file URI from the source to destination. * * @param context The context to get content resolver. - * @param sourceUri The source file uri. - * @param destinationUri The destination file uri. + * @param sourceUri The source file URI. + * @param destinationUri The destination file URI. * @param mode Mode for the destination file. *

May be "w", "wa", "rw", or "rwt". * @@ -506,12 +506,12 @@ public static boolean writeToFile(@NonNull Context context, } /** - * Writes a file uri from the source to destination in "rwt" mode which truncates all the - * previous content if the destination uri already exists. + * Writes a file URI from the source to destination in "rwt" mode which truncates all the + * previous content if the destination URI already exists. * * @param context The context to get content resolver. - * @param sourceUri The source file uri. - * @param destinationUri The destination file uri. + * @param sourceUri The source file URI. + * @param destinationUri The destination file URI. * * @return {@code true} if the file has been written successfully. * @@ -523,12 +523,12 @@ public static boolean writeToFile(@NonNull Context context, } /** - * Writes a string data to file uri from the source to destination. + * Writes a string data to file URI from the source to destination. * * @param context The context to get content resolver. * @param data The string data to be written. - * @param sourceUri The source file uri. - * @param destinationUri The destination file uri. + * @param sourceUri The source file URI. + * @param destinationUri The destination file URI. * @param mode Mode for the destination file. *

May be "w", "wa", "rw", or "rwt". * @@ -573,13 +573,13 @@ public static boolean writeStringToFile(@NonNull Context context, @Nullable Stri } /** - * Writes a string data to file uri from the source to destination in "rwt" mode which - * truncates all the previous content if the destination uri already exists. + * Writes a string data to file URI from the source to destination in "rwt" mode which + * truncates all the previous content if the destination URI already exists. * * @param context The context to get content resolver. * @param data The string data to be written. - * @param sourceUri The source file uri. - * @param destinationUri The destination file uri. + * @param sourceUri The source file URI. + * @param destinationUri The destination file URI. * * @return {@code true} if the file has been written successfully. * @@ -591,11 +591,11 @@ public static boolean writeStringToFile(@NonNull Context context, } /** - * Writes a string data to file uri. + * Writes a string data to file URI. * * @param context The context to get content resolver. * @param data The string data to be written. - * @param sourceUri The source file uri. + * @param sourceUri The source file URI. * * @return {@code true} if the file has been written successfully. * @@ -607,10 +607,10 @@ public static boolean writeStringToFile(@NonNull Context context, } /** - * Reads a string data from the file uri. + * Reads a string data from the file URI. * * @param context The context to get content resolver. - * @param fileUri The source file uri. + * @param fileUri The source file URI. * * @return The string data after reading the file. */ @@ -645,18 +645,18 @@ public static boolean writeStringToFile(@NonNull Context context, } /** - * Save and returns uri from the bitmap. + * Save and returns URI from the bitmap. *

It will automatically use the @link FileProvider} on API 24 and above. * *

It requires {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission on * API 18 and below. * * @param context The context to get the file provider. - * @param bitmap The bitmap to get the uri. + * @param bitmap The bitmap to get the URI. * @param name The name for the file. * @param extension The extension for the file. * - * @return The uri from the bitmap. + * @return The URI from the bitmap. * * @see Uri */ @@ -688,17 +688,17 @@ public static boolean writeStringToFile(@NonNull Context context, } /** - * Save and returns uri from the bitmap. + * Save and returns URI from the bitmap. *

It will automatically use the @link FileProvider} on API 24 and above. * *

It requires {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission on * API 18 and below. * * @param context The context to get the file provider. - * @param bitmap The bitmap to get the uri. + * @param bitmap The bitmap to get the URI. * @param name The name for the file. * - * @return The uri from the bitmap. + * @return The URI from the bitmap. * * @see Uri */ @@ -742,13 +742,13 @@ public static boolean isValidExtension(@Nullable Context context, } /** - * Checks whether the extension is valid for a uri. + * Checks whether the extension is valid for a URI. * * @param context The context to retrieve the resources. - * @param uri The uri to get the extension. + * @param uri The URI to get the extension. * @param extension The extension to be validated. * - * @return {@code true} if the extension is valid for the uri. + * @return {@code true} if the extension is valid for the URI. */ public static boolean isValidExtension(@Nullable Context context, @Nullable Uri uri, @Nullable String extension) { @@ -782,7 +782,7 @@ public static boolean isValidExtension(@Nullable Context context, /** * Checks whether the mime type is valid for an intent data. * - * @param context The context to match the uri mime type. + * @param context The context to match the URI mime type. * @param intent The intent to get the data. * @param mimeType The mime type to be validated. * @param extension The optional extension to be validated if mime type is invalid. @@ -815,10 +815,10 @@ && isValidExtension(context, } /** - * Checks whether the mime type is valid for a uri. + * Checks whether the mime type is valid for a URI. * * @param context The context to get the content resolver. - * @param uri The uri to get the type. + * @param uri The URI to get the type. * @param mimeType The mime type to be validated. * @param extension The optional extension to be validated if mime type is invalid. * @@ -847,7 +847,7 @@ public static boolean isValidMimeType(@Nullable Context context, * Checks whether the mime type is valid for a file. * * @param context The context to get the content resolver. - * @param file The file to get the uri. + * @param file The file to get the URI. * @param mimeType The mime type to be validated. * @param extension The optional extension to be validated if mime type is invalid. * @@ -917,8 +917,8 @@ public static void shareFiles(@NonNull Activity activity, @Nullable String title /** * Returns an intent to request a storage location for the supplied file. * - * @param context The context to get the file uri. - * @param file The file uri to request the storage location. + * @param context The context to get the file URI. + * @param file The file URI to request the storage location. * @param mimeType The mime type of the file. * * @return The intent to request a storage location for the supplied file. @@ -949,7 +949,7 @@ public static void shareFiles(@NonNull Activity activity, @Nullable String title /** * Returns an intent to request a storage location for the supplied file. * - * @param context The context to get the file uri. + * @param context The context to get the file URI. * @param file The file to request the storage location. * @param mimeType The mime type of the file. * diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicInputUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicInputUtils.java new file mode 100644 index 0000000..930b224 --- /dev/null +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicInputUtils.java @@ -0,0 +1,114 @@ +/* + * Copyright 2017-2021 Pranav Pandey + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.pranavpandey.android.dynamic.util; + +import android.text.InputFilter; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Helper class to perform input operations. + */ +public class DynamicInputUtils { + + /** + * Set the input filter for the supplied view. + * + * @param view The view to be used. + * @param filter The input filter to be set. + */ + public static void setFilter(@Nullable View view, @Nullable InputFilter filter) { + if (filter == null) { + return; + } + + if (view instanceof TextView) { + InputFilter[] filters = ((TextView) view).getFilters(); + if (filters == null) { + filters = new InputFilter[1]; + } + + List filtersList = new ArrayList<>(Arrays.asList(filters)); + filtersList.add(filter); + + ((TextView) view).setFilters(filtersList.toArray(new InputFilter[0])); + } + } + + /** + * Remove the input filter for the supplied view. + * + * @param view The view to be used. + * @param filter The input filter to be removed. + */ + public static void removeFilter(@Nullable View view, @Nullable InputFilter filter) { + if (filter == null) { + return; + } + + if (view instanceof TextView) { + InputFilter[] filters = ((TextView) view).getFilters(); + if (filters == null) { + filters = new InputFilter[1]; + } + + List filtersList = new ArrayList<>(Arrays.asList(filters)); + for (InputFilter inputFilter : filtersList) { + if (inputFilter.getClass().isInstance(filter)) { + filtersList.remove(inputFilter); + } + } + + ((TextView) view).setFilters(filtersList.toArray(new InputFilter[0])); + } + } + + /** + * Set the maximum length input filter for the supplied view. + * + * @param view The view to be used. + * @param length The maximum length to be set. + * + * @see #setFilter(View, InputFilter) + */ + public static void setMaxLength(@Nullable View view, int length) { + setFilter(view, new InputFilter.LengthFilter(length)); + } + + /** + * Set the all caps input filter for the supplied view. + * + * @param view The view to be used. + * @param allCaps {@code true} to set all caps. + * + * @see #setFilter(View, InputFilter) + * @see #removeFilter(View, InputFilter) + */ + public static void setAllCaps(@Nullable View view, boolean allCaps) { + if (allCaps) { + setFilter(view, new InputFilter.AllCaps()); + } else { + removeFilter(view, new InputFilter.AllCaps()); + } + } +} diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicIntentUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicIntentUtils.java similarity index 97% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicIntentUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicIntentUtils.java index 148de1e..8e6031c 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicIntentUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicIntentUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.annotation.TargetApi; import android.app.PendingIntent; @@ -109,12 +109,12 @@ public class DynamicIntentUtils { } /** - * Returns the intent stream or data uri according to the supplied action. + * Returns the intent stream or data URI according to the supplied action. * - * @param intent The intent to get the uri. - * @param action The action to return stream uri. + * @param intent The intent to get the URI. + * @param action The action to return stream URI. * - * @return The intent uri according to the stream or data. + * @return The intent URI according to the stream or data. * * @see Intent#EXTRA_STREAM * @see Intent#getData() diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicLinkUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicLinkUtils.java similarity index 87% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicLinkUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicLinkUtils.java index 32f6a80..36a9126 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicLinkUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicLinkUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.app.ApplicationErrorReport; import android.content.ClipData; @@ -36,12 +36,12 @@ public class DynamicLinkUtils { /** - * Android Market app url template to open app details on older devices. + * Android Market app URL template to open app details on older devices. */ private static final String URL_MARKET = "market://details?id="; /** - * Google Play app url template to open app details on newer devices. + * Google Play app URL template to open app details on newer devices. */ private static final String URL_PLAY_STORE = "http://play.google.com/store/apps/details?id="; @@ -97,7 +97,7 @@ public static boolean copyToClipboard(@NonNull Context context, * @param title The application chooser title if more than one apps are available. * @param message The default share message which user can modify. *

{@code null} to supply app and package name. - * @param uri The optional content uri to be shared. + * @param uri The optional content URI to be shared. * @param mimeType The optional mime type for the file. * * @return {@code true} on successful operation. @@ -149,7 +149,7 @@ public static boolean share(@Nullable Context context, @Nullable String title, * @param title The application chooser title if more than one apps are available. * @param message The default share message which user can modify. *

{@code null} to supply app and package name. - * @param image The optional image bitmap uri to be shared. + * @param image The optional image bitmap URI to be shared. * * @return {@code true} on successful operation. * @@ -206,9 +206,15 @@ public static boolean shareApp(@Nullable Context context) { * * @see Intent#ACTION_VIEW */ - public static boolean viewUrl(@Nullable Context context, @NonNull String url) { - return DynamicIntentUtils.viewIntent(context, - new Intent(Intent.ACTION_VIEW, Uri.parse(url))); + public static boolean viewUrl(@Nullable Context context, @Nullable String url) { + try { + return DynamicIntentUtils.viewIntent(context, + new Intent(Intent.ACTION_VIEW, Uri.parse(url))); + } catch (Exception e) { + e.printStackTrace(); + + return false; + } } /** @@ -333,6 +339,7 @@ public static boolean email(@Nullable Context context, @NonNull String email, * @param appName The app name for the email subject. *

{@code null} to get it from the supplied context. * @param email The email id of the developer. + * @param license {@code true} if the license is available on the devices. * * @return {@code true} on successful operation. * @@ -340,15 +347,18 @@ public static boolean email(@Nullable Context context, @NonNull String email, * @see MailTo#MAILTO_SCHEME */ public static boolean report(@Nullable Context context, - @Nullable String appName, @NonNull String email) { + @Nullable String appName, @NonNull String email, Boolean license) { if (context == null) { return false; } - String version = null; + String versionName = null; + int versionCode = 0; try { - version = context.getPackageManager().getPackageInfo( + versionName = context.getPackageManager().getPackageInfo( context.getPackageName(), PackageManager.GET_META_DATA).versionName; + versionCode = context.getPackageManager().getPackageInfo( + context.getPackageName(), PackageManager.GET_META_DATA).versionCode; } catch (Exception ignored) { } @@ -357,10 +367,36 @@ public static boolean report(@Nullable Context context, context.getPackageManager()).toString(); } - return email(context, email, String.format( - context.getResources().getString(R.string.adu_bug_title), appName, - version, Build.MANUFACTURER, Build.MODEL, Build.VERSION.RELEASE), - context.getResources().getString(R.string.adu_bug_desc)); + if (license != null) { + return email(context, email, String.format(context.getResources().getString( + R.string.adu_report_title_license), appName, versionName, versionCode, + license, Build.MANUFACTURER, Build.MODEL, Build.VERSION.RELEASE), + context.getResources().getString(R.string.adu_bug_desc)); + } else { + return email(context, email, String.format(context.getResources().getString( + R.string.adu_report_title), appName, versionName, versionCode, + Build.MANUFACTURER, Build.MODEL, Build.VERSION.RELEASE), + context.getResources().getString(R.string.adu_bug_desc)); + } + } + + /** + * Ask questions or submit bug report to the developer via email. + *

Subject of the email will be generated automatically by detecting the manufacturer, + * device, Android version and the app version along with the supplied app name. + * + * @param context The context to retrieve the resources. + * @param appName The app name for the email subject. + *

{@code null} to get it from the supplied context. + * @param email The email id of the developer. + * + * @return {@code true} on successful operation. + * + * @see #report(Context, String, String, Boolean) + */ + public static boolean report(@Nullable Context context, + @Nullable String appName, @NonNull String email) { + return report(context, appName, email, null); } /** diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicPackageUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicPackageUtils.java similarity index 99% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicPackageUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicPackageUtils.java index 78c0159..71be384 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicPackageUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicPackageUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.content.ComponentName; import android.content.Context; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicSdkUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicSdkUtils.java similarity index 99% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicSdkUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicSdkUtils.java index 6b58099..17dcbb4 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicSdkUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicSdkUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.annotation.TargetApi; import android.os.Build; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicTaskUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicTaskUtils.java similarity index 89% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicTaskUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicTaskUtils.java index 2cc9e16..43c69f4 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicTaskUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicTaskUtils.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.os.AsyncTask; import androidx.annotation.Nullable; -import com.pranavpandey.android.dynamic.utils.concurrent.DynamicConcurrent; -import com.pranavpandey.android.dynamic.utils.concurrent.DynamicStatus; -import com.pranavpandey.android.dynamic.utils.concurrent.DynamicTask; +import com.pranavpandey.android.dynamic.util.concurrent.DynamicConcurrent; +import com.pranavpandey.android.dynamic.util.concurrent.DynamicStatus; +import com.pranavpandey.android.dynamic.util.concurrent.DynamicTask; import java.util.concurrent.Executor; @@ -40,7 +40,7 @@ public class DynamicTaskUtils { * @see AsyncTask#executeOnExecutor(Executor, Object[]) * * @deprecated Use {@link #executeTask(DynamicTask)} or standard - * {@link java.util.concurrent} APIs. + * {@code java.util.concurrent} APIs. */ @SuppressWarnings("deprecation") public static void executeTask(@Nullable AsyncTask task) { @@ -64,7 +64,7 @@ public static void executeTask(@Nullable AsyncTask task) { * @see AsyncTask#cancel(boolean) * * @deprecated Use {@link #cancelTask(DynamicTask, boolean)} or standard - * {@link java.util.concurrent} APIs. + * {@code java.util.concurrent} APIs. */ @SuppressWarnings("deprecation") public static void cancelTask(@Nullable AsyncTask task) { diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicTextUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicTextUtils.java similarity index 97% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicTextUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicTextUtils.java index bad8aae..43dfe87 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicTextUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicTextUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.text.TextUtils; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicUnitUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicUnitUtils.java similarity index 98% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicUnitUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicUnitUtils.java index b5f165c..643c770 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicUnitUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicUnitUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.content.res.Resources; import android.util.TypedValue; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicViewUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicViewUtils.java similarity index 99% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicViewUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicViewUtils.java index d106bb4..24ae562 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicViewUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicViewUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.annotation.TargetApi; import android.os.Build; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicWindowUtils.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicWindowUtils.java similarity index 99% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicWindowUtils.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicWindowUtils.java index 3798921..7807255 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicWindowUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicWindowUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils; +package com.pranavpandey.android.dynamic.util; import android.annotation.TargetApi; import android.app.Activity; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/BitmapLruCache.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/BitmapLruCache.java similarity index 95% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/BitmapLruCache.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/BitmapLruCache.java index 7983802..173d8bc 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/BitmapLruCache.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/BitmapLruCache.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.cache; +package com.pranavpandey.android.dynamic.util.cache; import android.graphics.Bitmap; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/DrawableLruCache.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/DrawableLruCache.java similarity index 97% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/DrawableLruCache.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/DrawableLruCache.java index 0fb9bbf..5274438 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/DrawableLruCache.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/DrawableLruCache.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.cache; +package com.pranavpandey.android.dynamic.util.cache; import android.graphics.Bitmap; import android.graphics.Canvas; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/DynamicLruCache.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/DynamicLruCache.java similarity index 97% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/DynamicLruCache.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/DynamicLruCache.java index 5c96c9c..f1faf23 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/DynamicLruCache.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/DynamicLruCache.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.cache; +package com.pranavpandey.android.dynamic.util.cache; import androidx.collection.LruCache; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/IntegerLruCache.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/IntegerLruCache.java similarity index 95% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/IntegerLruCache.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/IntegerLruCache.java index b4d8769..2c26aa0 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/cache/IntegerLruCache.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/cache/IntegerLruCache.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.cache; +package com.pranavpandey.android.dynamic.util.cache; import androidx.annotation.NonNull; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicCallable.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicCallable.java similarity index 95% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicCallable.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicCallable.java index 9238b93..047d5d5 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicCallable.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicCallable.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent; +package com.pranavpandey.android.dynamic.util.concurrent; import androidx.annotation.Nullable; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicCallback.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicCallback.java similarity index 97% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicCallback.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicCallback.java index 8db7937..538d315 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicCallback.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicCallback.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent; +package com.pranavpandey.android.dynamic.util.concurrent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicConcurrent.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicConcurrent.java similarity index 99% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicConcurrent.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicConcurrent.java index 3a2da8c..7fc55e9 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicConcurrent.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicConcurrent.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent; +package com.pranavpandey.android.dynamic.util.concurrent; import android.os.Handler; import android.os.Looper; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicExecutor.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicExecutor.java similarity index 97% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicExecutor.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicExecutor.java index 8dbd5e3..e5692ba 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicExecutor.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicExecutor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent; +package com.pranavpandey.android.dynamic.util.concurrent; import androidx.annotation.NonNull; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicHandler.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicHandler.java similarity index 93% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicHandler.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicHandler.java index 1c48cbb..0f9f435 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicHandler.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent; +package com.pranavpandey.android.dynamic.util.concurrent; import android.os.Handler; import android.os.Looper; @@ -50,8 +50,8 @@ public class DynamicHandler extends Handler { /** * Message constant to set the content to {@code null} if not matched the criteria. * - * @see com.pranavpandey.android.dynamic.utils.loader.handler.ImageViewHandler - * @see com.pranavpandey.android.dynamic.utils.loader.handler.TextViewHandler + * @see com.pranavpandey.android.dynamic.util.loader.handler.ImageViewHandler + * @see com.pranavpandey.android.dynamic.util.loader.handler.TextViewHandler */ public static final int MESSAGE_NULL_IF_NOT = 0x3; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicResult.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicResult.java similarity index 98% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicResult.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicResult.java index 51af691..efd2159 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicResult.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicResult.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent; +package com.pranavpandey.android.dynamic.util.concurrent; import androidx.annotation.Nullable; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicRunnable.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicRunnable.java similarity index 99% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicRunnable.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicRunnable.java index 7c2fabd..83f6c63 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicRunnable.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicRunnable.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent; +package com.pranavpandey.android.dynamic.util.concurrent; import androidx.annotation.MainThread; import androidx.annotation.Nullable; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicStatus.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicStatus.java similarity index 94% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicStatus.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicStatus.java index 35473f0..8e46115 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicStatus.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicStatus.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent; +package com.pranavpandey.android.dynamic.util.concurrent; /** * Status constants to represent a asynchronous operation. diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicTask.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicTask.java similarity index 99% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicTask.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicTask.java index e2976a1..c15f22c 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/DynamicTask.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/DynamicTask.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent; +package com.pranavpandey.android.dynamic.util.concurrent; import android.os.Binder; import android.os.Looper; @@ -170,7 +170,7 @@ public boolean getBooleanResult(final @Nullable DynamicResult result) { success = (Boolean) result.getData(); } - return success != null; + return success != null && success; } /** diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/task/ContextTask.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/task/ContextTask.java similarity index 92% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/task/ContextTask.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/task/ContextTask.java index 311f009..5dc947d 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/task/ContextTask.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/task/ContextTask.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent.task; +package com.pranavpandey.android.dynamic.util.concurrent.task; import android.content.Context; import androidx.annotation.Nullable; -import com.pranavpandey.android.dynamic.utils.concurrent.DynamicTask; +import com.pranavpandey.android.dynamic.util.concurrent.DynamicTask; import java.lang.ref.WeakReference; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/task/FileDeleteTask.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/task/FileDeleteTask.java similarity index 92% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/task/FileDeleteTask.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/task/FileDeleteTask.java index 550f6c3..e016f1b 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/task/FileDeleteTask.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/task/FileDeleteTask.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent.task; +package com.pranavpandey.android.dynamic.util.concurrent.task; import androidx.annotation.Nullable; -import com.pranavpandey.android.dynamic.utils.concurrent.DynamicTask; +import com.pranavpandey.android.dynamic.util.concurrent.DynamicTask; import java.io.File; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/task/FileWriteTask.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/task/FileWriteTask.java similarity index 79% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/task/FileWriteTask.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/task/FileWriteTask.java index 294023c..76f8444 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/concurrent/task/FileWriteTask.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/concurrent/task/FileWriteTask.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.concurrent.task; +package com.pranavpandey.android.dynamic.util.concurrent.task; import android.content.Context; import android.net.Uri; import androidx.annotation.Nullable; -import com.pranavpandey.android.dynamic.utils.DynamicFileUtils; -import com.pranavpandey.android.dynamic.utils.concurrent.DynamicTask; +import com.pranavpandey.android.dynamic.util.DynamicFileUtils; +import com.pranavpandey.android.dynamic.util.concurrent.DynamicTask; /** * A {@link DynamicTask} to write a file {@link Uri} from source to the destination. @@ -43,8 +43,8 @@ public class FileWriteTask extends ContextTask { * Constructor to initialize an object of this class. * * @param context The context to get the content resolver. - * @param source The uri of the source file. - * @param destination The uri of the destination file. + * @param source The URI of the source file. + * @param destination The URI of the destination file. * * @see android.content.ContentResolver */ @@ -66,18 +66,18 @@ public FileWriteTask(@Nullable Context context, } /** - * Get the source uri used by this task. + * Get the source URI used by this task. * - * @return The source uri used by this task. + * @return The source URI used by this task. */ public @Nullable Uri getSource() { return mSource; } /** - * Get the destination uri used by this task. + * Get the destination URI used by this task. * - * @return The destination uri used by this task. + * @return The destination URI used by this task. */ public @Nullable Uri getDestination() { return mDestination; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/loader/DynamicLoader.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/loader/DynamicLoader.java similarity index 93% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/loader/DynamicLoader.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/loader/DynamicLoader.java index c38eda2..814ef45 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/loader/DynamicLoader.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/loader/DynamicLoader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.loader; +package com.pranavpandey.android.dynamic.util.loader; import android.content.Context; import android.graphics.drawable.Drawable; @@ -27,12 +27,12 @@ import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; -import com.pranavpandey.android.dynamic.utils.DynamicPackageUtils; -import com.pranavpandey.android.dynamic.utils.cache.DrawableLruCache; -import com.pranavpandey.android.dynamic.utils.concurrent.DynamicCallback; -import com.pranavpandey.android.dynamic.utils.concurrent.DynamicConcurrent; -import com.pranavpandey.android.dynamic.utils.loader.handler.ImageViewHandler; -import com.pranavpandey.android.dynamic.utils.loader.handler.TextViewHandler; +import com.pranavpandey.android.dynamic.util.DynamicPackageUtils; +import com.pranavpandey.android.dynamic.util.cache.DrawableLruCache; +import com.pranavpandey.android.dynamic.util.concurrent.DynamicCallback; +import com.pranavpandey.android.dynamic.util.concurrent.DynamicConcurrent; +import com.pranavpandey.android.dynamic.util.loader.handler.ImageViewHandler; +import com.pranavpandey.android.dynamic.util.loader.handler.TextViewHandler; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/loader/handler/ImageViewHandler.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/loader/handler/ImageViewHandler.java similarity index 94% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/loader/handler/ImageViewHandler.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/loader/handler/ImageViewHandler.java index c2598aa..c1d0d90 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/loader/handler/ImageViewHandler.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/loader/handler/ImageViewHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.loader.handler; +package com.pranavpandey.android.dynamic.util.loader.handler; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; @@ -26,7 +26,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.pranavpandey.android.dynamic.utils.concurrent.DynamicHandler; +import com.pranavpandey.android.dynamic.util.concurrent.DynamicHandler; import java.lang.ref.WeakReference; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/loader/handler/TextViewHandler.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/loader/handler/TextViewHandler.java similarity index 94% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/loader/handler/TextViewHandler.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/loader/handler/TextViewHandler.java index 0178278..30dbec9 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/loader/handler/TextViewHandler.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/loader/handler/TextViewHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.loader.handler; +package com.pranavpandey.android.dynamic.util.loader.handler; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; @@ -27,7 +27,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.pranavpandey.android.dynamic.utils.concurrent.DynamicHandler; +import com.pranavpandey.android.dynamic.util.concurrent.DynamicHandler; import java.lang.ref.WeakReference; diff --git a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/watcher/DynamicTextWatcher.java b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/watcher/DynamicTextWatcher.java similarity index 98% rename from dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/watcher/DynamicTextWatcher.java rename to dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/watcher/DynamicTextWatcher.java index e94c0a4..7322310 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/watcher/DynamicTextWatcher.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/watcher/DynamicTextWatcher.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.pranavpandey.android.dynamic.utils.watcher; +package com.pranavpandey.android.dynamic.util.watcher; import android.os.Handler; import android.os.Looper; diff --git a/dynamic-utils/src/main/res/values/donottranslate-strings.xml b/dynamic-utils/src/main/res/values/donottranslate-strings.xml index 860b75d..efdc9b4 100644 --- a/dynamic-utils/src/main/res/values/donottranslate-strings.xml +++ b/dynamic-utils/src/main/res/values/donottranslate-strings.xml @@ -24,6 +24,7 @@ %1$s\n"http://play.google.com/store/apps/details?id="%2$s - %1$s (v%2$s, %3$s, %4$s, %5$s) + %1$s (%2$s | %3$d, %4$s, %5$s, %6$s) + %1$s (%2$s | %3$d | %4$b, %5$s, %6$s, %7$s)