Skip to content

Instantly share code, notes, and snippets.

View flashfoxter's full-sized avatar
🏠
Working from home

Konstantin Le flashfoxter

🏠
Working from home
View GitHub Profile
@flashfoxter
flashfoxter / README.md
Created May 30, 2018 15:02 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

@flashfoxter
flashfoxter / Mask.java
Created May 29, 2018 12:18 — forked from malvre/Mask.java
[Android] Mask format for EditText
public abstract class Mask {
public static String unmask(String s) {
return s.replaceAll("[.]", "")
.replaceAll("[-]", "")
.replaceAll("[/]", "")
.replaceAll("[(]", "")
.replaceAll("[)]", "");
}
@flashfoxter
flashfoxter / EqualSpacingItemDecoration.java
Created May 25, 2018 17:20 — forked from alexfu/EqualSpacingItemDecoration.java
Add equal spacing to RecyclerView items automatically. Can handle horizontal, vertical, and grid display modes
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class EqualSpacingItemDecoration extends RecyclerView.ItemDecoration {
private final int spacing;
private int displayMode;
public static final int HORIZONTAL = 0;
@flashfoxter
flashfoxter / GridInsetDecoration.java
Created May 25, 2018 17:20 — forked from UweTrottmann/GridInsetDecoration.java
RecyclerView grid spacing decoration for use with GridLayoutManager.
/*
* Copyright 2015 Uwe Trottmann
*
* 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
@flashfoxter
flashfoxter / NoOverscrollSwipeRefreshLayout.java
Created May 17, 2018 14:12 — forked from felipecsl/ NoOverscrollSwipeRefreshLayout.java
Modified Android SwipeRefreshLayout that does not move down the content view on swipe down (no overscroll)
/*
* Copyright (C) 2013 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
@flashfoxter
flashfoxter / removeAllChildFragments
Created April 17, 2018 15:28 — forked from elsennov/removeAllChildFragments
Remove all child fragments inside parent fragment (Nested fragment)
private void removeAllChildFragments() {
List<String> childFragmentTags = CHILD_FRAGMENT_TAGS_MAP.get(mParentId);
if (childFragmentTags != null && !childFragmentTags.isEmpty()) {
List<Fragment> childFragments = getChildFragmentManager().getFragments();
if (childFragments != null && !childFragments.isEmpty()) {
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
for (Fragment childFragment : childFragments) {
if (childFragment != null) {
if (childFragmentTags.contains(childFragment.getTag())) {
fragmentTransaction.remove(childFragment);
@flashfoxter
flashfoxter / removeAllChildFragments
Created April 17, 2018 15:28 — forked from elsennov/removeAllChildFragments
Remove all child fragments inside parent fragment (Nested fragment)
private void removeAllChildFragments() {
List<String> childFragmentTags = CHILD_FRAGMENT_TAGS_MAP.get(mParentId);
if (childFragmentTags != null && !childFragmentTags.isEmpty()) {
List<Fragment> childFragments = getChildFragmentManager().getFragments();
if (childFragments != null && !childFragments.isEmpty()) {
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
for (Fragment childFragment : childFragments) {
if (childFragment != null) {
if (childFragmentTags.contains(childFragment.getTag())) {
fragmentTransaction.remove(childFragment);
@flashfoxter
flashfoxter / removeAllChildFragments
Created April 17, 2018 15:28 — forked from elsennov/removeAllChildFragments
Remove all child fragments inside parent fragment (Nested fragment)
private void removeAllChildFragments() {
List<String> childFragmentTags = CHILD_FRAGMENT_TAGS_MAP.get(mParentId);
if (childFragmentTags != null && !childFragmentTags.isEmpty()) {
List<Fragment> childFragments = getChildFragmentManager().getFragments();
if (childFragments != null && !childFragments.isEmpty()) {
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
for (Fragment childFragment : childFragments) {
if (childFragment != null) {
if (childFragmentTags.contains(childFragment.getTag())) {
fragmentTransaction.remove(childFragment);
@flashfoxter
flashfoxter / removeAllChildFragments
Created April 17, 2018 15:28 — forked from elsennov/removeAllChildFragments
Remove all child fragments inside parent fragment (Nested fragment)
private void removeAllChildFragments() {
List<String> childFragmentTags = CHILD_FRAGMENT_TAGS_MAP.get(mParentId);
if (childFragmentTags != null && !childFragmentTags.isEmpty()) {
List<Fragment> childFragments = getChildFragmentManager().getFragments();
if (childFragments != null && !childFragments.isEmpty()) {
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
for (Fragment childFragment : childFragments) {
if (childFragment != null) {
if (childFragmentTags.contains(childFragment.getTag())) {
fragmentTransaction.remove(childFragment);
@flashfoxter
flashfoxter / removeAllChildFragments
Created April 17, 2018 15:28 — forked from elsennov/removeAllChildFragments
Remove all child fragments inside parent fragment (Nested fragment)
private void removeAllChildFragments() {
List<String> childFragmentTags = CHILD_FRAGMENT_TAGS_MAP.get(mParentId);
if (childFragmentTags != null && !childFragmentTags.isEmpty()) {
List<Fragment> childFragments = getChildFragmentManager().getFragments();
if (childFragments != null && !childFragments.isEmpty()) {
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
for (Fragment childFragment : childFragments) {
if (childFragment != null) {
if (childFragmentTags.contains(childFragment.getTag())) {
fragmentTransaction.remove(childFragment);