Skip to content

Instantly share code, notes, and snippets.

@krupalshah
krupalshah / PreferenceHelper.kt
Last active June 2, 2023 07:44
helper for shared prefs - kotlin version - Final implementation
object PreferenceHelper {
fun defaultPrefs(context: Context): SharedPreferences
= PreferenceManager.getDefaultSharedPreferences(context)
fun customPrefs(context: Context, name: String): SharedPreferences
= context.getSharedPreferences(name, Context.MODE_PRIVATE)
inline fun SharedPreferences.edit(operation: (SharedPreferences.Editor) -> Unit) {
val editor = this.edit()
@andych008
andych008 / 1显示并隐藏loading.java
Last active May 26, 2017 13:40
显示并隐藏loading
/**
* 显示并隐藏loading
*/
@SuppressWarnings("unchecked")
public static <T> Observable.Transformer<T, T> showLoading(final ILoading loading) {
return new Observable.Transformer<T, T>() {
@Override
public Observable<T> call(Observable<T> observable) {
return observable
.doOnSubscribe(new Action0() {
@pagecho
pagecho / duoshuo.css
Created April 4, 2015 13:00
duoshuo.css
#ds-thread{
padding:1px 0 18px;
}
#ds-wrapper #ds-reset .ds-dialog-footer,#ds-thread #ds-reset .ds-meta,.ds-toolbar-buttons,.ds-post-likes,.ds-post-repost,.ds-post-report,.ds-icon-reply,#ds-thread #ds-reset .ds-toolbar,#ds-thread #ds-reset ul.ds-comments-tabs .ds-service-icon,/*#ds-bubble,*/#ds-indicator,#ds-thread #ds-reset .ds-powered-by,#ds-thread #ds-reset .ds-sort a{
display: none!important;
}
#ds-thread #ds-reset .ds-login-buttons{
font-size:14px;
@polbins
polbins / README.md
Last active February 28, 2025 10:00
Android Response Caching using Retrofit 1.9 + OkHttp 2.2

Android REST Controller with Cache-Control

Android REST Controller with Simple Cache Control Headers using Retrofit 1.9.0 + OkHttp 2.2.0

@gabrielemariotti
gabrielemariotti / Readme.md
Last active August 5, 2025 08:11
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@staltz
staltz / introrx.md
Last active October 26, 2025 03:06
The introduction to Reactive Programming you've been missing
@martyglaubitz
martyglaubitz / CircleNetworkImageView.java
Last active January 8, 2016 11:59
Circle mask NetworkImageView for Volley
/* The MIT License (MIT)
Copyright (c) 2014, Marty Glaubitz
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
furnished to do so, subject to the following conditions:
@daichan4649
daichan4649 / CheckableLayout.java
Created March 26, 2013 13:32
Checkable ListView (for Android)
package daichan4649.test;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Checkable;
import android.widget.LinearLayout;
public class CheckableLayout extends LinearLayout implements Checkable {