Skip to content

Commit 3043ee0

Browse files
committed
1. Updated Readme.
2. Updating library version.
1 parent 3bf7e81 commit 3043ee0

File tree

8 files changed

+310
-97
lines changed

8 files changed

+310
-97
lines changed

.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 220 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ sharedPreferenceData.setLongValue("keyname", 123456789);
101101
// specific for String set values.
102102
sharedPreferenceData.setStrSetValue("keyname", Set<String> value);
103103

104-
105104
// FOR GETTING DATA FROM SHARED PREFERENCE.
106105
// all the below methods will return some defaults values.
107106

@@ -491,16 +490,64 @@ else
491490
}
492491
```
493492

494-
### TextUtitlities class
493+
### TextUtils class
495494

496495
>**This class helps you replaces values, like replacing 'null' with empty string, replacing true or false with 1 or 0, etc.**
497496
498497
```java
498+
499+
/**
500+
* replace null method
501+
* this method will replace null with empty space
502+
*
503+
* @param string - string where you want to replace null
504+
* @return it will return empty string
505+
**/
499506
// example: for replacing null value from a string.
500-
TextUtilities.replaceNull(string); // this will return string value.
507+
TextUtils.replaceNullWithEmpty(string); // this will return string value.
501508

509+
/**
510+
* replace true or false
511+
* this method will replace true or false with 1 or 0
512+
*
513+
* @param string - string to replace true or false with
514+
* @return it will return 1 or 0
515+
**/
502516
// example: for replacing True or False from a string.
503-
TextUtilities.replaceTrueOrFalse(string); // this will return int value.
517+
TextUtils.replaceTrueOrFalse(string); // this will return int value.
518+
519+
/**
520+
* 2018 September 14 - Friday - 12:34 PM
521+
* replace null with zero method
522+
*
523+
* this method will replace null or empty values of string with zero
524+
*
525+
* @param stringToReplace - string to replace null with
526+
* @return it will return 1 or 0
527+
**/
528+
TextUtils.replaceNullWithZero(String stringToReplace)
529+
530+
/**
531+
* 2018 September 14 - Friday - 12:34 PM
532+
* remove last char method
533+
*
534+
* this method will remove the last character of the string
535+
*
536+
* @param stringToRemovedLastCharFrom - string to remove the last character from
537+
* @return it will return string with last character removed
538+
**/
539+
TextUtils.removeLastChar(String stringToRemovedLastCharFrom)
540+
541+
/**
542+
* capitalizeString method
543+
*
544+
* this method will capitalizeString or set the string to upper case
545+
*
546+
* @param string - string to capitalize
547+
* return - will return the string which was passed in capitalize form
548+
**/
549+
TextUtils.capitalizeString(String string)
550+
504551
```
505552

506553
### Validator class
@@ -614,26 +661,6 @@ UiUtils.setMaxLength(textInputEditText, maxLength);
614661
**Usage**
615662

616663
```java
617-
/**
618-
* is Sd Card Mounted
619-
* this method will check if sd card is mounted or not
620-
*
621-
* @return - true or false
622-
* if sd card available then will return true
623-
* else will return false
624-
**/
625-
Utils.isSdCardMounted();
626-
627-
628-
/**
629-
* this method gets IMEI number after getting the permission.
630-
* To this method you must have asked user for READ_PHONE_STATE PERMISSION.
631-
*
632-
* @return - it will return IMEI number if permission granted
633-
* else if no permission granted then will return empty string.
634-
**/
635-
Utils.sgetIMEINumber(context);
636-
637664

