Skip to content

Commit

Permalink
....
Browse files Browse the repository at this point in the history
  • Loading branch information
blades committed Oct 26, 2016
1 parent 6eba84b commit 8ba77df
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .idea/checkstyle-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions app/src/main/java/library/blades/rxcore/Captain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package library.blades.rxcore;

/**
* ClassName: Captain<p>
* Author: blades<p>
* Des: Captain<p>
* CreateTime: 2016/10/20 14:32<p>
* UpdateTime: 2016/10/20 14:32<p>
* GitHub: https://github.com/AlphaKnife
*/

public class Captain {

/**
* cap_id : 168105
* sal_id : 637
* cap_name : 测试
* add_time : 2016-09-21 16:01:23
* cap_tel : 13541253654
* dial_num : 0
* last_time : 0
* is_cap : 1
*/

public String cap_id;
public String sal_id;
public String cap_name;
public String add_time;
public String cap_tel;
public String dial_num;
public String last_time;
public String is_cap;

@Override
public String toString() {
return "Captain{" +
"cap_id='" + cap_id + '\'' +
", sal_id='" + sal_id + '\'' +
", cap_name='" + cap_name + '\'' +
", add_time='" + add_time + '\'' +
", cap_tel='" + cap_tel + '\'' +
", dial_num='" + dial_num + '\'' +
", last_time='" + last_time + '\'' +
", is_cap='" + is_cap + '\'' +
'}';
}
}
46 changes: 46 additions & 0 deletions app/src/main/java/library/blades/rxcore/RManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package library.blades.rxcore;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.rxandroidnetworking.RxAndroidNetworking;

import java.lang.reflect.Type;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Func1;
import rx.schedulers.Schedulers;

/**
* ClassName: RManager<p>
* Author: blades<p>
* Des: RManager<p>
* CreateTime: 2016/10/20 14:41<p>
* UpdateTime: 2016/10/20 14:41<p>
* GitHub: https://github.com/AlphaKnife
*/

public class RManager {


public static <T> Observable<BaseEntity<T>> getData(Observable<String> obserable) {
return obserable.map(new Func1<String, BaseEntity<T>>() {
@Override
public BaseEntity<T> call(String s) {
Gson gson = new Gson();
Type type = new TypeToken<BaseEntity<T>>() {
}.getType();

return gson.fromJson(s, type);
}
}).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}

public static Observable<String> create(String url) {
return RxAndroidNetworking
.get(url)
.build()
.getStringObservable();
}
}
32 changes: 32 additions & 0 deletions app/src/main/java/library/blades/rxcore/User.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package library.blades.rxcore;

/**
* ClassName: User<p>
* Author: blades<p>
* Des: User<p>
* CreateTime: 2016/10/20 14:15<p>
* UpdateTime: 2016/10/20 14:15<p>
* GitHub: https://github.com/AlphaKnife
*/

public class User {

/**
* id : 1
* firstname : Amit
* lastname : Shekhar
*/

public String id;
public String firstname;
public String lastname;

@Override
public String toString() {
return "User{" +
"id='" + id + '\'' +
", firstname='" + firstname + '\'' +
", lastname='" + lastname + '\'' +
'}';
}
}

0 comments on commit 8ba77df

Please sign in to comment.