Skip to content

Instantly share code, notes, and snippets.

View k0shk0sh's full-sized avatar

Kosh Sergani k0shk0sh

View GitHub Profile
@romannurik
romannurik / DrawInsetsFrameLayout.java
Created February 10, 2014 16:28
DrawInsetsFrameLayout — adding additional background protection for system UI chrome when using KitKat’s translucent decor flags.
/*
* Copyright 2014 Google Inc.
*
* 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
@Takhion
Takhion / ArcUtils.java
Last active April 11, 2022 02:29
Collection of methods to achieve better circular arc drawing, as Canvas.drawArc() is unreliable. See the related article: https://medium.com/p/9155f49166b8
/**
* ArcUtils.java
*
* Copyright (c) 2014 BioWink GmbH.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@felipecsl
felipecsl / NoOverscrollSwipeRefreshLayout.java
Last active January 7, 2020 05:54
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
@JakeWharton
JakeWharton / ForegroundImageView.java
Created July 10, 2014 16:42
An ImageView which supports a foreground drawable.
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;
public class ForegroundImageView extends ImageView {
private Drawable foreground;
@zhanghai
zhanghai / OnVerticalScrollListener.java
Last active May 8, 2019 07:17
RecyclerView.OnScrollListener that reports scrolled up/down or reached top/bottom.
/*
* Copyright (c) 2015 Zhang Hai <Dreaming.in.Code.ZH@Gmail.com>
* All Rights Reserved.
*/
package com.example.android;
import android.support.v7.widget.RecyclerView;
public abstract class OnVerticalScrollListener extends RecyclerView.OnScrollListener {
while true; do
    ./adb shell input swipe 100 400 4000 400 400;
done
@k0shk0sh
k0shk0sh / keybase.md
Last active April 4, 2017 13:37
keybase.md

Keybase proof

I hereby claim:

  • I am k0shk0sh on github.
  • I am imkosh (https://keybase.io/imkosh) on keybase.
  • I have a public key whose fingerprint is B21B 490E C3C3 1E29 FC36 A7D8 2950 DD2D A315 EE38

To claim this, I am signing this object:

/*
* Copyright 2016 Google Inc.
*
* 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
/*
* Copyright 2016 Google Inc.
*
* 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
@chrisbanes
chrisbanes / code.kt
Last active August 10, 2023 10:46
Night Mode inflater
/*
* Copyright 2017 Google, Inc.
*
* 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