638665
/**
639666
* is url valid
@@ -884,3 +911,172 @@ AnimUtil.bounceAnim(Context context, View view);
884911
ShineButton shineButton = findViewById(R.id.shine_button);
885912
shineButton.init(MainActivity.this);
886913
```
914+
915+
### DateTimeUtils
916+
917+
**Usage**
918+
919+
```java
920+
/**
921+
* format date time method
922+
* <p>
923+
* this method will format date time in to formats user provides
924+
*
925+
* @param dateToFormat - date time which you need to format
926+
* EX: 2018-10-09
927+
*
928+
* @param inDateTimeFormat - format of the date time in which you want to format given date
929+
* EX: dd-MM-yyyy OR dd-MM-yyyy hh:mm:ss
930+
*
931+
* @return date time in format provided
932+
**/
933+
DateTimeUtils.formatDateTime(String dateToFormat, String inDateTimeFormat)
934+
935+
/**
936+
* format date time method
937+
* <p>
938+
* this method will format date time in to formats user provides
939+
*
940+
* @param dateToFormat - date time which you need to format
941+
* EX: 2018-10-09
942+
*
943+
* @param inDateTimeFormat - format of the date time in which you want to format given date
944+
* EX: dd-MM-yyyy OR dd-MM-yyyy hh:mm:ss
945+
*
946+
* @param fromDateTimFormat - format of date time from which you want to format
947+
* EX: yyyy-MM-dd OR dd-MM-yyyy hh:mm:ss
948+
*
949+
* @return date time in format provided
950+
**/
951+
DateTimeUtils.formatDateTime(String dateToFormat, String inDateTimeFormat, String fromDateTimFormat)
952+
953+
/**
954+
* 2018 April 27 - Friday - 04:00 PM
955+
* format milli seconds to time method
956+
*
957+
* this method formats the string in hh:mm:ss format
958+
**/
959+
DateTimeUtils.formatMilliSecondsToTime(long milliseconds)
960+
961+
/**
962+
* two digit string method
963+
*
964+
* this string formats the given parameter in two digits
965+
*
966+
* @param number - number to be formatted in two digits
967+
*
968+
* @return returns number in two digits in string format
969+
**/
970+
DateTimeUtils.twoDigitString(long number)
971+
972+
/**
973+
* 2018 September 22 - Saturday - 04:38 PM
974+
* convert days in millis method
975+
*
976+
* this method will convert days in milliseconds
977+
*
978+
* @param days - days value in integer to be converted
979+
*
980+
* @return returns milli seconds value of given number of days
981+
**/
982+
DateTimeUtils.convertDaysInMillis(int days)
983+
984+
```
985+
986+
### DeviceUtils
987+
988+
**Usage**
989+
990+
```java
991+
992+
/**
993+
* is Sd Card Mounted
994+
* this method will check if sd card is mounted or not
995+
*
996+
* @return - true or false
997+
* if sd card available then will return true
998+
* else will return false
999+
**/
1000+
DeviceUtils.isSdCardMounted()
1001+
1002+
/**
1003+
* Get IMEI Number method
1004+
*
1005+
* this method gets IMEI number after getting the permission.
1006+
*
1007+
* @return - it will return IMEI number if permission granted
1008+
* else if no permission granted then will return empty string.
1009+
**/
1010+
DeviceUtils.getIMEINumber(@NonNull Context context)
1011+
1012+
/**
1013+
* 2018 September 18 - Tuesday - 04:54 PM
1014+
* get battery percentage method
1015+
*
1016+
* this method will get the percentage of battery remaining
1017+
*
1018+
* @param context - context of the application
1019+
* @return battery percentage in int or 0
1020+
**/
1021+
DeviceUtils.getBatteryPercentage(@NonNull Context context)
1022+
1023+
/**
1024+
* get device id method
1025+
*
1026+
* this method will get the device id
1027+
*
1028+
* @param context - application context
1029+
* @return device id in string
1030+
**/
1031+
DeviceUtils.getDeviceID(@NonNull Context context)
1032+
1033+
/**
1034+
* get device name method
1035+
*
1036+
* this method will get the name of the device
1037+
* @return name of the device with manufacturer
1038+
**/
1039+
DeviceUtils.getDeviceName()
1040+
1041+
/**
1042+
* 2018 October 04 - Thursday - 02:50 PM
1043+
* get mac address method
1044+
*
1045+
* this method will get mac address of the device
1046+
**/
1047+
DeviceUtils.getMacAddress(Context context)
1048+
1049+
```
1050+
1051+
### ExpandableGridView
1052+
1053+
>**This expandable grid view will help you to use this inside a scrollview.**
1054+
1055+
**Usage**
1056+
1057+
```xml
1058+
1059+
<com.amit.views.ExpandableGridView
1060+
android:id="@+id/gridView"
1061+
android:layout_width="match_parent"
1062+
android:layout_height="wrap_content"
1063+
android:layout_marginStart="@dimen/five_dp"
1064+
android:layout_marginTop="@dimen/five_dp"
1065+
android:layout_marginEnd="@dimen/ten_dp"
1066+
android:numColumns="3" />
1067+
1068+
```
1069+
1070+
### ExpandableListView
1071+
1072+
>**This expandable list view will help you to use this inside a scrollview.**
1073+
1074+
```xml
1075+
1076+
<com.amit.views.ExpandableListView
1077+
android:id="@+id/listView"
1078+
android:layout_width="match_parent"
1079+
android:layout_height="match_parent"
1080+
android:layout_marginTop="@dimen/five_dp" />
1081+
1082+
```

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
defaultConfig {
1111
minSdkVersion 19
1212
targetSdkVersion 28
13-
versionCode 26 // this indicates the number of releases of library
14-
versionName "1.2.19" // this indicates the current version of library
13+
versionCode 28 // this indicates the number of releases of library
14+
versionName "1.3.0" // this indicates the current version of library
1515
}
1616
buildTypes {
1717
release {

app/src/main/java/com/amit/utilities/DateTimeUtils.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ public class DateTimeUtils
2424
* this method will format date time in to formats user provides
2525
*
2626
* @param dateToFormat - date time which you need to format
27+
* EX: 2018-10-09
2728
*
2829
* @param inDateTimeFormat - format of the date time in which you want to format given date
30+
* EX: dd-MM-yyyy OR dd-MM-yyyy hh:mm:ss
2931
*
3032
* @return date time in format provided
3133
**/
@@ -46,8 +48,13 @@ public static String formatDateTime(String dateToFormat, String inDateTimeFormat
4648
* this method will format date time in to formats user provides
4749
*
4850
* @param dateToFormat - date time which you need to format
51+
* EX: 2018-10-09
4952
*
5053
* @param inDateTimeFormat - format of the date time in which you want to format given date
54+
* EX: dd-MM-yyyy OR dd-MM-yyyy hh:mm:ss
55+
*
56+
* @param fromDateTimFormat - format of date time from which you want to format
57+
* EX: yyyy-MM-dd OR dd-MM-yyyy hh:mm:ss
5158
*
5259
* @return date time in format provided
5360
**/
@@ -82,10 +89,13 @@ public static String formatMilliSecondsToTime(long milliseconds)
8289
}
8390

8491
/**
85-
* 2018 April 27 - Friday - 04:00 PM
8692
* two digit string method
8793
*
8894
* this string formats the given parameter in two digits
95+
*
96+
* @param number - number to be formatted in two digits
97+
*
98+
* @return returns number in two digits in string format
8999
**/
90100
public static String twoDigitString(long number)
91101
{
@@ -107,6 +117,10 @@ public static String twoDigitString(long number)
107117
* convert days in millis method
108118
*
109119
* this method will convert days in milliseconds
120+
*
121+
* @param days - days value in integer to be converted
122+
*
123+
* @return returns milli seconds value of given number of days
110124
**/
111125
public static long convertDaysInMillis(int days)
112126
{

0 commit comments

Comments
 (0)