Android REST Controller with Simple Cache Control Headers using Retrofit 1.9.0 + OkHttp 2.2.0
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
| 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() |
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
| /** | |
| * 显示并隐藏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() { |
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
| #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; |
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
Example:
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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
| /* 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: |
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
| 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 { |
