From 2e05d2bd50db2764516a34fe05d60d951ee34fa3 Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 12:12:42 +0430 Subject: [PATCH 01/14] Create README.md --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1db9da0 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# Utils-Library + +Android amazing helper fucntion library
+`Only work on kotlin` + +Setup +-------- + Use Gradle: + +```gradle +//Project +allprojects { + repositories { + google() + jcenter() + maven { url 'https://jitpack.io' } + } +} + +//Module:App +dependencies { + implementation 'com.github.Aryan-mor:Utils-Library:1.3.7' +} +``` + +Example +-------- +Intent functions: +```intent +class MainActivity : AppCompatActivity(){ + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + + intentTo(AnotherActivity::class) + //Or + var intent = makeIntent(AnotherActivity::class) + + + //You can send any params to another activity + intentTo(AnotherActivity::class,"myParamKey",AnyObject) + + + + //On another activity you can recive object like this + //if your paramter not int, float, + + } + +} +``` From 7216ef12c42a244b65168a3111e42e9555f24d38 Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 12:37:14 +0430 Subject: [PATCH 02/14] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1db9da0..aec9e95 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ Android amazing helper fucntion library
`Only work on kotlin` -Setup +Usage -------- - Use Gradle: +Include the library in your build.gradle ```gradle //Project @@ -33,19 +33,19 @@ class MainActivity : AppCompatActivity(){ super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - + //Basic usage intentTo(AnotherActivity::class) //Or var intent = makeIntent(AnotherActivity::class) //You can send any params to another activity - intentTo(AnotherActivity::class,"myParamKey",AnyObject) + intentTo(AnotherActivity::class,"myParamKey", anyObject) //On another activity you can recive object like this - //if your paramter not int, float, + val myParam = getExtra("myParamKey",AnyObject::class.java) } From f6efca891179cb391ad73620c3d5f577b75e37e6 Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 12:40:29 +0430 Subject: [PATCH 03/14] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aec9e95..d722bfb 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,11 @@ dependencies { } ``` -Example +# Example +چند نمونه از فانکشن های این کتاب خانه + +Intent functions -------- -Intent functions: ```intent class MainActivity : AppCompatActivity(){ From 1a00b0d7ea80a873429abeab728e3ace1f1a0616 Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 12:47:01 +0430 Subject: [PATCH 04/14] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d722bfb..245f800 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,13 @@ dependencies { } ``` +### Index +* [Intent](#intentfunctions) + # Example چند نمونه از فانکشن های این کتاب خانه -Intent functions +## IntentFunctions -------- ```intent class MainActivity : AppCompatActivity(){ From 2e2eec4412c62fd4f0716d57cfdf671476d0683d Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 12:47:45 +0430 Subject: [PATCH 05/14] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 245f800..a23961b 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,6 @@ dependencies { چند نمونه از فانکشن های این کتاب خانه ## IntentFunctions --------- ```intent class MainActivity : AppCompatActivity(){ From 75dbaa200ad1b7c5e12b68b6e3d1278d0b100af1 Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 13:08:52 +0430 Subject: [PATCH 06/14] Update README.md --- README.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/README.md b/README.md index a23961b..c61b42d 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ dependencies { ### Index * [Intent](#intentfunctions) +* [Log](#logfunctions) # Example چند نمونه از فانکشن های این کتاب خانه @@ -55,3 +56,69 @@ class MainActivity : AppCompatActivity(){ } ``` + +## LogFunctions +**AnyWhere can use log funtion :relaxed:** +```basicLog +class AnyClass{ + + fun a(){ + //Basic usage + log(Any) // log any object + //or + Any().logThis() + //or + log("log this message") + + //AdvanceTools + log(Any(),"MyLogFlag",LOG_ERROR_MODE) + //or + log(logMessage = Any(),logFlag = "MyLogFlag",logType = LOG_ERROR_MODE) + + //LogType -> + //LOG_DEBUG_MODE + //LOG_ERROR_MODE + //LOG_INFO_MODE + //LOG_VERBOSE_MODE + //LOG_WARN_MODE + //LOG_WTF_MODE + + } + +} +``` + +**You can use 6 type log type :metal:** +```logType +class AnyClass{ + + fun a(){ + logD("Log Type Debug") + logE("Log Type Error") + logI("Log Type Info") + logV("Log Type Verbose") + logW("Log Type Warn") + logWTF("Log Type WTF") + } + +} +``` + +You can log ArrayList or Map item +```logType +class AnyClass{ + + fun a(){ + val map = hashMapOf() + map["aa"] = "safa" + map.logThis() + //or + map.logThisE() + //or .... + + + //The array is the same + } + +} +``` From d312f073167394531ceaa1d05a259be2e7eb0e64 Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 13:17:48 +0430 Subject: [PATCH 07/14] Update README.md --- README.md | 101 +++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index c61b42d..d6609c2 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,10 @@ dependencies { ### Index * [Intent](#intentfunctions) * [Log](#logfunctions) +* [UtilsFucntion](#utilsfunctions) # Example -چند نمونه از فانکشن های این کتاب خانه +**Some examples of library functions** ## IntentFunctions ```intent @@ -60,65 +61,63 @@ class MainActivity : AppCompatActivity(){ ## LogFunctions **AnyWhere can use log funtion :relaxed:** ```basicLog -class AnyClass{ + //Basic usage + log(Any) // log any object + //or + Any().logThis() + //or + log("log this message") + + //AdvanceTools + log(Any(),"MyLogFlag",LOG_ERROR_MODE) + //or + log(logMessage = Any(),logFlag = "MyLogFlag",logType = LOG_ERROR_MODE) + + //LogType -> + //LOG_DEBUG_MODE + //LOG_ERROR_MODE + //LOG_INFO_MODE + //LOG_VERBOSE_MODE + //LOG_WARN_MODE + //LOG_WTF_MODE - fun a(){ - //Basic usage - log(Any) // log any object - //or - Any().logThis() - //or - log("log this message") - - //AdvanceTools - log(Any(),"MyLogFlag",LOG_ERROR_MODE) - //or - log(logMessage = Any(),logFlag = "MyLogFlag",logType = LOG_ERROR_MODE) - - //LogType -> - //LOG_DEBUG_MODE - //LOG_ERROR_MODE - //LOG_INFO_MODE - //LOG_VERBOSE_MODE - //LOG_WARN_MODE - //LOG_WTF_MODE - - } - -} ``` **You can use 6 type log type :metal:** ```logType -class AnyClass{ - - fun a(){ - logD("Log Type Debug") - logE("Log Type Error") - logI("Log Type Info") - logV("Log Type Verbose") - logW("Log Type Warn") - logWTF("Log Type WTF") - } -} + logD("Log Type Debug") + logE("Log Type Error") + logI("Log Type Info") + logV("Log Type Verbose") + logW("Log Type Warn") + logWTF("Log Type WTF") + ``` You can log ArrayList or Map item ```logType -class AnyClass{ - - fun a(){ - val map = hashMapOf() - map["aa"] = "safa" - map.logThis() - //or - map.logThisE() - //or .... - - - //The array is the same - } -} + val map = hashMapOf() + map["aa"] = "safa" + map.logThis() + //or + map.logThisE() + //or .... + + //The array is the same + +``` + +## UtilsFunctions + +You can all Object conver to json like this and hydrate Object +```ConvetToJson + + val json = Any().toJson() + + //json type is string + + json.hydrate(Any::class.java) + ``` From 7d2c8451b85471c677dff66c89ee1d36197387cb Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 13:41:17 +0430 Subject: [PATCH 08/14] Update README.md --- README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d6609c2..92ff826 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,11 @@ class MainActivity : AppCompatActivity(){ } ``` +You can intent to your app package setting like this +```intentToPackageSetting + intentToPackageSetting() +``` + ## LogFunctions **AnyWhere can use log funtion :relaxed:** ```basicLog @@ -111,7 +116,7 @@ You can log ArrayList or Map item ## UtilsFunctions -You can all Object conver to json like this and hydrate Object +You can convert all classes to json like this and hydrate ```ConvetToJson val json = Any().toJson() @@ -121,3 +126,54 @@ You can all Object conver to json like this and hydrate Object json.hydrate(Any::class.java) ``` + +Another functions +```AnotherFunction + //You can close application like this + activity.closeApp() + + //You can restart application like this + activity.restartApp() + + //you can delay application like this + actvity.delayOnUiThread(200) // 200 is duration milisecound + //or run funtion by delay like this + actvity.delayOnUiThread(200){ + //your code + } + + *************************************** + + //Hidden keyboard + actvity.showSoftKeyboard() + //or + actvity.showSoftKeyboard(EditText) + + //Show keyboard + actvity.showSoftKeyboard() + //or + actvity.showSoftKeyboard(AnyView) + + *************************************** + + //You can understand user device size | fucntions return Boolean + context.isTablet() + context.isLargeScreen() + context.isNormalScreen() + context.isSmallScreen() + + *************************************** + + //You can understand device is portrait or landscape | fucntions return Boolean + context.isPortrait() + context.isLandscape() + + *************************************** + + //You can vibrate phone if use vibrate permision on your manifest | fucntions return Vibrator? + activity.vibrate(VibrationEffect) + //Or + activity.vibrate(milliseconds: Long, amplitude: Int) + + +``` From e0b8654685df6bdb31f9a7672ea10f7d48bc4bf5 Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 13:46:41 +0430 Subject: [PATCH 09/14] Update README.md --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 92ff826..ece272f 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,13 @@ class MainActivity : AppCompatActivity(){ You can intent to your app package setting like this ```intentToPackageSetting - intentToPackageSetting() + context.intentToPackageSetting() +``` + + +You can open link like this +```intentToPackageSetting + context.openLink("http://...") ``` ## LogFunctions From 7edef714e99ab88a05dc5e53a259e7be9dc85dcf Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 13:47:46 +0430 Subject: [PATCH 10/14] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ece272f..a507916 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ dependencies { * [UtilsFucntion](#utilsfunctions) # Example -**Some examples of library functions** +Some examples of library functions ## IntentFunctions ```intent @@ -70,7 +70,7 @@ You can open link like this ``` ## LogFunctions -**AnyWhere can use log funtion :relaxed:** +AnyWhere can use log funtion :relaxed: ```basicLog //Basic usage log(Any) // log any object @@ -94,7 +94,7 @@ You can open link like this ``` -**You can use 6 type log type :metal:** +You can use 6 type log type :metal: ```logType logD("Log Type Debug") From ea3d0ae9678ceb33729a17898876298a96a98f0c Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 13:55:04 +0430 Subject: [PATCH 11/14] Update README.md --- README.md | 138 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 77 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index a507916..26aebbc 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,79 @@ dependencies { ``` ### Index +* [UtilsFucntion](#utilsfunctions) * [Intent](#intentfunctions) * [Log](#logfunctions) -* [UtilsFucntion](#utilsfunctions) +* [Toast](#toastfunctions) # Example Some examples of library functions + +## UtilsFunctions + +You can convert all classes to json like this and hydrate +```ConvetToJson + + val json = Any().toJson() + + //json type is string + + json.hydrate(Any::class.java) + +``` + +Another functions +```AnotherFunction + //You can close application like this + activity.closeApp() + + //You can restart application like this + activity.restartApp() + + //you can delay application like this + actvity.delayOnUiThread(200) // 200 is duration milisecound + //or run funtion by delay like this + actvity.delayOnUiThread(200){ + //your code + } + + *************************************** + + //Hidden keyboard + actvity.showSoftKeyboard() + //or + actvity.showSoftKeyboard(EditText) + + //Show keyboard + actvity.showSoftKeyboard() + //or + actvity.showSoftKeyboard(AnyView) + + *************************************** + + //You can understand user device size | fucntions return Boolean + context.isTablet() + context.isLargeScreen() + context.isNormalScreen() + context.isSmallScreen() + + *************************************** + + //You can understand device is portrait or landscape | fucntions return Boolean + context.isPortrait() + context.isLandscape() + + *************************************** + + //You can vibrate phone if use vibrate permision on your manifest | fucntions return Vibrator? + activity.vibrate(VibrationEffect) + //Or + activity.vibrate(milliseconds: Long, amplitude: Int) + + +``` + ## IntentFunctions ```intent class MainActivity : AppCompatActivity(){ @@ -107,7 +173,7 @@ You can use 6 type log type :metal: ``` You can log ArrayList or Map item -```logType +```logMapAndArray val map = hashMapOf() map["aa"] = "safa" @@ -120,66 +186,16 @@ You can log ArrayList or Map item ``` -## UtilsFunctions - -You can convert all classes to json like this and hydrate -```ConvetToJson - - val json = Any().toJson() - - //json type is string - - json.hydrate(Any::class.java) - -``` - -Another functions -```AnotherFunction - //You can close application like this - activity.closeApp() - - //You can restart application like this - activity.restartApp() - - //you can delay application like this - actvity.delayOnUiThread(200) // 200 is duration milisecound - //or run funtion by delay like this - actvity.delayOnUiThread(200){ - //your code - } - - *************************************** - - //Hidden keyboard - actvity.showSoftKeyboard() - //or - actvity.showSoftKeyboard(EditText) - - //Show keyboard - actvity.showSoftKeyboard() - //or - actvity.showSoftKeyboard(AnyView) - - *************************************** - - //You can understand user device size | fucntions return Boolean - context.isTablet() - context.isLargeScreen() - context.isNormalScreen() - context.isSmallScreen() - - *************************************** - - //You can understand device is portrait or landscape | fucntions return Boolean - context.isPortrait() - context.isLandscape() - - *************************************** +## ToastFunctions +Toast fuction by context +```toast + //ToastFucntion | return Toast + context.toast("myToastMessage").show() - //You can vibrate phone if use vibrate permision on your manifest | fucntions return Vibrator? - activity.vibrate(VibrationEffect) - //Or - activity.vibrate(milliseconds: Long, amplitude: Int) + context.toast(R.string.myString).show() + context.longToast("myToastMessage").show() + context.longToast(R.string.myString).show() + ``` From 2aaacc4e17a7b07f71ff665eea32eff689b1fff4 Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 13:56:13 +0430 Subject: [PATCH 12/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26aebbc..98a5870 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Utils-Library -Android amazing helper fucntion library
+Android amazing helper function library
`Only work on kotlin` Usage From 379d7915a92ab012b24698a6d82c9fae282361dc Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 14:14:09 +0430 Subject: [PATCH 13/14] Update README.md --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 98a5870..f9c846e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,15 @@ dependencies { * [UtilsFucntion](#utilsfunctions) * [Intent](#intentfunctions) * [Log](#logfunctions) +* [SharedPreferences](#sharedpreferencesfunctions) * [Toast](#toastfunctions) +* [SnackBar](#toastfunctions) +* [CheckUtils](#checkutilsfunctions) +* [Convertor](#convertorfunctions) +* [DateUtils](#datefunctions) +* [DirUtils](#dirfunctions) +* [FileUtils](#filefunctions) +* [Encryption](#encryptionfunctions) # Example Some examples of library functions @@ -186,6 +194,24 @@ You can log ArrayList or Map item ``` +## SharedPreferencesFunctions +Secure shared preferences. +All item save to preferences key and value first key and value encrypted
+and when getItem decrypt and return item. +```Pref + + context.addPref("key", any) + + context.getPref("key", Any:class.java) + //Or + getPrefBoolean("key", defultValue) + getPrefString("key", defultValue) + getPrefInt("key", defultValue) + getPrefFloat("key", defultValue) + getPrefLong("key", defultValue) + +``` + ## ToastFunctions Toast fuction by context ```toast From 650567d34602609dce6d6250f24b139b037c8ab1 Mon Sep 17 00:00:00 2001 From: Aryan-mor Date: Sun, 2 Jun 2019 14:17:41 +0430 Subject: [PATCH 14/14] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f9c846e..3423768 100644 --- a/README.md +++ b/README.md @@ -195,9 +195,9 @@ You can log ArrayList or Map item ``` ## SharedPreferencesFunctions -Secure shared preferences. -All item save to preferences key and value first key and value encrypted
-and when getItem decrypt and return item. +Source code for Shared Preferences +All items will be first encrypted and then saved into shared preferences, +items will be decrypted upon retrieving ```Pref context.addPref("key", any)