Skip to content

Instantly share code, notes, and snippets.

Avatar

ArthurNagy

View GitHub Profile
@ArthurNagy
ArthurNagy / network_security_config.xml
Created Sep 15, 2020
Network security config for proxy
View network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config>
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>
View inflate.kt
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return AccountMenuBinding.inflate(inflater, container, false).also { binding = it }.root
}
View inflate.kt
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return AccountMenuBinding.inflate(inflater, container, false).also { binding = it }.root
}
@ArthurNagy
ArthurNagy / MyCustomView.kt
Last active Oct 15, 2018
View Lifecycle owner
View MyCustomView.kt
class MyCustomView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
View(context, attrs, defStyleAttr) {
private val viewModel = MyViewModel()
private val viewLifecycleOwner = ViewLifecycleOwner()
init {
viewModel.data.observe(viewLifecycleOwner) { data ->
// ...
}
@ArthurNagy
ArthurNagy / RoundedBottomSheetDialogFragment.kt
Last active Jun 15, 2020
Rounded modal bottom sheet as seen in new Google products(Tasks, News, etc.), described in this article: https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b
View RoundedBottomSheetDialogFragment.kt
package com.your.package
import android.app.Dialog
import android.os.Bundle
import com.your.package.R
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* BottomSheetDialog fragment that uses a custom
View code_stats.sh
#!/bin/sh
project_dir=$1
cd $project_dir
stats_for_month(){
java_files="$(find \. -mindepth 1 -type f -name '*.java' -print)"
kotlin_files="$(find \. -mindepth 1 -type f -name '*.kt' -print)"
java_files_nr=$(echo "$java_files" | wc -l)
kotlin_files_nr=$(echo "$kotlin_files" | wc -l)
@ArthurNagy
ArthurNagy / ic_add_checkmark
Created Sep 29, 2016
plus to checkmark and checkmark to plus animated vector drawables, paths are not exactly material icons approved :D
View ic_add_checkmark
<?xml version="1.0" encoding="utf-8"?><!--suppress AndroidDomInspection -->
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingPrefix,NewApi"
tools:targetApi="lollipop">
<aapt:attr name="android:drawable">
<vector
You can’t perform that action at this time.