Instantly share code, notes, and snippets.

View ListPositioner.kt
interface ListPositioner {
val recyclerScrollKey: String
fun loadListPosition()
fun saveListPosition()
fun resetListPosition()
}
View layout.xml
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Label_Email" />
<TextView
android:id="@+id/customer_email"
View index.html
<a class="fa-stack fa-2x fa-fw" href="https://www.linkedin.com/in/jake-lee" target="_blank">
<i class="fab fa-linkedin fa-2x"></i>
</a>
<a class="fa-stack fa-2x fa-fw" href="https://github.com/JakeSteam" target="_blank">
<i class="fab fa-github-square fa-2x"></i>
</a>
<a class="fa-stack fa-2x fa-fw" href="https://www.reddit.com/user/JakeSteam/" target="_blank">
<i class="fab fa-reddit-square fa-2x"></i>
</a>
<a class="fa-stack fa-2x fa-fw" href="https://facebook.com/Jake.L" target="_blank">
View AndroidManifest.xml
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
View AndroidManifest.xml
<service
android:name=".JobScheduler"
android:exported="false">
<intent-filter>
<action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE" />
</intent-filter>
</service>
View fragment_develop_ml_kit.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".develop.mlkit.MLKitFragment"
android:fadeScrollbars="false">
<LinearLayout
View LoginFragment.kt
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
TrackingUtil(activity!!).track(TrackingUtil.Screens.Login)
return inflater.inflate(R.layout.fragment_login, container, false)
}
View ActionHandler.kt
interface ActionHandler {
fun handleAction(actionCode: String)
}
View DrawableModifier.kt
// Changing colour
val layerDrawable = (ImageView)findViewById(R.id.my_drawable).drawable as LayerDrawable
val backgroundDrawable = layerDrawable.findDrawableByLayerId(R.id.background_circle) as GradientDrawable
backgroundDrawable.setColor(ContextCompat.getColor(context, R.color.my_colour))
// Changing drawable
layerDrawable.setDrawableByLayerId(R.id.foreground_icon, ContextCompat.getDrawable(context, R.drawable.new_foreground_icon))
View styles.xml
<style name="Font_Regular" tools:keep="@style/Font_Regular">
<item name="android:fontFamily">@font/the_sans_c4s</item>
</style>
<style name="Font_Regular_Italic" parent="Font_Regular" tools:keep="@style/Font_Regular_Italic">
<item name="android:textStyle">italic</item>
</style>
<style name="Font_Bold" parent="Font_Regular" tools:keep="@style/Font_Bold">
<item name="android:textStyle">bold</item>