Skip to content

Instantly share code, notes, and snippets.

View yasincidem's full-sized avatar
🦜

Yasin Çidem yasincidem

🦜
View GitHub Profile
@handstandsam
handstandsam / MyLifecycleOwner.kt
Last active June 11, 2024 20:23
Jetpack Compose OverlayService. You have to have all the correct permissions granted and in your manifest, but if you do, this this will show a green box with "Hello" in it!
import android.os.Bundle
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleRegistry
import androidx.savedstate.SavedStateRegistry
import androidx.savedstate.SavedStateRegistryController
import androidx.savedstate.SavedStateRegistryOwner
internal class MyLifecycleOwner : SavedStateRegistryOwner {
private var mLifecycleRegistry: LifecycleRegistry = LifecycleRegistry(this)
private var mSavedStateRegistryController: SavedStateRegistryController = SavedStateRegistryController.create(this)
@cedrickring
cedrickring / ColoredShadow.kt
Last active April 18, 2024 10:29
Draw a colored shadow in Android Jetpack Compose
/*
Copyright 2020 Cedric Kring.
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
distributed under the License is distributed on an "AS IS" BASIS,
@alexjlockwood
alexjlockwood / CircleSquare.kt
Last active September 26, 2020 17:52
A circle square animation implemented using Jetpack Compose. Inspired by @beesandbombs (twitter.com/beesandbombs).
package com.alexjlockwood.circlesquare
import androidx.compose.animation.animatedFloat
import androidx.compose.animation.core.AnimationConstants
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.repeatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.runtime.Composable
@iniyan455
iniyan455 / ABI
Created June 29, 2020 08:04
Android ABI Understanding
MIPS uses a single syscall instruction for all access to operating system services. The setup for a syscall instruction puts a syscall code into a register. ... They allocate and keep track of the addresses and allow a programmer to use labels instead of addresses in assembly language code.
MIPS (Microprocessor without Interlocked Pipelined Stages) is a reduced instruction set computer (RISC) instruction set architecture (ISA)
A reduced instruction set computer, or RISC (/rɪsk/),
For example, if we are having mips, x86, armeabi, armeabi-v7a, armeabi-v8a, then the .so file will be generated for all the five architectures. So, if the size of one .so file is 5MB then the application size should be 5MB but in reality, it will be of 5*5 = 25MB.
Arm, previously Advanced RISC Machine, originally Acorn RISC Machine, is a family of reduced instruction set computing (RISC) architectures for computer processors, configured for various environments.
Title:
Incident date:
Owner:
Peer-review committee:
Tags:
Summary:
Supporting data:
Customer Impact:
Incident Response Analysis:
Post-Incident Analysis:
task getDeviceIp {
doLast {
new ByteArrayOutputStream().withStream { os ->
exec {
commandLine(android.getAdbExe())
args('shell', 'ip', 'addr', 'show', 'wlan0', ' | grep', '\'inet \'', '| cut -d\' \'', '-f6', '|cut -d/', '-f1')
standardOutput = os
}
ext.deviceIp = os.toString().trim()
}
@Zhuinden
Zhuinden / FragmentViewBindingDelegate.kt
Last active February 24, 2024 20:13
Fragment view binding delegate
// https://github.com/Zhuinden/fragmentviewbindingdelegate-kt
import android.view.View
import androidx.fragment.app.Fragment
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.Observer
import androidx.viewbinding.ViewBinding
import kotlin.properties.ReadOnlyProperty
@mirland
mirland / build.gradle
Last active June 5, 2020 08:45
Script to manage android secret keys
apply from: rootProject.file('read_secrets.gradle')
apply plugin: 'com.android.application'
....
android {
defaultConfig {
buildConfigField 'String', 'SOMETHING_SECRET', getEnvVariable('SOMETHING_SECRET')
}
signingConfigs {
@JoseAlcerreca
JoseAlcerreca / EventObserver.kt
Created April 26, 2018 12:14
An Observer for Events, simplifying the pattern of checking if the Event's content has already been handled.
/**
* An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has
* already been handled.
*
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled.
*/
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> {
override fun onChanged(event: Event<T>?) {
event?.getContentIfNotHandled()?.let { value ->
onEventUnhandledContent(value)
@keima
keima / HowToUseActivity.kt
Last active March 31, 2024 21:58
LifecycleOwner implemented RecyclerView ViewHolder & Adapter (concept design)
import android.os.Bundle
import android.util.Log
import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import app.keima.android.recyclerviewsandbox.databinding.ActivityMainBinding