Instead of the verbose setOnClickListener
:
RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));
Observable
.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
public abstract class CachedRefreshable<P, T> extends Refreshable<P, T> { | |
protected abstract Observable<T> getSourceObservable(P parameters); | |
/** | |
* Return the Observable that gets data from a cached source. | |
* | |
* @return Observable from cache item, or null if the cache misses. | |
*/ | |
protected abstract Observable<T> getCachedObservable(P parameters); |
private class HttpInterceptor implements Interceptor { | |
@Override | |
public Response intercept(Chain chain) throws IOException { | |
Request request = chain.request(); | |
//Build new request | |
Request.Builder builder = request.newBuilder(); | |
builder.header("Accept", "application/json"); //if necessary, say to consume JSON | |
mContent = (EditText) v.findViewById(R.id.dialog_item_content_EditText); | |
mContent.setText(mContentInit); | |
mContent.setRawInputType(InputType.TYPE_CLASS_TEXT); | |
mContent.setImeActionLabel(getResources().getString(R.string.done), EditorInfo.IME_ACTION_DONE); | |
mContent.setImeOptions(EditorInfo.IME_ACTION_DONE); | |
mContent.setOnEditorActionListener(new TextView.OnEditorActionListener() { | |
@Override | |
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { | |
if (event == null) { |
/* | |
* Copyright 2014 Soichiro Kashima | |
* | |
* 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 |
Observable.just(1) | |
.doOnSubscribe(() -> System.out.println("before 1st doOnSubscribe: " + Thread.currentThread().getName())) | |
.subscribeOn(Schedulers.newThread()) | |
.doOnSubscribe(() -> System.out.println("before 2nd doOnSubscribe: " + Thread.currentThread().getName())) | |
.subscribeOn(Schedulers.io()) | |
.doOnSubscribe(() -> System.out.println("before 3rd doOnSubscribe: " + Thread.currentThread().getName())) | |
.subscribeOn(Schedulers.computation()) | |
.doOnSubscribe(() -> System.out.println("before subscribe: " + Thread.currentThread().getName())) | |
.subscribe(new Subscriber<Integer>() { | |
@Override |
EDIT: You can find this same updated tutorial here -> Medium
Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:
package com.amulyakhare.textdrawable; | |
import android.graphics.*; | |
import android.graphics.drawable.ShapeDrawable; | |
import android.graphics.drawable.shapes.OvalShape; | |
import android.graphics.drawable.shapes.RectShape; | |
import android.graphics.drawable.shapes.RoundRectShape; | |
/** | |
* @author amulya |
public class NewsDetailActivity extends AppCompatActivity implements View.OnClickListener { | |
Activity activity; | |
Toolbar toolbar; | |
File TEMP_FILE_SAVE_PATH = Environment.getExternalStorageDirectory(); | |
String TEMP_FILE_NAME = "news_"; | |
String URL=""; | |
private DownloadManager downloadManager; | |
@Override |