@@ -16,7 +16,7 @@ allprojects{
1616```
1717dependencies {
1818 ...
19- implementation 'com.github.amitjangid80:multiutillib:v1.1.2 '
19+ implementation 'com.github.amitjangid80:multiutillib:v1.1.4 '
2020}
2121```
2222
@@ -34,7 +34,7 @@ dependencies {
3434<dependency>
3535 <groupId>com.github.amitjangid80</groupId>
3636 <artifactId>multiutillib</artifactId>
37- version>v1.1.2 </version>
37+ version>v1.1.4 </version>
3838dependency>
3939```
4040
@@ -67,7 +67,54 @@ public class ProjectApplication extends Application
6767``` java
6868// use it in the activity or class you want to.
6969SharedPreferenceData sharedPreferenceData = new SharedPreferenceData (context);
70+
71+ // FOR SETTING DATA TO SHARED PREFERENCE.
72+ // generic method storing string values.
7073sharedPreferenceData. setValue(" keyname" , " value for that keyname" );
74+
75+ // specific for string values.
76+ sharedPreferenceData. setStrValue(" keyname" , " value for that keyname" );
77+
78+ // specific for int values.
79+ sharedPreferenceData. setIntValue(" keyname" , 1 );
80+
81+ // specific for boolean values.
82+ sharedPreferenceData. setBooleanValue(" keyname" , true );
83+
84+ // spefici for float values.
85+ sharedPreferenceData. setFloatValue(" keyname" , 1.0 );
86+
87+ // specific for long values.
88+ sharedPreferenceData. setLongValue(" keyname" , 123456789 );
89+
90+ // specific for String set values.
91+ sharedPreferenceData. setStrSetValue(" keyname" , Set<String > value);
92+
93+
94+ // FOR GETTING DATA FROM SHARED PREFERENCE.
95+ // all the below methods will return some defaults values.
96+
97+ // generic method for getting values returns 0 by default as string type.
98+ sharedPreferenceData. getValue(key);
99+
100+ // specific for getting string values returns 0 by default as string type.
101+ sharedPreferenceData. getStrValue(key);
102+
103+ // specific for getting int values returns 0 by default as int type.
104+ sharedPreferenceData. getIntValue(key);
105+
106+ // specific for getting boolean values returns false by default as int type.
107+ sharedPreferenceData. getBooleanValue(key);
108+
109+ // specific for getting float values returns 0f by default as int type.
110+ sharedPreferenceData. getFloatValue(key);
111+
112+ // specific for getting long values returns 0 by default as int type.
113+ sharedPreferenceData. getLongValue(key);
114+
115+ // specific for getting set of string values returns null by default as int type.
116+ sharedPreferenceData. getStrSetValue(key);
117+
71118```
72119
73120### ApiServices
@@ -474,3 +521,161 @@ Validator.noSpecialCharacters("abcd123");
474521Validator . atLeastOneSpecialCharacters(" abcd@123" );
475522```
476523
524+ ### UiUtils
525+
526+ > ** This class has utils for ui like setting max length to TextView, EditText, TextInputEditText.**
527+
528+ ** Usage: For setting char count on edittext or textinputedittext**
529+
530+ ``` java
531+ /**
532+ * set char counter
533+ * Shows live character counter for the number of characters
534+ * typed in the parameter {@link android.widget.EditText}
535+ *
536+ * @param editText Characters to count from
537+ * @param tvCounterView {@link android.widget.TextView} to show live character count in
538+ * @param maxCharCount Max characters that can be typed in into the parameter edit text
539+ * @param countDown if true, only the remaining of the max character count will be displayed.
540+ * if false, current character count as well as max character count will be displayed in the UI.
541+ **/
542+ UiUtils . setCharCounter(editText, tvCounterView, maxCharCount, countDown);
543+
544+
545+ /**
546+ * set char counter
547+ * Shows live character counter for the number of characters
548+ *
549+ * @param textInputEditText Characters to count from
550+ * @param tvCounterView {@link android.widget.TextView} to show live character count in
551+ * @param maxCharCount Max characters that can be typed in into the parameter edit text
552+ * @param countDown if true, only the remaining of the max character count will be displayed.
553+ * if false, current character count as well as max character count will be displayed in the UI.
554+ **/
555+ UiUtils . setCharCounter(textInputEditText, tvCounterView, maxCharCount, countDown);
556+
557+ /**
558+ * set max length
559+ * this method sets max text length for text view
560+ *
561+ * @param textView - text view on which you want to set max length
562+ * @param maxLength - length to set on text view
563+ **/
564+ UiUtils . setMaxLength(textView, maxLength);
565+
566+ /**
567+ * set max length
568+ * this method sets max text length for text view
569+ *
570+ * @param editText - text view on which you want to set max length
571+ * @param maxLength - length to set on text view
572+ **/
573+ UiUtils . setMaxLength(editText, maxLength);
574+
575+ /**
576+ * set max length
577+ * this method sets max text length for text view
578+ *
579+ * @param textInputEditText - text view on which you want to set max length
580+ * @param maxLength - length to set on text view
581+ **/
582+ UiUtils . setMaxLength(textInputEditText, maxLength);
583+
584+ ```
585+
586+ ### Utils
587+
588+ > ** This utils class helps for generic usages.**
589+
590+ ** Usage**
591+
592+ ``` java
593+ /**
594+ * is Sd Card Mounted
595+ * this method will check if sd card is mounted or not
596+ *
597+ * @return - true or false
598+ * if sd card available then will return true
599+ * else will return false
600+ **/
601+ Utils . isSdCardMounted();
602+
603+
604+ /**
605+ * this method gets IMEI number after getting the permission.
606+ * To this method you must have asked user for READ_PHONE_STATE PERMISSION.
607+ *
608+ * @return - it will return IMEI number if permission granted
609+ * else if no permission granted then will return empty string.
610+ **/
611+ Util . sgetIMEINumber(context);
612+
613+
614+ /**
615+ * is url valid
616+ * this method will check if the url provided is valid or not
617+ *
618+ * @param url - url to check
619+ * @return - will return true if the url is valid
620+ * else will return false
621+ **/
622+ Utils . isUrlValid(url);
623+
624+
625+ /**
626+ * to Bold
627+ * this method will convert the normal text to bold
628+ *
629+ * @param sourceText - text to convert to bold
630+ *
631+ * @return - {@link android.text.SpannableString} in BOLD TypeFace
632+ **/
633+ Utils . toBold(sourceText);
634+
635+
636+ /**
637+ * to Bold
638+ * this method will convert a string or a sub string to bold
639+ *
640+ * @param string - string in which the sub string has to be converted to bold
641+ * or string to be converted to bold
642+ *
643+ * @param subString - The subString within the string to bold.
644+ * Pass null to bold entire string.
645+ *
646+ * @return - {@link android.text.SpannableString} in Bold TypeFace
647+ **/
648+ Utils . toBold(string, subString);
649+
650+
651+ /**
652+ * hide keyboard
653+ * this method will hide the keyboard
654+ *
655+ * @param context - context of the application
656+ **/
657+ Utils . hideKeyboard(context);
658+
659+
660+ /**
661+ * get sha 512 hash
662+ * this method will convert a string to byte array.
663+ *
664+ * @param stringToHash - string to convert to hash.
665+ *
666+ * @return string converted to hash value.
667+ **/
668+ Utils . getSha512Hash(stringToHash);
669+
670+
671+ /**
672+ * get sha 512 hash
673+ * this method will convert the byte array to string
674+ * which is converted to hash
675+ *
676+ * @param dataToHash - byte array to convert to hash value
677+ *
678+ * @return string converted into hash value.
679+ **/
680+ Utils . getSha512Hash(byte [] dataToHash);
681+ ```
0 commit comments