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 May 18, 2024 15:53
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 February 11, 2024 15:10
난해한 혀엉.... 언어

이 문서가 여기저기 알려짐에 따라, 이곳에 여러가지 댓글이 달리고 있습니다. 개인적으로는 댓글창을 없애버리고 싶지만 그럴 수 없는 터라, 댓글을 달기 전에 한번씩만 더 생각해주셨으면 합니다.

  • 개인적인 감상은 이곳이 아닌 다른 곳에 적어주세요.
  • 동성애 혐오적인 댓글을 달지 마세요.
  • 기타 "난해한 혀엉... 언어"와 관련없는 댓글을 달지 말아주세요.

위 사항들을 포함해 제 마음에 안 드는 댓글들은 임의로 삭제하고 있습니다. 양해 부탁드립니다.


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;