Skip to content

Instantly share code, notes, and snippets.

View joreilly's full-sized avatar

John O'Reilly joreilly

View GitHub Profile
@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
@objcode
objcode / Permissions.kt
Last active February 21, 2023 23:01
Quick demo of compose permissions using activity result API. Uses Flow instead of State to make it reusable outside of Compose.
/*
* Copyright 2020 The Android Open Source Project
*
* 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
@yrezgui
yrezgui / execute.sh
Created May 1, 2020 16:14
Android 11 Wifi debugging
# 🤖Android 11 WiFi debugging
# Connect your device to the same WiFi as your computer
# Enable WiFi debugging in developer settings of your device
# Disable USB debugging if it's already enabled
# Plug your device to computer via USB
# You may have to kill adb server
adb kill-server
adb tcpip 5555
@danybony
danybony / screenshot_android.sh
Last active June 30, 2021 12:05
Android screenshot to current dir
#!/bin/bash
while getopts y: flag
do
case "${flag}" in
y) size=${OPTARG};;
esac
done
DEVICES=`adb devices | grep -v devices | grep device | cut -f 1`
@Sloy
Sloy / FirebaseCoroutinesExtensions.kt
Last active January 20, 2021 11:48
Reading Firebase Database as Kotlin coroutines
/*
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WARNING!!!
NO, SERIOUSLY. REAL WARNING!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@mtsahakis
mtsahakis / GridFragment.java
Last active April 25, 2021 22:40
Dynamically set span count in an Android RecyclerView's GridLayoutManager. Implementation is taken from a Fragment.
private RecyclerView mRecyclerView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_view, container, false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
// ommiting other recycler view set up, such as adapter and Layout manager set up ..
ViewTreeObserver viewTreeObserver = mRecyclerView.getViewTreeObserver();
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {