Skip to content

Instantly share code, notes, and snippets.

View fornewid's full-sized avatar
๐Ÿค–
on android

Sungyong An fornewid

๐Ÿค–
on android
View GitHub Profile
@alexjlockwood
alexjlockwood / RingOfCirclesView.kt
Last active January 10, 2024 14:07
Kotlin implementation of a Ring of Circles animation, inspired by https://twitter.com/InfinityLoopGIF/status/1101584983259533312
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View
private const val N = 16
private const val PERIOD1 = -10000.0
private const val PERIOD2 = -500.0
package com.geekorum.geekdroid.navigation
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import androidx.core.content.res.use
import androidx.core.os.bundleOf
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
@NickHolcombe
NickHolcombe / ListAdapterWithHeader.kt
Last active October 18, 2023 00:16
Example of a RecyclerView Adapter based on ListAdapter with a header
package example
import android.support.v7.recyclerview.extensions.AsyncDifferConfig
import android.support.v7.recyclerview.extensions.AsyncListDiffer
import android.support.v7.util.DiffUtil
import android.support.v7.util.ListUpdateCallback
import android.support.v7.widget.RecyclerView
/**
* {@link RecyclerView.Adapter RecyclerView.Adapter} base class based on
@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)
@kingori
kingori / ConstraintLayout.xml
Last active April 20, 2022 08:43
Live template for ConstraintLayout xml attributes for Android
<templateSet group="ConstraintLayout">
<template name="cbb" value="app:layout_constraintBottom_toBottomOf=&quot;$cursor$&quot;" description="constraint bottom to bottom of id" toReformat="true" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="cbp" value="app:layout_constraintBottom_toBottomOf=&quot;parent&quot;" description="constraint bottom to bottom of parent" toReformat="true" toShortenFQNames="true">
<context>
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active April 17, 2025 05:05
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
/*
* Copyright (C) 2016 Jeff Gilfelt.
*
* 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
@xnuk
xnuk / hyeong.md
Last active March 15, 2025 15:25
๋‚œํ•ดํ•œ ํ˜€์—‰.... ์–ธ์–ด

๋‚œํ•ดํ•œ ํ˜€์—‰... ์–ธ์–ด v0.4.5

  • โ€ฆ(U+2026), โ‹ฏ(U+22EF), โ‹ฎ(U+22EE)๋Š” ๋ชจ๋‘ .(U+002E)๊ฐ€ 3๋ฒˆ ์—ฐ์†์œผ๋กœ ๋‚˜์—ด๋œ ๊ฒƒ๊ณผ ๊ฐ™์€ ๊ฒƒ์œผ๋กœ ๋ด…๋‹ˆ๋‹ค.
  • "ํ•œ๊ธ€ ์Œ์ ˆ ๋ฌธ์ž"๋Š” ๊ฐ€(U+AC00) ์ด์ƒ ํžฃ(U+D7A3) ์ดํ•˜์˜ ์œ ๋‹ˆ์ฝ”๋“œ ๋ฌธ์ž๋“ค์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.

์Šคํƒ

public class MainActivity extends AppCompatActivity {
public static class Shop {
public int id;
public String name;
public List<Coordinate> coordinates = new ArrayList<>();
@Override
public String toString() {
String str = id + " (" + name + ") [ ";
package productmeister.com.productmeister.view;
import android.annotation.TargetApi;
import android.os.Build;
import android.support.design.widget.AppBarLayout;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;