Skip to content

Instantly share code, notes, and snippets.

View swanhtet1992's full-sized avatar
🪶
Studying programming again!

Swan Htet Aung swanhtet1992

🪶
Studying programming again!
View GitHub Profile
@nickbutcher
nickbutcher / 1 search_bar.xml
Last active March 26, 2022 10:03
Demonstrating morphing a search icon into a search field. To do this we use an AnimatedVectorDrawable (https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html) made up of two paths. The first is the search icon (as a single line) the second is the horizontal bar. We then animate the 'trimPathStart' property …
<?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
@gabrielemariotti
gabrielemariotti / README.md
Last active March 9, 2023 06:02
A SectionedGridRecyclerViewAdapter: use this class to realize a simple sectioned grid `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active March 26, 2023 11:58
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* 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
@gabrielemariotti
gabrielemariotti / Readme.md
Last active March 2, 2024 23:10
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
@alexfu
alexfu / ColorUtils.java
Last active January 30, 2023 00:04
Automatic text color selection using relative luminance.
public class ColorUtils {
private static final double LM_RED_COEFFICIENT = 0.2126;
private static final double LM_GREEN_COEFFICIENT = 0.7152;
private static final double LM_BLUE_COEFFICIENT = 0.0722;
public static int calculateRelativeLuminance(int color) {
int red = (int) (Color.red(color) * LM_RED_COEFFICIENT);
int green = (int) (Color.green(color) * LM_GREEN_COEFFICIENT);
int blue = (int) (Color.blue(color) * LM_BLUE_COEFFICIENT);
return red + green + blue;
@antoniolg
antoniolg / SwipeRefreshActivity.java
Last active July 29, 2019 11:59
An activity that uses a SwipeRefreshLayout as a container for the layout of the classes that extend it.
/*
* Copyright (C) 2014 Antonio Leiva Gordillo.
*
* 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
@jgilfelt
jgilfelt / ScalpelDrawer.java
Last active January 28, 2017 13:09
ScalpelDrawer - A simple wrapper for Scalpel (https://github.com/JakeWharton/scalpel) that includes toggle controls accessible from a right-side navigation drawer. Call ScalpelDrawer.wrapInside() in a base Activity onPostCreate() to easily wrap all content in your app.
package com.example.scalpeldrawer;
import android.app.Activity;
import android.content.Context;
import android.support.v4.widget.DrawerLayout;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
@cyrilmottier
cyrilmottier / _app_avelibRelease_res_values_config.xml
Last active November 20, 2020 11:27
Using the new Gradle-based Android build system: an example
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="config_app_name">AVélib</string>
<string name="config_authority">com.cyrilmottier.android.avelib.citybikes</string>
<string name="config_com.google.android.maps.v2.api_key">XXX</string>
</resources>
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active April 17, 2024 10:51
Backend Architectures Keywords and References