Skip to content

Commit b80de93

Browse files
author
Mustafa Sezgin
committed
Moved sources under main android package.
Excluded the test support package from being included when building a jar or generating javadoc Javadoc comments added
1 parent 7d397a7 commit b80de93

File tree

4 files changed

+66
-22
lines changed

4 files changed

+66
-22
lines changed

rxjava-contrib/rxjava-android/build.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,21 @@ idea {
3232
}
3333

3434
javadoc {
35+
exclude "rx/android/testsupport"
36+
//Excluding the test support directory causes an error when generating docs
37+
failOnError false;
3538
options {
3639
doclet = "org.benjchristensen.doclet.DocletExclude"
3740
docletpath = [rootProject.file('./gradle/doclet-exclude.jar')]
3841
stylesheetFile = rootProject.file('./gradle/javadocStyleSheet.css')
39-
windowTitle = "RxJava Javadoc ${project.version}"
42+
windowTitle = "RxJava Android Javadoc ${project.version}"
4043
}
41-
options.addStringOption('top').value = '<h2 class="title" style="padding-top:40px">RxJava</h2>'
44+
options.addStringOption('top').value = '<h2 class="title" style="padding-top:40px">RxJava Android</h2>'
4245
}
4346

4447
jar {
48+
exclude "rx/android/testsupport"
49+
4550
manifest {
4651
name = 'rxjava-android'
4752
instruction 'Bundle-Vendor', 'Netflix'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package rx.android.concurrency;
2+
3+
import android.os.Handler;
4+
import android.os.Looper;
5+
import rx.Scheduler;
6+
7+
/**
8+
* Schedulers that have Android specific functionality
9+
*/
10+
public class AndroidSchedulers {
11+
12+
private static final Scheduler MAIN_THREAD_SCHEDULER =
13+
new HandlerThreadScheduler(new Handler(Looper.getMainLooper()));
14+
15+
private AndroidSchedulers(){
16+
17+
}
18+
19+
/**
20+
* {@link Scheduler} which uses the provided {@link Handler} to execute an action
21+
* @param handler The handler that will be used when executing the action
22+
* @return A handler based scheduler
23+
*/
24+
public static Scheduler handlerThread(final Handler handler) {
25+
return new HandlerThreadScheduler(handler);
26+
}
27+
28+
/**
29+
* {@link Scheduler} which will execute an action on the main Android UI thread.
30+
*
31+
* @return A Main {@link Looper} based scheduler
32+
*/
33+
public static Scheduler mainThread() {
34+
return MAIN_THREAD_SCHEDULER;
35+
}
36+
}

rxjava-contrib/rxjava-android/src/main/java/rx/concurrency/HandlerThreadScheduler.java renamed to rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/HandlerThreadScheduler.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package rx.concurrency;
1+
package rx.android.concurrency;
22

33
import android.os.Handler;
44
import org.junit.Test;
@@ -23,15 +23,37 @@ public class HandlerThreadScheduler extends Scheduler {
2323

2424
private final Handler handler;
2525

26+
/**
27+
* Constructs a {@link HandlerThreadScheduler} using the given {@link Handler}
28+
* @param handler {@link Handler} to use when scheduling actions
29+
*/
2630
public HandlerThreadScheduler(Handler handler) {
2731
this.handler = handler;
2832
}
2933

34+
/**
35+
* Calls {@link HandlerThreadScheduler#schedule(Object, rx.util.functions.Func2, long, java.util.concurrent.TimeUnit)}
36+
* with a delay of zero milliseconds.
37+
*
38+
* See {@link #schedule(Object, rx.util.functions.Func2, long, java.util.concurrent.TimeUnit)}
39+
*/
3040
@Override
3141
public <T> Subscription schedule(final T state, final Func2<Scheduler, T, Subscription> action) {
3242
return schedule(state, action, 0L, TimeUnit.MILLISECONDS);
3343
}
3444

45+
/**
46+
* Calls {@link Handler#postDelayed(Runnable, long)} with a runnable that executes the given action.
47+
* @param state
48+
* State to pass into the action.
49+
* @param action
50+
* Action to schedule.
51+
* @param delayTime
52+
* Time the action is to be delayed before executing.
53+
* @param unit
54+
* Time unit of the delay time.
55+
* @return A Subscription from which one can unsubscribe from.
56+
*/
3557
@Override
3658
public <T> Subscription schedule(final T state, final Func2<Scheduler, T, Subscription> action, long delayTime, TimeUnit unit) {
3759
final AtomicObservableSubscription subscription = new AtomicObservableSubscription();

rxjava-contrib/rxjava-android/src/main/java/rx/concurrency/AndroidSchedulers.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)