diff --git a/README.md b/README.md index a17cd6f..8c2c757 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,10 @@ so, minimum SDK will be Android 14+ (ICS or above). - [DynamicLinkUtils](https://github.com/pranavpandey/dynamic-utils#dynamiclinkutils) - [DynamicPackageUtils](https://github.com/pranavpandey/dynamic-utils#dynamicpackageutils) - [DynamicTaskUtils](https://github.com/pranavpandey/dynamic-utils#dynamictaskutils) + - [DynamicUnitUtils](https://github.com/pranavpandey/dynamic-utils#dynamicwindowutils) - [DynamicVersionUtils](https://github.com/pranavpandey/dynamic-utils#dynamicversionutils) + - [DynamicViewUtils](https://github.com/pranavpandey/dynamic-utils#dynamicviewutils) - [DynamicWindowUtils](https://github.com/pranavpandey/dynamic-utils#dynamicwindowutils) - - [DynamicUnitUtils](https://github.com/pranavpandey/dynamic-utils#dynamicwindowutils) - [License](https://github.com/pranavpandey/dynamic-utils#license) --- @@ -37,7 +38,7 @@ It can be installed by adding the following dependency to your `build.gradle` fi ```groovy dependencies { - compile 'com.pranavpandey.android:dynamic-utils:0.4.0' + compile 'com.pranavpandey.android:dynamic-utils:0.5.0' } ``` @@ -135,6 +136,18 @@ Helper class to easily execute or cancel an AsyncTask by handling all the except - `void executeTask(asyncTask)` - Try to execute the supplied AsyncTask. +### DynamicUnitUtils + +Helper class to perform unit conversions. + +- `int convertDpToPixels(dp)` - To convert DP into pixels. + +- `int convertPixelsToDp(pixels)` - To convert pixels into DP. + +- `int convertSpToPixels(sp)` - To convert SP into pixels. + +- `int convertPixelsToSp(pixels)` - To convert pixels into SP. + ### DynamicVersionUtils Helper class to detect the Android SDK version at runtime so that we can provide the user @@ -147,9 +160,19 @@ or above. ... -- `boolean isNougat()` - To detect if the current Android version is N or above. +- `boolean isNougatMR1()` - To detect if the current Android version is NougatMR1 or above. + +- `boolean isOreo()` - To detect if the current Android version is Oreo or above. + +### DynamicViewUtils -- `boolean isNougatMR1()` - To detect if the current Android version is N_MR1 or above. +Helper class to perform `view` operations. + +- `void setLightStatusBar(view, isLight)` - Set light status bar if we are using light primary +color on Android M or above devices. + +- `void setLightNavigationBar(view, isLight)` - Set light navigation bar if we are using light +primary color on Android O or above devices. ### DynamicWindowUtils @@ -161,19 +184,9 @@ Helper class to perform Window operations and to detect system configurations at - `Point getNavigationBarSize(context)` - Get the on-screen navigation bar size. -- `boolean isNavigationBarThemeSupported(context)` - Detect support for navigation bar theme. - -### DynamicUnitUtils - -Helper class to perform unit conversions. +- `boolean isNavigationBarPresent(context)` - Detect if on-screen navigation bar is present or not. -- `int convertDpToPixels(dp)` - To convert DP into pixels. - -- `int convertPixelsToDp(pixels)` - To convert pixels into DP. - -- `int convertSpToPixels(sp)` - To convert SP into pixels. - -- `int convertPixelsToSp(pixels)` - To convert pixels into SP. +- `boolean isNavigationBarThemeSupported(context)` - Detect support for navigation bar theme. --- diff --git a/build.gradle b/build.gradle index 2a2cc1e..0088301 100644 --- a/build.gradle +++ b/build.gradle @@ -40,7 +40,7 @@ ext { githubUrl = 'pranavpandey/dynamic-utils' mavenGroup = 'com.pranavpandey.android' - mavenVersion = '0.4.0' + mavenVersion = '0.5.0' mavenInceptionYear = 2017 mavenArtifactId = 'dynamic-utils' bintrayRepo = 'android' @@ -54,12 +54,12 @@ ext { licenseDistribution = 'repo' allLicenses = ["Apache-2.0"] - versionCode = 4 + versionCode = 5 buildTools = '26.0.1' minSdk = 14 compileSdk = 26 - targetSdk = 25 + targetSdk = 26 androidSupport = '26.0.2' } 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/utils/DynamicLinkUtils.java index 6a28484..34a4ad0 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicLinkUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicLinkUtils.java @@ -89,8 +89,8 @@ public class DynamicLinkUtils { * * @see android.content.Intent#ACTION_SEND */ - public static void shareApp(@NonNull Context context, - @Nullable String title, @Nullable String message) { + public static void shareApp(@NonNull Context context, @Nullable String title, + @Nullable String message) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.setType("text/plain"); @@ -141,8 +141,8 @@ public static void shareApp(@NonNull Context context) { * * @see android.content.Intent#ACTION_VIEW */ - public static void viewInGooglePlay( - @NonNull Context context, @NonNull String packageName) { + public static void viewInGooglePlay(@NonNull Context context, + @NonNull String packageName) { try { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(LINK_MARKET + packageName))); 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/utils/DynamicPackageUtils.java index 631c8fd..3d64bcf 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicPackageUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicPackageUtils.java @@ -56,7 +56,8 @@ public static ComponentName getComponentName(@NonNull Context context) { * * @see ApplicationInfo#loadLabel(PackageManager) */ - public static CharSequence getAppLabel(@NonNull Context context, @Nullable String packageName) { + public static CharSequence getAppLabel(@NonNull Context context, + @Nullable String packageName) { PackageManager packageManager = context.getPackageManager(); try { return packageManager.getPackageInfo(packageName, 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/utils/DynamicViewUtils.java index 80cff6b..2244d75 100644 --- a/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicViewUtils.java +++ b/dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/utils/DynamicViewUtils.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2017 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.utils; import android.annotation.TargetApi; @@ -17,7 +33,7 @@ public class DynamicViewUtils { * @param isLight {@code true} to set the light status bar. */ @TargetApi(android.os.Build.VERSION_CODES.M) - public static void setLightStatusBar(@NonNull View view, boolean isLight){ + public static void setLightStatusBar(@NonNull View view, boolean isLight) { if (DynamicVersionUtils.isMarshmallow()) { int flags = view.getSystemUiVisibility(); if (isLight) { @@ -37,7 +53,7 @@ public static void setLightStatusBar(@NonNull View view, boolean isLight){ * @param isLight {@code true} to set the light navigation bar. */ @TargetApi(android.os.Build.VERSION_CODES.O) - public static void setLightNavigationBar(@NonNull View view, boolean isLight){ + public static void setLightNavigationBar(@NonNull View view, boolean isLight) { if (DynamicVersionUtils.isOreo()) { int flags = view.getSystemUiVisibility(); if (isLight) { @@ -55,7 +71,7 @@ public static void setLightNavigationBar(@NonNull View view, boolean isLight){ * * @param viewGroup View group to add the view. * @param view View to be added. - * @param removePrevious {@link true} to remove all the previous + * @param removePrevious {@code true} to remove all the previous * views of the view group. */ public static void addView(@NonNull ViewGroup viewGroup,