@@ -101,7 +101,6 @@ sharedPreferenceData.setLongValue("keyname", 123456789);
101
101
// specific for String set values.
102
102
sharedPreferenceData. setStrSetValue(" keyname" , Set<String > value);
103
103
104
-
105
104
// FOR GETTING DATA FROM SHARED PREFERENCE.
106
105
// all the below methods will return some defaults values.
107
106
@@ -491,16 +490,64 @@ else
491
490
}
492
491
```
493
492
494
- ### TextUtitlities class
493
+ ### TextUtils class
495
494
496
495
> ** This class helps you replaces values, like replacing 'null' with empty string, replacing true or false with 1 or 0, etc.**
497
496
498
497
``` 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
+ **/
499
506
// 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.
501
508
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
+ **/
502
516
// 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
+
504
551
```
505
552
506
553
### Validator class
@@ -614,26 +661,6 @@ UiUtils.setMaxLength(textInputEditText, maxLength);
614
661
** Usage**
615
662
616
663
``` 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
-
637
664
638
665
/**
639
666
* is url valid
@@ -884,3 +911,172 @@ AnimUtil.bounceAnim(Context context, View view);
884
911
ShineButton shineButton = findViewById(R . id. shine_button);
885
912
shineButton. init(MainActivity . this );
886
913
```
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
+ ```
0 commit comments