sources = new ArrayList<>();
40 |
41 | /**
42 | * 源和对应链接
43 | */
44 | public static class SL implements Serializable{
45 | public String link;
46 |
47 | public Source source;
48 |
49 | public SL(String link, Source source) {
50 | this.link = link;
51 | this.source = source;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/common/src/main/java/com/qy/reader/common/entity/chapter/Chapter.java:
--------------------------------------------------------------------------------
1 | package com.qy.reader.common.entity.chapter;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * 章节
7 | *
8 | * Created by yuyuhang on 2018/1/7.
9 | */
10 | public class Chapter implements Serializable {
11 |
12 | public String title;
13 |
14 | public String lastUpdateTime;
15 |
16 | public String link;
17 | }
18 |
--------------------------------------------------------------------------------
/common/src/main/java/com/qy/reader/common/entity/source/Source.java:
--------------------------------------------------------------------------------
1 | package com.qy.reader.common.entity.source;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * 源
7 | *
8 | * Created by yuyuhang on 2018/1/7.
9 | */
10 | public class Source implements Serializable {
11 |
12 | @SourceID
13 | public int id;
14 |
15 | public String name;
16 |
17 | public String searchURL;
18 |
19 | /**
20 | * 最少输入字数
21 | */
22 | public int minKeywords = 1;
23 |
24 | public Source(@SourceID int id, String name, String searchURL) {
25 | this.id = id;
26 | this.name = name;
27 | this.searchURL = searchURL;
28 | }
29 |
30 | public Source(@SourceID int id, String name, String searchURL, int minKeywords) {
31 | this.id = id;
32 | this.name = name;
33 | this.searchURL = searchURL;
34 | this.minKeywords = minKeywords;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/common/src/main/java/com/qy/reader/common/entity/source/SourceConfig.java:
--------------------------------------------------------------------------------
1 | package com.qy.reader.common.entity.source;
2 |
3 | /**
4 | * 默认配置
5 | * 可能有部分源,比较复杂,需要多个xpath,那就继承重写
6 | *
7 | * Created by quezhongsang on 2018/1/7.
8 | */
9 | public class SourceConfig {
10 |
11 | @SourceID
12 | public int id;
13 |
14 | /**
15 | * 搜索
16 | */
17 | public Search search;
18 |
19 | /**
20 | * 小说目录内容
21 | */
22 | public Catalog catalog;
23 |
24 | /**
25 | * 小说内容
26 | */
27 | public Content content;
28 |
29 | public SourceConfig(@SourceID int id) {
30 | this.id = id;
31 | }
32 |
33 | @SourceID
34 | public int getId() {
35 | return id;
36 | }
37 |
38 | public void setId(@SourceID int id) {
39 | this.id = id;
40 | }
41 |
42 | public static class Search {
43 |
44 | public String charset;
45 |
46 | public String xpath;
47 |
48 | public String coverXpath;
49 |
50 | public String titleXpath;
51 |
52 | public String linkXpath;
53 |
54 | public String authorXpath;
55 |
56 | public String descXpath;
57 | }
58 |
59 | public static class Catalog {
60 | public String xpath;
61 |
62 | public String titleXpath;
63 |
64 | public String linkXpath;
65 | }
66 |
67 | public static class Content {
68 | public String xpath;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/common/src/main/java/com/qy/reader/common/entity/source/SourceEnable.java:
--------------------------------------------------------------------------------
1 | package com.qy.reader.common.entity.source;
2 |
3 | /**
4 | * Created by yuyuhang on 2018/1/12.
5 | */
6 | public class SourceEnable {
7 |
8 | @SourceID
9 | public int id;
10 |
11 | public boolean enable;
12 |
13 | public SourceEnable(int id, boolean enable) {
14 | this.id = id;
15 | this.enable = enable;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/common/src/main/java/com/qy/reader/common/entity/source/SourceID.java:
--------------------------------------------------------------------------------
1 | package com.qy.reader.common.entity.source;
2 |
3 | import android.support.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | @IntDef({
9 | SourceID.LIEWEN,
10 | SourceID.CHINESE81,
11 | SourceID.ZHUISHU,
12 | SourceID.BIQUG,
13 | SourceID.WENXUEMI,
14 | SourceID.CHINESEXIAOSHUO,
15 | SourceID.DINGDIAN,
16 | SourceID.BIQUGER,
17 | SourceID.CHINESEZHUOBI,
18 | SourceID.DASHUBAO,
19 | SourceID.CHINESEWUZHOU,
20 | SourceID.UCSHUMENG,
21 | SourceID.QUANXIAOSHUO,
22 | SourceID.YANMOXUAN,
23 | SourceID.AIQIWENXUE,
24 | SourceID.QIANQIANXIAOSHUO,
25 | SourceID.PIAOTIANWENXUE,
26 | SourceID.SUIMENGXIAOSHUO,
27 | SourceID.DAJIADUSHUYUAN,
28 | SourceID.SHUQIBA,
29 | SourceID.XIAOSHUO52,
30 |
31 | })
32 | @Retention(RetentionPolicy.SOURCE)
33 | public @interface SourceID {
34 |
35 | /**
36 | * 猎文网
37 | */
38 | int LIEWEN = 1;
39 |
40 | /**
41 | * 81中文网
42 | */
43 | int CHINESE81 = 2;
44 |
45 | /**
46 | * 追书网
47 | */
48 | int ZHUISHU = 3;
49 |
50 | /**
51 | * 笔趣阁
52 | */
53 | int BIQUG = 4;
54 |
55 | /**
56 | * 文学迷
57 | */
58 | int WENXUEMI = 5;
59 |
60 | /**
61 | * 小说中文网
62 | */
63 | int CHINESEXIAOSHUO = 6;
64 |
65 | /**
66 | * 顶点小说
67 | */
68 | int DINGDIAN = 7;
69 |
70 | /**
71 | * 笔趣阁儿
72 | */
73 | int BIQUGER = 8;
74 |
75 | /**
76 | * 着笔中文网
77 | */
78 | int CHINESEZHUOBI = 9;
79 |
80 | /**
81 | * 大书包
82 | */
83 | int DASHUBAO = 10;
84 |
85 | /**
86 | * 梧州中文台
87 | */
88 | int CHINESEWUZHOU = 11;
89 |
90 | /**
91 | * UC书盟
92 | */
93 | int UCSHUMENG = 12;
94 |
95 | /**
96 | * 全小说
97 | */
98 | int QUANXIAOSHUO = 13;
99 |
100 | /**
101 | * 衍墨轩
102 | */
103 | int YANMOXUAN = 14;
104 |
105 | /**
106 | * 爱奇文学
107 | */
108 | int AIQIWENXUE = 15;
109 |
110 | /**
111 | * 千千小说
112 | */
113 | int QIANQIANXIAOSHUO = 16;
114 |
115 | /**
116 | * 飘天文学网
117 | */
118 | int PIAOTIANWENXUE = 17;
119 |
120 | /**
121 | * 随梦小说网
122 | */
123 | int SUIMENGXIAOSHUO = 18;
124 |
125 | /**
126 | * 大家读书苑
127 | */
128 | int DAJIADUSHUYUAN = 19;
129 |
130 | /**
131 | * 书旗吧
132 | */
133 | int SHUQIBA = 20;
134 |
135 | /**
136 | * 小说52
137 | */
138 | int XIAOSHUO52 = 21;
139 | }
--------------------------------------------------------------------------------
/common/src/main/java/com/qy/reader/common/utils/AndroidRomUtil.java:
--------------------------------------------------------------------------------
1 | package com.qy.reader.common.utils;
2 |
3 | import android.os.Build;
4 | import android.os.Environment;
5 |
6 | import java.io.File;
7 | import java.io.FileInputStream;
8 | import java.io.IOException;
9 | import java.lang.reflect.Method;
10 | import java.util.Collection;
11 | import java.util.Enumeration;
12 | import java.util.Map;
13 | import java.util.Properties;
14 | import java.util.Set;
15 |
16 | /**
17 | * 判断国产rom
18 | *
19 | * Created by yuyuhang on 2018/1/8.
20 | */
21 | public class AndroidRomUtil {
22 |
23 | private static final String KEY_EMUI_VERSION_CODE = "ro.build.version.emui";
24 | private static final String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code";
25 | private static final String KEY_MIUI_VERSION_NAME = "ro.miui.ui.version.name";
26 | private static final String KEY_MIUI_INTERNAL_STORAGE = "ro.miui.internal.storage";
27 |
28 |
29 | /**
30 | * 华为rom
31 | *
32 | * @return
33 | */
34 | public static boolean isEMUI() {
35 | try {
36 | final BuildProperties prop = BuildProperties.newInstance();
37 | return prop.getProperty(KEY_EMUI_VERSION_CODE, null) != null;
38 | } catch (final IOException e) {
39 | return false;
40 | }
41 | }
42 |
43 | /**
44 | * 小米rom
45 | *
46 | * @return
47 | */
48 | public static boolean isMIUI() {
49 | try {
50 | final BuildProperties prop = BuildProperties.newInstance();
51 | /*String rom = "" + prop.getProperty(KEY_MIUI_VERSION_CODE, null) + prop.getProperty(KEY_MIUI_VERSION_NAME, null)+prop.getProperty(KEY_MIUI_INTERNAL_STORAGE, null);
52 | Log.d("Android_Rom", rom);*/
53 | return prop.getProperty(KEY_MIUI_VERSION_CODE, null) != null
54 | || prop.getProperty(KEY_MIUI_VERSION_NAME, null) != null
55 | || prop.getProperty(KEY_MIUI_INTERNAL_STORAGE, null) != null;
56 | } catch (final IOException e) {
57 | return false;
58 | }
59 | }
60 |
61 | /**
62 | * 魅族rom
63 | *
64 | * @return
65 | */
66 | public static boolean isFlyme() {
67 | try {
68 | final Method method = Build.class.getMethod("hasSmartBar");
69 | return method != null;
70 | } catch (final Exception e) {
71 | return false;
72 | }
73 | }
74 |
75 | public static class BuildProperties {
76 |
77 | private final Properties properties;
78 |
79 | private BuildProperties() throws IOException {
80 | properties = new Properties();
81 | properties.load(new FileInputStream(new File(Environment.getRootDirectory(), "build.prop")));
82 | }
83 |
84 | public boolean containsKey(final Object key) {
85 | return properties.containsKey(key);
86 | }
87 |
88 | public boolean containsValue(final Object value) {
89 | return properties.containsValue(value);
90 | }
91 |
92 | public Set> entrySet() {
93 | return properties.entrySet();
94 | }
95 |
96 | public String getProperty(final String name) {
97 | return properties.getProperty(name);
98 | }
99 |
100 | public String getProperty(final String name, final String defaultValue) {
101 | return properties.getProperty(name, defaultValue);
102 | }
103 |
104 | public boolean isEmpty() {
105 | return properties.isEmpty();
106 | }
107 |
108 | public Enumeration