This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CircularImageView : ImageView { | |
| constructor(context: Context) : super(context) {} | |
| constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {} | |
| constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {} | |
| override fun onDraw(canvas: Canvas) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun AppCompatActivity.toggleHideShowKeyboard() { | |
| val inputMethodManager = this.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager | |
| when { | |
| inputMethodManager.isActive -> inputMethodManager.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0) | |
| else -> inputMethodManager.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0) // hide | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun AppCompatActivity.hideKeyBoard(){ | |
| val view = this.currentFocus | |
| if (view != null) { | |
| val inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | |
| inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun Snackbar.setTextColor(color: Int): Snackbar { | |
| val tv = view.findViewById(android.support.design.R.id.snackbar_text) as TextView | |
| tv.setTextColor(color) | |
| return this | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Description of this regular expression is as below: | |
| Passwords will contain at least 1 upper case letter | |
| Passwords will contain at least 1 lower case letter | |
| Passwords will contain at least 1 number or special character | |
| Passwords will contain at least 8 characters in length | |
| Password maximum length should not be arbitrarily limited | |
| (?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun closeActivitiesGoLogin(context: Context?) { | |
| val intent = Intent(context, LoginActivity::class.java) | |
| val cn = intent.component | |
| val mainIntent = Intent.makeRestartActivityTask(cn) | |
| context?.startActivity(mainIntent) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun View.changeColorAnimatedly(duration: Long, repeatable: Boolean, startColor: Int, endColor: Int) { | |
| val anim = ObjectAnimator.ofInt(this, "backgroundColor", startColor, endColor) | |
| anim.duration = duration | |
| anim.setEvaluator(ArgbEvaluator()) | |
| if (repeatable) { | |
| anim.repeatCount = ValueAnimator.INFINITE | |
| anim.repeatMode = ValueAnimator.REVERSE | |
| } | |
| anim.start() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| values-sw720dp 10.1” tablet 1280x800 mdpi | |
| values-sw600dp 7.0” tablet 1024x600 mdpi | |
| values-sw480dp 5.4” 480x854 mdpi | |
| values-sw480dp 5.1” 480x800 mdpi | |
| values-xxhdpi 5.5" 1080x1920 xxhdpi | |
| values-xxxhdpi 5.5" 1440x2560 xxxhdpi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun printKeyHash() { | |
| try { | |
| val info = activity?.packageManager?.getPackageInfo("com.s", PackageManager.GET_SIGNATURES) | |
| for (signature in info!!.signatures!!) { | |
| val md = MessageDigest.getInstance("SHA") | |
| md.update(signature.toByteArray()) | |
| Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT)) | |
| } | |
| } catch (e: PackageManager.NameNotFoundException) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <androidx.constraintlayout.widget.ConstraintLayout | |
| android:id="@+id/layoutHeaderNavView" | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" | |
| android:background="?attr/selectableItemBackground" | |
| android:clickable="true" | |
| android:focusable="true"> |