Skip to content

Instantly share code, notes, and snippets.

View runemart's full-sized avatar
🐘
https://androiddev.social/@Kvisten

Rune M. Andersen runemart

🐘
https://androiddev.social/@Kvisten
View GitHub Profile
@bdsaglam
bdsaglam / Singleton.kt
Created September 9, 2019 07:52
Kotlin Singleton with initialization parameters
class Singleton private constructor(application: Application) {
companion object {
@Volatile
private var INSTANCE: Singleton? = null
fun getInstance(application: Application): Singleton =
INSTANCE ?: synchronized(this) {
INSTANCE
?: Singleton(application).also { INSTANCE = it }
}
@nickbutcher
nickbutcher / 10: animator-morph_ridge_2_to_tick.xml
Last active February 20, 2021 07:32
Demonstrating an animation for scanning a fingerprint and showing success or failure. This uses a number of AnimatedVectorDrawables (https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html) to 'morph' parts of the fingerprint into the tick or cross to report success or failure. It also uses a moving clip-pat…
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 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
@jaredrummler
jaredrummler / MenuTint.java
Last active July 6, 2024 16:37
Helper class to set the color and transparency for menu icons in an ActionBar or Toolbar.
/*
* Copyright (C) 2015. Jared Rummler <jared.rummler@gmail.com>
*
* 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
@icchan
icchan / RegexCardValidator.java
Last active May 16, 2024 04:13
Java Credit Card Number Validator
package net.bubblemix.cardcheck;
/**
* Validator for credit card numbers
* Checks validity and returns card type
*
* @author ian.chen
*/
public class RegexCardValidator {
@johan
johan / index.md
Last active September 26, 2023 16:35
osx + java 7 = painfully easy

Step 1

Does your osx terminal speak java 7? Start Terminal.app and try: java -version:

> java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
@Joev-
Joev- / DialogFragmentCallback.md
Last active June 25, 2021 08:43
Getting results from DialogFragment to calling Fragment using Callbacks

##Getting results from DialogFragments to another Fragment.

When setting up the DialogFragment make a call to Fragment.setTargetFragment()
Then from DialogFragment you can access the main fragment with Fragment.getTargetFragment()
Use interfaces to provide the required actions to the calling Fragment.

##Example code.

###AddFriendDialogFragment - Calls back to calling fragment.