Skip to content

Commit

Permalink
Version 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavpandey committed Sep 8, 2017
1 parent 69094c1 commit 371dfd6
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 27 deletions.
45 changes: 29 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

---
Expand All @@ -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'
}
```

Expand Down Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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.

---

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit 371dfd6

Please sign in to comment.