https://learnui.design/blog/ios-vs-android-app-ui-design-complete-guide.html
<what>_<where> (snake_case)
| what | where | sample |
|---|---|---|
| activity | Content View of Activity | activity_splash.xml |
| fun Activity.hideKeyboardOnClickOutsideEditText(view: View) { | |
| // Set up touch listener for non-text box views to hide keyboard. | |
| var previousAction = 0 | |
| val onTouchListener = View.OnTouchListener { v, event -> | |
| if (currentFocus != null | |
| && event.action != MotionEvent.ACTION_DOWN | |
| && event.action != MotionEvent.ACTION_MOVE | |
| && previousAction != MotionEvent.ACTION_MOVE | |
| ) { | |
| currentFocus?.clearFocus() |
| package com.zakrodionov.commonApp.app.platform | |
| import android.content.BroadcastReceiver | |
| import android.content.Context | |
| import android.content.Intent | |
| import android.content.IntentFilter | |
| import android.net.ConnectivityManager | |
| import android.net.Network | |
| import android.os.Build | |
| import androidx.core.content.ContextCompat.getSystemService |
| /* | |
| SampleAuthenticator (c) by Farhan Khan | |
| SampleAuthenticator is licensed under a | |
| Creative Commons Attribution 3.0 Unported License. | |
| http://creativecommons.org/licenses/by/3.0/ | |
| */ | |
| class SampleAuthenticator( |
| class AddressesSpinnerAdapter( | |
| context: Context, | |
| textViewResourceId: Int = android.R.layout.simple_spinner_item | |
| ) : ArrayAdapter<AddressesSpinnerItem>(context, textViewResourceId) { | |
| var values: ArrayList<AddressesSpinnerItem> = arrayListOf() | |
| set(value) { | |
| field.clear() | |
| field = value | |
| notifyDataSetChanged() |
| class HorizontalPaddingDecoration( | |
| private val padding: Float = 2f, | |
| private val firstLastPadding: Float = 20f | |
| ) : RecyclerView.ItemDecoration() { | |
| override fun getItemOffsets( | |
| outRect: Rect, | |
| view: View, | |
| parent: RecyclerView, | |
| state: RecyclerView.State |
https://learnui.design/blog/ios-vs-android-app-ui-design-complete-guide.html
<what>_<where> (snake_case)
| what | where | sample |
|---|---|---|
| activity | Content View of Activity | activity_splash.xml |
| // Example | |
| fun expandAdapterDelegate() = adapterDelegateLayoutContainer<ExpandedItem, DisplayableItem>(R.layout.item_expanded) { | |
| llArrowContainer.setOnClickListener { | |
| val isExpand = !item.isExpanded | |
| item.isExpanded = isExpand | |
| expandText(isExpand, ivArrow, llTextContainer) | |
| } | |
| bind { |
| import android.content.Context; | |
| import android.content.pm.PackageInfo; | |
| import android.content.pm.PackageManager; | |
| import android.content.pm.PackageManager.NameNotFoundException; | |
| import android.content.pm.Signature; | |
| public class TamperCheck { | |
| //we store the hash of the signture for a little more protection | |
| private static final String APP_SIGNATURE = "1038C0E34658923C4192E61B16846"; |
| /* | |
| * Copyright 2015 Yuriy Mysochenko | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| package com.kevicsalazar.utils; | |
| import android.animation.AnimatorSet; | |
| import android.animation.ObjectAnimator; | |
| import android.view.View; | |
| public class AnimationUtils { | |
| // Attention | |
| public static AnimatorSet loadBounceAnimator(View target) { | |
| AnimatorSet animatorSet = new AnimatorSet(); |