When this is set as the head of the list,
22 | * an instance of it can function as a drop-in replacement for {@link android.util.Log}.
23 | * Most of the methods in this class server only to map a method call in Log to its equivalent
24 | * in LogNode.
25 | */
26 | public class Log {
27 | // Grabbing the native values from Android's native logging facilities,
28 | // to make for easy migration and interop.
29 | public static final int NONE = -1;
30 | public static final int VERBOSE = android.util.Log.VERBOSE;
31 | public static final int DEBUG = android.util.Log.DEBUG;
32 | public static final int INFO = android.util.Log.INFO;
33 | public static final int WARN = android.util.Log.WARN;
34 | public static final int ERROR = android.util.Log.ERROR;
35 | public static final int ASSERT = android.util.Log.ASSERT;
36 |
37 | // Stores the beginning of the LogNode topology.
38 | private static LogNode mLogNode;
39 |
40 | /**
41 | * Returns the next LogNode in the linked list.
42 | */
43 | public static LogNode getLogNode() {
44 | return mLogNode;
45 | }
46 |
47 | /**
48 | * Sets the LogNode data will be sent to.
49 | */
50 | public static void setLogNode(LogNode node) {
51 | mLogNode = node;
52 | }
53 |
54 | /**
55 | * Instructs the LogNode to print the log data provided. Other LogNodes can
56 | * be chained to the end of the LogNode as desired.
57 | *
58 | * @param priority Log level of the data being logged. Verbose, Error, etc.
59 | * @param tag Tag for for the log data. Can be used to organize log statements.
60 | * @param msg The actual message to be logged.
61 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
62 | * to extract and print useful information.
63 | */
64 | public static void println(int priority, String tag, String msg, Throwable tr) {
65 | if (mLogNode != null) {
66 | mLogNode.println(priority, tag, msg, tr);
67 | }
68 | }
69 |
70 | /**
71 | * Instructs the LogNode to print the log data provided. Other LogNodes can
72 | * be chained to the end of the LogNode as desired.
73 | *
74 | * @param priority Log level of the data being logged. Verbose, Error, etc.
75 | * @param tag Tag for for the log data. Can be used to organize log statements.
76 | * @param msg The actual message to be logged. The actual message to be logged.
77 | */
78 | public static void println(int priority, String tag, String msg) {
79 | println(priority, tag, msg, null);
80 | }
81 |
82 | /**
83 | * Prints a message at VERBOSE priority.
84 | *
85 | * @param tag Tag for for the log data. Can be used to organize log statements.
86 | * @param msg The actual message to be logged.
87 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
88 | * to extract and print useful information.
89 | */
90 | public static void v(String tag, String msg, Throwable tr) {
91 | println(VERBOSE, tag, msg, tr);
92 | }
93 |
94 | /**
95 | * Prints a message at VERBOSE priority.
96 | *
97 | * @param tag Tag for for the log data. Can be used to organize log statements.
98 | * @param msg The actual message to be logged.
99 | */
100 | public static void v(String tag, String msg) {
101 | v(tag, msg, null);
102 | }
103 |
104 |
105 | /**
106 | * Prints a message at DEBUG priority.
107 | *
108 | * @param tag Tag for for the log data. Can be used to organize log statements.
109 | * @param msg The actual message to be logged.
110 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
111 | * to extract and print useful information.
112 | */
113 | public static void d(String tag, String msg, Throwable tr) {
114 | println(DEBUG, tag, msg, tr);
115 | }
116 |
117 | /**
118 | * Prints a message at DEBUG priority.
119 | *
120 | * @param tag Tag for for the log data. Can be used to organize log statements.
121 | * @param msg The actual message to be logged.
122 | */
123 | public static void d(String tag, String msg) {
124 | d(tag, msg, null);
125 | }
126 |
127 | /**
128 | * Prints a message at INFO priority.
129 | *
130 | * @param tag Tag for for the log data. Can be used to organize log statements.
131 | * @param msg The actual message to be logged.
132 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
133 | * to extract and print useful information.
134 | */
135 | public static void i(String tag, String msg, Throwable tr) {
136 | println(INFO, tag, msg, tr);
137 | }
138 |
139 | /**
140 | * Prints a message at INFO priority.
141 | *
142 | * @param tag Tag for for the log data. Can be used to organize log statements.
143 | * @param msg The actual message to be logged.
144 | */
145 | public static void i(String tag, String msg) {
146 | i(tag, msg, null);
147 | }
148 |
149 | /**
150 | * Prints a message at WARN priority.
151 | *
152 | * @param tag Tag for for the log data. Can be used to organize log statements.
153 | * @param msg The actual message to be logged.
154 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
155 | * to extract and print useful information.
156 | */
157 | public static void w(String tag, String msg, Throwable tr) {
158 | println(WARN, tag, msg, tr);
159 | }
160 |
161 | /**
162 | * Prints a message at WARN priority.
163 | *
164 | * @param tag Tag for for the log data. Can be used to organize log statements.
165 | * @param msg The actual message to be logged.
166 | */
167 | public static void w(String tag, String msg) {
168 | w(tag, msg, null);
169 | }
170 |
171 | /**
172 | * Prints a message at WARN priority.
173 | *
174 | * @param tag Tag for for the log data. Can be used to organize log statements.
175 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
176 | * to extract and print useful information.
177 | */
178 | public static void w(String tag, Throwable tr) {
179 | w(tag, null, tr);
180 | }
181 |
182 | /**
183 | * Prints a message at ERROR priority.
184 | *
185 | * @param tag Tag for for the log data. Can be used to organize log statements.
186 | * @param msg The actual message to be logged.
187 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
188 | * to extract and print useful information.
189 | */
190 | public static void e(String tag, String msg, Throwable tr) {
191 | println(ERROR, tag, msg, tr);
192 | }
193 |
194 | /**
195 | * Prints a message at ERROR priority.
196 | *
197 | * @param tag Tag for for the log data. Can be used to organize log statements.
198 | * @param msg The actual message to be logged.
199 | */
200 | public static void e(String tag, String msg) {
201 | e(tag, msg, null);
202 | }
203 |
204 | /**
205 | * Prints a message at ASSERT priority.
206 | *
207 | * @param tag Tag for for the log data. Can be used to organize log statements.
208 | * @param msg The actual message to be logged.
209 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
210 | * to extract and print useful information.
211 | */
212 | public static void wtf(String tag, String msg, Throwable tr) {
213 | println(ASSERT, tag, msg, tr);
214 | }
215 |
216 | /**
217 | * Prints a message at ASSERT priority.
218 | *
219 | * @param tag Tag for for the log data. Can be used to organize log statements.
220 | * @param msg The actual message to be logged.
221 | */
222 | public static void wtf(String tag, String msg) {
223 | wtf(tag, msg, null);
224 | }
225 |
226 | /**
227 | * Prints a message at ASSERT priority.
228 | *
229 | * @param tag Tag for for the log data. Can be used to organize log statements.
230 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
231 | * to extract and print useful information.
232 | */
233 | public static void wtf(String tag, Throwable tr) {
234 | wtf(tag, null, tr);
235 | }
236 | }
237 |
--------------------------------------------------------------------------------
/app/src/main/java/com/demo/maat/hello_rxjava/common/logger/LogFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | /*
17 | * Copyright 2013 The Android Open Source Project
18 | *
19 | * Licensed under the Apache License, Version 2.0 (the "License");
20 | * you may not use this file except in compliance with the License.
21 | * You may obtain a copy of the License at
22 | *
23 | * http://www.apache.org/licenses/LICENSE-2.0
24 | *
25 | * Unless required by applicable law or agreed to in writing, software
26 | * distributed under the License is distributed on an "AS IS" BASIS,
27 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28 | * See the License for the specific language governing permissions and
29 | * limitations under the License.
30 | */
31 |
32 | package com.demo.maat.hello_rxjava.common.logger;
33 |
34 | import android.graphics.Typeface;
35 | import android.os.Bundle;
36 | import android.support.v4.app.Fragment;
37 | import android.text.Editable;
38 | import android.text.TextWatcher;
39 | import android.view.Gravity;
40 | import android.view.LayoutInflater;
41 | import android.view.View;
42 | import android.view.ViewGroup;
43 | import android.widget.ScrollView;
44 |
45 | /**
46 | * Simple fraggment which contains a LogView and uses is to output log data it receives
47 | * through the LogNode interface.
48 | */
49 | public class LogFragment extends Fragment {
50 |
51 | private LogView mLogView;
52 | private ScrollView mScrollView;
53 |
54 | public LogFragment() {}
55 |
56 | public View inflateViews() {
57 | mScrollView = new ScrollView(getActivity());
58 | ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
59 | ViewGroup.LayoutParams.MATCH_PARENT,
60 | ViewGroup.LayoutParams.MATCH_PARENT);
61 | mScrollView.setLayoutParams(scrollParams);
62 |
63 | mLogView = new LogView(getActivity());
64 | ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
65 | logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
66 | mLogView.setLayoutParams(logParams);
67 | mLogView.setTextSize(10);
68 | mLogView.setClickable(true);
69 | mLogView.setFocusable(true);
70 | mLogView.setTypeface(Typeface.MONOSPACE);
71 |
72 | // Want to set padding as 16 dips, setPadding takes pixels. Hooray math!
73 | int paddingDips = 16;
74 | double scale = getResources().getDisplayMetrics().density;
75 | int paddingPixels = (int) ((paddingDips * (scale)) + .5);
76 | mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
77 | mLogView.setCompoundDrawablePadding(paddingPixels);
78 |
79 | mLogView.setGravity(Gravity.BOTTOM);
80 | mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
81 |
82 | mScrollView.addView(mLogView);
83 | return mScrollView;
84 | }
85 |
86 | @Override
87 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
88 | Bundle savedInstanceState) {
89 |
90 | View result = inflateViews();
91 |
92 | mLogView.addTextChangedListener(new TextWatcher() {
93 | @Override
94 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
95 |
96 | @Override
97 | public void onTextChanged(CharSequence s, int start, int before, int count) {}
98 |
99 | @Override
100 | public void afterTextChanged(Editable s) {
101 | //afterTextChanged 在 text发生改变后马上被调用,此时可能text还未被绘制,导致无法滑动到最底部
102 | //所以不能直接调用,而应该使用post
103 | mScrollView.post(new Runnable(){
104 | @Override
105 | public void run() {
106 | mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
107 | }
108 | });
109 | }
110 | });
111 | return result;
112 | }
113 |
114 | public LogView getLogView() {
115 | return mLogView;
116 | }
117 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/demo/maat/hello_rxjava/common/logger/LogNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.demo.maat.hello_rxjava.common.logger;
17 |
18 | /**
19 | * Basic interface for a logging system that can output to one or more targets.
20 | * Note that in addition to classes that will output these logs in some format,
21 | * one can also implement this interface over a filter and insert that in the chain,
22 | * such that no targets further down see certain data, or see manipulated forms of the data.
23 | * You could, for instance, write a "ToHtmlLoggerNode" that just converted all the log data
24 | * it received to HTML and sent it along to the next node in the chain, without printing it
25 | * anywhere.
26 | */
27 | public interface LogNode {
28 |
29 | /**
30 | * Instructs first LogNode in the list to print the log data provided.
31 | * @param priority Log level of the data being logged. Verbose, Error, etc.
32 | * @param tag Tag for for the log data. Can be used to organize log statements.
33 | * @param msg The actual message to be logged. The actual message to be logged.
34 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
35 | * to extract and print useful information.
36 | */
37 | public void println(int priority, String tag, String msg, Throwable tr);
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/demo/maat/hello_rxjava/common/logger/LogView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.demo.maat.hello_rxjava.common.logger;
17 |
18 | import android.app.Activity;
19 | import android.content.Context;
20 | import android.util.AttributeSet;
21 | import android.widget.TextView;
22 |
23 | /** Simple TextView which is used to output log data received through the LogNode interface.
24 | */
25 | public class LogView extends TextView implements LogNode {
26 |
27 | public LogView(Context context) {
28 | super(context);
29 | }
30 |
31 | public LogView(Context context, AttributeSet attrs) {
32 | super(context, attrs);
33 | }
34 |
35 | public LogView(Context context, AttributeSet attrs, int defStyle) {
36 | super(context, attrs, defStyle);
37 | }
38 |
39 | /**
40 | * Formats the log data and prints it out to the LogView.
41 | * @param priority Log level of the data being logged. Verbose, Error, etc.
42 | * @param tag Tag for for the log data. Can be used to organize log statements.
43 | * @param msg The actual message to be logged. The actual message to be logged.
44 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
45 | * to extract and print useful information.
46 | */
47 | @Override
48 | public void println(int priority, String tag, String msg, Throwable tr) {
49 |
50 |
51 | String priorityStr = null;
52 |
53 | // For the purposes of this View, we want to print the priority as readable text.
54 | switch(priority) {
55 | case android.util.Log.VERBOSE:
56 | priorityStr = "VERBOSE";
57 | break;
58 | case android.util.Log.DEBUG:
59 | priorityStr = "DEBUG";
60 | break;
61 | case android.util.Log.INFO:
62 | priorityStr = "INFO";
63 | break;
64 | case android.util.Log.WARN:
65 | priorityStr = "WARN";
66 | break;
67 | case android.util.Log.ERROR:
68 | priorityStr = "ERROR";
69 | break;
70 | case android.util.Log.ASSERT:
71 | priorityStr = "ASSERT";
72 | break;
73 | default:
74 | break;
75 | }
76 |
77 | // Handily, the Log class has a facility for converting a stack trace into a usable string.
78 | String exceptionStr = null;
79 | if (tr != null) {
80 | exceptionStr = android.util.Log.getStackTraceString(tr);
81 | }
82 |
83 | // Take the priority, tag, message, and exception, and concatenate as necessary
84 | // into one usable line of text.
85 | final StringBuilder outputBuilder = new StringBuilder();
86 |
87 | String delimiter = "\t";
88 | appendIfNotNull(outputBuilder, priorityStr, delimiter);
89 | appendIfNotNull(outputBuilder, tag, delimiter);
90 | appendIfNotNull(outputBuilder, msg, delimiter);
91 | appendIfNotNull(outputBuilder, exceptionStr, delimiter);
92 |
93 | // In case this was originally called from an AsyncTask or some other off-UI thread,
94 | // make sure the update occurs within the UI thread.
95 | ((Activity) getContext()).runOnUiThread( (new Thread(new Runnable() {
96 | @Override
97 | public void run() {
98 | // Display the text we just generated within the LogView.
99 | appendToLog(outputBuilder.toString());
100 | }
101 | })));
102 |
103 | if (mNext != null) {
104 | mNext.println(priority, tag, msg, tr);
105 | }
106 | }
107 |
108 | public LogNode getNext() {
109 | return mNext;
110 | }
111 |
112 | public void setNext(LogNode node) {
113 | mNext = node;
114 | }
115 |
116 | /** Takes a string and adds to it, with a separator, if the bit to be added isn't null. Since
117 | * the logger takes so many arguments that might be null, this method helps cut out some of the
118 | * agonizing tedium of writing the same 3 lines over and over.
119 | * @param source StringBuilder containing the text to append to.
120 | * @param addStr The String to append
121 | * @param delimiter The String to separate the source and appended strings. A tab or comma,
122 | * for instance.
123 | * @return The fully concatenated String as a StringBuilder
124 | */
125 | private StringBuilder appendIfNotNull(StringBuilder source, String addStr, String delimiter) {
126 | if (addStr != null) {
127 | if (addStr.length() == 0) {
128 | delimiter = "";
129 | }
130 |
131 | return source.append(addStr).append(delimiter);
132 | }
133 | return source;
134 | }
135 |
136 | // The next LogNode in the chain.
137 | LogNode mNext;
138 |
139 | /** Outputs the string as a new line of log data in the LogView. */
140 | public void appendToLog(String s) {
141 | append("\n" + s);
142 | }
143 |
144 |
145 | }
146 |
--------------------------------------------------------------------------------
/app/src/main/java/com/demo/maat/hello_rxjava/common/logger/LogWrapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.demo.maat.hello_rxjava.common.logger;
17 |
18 | import android.util.Log;
19 |
20 | /**
21 | * Helper class which wraps Android's native Log utility in the Logger interface. This way
22 | * normal DDMS output can be one of the many targets receiving and outputting logs simultaneously.
23 | */
24 | public class LogWrapper implements LogNode {
25 |
26 | // For piping: The next node to receive Log data after this one has done its work.
27 | private LogNode mNext;
28 |
29 | /**
30 | * Returns the next LogNode in the linked list.
31 | */
32 | public LogNode getNext() {
33 | return mNext;
34 | }
35 |
36 | /**
37 | * Sets the LogNode data will be sent to..
38 | */
39 | public void setNext(LogNode node) {
40 | mNext = node;
41 | }
42 |
43 | /**
44 | * Prints data out to the console using Android's native log mechanism.
45 | * @param priority Log level of the data being logged. Verbose, Error, etc.
46 | * @param tag Tag for for the log data. Can be used to organize log statements.
47 | * @param msg The actual message to be logged. The actual message to be logged.
48 | * @param tr If an exception was thrown, this can be sent along for the logging facilities
49 | * to extract and print useful information.
50 | */
51 | @Override
52 | public void println(int priority, String tag, String msg, Throwable tr) {
53 | // There actually are log methods that don't take a msg parameter. For now,
54 | // if that's the case, just convert null to the empty string and move on.
55 | String useMsg = msg;
56 | if (useMsg == null) {
57 | useMsg = "";
58 | }
59 |
60 | // If an exeption was provided, convert that exception to a usable string and attach
61 | // it to the end of the msg method.
62 | if (tr != null) {
63 | msg += "\n" + Log.getStackTraceString(tr);
64 | }
65 |
66 | // This is functionally identical to Log.x(tag, useMsg);
67 | // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg)
68 | Log.println(priority, tag, useMsg);
69 |
70 | // If this isn't the last node in the chain, move things along.
71 | if (mNext != null) {
72 | mNext.println(priority, tag, msg, tr);
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/com/demo/maat/hello_rxjava/common/logger/MessageOnlyLogFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.demo.maat.hello_rxjava.common.logger;
17 |
18 | /**
19 | * Simple {@link LogNode} filter, removes everything except the message.
20 | * Useful for situations like on-screen log output where you don't want a lot of metadata displayed,
21 | * just easy-to-read message updates as they're happening.
22 | */
23 | public class MessageOnlyLogFilter implements LogNode {
24 |
25 | LogNode mNext;
26 |
27 | /**
28 | * Takes the "next" LogNode as a parameter, to simplify chaining.
29 | *
30 | * @param next The next LogNode in the pipeline.
31 | */
32 | public MessageOnlyLogFilter(LogNode next) {
33 | mNext = next;
34 | }
35 |
36 | public MessageOnlyLogFilter() {
37 | }
38 |
39 | @Override
40 | public void println(int priority, String tag, String msg, Throwable tr) {
41 | if (mNext != null) {
42 | getNext().println(Log.NONE, null, msg, null);
43 | }
44 | }
45 |
46 | /**
47 | * Returns the next LogNode in the chain.
48 | */
49 | public LogNode getNext() {
50 | return mNext;
51 | }
52 |
53 | /**
54 | * Sets the LogNode data will be sent to..
55 | */
56 | public void setNext(LogNode node) {
57 | mNext = node;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/demo/maat/hello_rxjava/retrofit/ZhihuApi.java:
--------------------------------------------------------------------------------
1 | package com.demo.maat.hello_rxjava.retrofit;
2 |
3 |
4 | import com.demo.maat.hello_rxjava.retrofit.zhihu.ZhihuDaily;
5 |
6 | import retrofit2.http.GET;
7 | import rx.Observable;
8 |
9 |
10 | public interface ZhihuApi {
11 |
12 | @GET("/api/4/news/latest")
13 | Observable getLastDaily();
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/demo/maat/hello_rxjava/retrofit/zhihu/ZhihuDaily.java:
--------------------------------------------------------------------------------
1 | package com.demo.maat.hello_rxjava.retrofit.zhihu;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | import java.util.ArrayList;
6 |
7 | /**
8 | * Created by 蔡小木 on 2016/3/6 0006.
9 | */
10 | public class ZhihuDaily{
11 | @SerializedName("date")
12 | private String date;
13 | @SerializedName("top_stories")
14 | private ArrayList mZhihuDailyItems;
15 | @SerializedName("stories")
16 | private ArrayList stories;
17 |
18 | public String getDate() {
19 | return date;
20 | }
21 |
22 | public void setDate(String date) {
23 | this.date = date;
24 | }
25 |
26 | public ArrayList getZhihuDailyItems() {
27 | return mZhihuDailyItems;
28 | }
29 |
30 | public void setZhihuDailyItems(ArrayList zhihuDailyItems) {
31 | this.mZhihuDailyItems = zhihuDailyItems;
32 | }
33 |
34 | public ArrayList getStories() {
35 | return stories;
36 | }
37 |
38 | public void setStories(ArrayList stories) {
39 | this.stories = stories;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/demo/maat/hello_rxjava/retrofit/zhihu/ZhihuDailyItem.java:
--------------------------------------------------------------------------------
1 | package com.demo.maat.hello_rxjava.retrofit.zhihu;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | /**
6 | * Created by 蔡小木 on 2016/3/6 0006.
7 | */
8 | public class ZhihuDailyItem{
9 | @SerializedName("images")
10 | private String[] images;
11 | @SerializedName("type")
12 | private int type;
13 | @SerializedName("id")
14 | private String id;
15 | @SerializedName("title")
16 | private String title;
17 | private String date;
18 | public boolean hasFadedIn = false;
19 |
20 | public String[] getImages() {
21 | return images;
22 | }
23 |
24 | public void setImages(String[] images) {
25 | this.images = images;
26 | }
27 |
28 | public int getType() {
29 | return type;
30 | }
31 |
32 | public void setType(int type) {
33 | this.type = type;
34 | }
35 |
36 | public String getId() {
37 | return id;
38 | }
39 |
40 | public void setId(String id) {
41 | this.id = id;
42 | }
43 |
44 | public String getTitle() {
45 | return title;
46 | }
47 |
48 | public void setTitle(String title) {
49 | this.title = title;
50 | }
51 |
52 | public String getDate() {
53 | return date;
54 | }
55 |
56 | public void setDate(String date) {
57 | this.date = date;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/com/demo/maat/hello_rxjava/retrofit/zhihu/ZhihuManager.java:
--------------------------------------------------------------------------------
1 | package com.demo.maat.hello_rxjava.retrofit.zhihu;
2 |
3 | import com.demo.maat.hello_rxjava.retrofit.ZhihuApi;
4 |
5 | import retrofit2.Retrofit;
6 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
7 | import retrofit2.converter.gson.GsonConverterFactory;
8 |
9 | /**
10 | * Created by xinghongfei on 16/10/5.
11 | */
12 |
13 | public class ZhihuManager {
14 | private static ZhihuManager mManager;
15 |
16 | public ZhihuApi zhihuApi;
17 | public static ZhihuManager getInstance(){
18 |
19 | if (mManager==null){
20 | mManager= new ZhihuManager();
21 | }
22 | return mManager;
23 | }
24 |
25 | public ZhihuApi getZhihuApiService() {
26 | if (zhihuApi == null) {
27 | if (zhihuApi == null) {
28 | zhihuApi = new Retrofit.Builder()
29 | .baseUrl("http://news-at.zhihu.com")
30 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
31 | .addConverterFactory(GsonConverterFactory.create())
32 | .build().create(ZhihuApi.class);
33 |
34 | }
35 | }
36 |
37 | return zhihuApi;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tile.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/app/src/main/res/drawable/tile.9.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
17 |
23 |
24 |
30 |
31 |
32 |
37 |
38 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/debounce_activity_main.xml:
--------------------------------------------------------------------------------
1 |
16 |
22 |
23 |
24 |
30 |
31 |
32 |
36 |
37 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/debounce_fragment.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
22 |
23 |
29 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/operator1_activity_main.xml:
--------------------------------------------------------------------------------
1 |
16 |
22 |
23 |
24 |
30 |
31 |
32 |
36 |
37 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/operator2_activity_main.xml:
--------------------------------------------------------------------------------
1 |
16 |
22 |
23 |
24 |
30 |
31 |
32 |
36 |
37 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/operators1_fragment.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
22 |
23 |
29 |
30 |
31 |
37 |
38 |
43 |
44 |
45 |
50 |
51 |
56 |
57 |
62 |
63 |
68 |
69 |
74 |
75 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/operators2_fragment.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
22 |
23 |
29 |
30 |
31 |
37 |
38 |
39 |
40 |
45 |
46 |
51 |
52 |
57 |
58 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/polling_activity_main.xml:
--------------------------------------------------------------------------------
1 |
16 |
22 |
23 |
24 |
30 |
31 |
32 |
36 |
37 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/polling_fragment.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
22 |
23 |
29 |
30 |
31 |
37 |
38 |
39 |
40 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/retrofit_fragment.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
22 |
23 |
29 |
30 |
31 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/rxandroid_fragment.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
22 |
23 |
29 |
30 |
31 |
37 |
38 |
39 |
40 |
45 |
46 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/rxjava_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
17 |
23 |
24 |
25 |
30 |
31 |
36 |
37 |
38 |
43 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/scheduler_activity_main.xml:
--------------------------------------------------------------------------------
1 |
16 |
22 |
23 |
24 |
30 |
31 |
32 |
36 |
37 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/scheduler_fragment.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
22 |
23 |
29 |
30 |
34 |
35 |
36 |
41 |
42 |
43 |
48 |
53 |
58 |
63 |
68 |
73 |
79 |
84 |
85 |
91 |
92 |
97 |
98 |
99 |
105 |
106 |
111 |
112 |
119 |
120 |
127 |
128 |
129 |
135 |
136 |
141 |
142 |
149 |
150 |
157 |
158 | />
159 |
160 |
161 |
162 |
163 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/fragmentview_strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 | Show Log
18 | Hide Log
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/template-dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 | 4dp
22 | 8dp
23 | 16dp
24 | 32dp
25 | 64dp
26 |
27 |
28 |
29 | @dimen/margin_medium
30 | @dimen/margin_medium
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/template-styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
33 |
34 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Hello RxJava
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/demo/maat/hello_rxjava/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.demo.maat.hello_rxjava;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.3'
9 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/screenshots/LongOperation.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/LongOperation.gif
--------------------------------------------------------------------------------
/screenshots/debounce.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/debounce.gif
--------------------------------------------------------------------------------
/screenshots/just.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just.gif
--------------------------------------------------------------------------------
/screenshots/just.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just.png
--------------------------------------------------------------------------------
/screenshots/just1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just1.gif
--------------------------------------------------------------------------------
/screenshots/just1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just1.png
--------------------------------------------------------------------------------
/screenshots/just1p.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just1p.png
--------------------------------------------------------------------------------
/screenshots/just2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just2.gif
--------------------------------------------------------------------------------
/screenshots/just2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just2.png
--------------------------------------------------------------------------------
/screenshots/just2p.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just2p.png
--------------------------------------------------------------------------------
/screenshots/just3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just3.gif
--------------------------------------------------------------------------------
/screenshots/just3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just3.png
--------------------------------------------------------------------------------
/screenshots/just3p.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just3p.png
--------------------------------------------------------------------------------
/screenshots/just4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just4.gif
--------------------------------------------------------------------------------
/screenshots/just4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just4.png
--------------------------------------------------------------------------------
/screenshots/just4p.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just4p.png
--------------------------------------------------------------------------------
/screenshots/just5.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just5.gif
--------------------------------------------------------------------------------
/screenshots/just5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just5.png
--------------------------------------------------------------------------------
/screenshots/just5p.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just5p.png
--------------------------------------------------------------------------------
/screenshots/just6.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just6.gif
--------------------------------------------------------------------------------
/screenshots/just6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just6.png
--------------------------------------------------------------------------------
/screenshots/just6p.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/just6p.png
--------------------------------------------------------------------------------
/screenshots/justp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/justp.png
--------------------------------------------------------------------------------
/screenshots/polling.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/polling.gif
--------------------------------------------------------------------------------
/screenshots/rxandroid.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/rxandroid.gif
--------------------------------------------------------------------------------
/screenshots/rxjavaretrofit.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinghongfei/Hello-RxJava/5969c976b5eeba764bc65cbc7d946c7a2f596210/screenshots/rxjavaretrofit.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------