See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
org.gradle.jvmargs=-Xmx12g -XX:MaxPermSize=4g -Dfile.encoding=UTF-8 -XX:+UseGCOverheadLimit -XX:GCTimeLimit=10 -XX:+HeapDumpOnOutOfMemoryError | |
org.gradle.daemon.idletimeout=120000 | |
org.gradle.daemon=true | |
org.gradle.caching=true | |
org.gradle.configureondemand=true | |
org.gradle.parallel=true | |
org.gradle.unsafe.watch-fs=true | |
org.gradle.unsafe.configuration-cache=ON | |
room.incremental=true | |
android.enableSeparateRClassCompilation=true |
fun Activity.getRootView(): View { | |
return findViewById(android.R.id.content) | |
} | |
fun Context.convertDpToPx(dp: Float): Float { | |
return TypedValue.applyDimension( | |
TypedValue.COMPLEX_UNIT_DIP, | |
dp, | |
this.resources.displayMetrics | |
) | |
} |
private var mLastContentHeight by Delegates.notNull<Int>() | |
private val keyboardLayoutListener = OnGlobalLayoutListener { | |
val currentContentHeight: Int = requireActivity().window.findViewById<View>(Window.ID_ANDROID_CONTENT).getHeight() | |
if (mLastContentHeight > currentContentHeight + 100) { | |
showKeyboard() | |
mLastContentHeight = currentContentHeight | |
} else if (currentContentHeight > mLastContentHeight + 100) { | |
hideKeyboard() | |
mLastContentHeight = currentContentHeight |
fun View.setShadow( | |
@ColorRes shadowColor: Int, | |
@DimenRes cornerRadius: Int, | |
@DimenRes elevation: Int, | |
shadowGravity: Int = Gravity.BOTTOM, | |
@ColorRes backgroundColorResource: Int = 0 | |
) { | |
val resource = context.resources | |
val firstLayer = 0 | |
val ratioTopBottom = 3 |
/** Set the View visibility to VISIBLE and eventually animate the View alpha till 100% */ | |
fun View.visible(animate: Boolean = true) { | |
if (animate) { | |
animate().alpha(1f).setDuration(300).setListener(object : AnimatorListenerAdapter() { | |
override fun onAnimationStart(animation: Animator) { | |
super.onAnimationStart(animation) | |
visibility = View.VISIBLE | |
} | |
}) | |
} else { |
<androidx.recyclerview.widget.RecyclerView | |
android:id="@+id/recycler_view" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layoutAnimation="@anim/layout_animation" | |
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> |
1) in manifest in main activity | |
<meta-data | |
android:name="android.app.shortcuts" | |
android:resource="@xml/shortcuts" /> | |
2) shortcuts.xml | |
<?xml version="1.0" encoding="utf-8"?> | |
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android"> | |
<shortcut |
import android.os.Build | |
import android.os.Environment | |
import android.util.Log | |
import org.threeten.bp.LocalDateTime | |
import tech.dcloud.erfid.core.base.extension.getDateTimeOfPattern | |
import tech.dcloud.erfid.ugrokit.BuildConfig | |
import tech.dcloud.erfid.ugrokit.ui.util.LoggerHandler.Companion.TXT_NAME | |
import java.io.File | |
import java.io.FileOutputStream |
import android.os.Build | |
import android.os.Environment | |
import android.util.Log | |
import org.threeten.bp.LocalDateTime | |
import tech.dcloud.erfid.core.base.extension.getDateTimeOfPattern | |
import tech.dcloud.erfid.ugrokit.BuildConfig | |
import timber.log.Timber | |
import java.io.File | |
import java.io.FileOutputStream |