Skip to content

Commit

Permalink
Improve javadoc and fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavpandey committed Jan 27, 2021
1 parent 9c4fb47 commit 07e9c91
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
/**
* Helper class to perform various {@link File} operations.
*
* <p><p>A {@link FileProvider} in the form of {@code ${applicationId}.FileProvider} must be
* <p>A {@link FileProvider} in the form of {@code ${applicationId}.FileProvider} must be
* added in the {@code manifest} to perform some operations automatically like saving the
* bitmap or file in app isolated directory.
*
Expand Down Expand Up @@ -609,7 +609,7 @@ public static boolean writeStringToFile(@NonNull Context context,
* Save and returns uri from the bitmap.
* <p>It will automatically use the @link FileProvider} on API 24 and above devices.
*
* <p><p>It requires {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission on
* <p>It requires {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission on
* pre KitKat ({@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} or below) devices.
*
* @param context The context to get the file provider.
Expand Down Expand Up @@ -652,7 +652,7 @@ public static boolean writeStringToFile(@NonNull Context context,
* Save and returns uri from the bitmap.
* <p>It will automatically use the @link FileProvider} on API 24 and above devices.
*
* <p><p>It requires {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission on
* <p>It requires {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission on
* pre KitKat ({@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} or below) devices.
*
* @param context The context to get the file provider.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.pranavpandey.android.dynamic.utils;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.ApplicationErrorReport;
import android.content.ActivityNotFoundException;
Expand Down Expand Up @@ -98,7 +99,7 @@ public static boolean copyToClipboard(@NonNull Context context,
* Share application via system default share intent so that user can select from the
* available apps if more than one apps are available.
*
* <p><p>This method throws {@link ActivityNotFoundException} if there was no activity found
* <p>This method throws {@link ActivityNotFoundException} if there was no activity found
* to run the given intent.
*
* @param context The context to retrieve the resources.
Expand Down Expand Up @@ -152,7 +153,7 @@ public static boolean share(@NonNull Context context, @Nullable String title,
* Share application via system default share intent so that user can select from the
* available apps if more than one apps are available.
*
* <p><p>This method throws {@link ActivityNotFoundException} if there was no activity found
* <p>This method throws {@link ActivityNotFoundException} if there was no activity found
* to run the given intent.
*
* @param context The context to retrieve the resources.
Expand All @@ -176,7 +177,7 @@ public static boolean share(@NonNull Context context, @Nullable String title,
* Share application via system default share intent so that user can select from the
* available apps if more than one apps are available.
*
* <p><p>This method throws {@link ActivityNotFoundException} if there was no activity found
* <p>This method throws {@link ActivityNotFoundException} if there was no activity found
* to run the given intent.
*
* @param context The context to retrieve the resources.
Expand All @@ -199,7 +200,7 @@ public static boolean share(@NonNull Context context,
* Share application via system default share intent so that user can select from the
* available apps if more than one apps are available.
*
* <p><p>This method throws {@link ActivityNotFoundException} if there was no activity found
* <p>This method throws {@link ActivityNotFoundException} if there was no activity found
* to run the given intent.
*
* @param context The context to retrieve the resources.
Expand All @@ -219,7 +220,7 @@ public static boolean shareApp(@NonNull Context context) {
* respective apps if installed on the device. Special treatment is applied for the
* Facebook URLs to open them directly in the app.
*
* <p><p>This method throws {@link ActivityNotFoundException} if there was no activity found
* <p>This method throws {@link ActivityNotFoundException} if there was no activity found
* to run the given intent.
*
* @param context The context to retrieve the resources.
Expand Down Expand Up @@ -285,7 +286,7 @@ public static boolean viewInGooglePlay(@NonNull Context context,
* View app on Google Play or Android Market.
* <p>Can be used for the quick feedback or rating from the user.
*
* <p><p>This method throws {@link ActivityNotFoundException} if there was no activity found
* <p>This method throws {@link ActivityNotFoundException} if there was no activity found
* to run the given intent.
*
* @param context The context to retrieve the resources.
Expand All @@ -304,7 +305,7 @@ public static boolean rateApp(@NonNull Context context) {
/**
* View other apps of a Publisher on Google Play or Android Market.
*
* <p><p>This method throws {@link ActivityNotFoundException} if there was no activity found
* <p>This method throws {@link ActivityNotFoundException} if there was no activity found
* to run the given intent.
*
* @param context The context to retrieve the resources.
Expand All @@ -330,7 +331,7 @@ public static boolean moreApps(@NonNull Context context, @NonNull String publish
* <p>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.
*
* <p><p>This method throws {@link ActivityNotFoundException} if there was no activity found
* <p>This method throws {@link ActivityNotFoundException} if there was no activity found
* to run the given intent.
*
* @param context The context to retrieve the resources.
Expand Down Expand Up @@ -367,7 +368,7 @@ public static boolean email(@NonNull Context context, @NonNull String email,
* <p>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.
*
* <p><p>This method throws {@link ActivityNotFoundException} if there was no activity found
* <p>This method throws {@link ActivityNotFoundException} if there was no activity found
* to run the given intent.
*
* @param context The context to retrieve the resources.
Expand Down Expand Up @@ -405,13 +406,14 @@ public static boolean report(@NonNull Context context,

/**
* Checks whether the email client exists on the device.
* <p><p>Use {@code queries} tag for {@link Intent#ACTION_SENDTO} with scheme
* <p>Use {@code queries} tag for {@link Intent#ACTION_SENDTO} with scheme
* {@link MailTo#MAILTO_SCHEME} in {@code AndroidManifest} to support API 30.
*
* @param context The context to get the package manager.
*
* @return {@code true} if the email client exists on the device.
*/
@SuppressLint("QueryPermissionsNeeded")
public static boolean isEmailExists(@NonNull Context context) {
List<ResolveInfo> list = null;

Expand Down Expand Up @@ -464,7 +466,7 @@ public static boolean isFeedbackExists(@NonNull Context context) {
/**
* Ask questions or submit bug report to the developer via Google feedback.
*
* <p><p>It will redirect to {@link #report(Context, String, String)} method if feedback
* <p>It will redirect to {@link #report(Context, String, String)} method if feedback
* package is not available on the device.
*
* @param context The context to retrieve the resources.
Expand Down Expand Up @@ -515,7 +517,7 @@ public static void feedback(@NonNull Context context,
/**
* Ask questions or submit bug report to the developer via Google feedback.
*
* <p><p>It will redirect to {@link #report(Context, String, String)} method if feedback
* <p>It will redirect to {@link #report(Context, String, String)} method if feedback
* package is not available on the device.
*
* @param context The context to retrieve the resources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class DynamicTextUtils {
return text.substring(0, 1).toUpperCase(locale) + text.substring(1);
}

return text.substring(0, 1).toUpperCase() + text.substring(1);
return text.substring(0, 1).toUpperCase(Locale.getDefault()) + text.substring(1);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected void onPostExecute(@Nullable DynamicResult<R> result) { }
* Runs on the UI thread after {@link #cancel(boolean)} is invoked and
* {@link #doInBackground(Object)} has finished.
*
* <p><p>The default implementation simply invokes {@link #onCancelled()} and
* <p>The default implementation simply invokes {@link #onCancelled()} and
* ignores the result. If you write your own implementation, do not call
* <code>super.onCancelled(result)</code>.
*
Expand All @@ -110,7 +110,7 @@ protected void onCancelled(DynamicResult<R> result) {
* This method is invoked by the default implementation of {@link #onCancelled(DynamicResult)}.
* <p>The default version does nothing.
*
* <p><p>Runs on the UI thread after {@link #cancel(boolean)} is invoked and
* <p>Runs on the UI thread after {@link #cancel(boolean)} is invoked and
* {@link #doInBackground(Object)} has finished.
*
* @see #onCancelled(DynamicResult)
Expand Down Expand Up @@ -140,14 +140,14 @@ protected void onCancelled() { }
* {@code mayInterruptIfRunning} parameter determines whether the thread executing this
* task should be interrupted in an attempt to stop the task.
*
* <p><p>Calling this method will result in {@link #onCancelled(DynamicResult)} being invoked
* <p>Calling this method will result in {@link #onCancelled(DynamicResult)} being invoked
* on the UI thread after {@link #doInBackground(Object)} returns. Calling this method
* guarantees that onPostExecute(Object) is never subsequently invoked, even if
* {@code cancel} returns false, but {@link #onPostExecute} has not yet run.
* To finish the task as early as possible, check {@link #isCancelled()} periodically
* from {@link #doInBackground(Object)}.</p>
* from {@link #doInBackground(Object)}.
*
* <p><p>This only requests cancellation. It never waits for a running background task to
* <p>This only requests cancellation. It never waits for a running background task to
* terminate, even if {@code mayInterruptIfRunning} is true.
*
* @param mayInterruptIfRunning {@code true} if the thread executing this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
/**
* Base class to represent {@link Runnable} according to the {@link DynamicRunnable}.
*/
@SuppressWarnings({"unchecked", "deprecation"})
public abstract class DynamicTask<T, P, R> extends DynamicRunnable<T, P, R> {

/**
Expand Down

0 comments on commit 07e9c91

Please sign in to comment.