Skip to content

Instantly share code, notes, and snippets.

View Jericho2Code's full-sized avatar

Mikhail Panchukov Jericho2Code

View GitHub Profile
inline fun <reified T> Fragment.argument(name: String? = null): ReadOnlyProperty<Fragment, T> =
object : ReadOnlyProperty<Fragment, T> {
override operator fun getValue(thisRef: Fragment, property: KProperty<*>): T {
return thisRef.arguments?.get(name ?: property.name) as T
}
}
class FullscreenImagesDialogFragment : DialogFragment() {
private val something by argument<String>(SOMETHING_KEY)
@AKiniyalocts
AKiniyalocts / EdgeDecorator.java
Created December 8, 2016 21:00
Quick way to add padding to first and last item in recyclerview via decorators
package com.batterii.mobile.ui.component.decorators;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;
/**
* Created by anthonykiniyalocts on 12/8/16.
*
* Quick way to add padding to first and last item in recyclerview via decorators
@lopspower
lopspower / KeyboardUtils.java
Last active July 6, 2023 13:35
Force Hide Keyboard Android
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
public class KeyboardUtils {
public static void hideKeyboard(Activity activity) {
View view = activity.findViewById(android.R.id.content);
@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