() {
51 | @Override
52 | public void onCompleted() {
53 |
54 | }
55 |
56 | @Override
57 | public void onError(Throwable e) {
58 |
59 | }
60 |
61 | @Override
62 | public void onNext(BooksBean imageBean) {
63 | getAdapter().addAll(imageBean.getList());
64 | }
65 | });
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/allyn/lives/utils/Config.java:
--------------------------------------------------------------------------------
1 | package com.allyn.lives.utils;
2 |
3 | /**
4 | * Created by Administrator on 2016/6/24.
5 | */
6 | public class Config {
7 |
8 | public static final String Type="list_typeId";
9 |
10 | public static final String BookId="book_Id";
11 |
12 | public static final String Title="title";
13 |
14 | public static final String BookClassifyName="classify_name";
15 |
16 | public static final String DetailId="detail_id";
17 |
18 | public static final String position ="music_indedx";
19 |
20 | public static final String position_liteorm="position_liteorm";
21 |
22 | public static final String bunder ="bunder";
23 |
24 | public static final int size=15;
25 |
26 | public static final int classify_size=2;
27 |
28 | public static final int def_size=1;
29 |
30 | public static final int random_size=10;
31 |
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/allyn/lives/utils/Dialog.java:
--------------------------------------------------------------------------------
1 | package com.allyn.lives.utils;
2 |
3 | import android.content.Context;
4 | import android.support.design.widget.BottomSheetDialog;
5 | import android.text.Html;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.widget.TextView;
9 |
10 | import com.allyn.lives.R;
11 |
12 | /**
13 | * Created by Administrator on 2016/6/29.
14 | */
15 | public class Dialog {
16 |
17 | public static void showMsg(Context context, String title, String Content) {
18 | final BottomSheetDialog sheetDialog = new BottomSheetDialog(context, R.style.AppTheme_BottomSheetDialog);
19 | View view1 = LayoutInflater.from(context).inflate(R.layout.myview_dialog, null);
20 | TextView tvClassTitle = (TextView) view1.findViewById(R.id.tvClassTitle);
21 | TextView tvContent = (TextView) view1.findViewById(R.id.tvContent);
22 | sheetDialog.setContentView(view1);
23 | tvContent.setText(Html.fromHtml(Content));
24 | tvClassTitle.setText(Html.fromHtml(title));
25 | // sheetDialog.setCanceledOnTouchOutside(false);
26 | sheetDialog.show();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/allyn/lives/utils/NetworkUtils.java:
--------------------------------------------------------------------------------
1 | package com.allyn.lives.utils;
2 |
3 | import android.content.Context;
4 | import android.net.ConnectivityManager;
5 | import android.net.NetworkInfo;
6 |
7 | /**
8 | * Created by C on 21/3/2016.
9 | * https://github.com/nukc
10 | */
11 | public class NetworkUtils {
12 |
13 | /**
14 | * 判断当前网络是否是移动数据网络.
15 | *
16 | * @param context the context
17 | * @return boolean
18 | */
19 | public static boolean isMobile(Context context) {
20 | ConnectivityManager connectivityManager = (ConnectivityManager) context
21 | .getSystemService(Context.CONNECTIVITY_SERVICE);
22 | NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
23 | if (activeNetInfo != null
24 | && activeNetInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
25 | return true;
26 | }
27 | return false;
28 | }
29 |
30 |
31 | /**
32 | * 检查是否有wifi
33 | * @param context Context
34 | * @return boolean
35 | */
36 | public static boolean isWifi(Context context) {
37 | ConnectivityManager mConnectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
38 | NetworkInfo info = mConnectivity.getActiveNetworkInfo();
39 | if (info == null) {
40 | return false;
41 | }
42 | int netType = info.getType();
43 | return netType == ConnectivityManager.TYPE_WIFI && info.isConnected();
44 | }
45 |
46 | /**
47 | * 描述:判断网络是否有效.
48 | *
49 | * @param context the context
50 | * @return true, if is network available
51 | */
52 | public static boolean isNetworkAvailable(Context context) {
53 | try {
54 | ConnectivityManager connectivity = (ConnectivityManager) context
55 | .getSystemService(Context.CONNECTIVITY_SERVICE);
56 | if (connectivity != null) {
57 | NetworkInfo info = connectivity.getActiveNetworkInfo();
58 | if (info != null && info.isConnected()) {
59 | if (info.getState() == NetworkInfo.State.CONNECTED) {
60 | return true;
61 | }
62 | }
63 | }
64 | } catch (Exception e) {
65 | e.printStackTrace();
66 | return false;
67 | }
68 | return false;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/app/src/main/java/com/allyn/lives/utils/RxBus.java:
--------------------------------------------------------------------------------
1 | package com.allyn.lives.utils;
2 |
3 | import rx.Observable;
4 | import rx.functions.Func1;
5 | import rx.subjects.PublishSubject;
6 | import rx.subjects.SerializedSubject;
7 | import rx.subjects.Subject;
8 |
9 | /**
10 | * Created by C on 9/3/2016.
11 | * https://github.com/nukc
12 | *
13 | * this is the middleman object
14 | */
15 | public class RxBus {
16 |
17 | private static RxBus mInstance;
18 | private final Subject