This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FullscreenOverlayService extends Service { | |
private View overlay; | |
private WindowManager windowManager; | |
@Nullable | |
@Override | |
public IBinder onBind(Intent intent) { | |
return null; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Color; | |
import android.support.annotation.ColorInt; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Size; | |
public class ColorUtil { | |
public static @ColorInt int lighten(@ColorInt int color, float value) { | |
float[] hsl = colorToHSL(color); | |
hsl[2] += value / 100; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PathSimplifier.swift | |
import UIKit | |
private let TOLERANCE: CGFloat = 1e-6 | |
private let EPSILON: CGFloat = 1e-12 | |
extension CGPoint { | |
func add(p: CGPoint) -> CGPoint { | |
return CGPointMake(x+p.x, y+p.y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol ScopeFunc {} | |
extension ScopeFunc { | |
@inline(__always) func apply(block: (Self) -> ()) -> Self { | |
block(self) | |
return self | |
} | |
@inline(__always) func letIt<R>(block: (Self) -> R) -> R { | |
return block(self) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.widget.ListPopupWindow; | |
import android.widget.PopupWindow; | |
import android.widget.Spinner; | |
public static void avoidSpinnerDropdownFocus(Spinner spinner) { | |
try { | |
Field listPopupField = Spinner.class.getDeclaredField("mPopup"); | |
listPopupField.setAccessible(true); | |
Object listPopup = listPopupField.get(spinner); | |
if (listPopup instanceof ListPopupWindow) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConcatObjectAdapter( | |
private vararg val adapters: ObjectAdapter | |
) : ObjectAdapter() { | |
init { | |
adapters.forEach { adapter -> | |
adapter.registerObserver(object : DataObserver() { | |
override fun onChanged() { | |
super.onChanged() | |
this@ConcatObjectAdapter.notifyChanged() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author kakajika | |
* @since 2016/04/27 | |
*/ | |
public class MaxLinearLayout extends LinearLayout { | |
public MaxLinearLayout(Context context) { | |
super(context); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Build | |
import android.text.style.LineHeightSpan | |
import androidx.annotation.Px | |
import kotlin.math.roundToInt | |
object LineHeightSpanCompat { | |
fun standard(@Px lineHeight: Int): LineHeightSpan = | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { | |
LineHeightSpan.Standard(lineHeight) | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.firebase.database.* | |
import rx.Observable | |
import rx.lang.kotlin.add | |
import rx.lang.kotlin.observable | |
/** | |
* @author kakajika | |
* @since 2016/11/08 | |
*/ | |
class RxFirebaseDatabase { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* px/dp/sp/pt/mm unit converter. | |
* This is not incompatible with Jetpack Compose. | |
*/ | |
inline class Pixel(private val pxF: Float) { | |
val toPx: Int @Px get() = pxF.roundToInt() | |
fun toDp(res: Resources = Resources.getSystem()): Float = pxF / TypedValue.applyDimension( | |
TypedValue.COMPLEX_UNIT_DIP, 1.0f, res.displayMetrics | |
) |
NewerOlder