Skip to content

Instantly share code, notes, and snippets.

View luongvo's full-sized avatar
🚀
flying in the sky

Luong Vo (Lucas) luongvo

🚀
flying in the sky
View GitHub Profile
@arunkumar9t2
arunkumar9t2 / PreferencesX.kt
Last active September 6, 2023 15:20
Android PreferenceScreen DSL for using with androidx.preference framework.
@file:Suppress("NOTHING_TO_INLINE")
import android.content.Context
import androidx.annotation.StringRes
import androidx.fragment.app.Fragment
import androidx.preference.*
/**
* DSL marker for restricting access scope when [PreferencesBuilder.preference] is nested.
*/
@icedraco
icedraco / permutations.kt
Created February 7, 2018 15:29
Kotlin permutation generator function: creates sequences
/* Created by IceDragon on 07-Feb-2018 */
import kotlin.coroutines.experimental.buildSequence
fun permutations(items: List<Any?>, qty: Int): Sequence<List<Any?>> = buildSequence {
if (items.size < qty || qty == 0)
return@buildSequence
val availableIndices = Array<Int?>(items.size, { it })
val iterators = Array<Iterator<Int>>(qty, { (0 until availableIndices.size).iterator() })
@bassaer
bassaer / config.yml
Last active September 10, 2018 17:39
CircleCI 2.0でAndroidライブラリの自動デプロイ ref: http://qiita.com/bassaer/items/6b9aedae4571d59f0fdf
version: 2
jobs:
build:
branches:
only:
- master
- develop
docker:
# specify the version you desire here
- image: circleci/android:api-26-alpha
/*
* Copyright (C) 2017 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
@MensObscura
MensObscura / CustomBottomNavigationView.java
Last active July 15, 2019 12:42
BottomNavigationView with shifModeDisable and Badge
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.support.design.internal.BottomNavigationItemView;
import android.support.design.internal.BottomNavigationMenuView;
import android.support.design.widget.BottomNavigationView;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.Gravity;
@tobiasschuerg
tobiasschuerg / SupportDatePickerDialog.java
Last active April 17, 2019 06:47
SupportDatePickerDialog for working around IllegalFormatConversionException on Samsung 5.0 and Samsung 5.1. Inspired by http://stackoverflow.com/a/31855744/570168
import android.app.DatePickerDialog;
import android.content.Context;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.annotation.StyleRes;
import android.support.v7.view.ContextThemeWrapper;
@LuigiPapino
LuigiPapino / FontAwareTabLayout.java
Last active July 4, 2017 07:13
Android - Calligraphy and TabLayout
/**
* Simple helper class which extends a TabLayout to allow us to customize the font of the tab.
* https://gist.github.com/tmtrademarked/09926077a406959be15fc8a824a52751
* https://github.com/chrisjenx/Calligraphy/issues/180
*/
public final class FontAwareTabLayout extends TabLayout {
private String fontPath;
public FontAwareTabLayout(Context context, AttributeSet attrs) {
@juanca
juanca / github_load_all_diffs.js
Created March 2, 2017 18:42
Github PR bookmarklet: Load all file diffs
javascript:
document.querySelectorAll('.load-diff-button').forEach(node => node.click())
package com.mindorks.snaphelperexample.ui.common;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.LinearSnapHelper;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
import android.view.View;
@jaredrummler
jaredrummler / XposedUtils.java
Created October 31, 2016 22:34
Utility methods for checking if the Xposed framework is installed.
/*
* Copyright (C) 2016 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