Skip to content

Instantly share code, notes, and snippets.

View ArthurNagy's full-sized avatar

Arthur Nagy ArthurNagy

View GitHub Profile
@ArthurNagy
ArthurNagy / BottomSheetDialog.kt
Created November 28, 2022 12:41
Compose modal bottom sheet
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.appcompat.view.ContextThemeWrapper
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionContext
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@ArthurNagy
ArthurNagy / network_security_config.xml
Created September 15, 2020 20:32
Network security config for proxy
<?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>
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return AccountMenuBinding.inflate(inflater, container, false).also { binding = it }.root
}
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 May 4, 2021 04:46
View Lifecycle owner
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 October 31, 2024 11:35
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
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
#!/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 September 29, 2016 21:53
plus to checkmark and checkmark to plus animated vector drawables, paths are not exactly material icons approved :D
<?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