", "");
138 | webView.loadDataWithBaseURL("file:///android_asset/", html, "text/html", "UTF-8", null);
139 | resultRepository.removeUpdatable(this);
140 | }
141 | });
142 | } else {
143 | webView.loadData(value.getBody(), "text/html", "utf-8");
144 | }
145 | }
146 | });
147 | }
148 | }
149 |
150 | class NewsDetailSupplier implements Supplier
> {
151 |
152 | String key;
153 |
154 | public void setKey(String key) {
155 | this.key = key;
156 |
157 | }
158 |
159 | @NonNull
160 | @Override
161 | public Result get() {
162 | NewsDetailResponse newsDetailResponse = null;
163 | try {
164 | newsDetailResponse = AppClient.httpService.getNewsDetail(key).execute().body();
165 | } catch (IOException e) {
166 | e.printStackTrace();
167 | }
168 | if (newsDetailResponse == null) {
169 | return Result.failure();
170 | } else {
171 | return Result.success(newsDetailResponse);
172 | }
173 | }
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | generateDebugSources
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
--------------------------------------------------------------------------------
/app/src/main/assets/news.css:
--------------------------------------------------------------------------------
1 | article,
2 | aside,
3 | details,
4 | figcaption,
5 | figure,
6 | footer,
7 | header,
8 | hgroup,
9 | main,
10 | nav,
11 | section,
12 | summary {
13 | display: block;
14 | }
15 | audio,
16 | canvas,
17 | video {
18 | display: inline-block;
19 | }
20 | audio:not([controls]) {
21 | display: none;
22 | height: 0;
23 | }
24 | html {
25 | font-family: sans-serif;
26 | -webkit-text-size-adjust: 100%;
27 | }
28 | body {
29 | font-family: 'Helvetica Neue', Helvetica, Arial, Sans-serif;
30 | background: #fff;
31 | padding-top: 0;
32 | margin: 0;
33 | }
34 | a:focus {
35 | outline: thin dotted;
36 | }
37 | a:active,
38 | a:hover {
39 | outline: 0;
40 | }
41 | h1 {
42 | margin: .67em 0;
43 | }
44 | h1,
45 | h2,
46 | h3,
47 | h4,
48 | h5,
49 | h6 {
50 | font-size: 16px;
51 | }
52 | abbr[title] {
53 | border-bottom: 1px dotted;
54 | }
55 | hr {
56 | box-sizing: content-box;
57 | height: 0;
58 | }
59 | mark {
60 | background: #ff0;
61 | color: #000;
62 | }
63 | code,
64 | kbd,
65 | pre,
66 | samp {
67 | font-family: monospace,serif;
68 | font-size: 1em;
69 | }
70 | pre {
71 | white-space: pre-wrap;
72 | }
73 | q {
74 | quotes: \201C\201D\2018\2019;
75 | }
76 | small {
77 | font-size: 80%;
78 | }
79 | sub,
80 | sup {
81 | font-size: 75%;
82 | line-height: 0;
83 | position: relative;
84 | vertical-align: baseline;
85 | }
86 | sup {
87 | top: -0.5em;
88 | }
89 | sub {
90 | bottom: -0.25em;
91 | }
92 | img {
93 | border: 0;
94 | vertical-align: middle;
95 | color: transparent;
96 | font-size: 0;
97 | }
98 | svg:not(:root) {
99 | overflow: hidden;
100 | }
101 | figure {
102 | margin: 0;
103 | }
104 | fieldset {
105 | border: 1px solid silver;
106 | margin: 0 2px;
107 | padding: .35em .625em .75em;
108 | }
109 | legend {
110 | border: 0;
111 | padding: 0;
112 | }
113 | table {
114 | border-collapse: collapse;
115 | border-spacing: 0;
116 | overflow: hidden;
117 | }
118 | a {
119 | text-decoration: none;
120 | }
121 | blockquote {
122 | border-left: 3px solid #D0E5F2;
123 | font-style: normal;
124 | display: block;
125 | line-height: 1.4em;
126 | vertical-align: baseline;
127 | font-size: 100%;
128 | margin: .5em 0;
129 | padding: 0 0 0 .5em;
130 | }
131 | ul,
132 | ol {
133 | padding-left: 20px;
134 | }
135 | .main-wrap {
136 | max-width: 100%;
137 | min-width: 300px;
138 | margin: 0 auto;
139 | }
140 | .content-wrap {
141 | overflow: hidden;
142 | background-color: #f9f9f9;
143 | }
144 | .content-wrap a {
145 | word-break: break-all;
146 | }
147 | .headline {
148 | border-bottom: 4px solid #f6f6f6;
149 | }
150 | .headline-title.onlyheading {
151 | margin: 20px 0;
152 | }
153 | .headline img {
154 | max-width: 100%;
155 | vertical-align: top;
156 | }
157 | .headline-background-link {
158 | line-height: 2em;
159 | position: relative;
160 | display: block;
161 | padding: 20px 45px 20px 20px !important;
162 | }
163 | .icon-arrow-right {
164 | position: absolute;
165 | top: 50%;
166 | right: 20px;
167 | background-image: url(http://static.daily.zhihu.com/img/share-icons.png);
168 | background-repeat: no-repeat;
169 | display: inline-block;
170 | vertical-align: middle;
171 | background-position: -70px -20px;
172 | width: 10px;
173 | height: 15px;
174 | margin-top: -7.5px;
175 | }
176 | .headline-background .heading {
177 | color: #999;
178 | font-size: 15px!important;
179 | margin-bottom: 8px;
180 | line-height: 1em;
181 | }
182 | .headline-background .heading-content {
183 | color: #444;
184 | font-size: 17px!important;
185 | line-height: 1.2em;
186 | }
187 | .headline-title {
188 | line-height: 1.2em;
189 | color: #000;
190 | font-size: 22px;
191 | margin: 20px 0 10px;
192 | padding: 0 20px!important;
193 | font-weight: bold;
194 | }
195 | .meta {
196 | white-space: nowrap;
197 | text-overflow: ellipsis;
198 | overflow: hidden;
199 | font-size: 16px;
200 | color: #b8b8b8;
201 | }
202 | .meta .source-icon {
203 | width: 20px;
204 | height: 20px;
205 | margin-right: 4px;
206 | }
207 | .meta .time {
208 | float: right;
209 | margin-top: 2px;
210 | }
211 | .content {
212 | color: #444;
213 | line-height: 1.6em;
214 | font-size: 17px;
215 | margin: 10px 0 20px;
216 | }
217 | .content img {
218 | max-width: 100%;
219 | display: block;
220 | margin: 10px 0;
221 | }
222 | .content img[src*="zhihu.com/equation"] {
223 | display: inline-block;
224 | margin: 0 3px;
225 | }
226 | .content a {
227 | color: #259;
228 | }
229 | .content a:hover {
230 | text-decoration: underline;
231 | }
232 | .view-more {
233 | margin-bottom: 25px;
234 | text-align: center;
235 | }
236 | .view-more a {
237 | font-size: 16px;
238 | display: inline-block;
239 | width: 125px;
240 | height: 30px;
241 | line-height: 30px;
242 | background: #f0f0f0;
243 | color: #B8B8B8;
244 | }
245 | .question {
246 | overflow: hidden;
247 | padding: 0 20px!important;
248 | }
249 | .question + .question {
250 | border-top: 5px solid #f6f6f6;
251 | }
252 | .question-title {
253 | line-height: 1.4em;
254 | color: #000;
255 | font-weight: 700;
256 | font-size: 18px;
257 | margin: 20px 0;
258 | }
259 | .meta .author {
260 | color: #444;
261 | font-weight: 700;
262 | }
263 | .answer + .answer {
264 | border-top: 2px solid #f6f6f6;
265 | padding-top: 20px;
266 | }
267 | .footer {
268 | text-align: center;
269 | color: #b8b8b8;
270 | font-size: 13px;
271 | padding: 20px 0;
272 | }
273 | .footer a {
274 | color: #b8b8b8;
275 | }
276 | .question .view-more a {
277 | width: 100%;
278 | display: block;
279 | }
280 | .hot-comment {
281 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
282 | }
283 | .comment-label {
284 | font-size: 16px;
285 | color: #333;
286 | line-height: 1.5em;
287 | font-weight: 700;
288 | border-top: 1px solid #eee;
289 | border-bottom: 1px solid #eee;
290 | margin: 0;
291 | padding: 9px 20px;
292 | }
293 | .comment-list {
294 | margin-bottom: 20px;
295 | }
296 | .comment-item {
297 | font-size: 15px;
298 | color: #666;
299 | border-bottom: 1px solid #eee;
300 | padding: 15px 20px;
301 | }
302 | .comment-meta {
303 | position: relative;
304 | margin-bottom: 10px;
305 | }
306 | .comment-meta .author {
307 | vertical-align: middle;
308 | color: #444;
309 | }
310 | .comment-meta .vote {
311 | position: absolute;
312 | color: #b8b8b8;
313 | font-size: 12px;
314 | right: 0;
315 | }
316 | .night .comment-label {
317 | color: #b8b8b8;
318 | border-top: 1px solid #303030;
319 | border-bottom: 1px solid #303030;
320 | }
321 | .night .comment-item {
322 | color: #7f7f7f;
323 | border-bottom: 1px solid #303030;
324 | }
325 | .icon-vote,
326 | .icon-voted {
327 | background-repeat: no-repeat;
328 | display: inline-block;
329 | vertical-align: 0;
330 | width: 11px;
331 | height: 12px;
332 | margin-right: 4px;
333 | background-image: url(http://static.daily.zhihu.com/img/app/Comment_Vote.png) !important;
334 | }
335 | .icon-voted {
336 | background-image: url(http://static.daily.zhihu.com/img/app/Comment_Voted.png) !important;
337 | }
338 | .night .icon-vote {
339 | background-image: url(http://static.daily.zhihu.com/img/app/Dark_Comment_Vote.png) !important;
340 | }
341 | .img-wrap .headline-title {
342 | bottom: 5px;
343 | }
344 | .img-wrap .img-source {
345 | right: 10px!important;
346 | font-size: 9px;
347 | }
348 | .global-header {
349 | position: static;
350 | }
351 | .button {
352 | width: 60px;
353 | }
354 | .button i {
355 | margin-right: 0;
356 | }
357 | .headline .img-place-holder {
358 | height: 200px;
359 | }
360 | .from-column {
361 | width: 280px;
362 | line-height: 30px;
363 | height: 30px;
364 | padding-left: 90px;
365 | color: #2aacec;
366 | background-image: url(http://static.daily.zhihu.com/img/News_Column_Entrance.png);
367 | box-sizing: border-box;
368 | margin: 0 20px 20px;
369 | }
370 | .from-column:active {
371 | background-image: url(http://static.daily.zhihu.com/img/News_Column_Entrance_Highlight.png);
372 | }
373 | .night .headline {
374 | border-bottom: 4px solid #303030;
375 | }
376 | .night img {
377 | -webkit-mask-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(0, 0, 0, 0.7)), to(rgba(0, 0, 0, 0.7)));
378 | }
379 | body.night,
380 | .night .content-wrap {
381 | background: #343434;
382 | }
383 | .night .answer + .answer {
384 | border-top: 2px solid #303030;
385 | }
386 | .night .question + .question {
387 | border-top: 4px solid #303030;
388 | }
389 | .night .view-more a {
390 | background: #292929;
391 | color: #666;
392 | }
393 | .night .icon-arrow-right {
394 | background-image: url(http://static.daily.zhihu.com/img/share-icons.png);
395 | background-repeat: no-repeat;
396 | display: inline-block;
397 | vertical-align: middle;
398 | background-position: -70px -35px;
399 | width: 10px;
400 | height: 15px;
401 | }
402 | .night blockquote,
403 | .night sup {
404 | border-left: 3px solid #666;
405 | }
406 | .night .content a {
407 | color: #698ebf;
408 | }
409 | .night .from-column {
410 | color: #2b82ac;
411 | background-image: url(http://static.daily.zhihu.com/img/Dark_News_Column_Entrance.png);
412 | }
413 | .night .from-column:active {
414 | background-image: url(http://static.daily.zhihu.com/img/Dark_News_Column_Entrance_Highlight.png);
415 | }
416 | .large .question-title {
417 | font-size: 24px;
418 | }
419 | .large .meta {
420 | font-size: 18px;
421 | }
422 | .large .content {
423 | font-size: 20px;
424 | }
425 | .large blockquote,
426 | .large sup {
427 | line-height: 1.6;
428 | }
429 | .meta .meta-item {
430 | -o-text-overflow: ellipsis;
431 | width: 39%;
432 | overflow: hidden;
433 | white-space: nowrap;
434 | text-overflow: ellipsis;
435 | display: inline-block;
436 | color: #929292;
437 | margin-right: 7px;
438 | }
439 | .headline .meta {
440 | white-space: nowrap;
441 | text-overflow: ellipsis;
442 | overflow: hidden;
443 | font-size: 11px;
444 | color: #b8b8b8;
445 | margin: 15px 0;
446 | padding: 0 20px;
447 | }
448 | .headline .meta a,
449 | .headline .meta a:hover {
450 | padding-left: 1em;
451 | margin-top: 2px;
452 | float: right;
453 | font-size: 11px;
454 | color: #0066cf;
455 | text-decoration: none;
456 | }
457 | .highlight {
458 | overflow: auto;
459 | word-wrap: normal;
460 | background: #fff;
461 | }
462 | .highlight pre {
463 | white-space: pre;
464 | }
465 | .highlight .hll {
466 | background-color: #ffc;
467 | }
468 | .highlight .err {
469 | color: #a61717;
470 | background-color: #e3d2d2;
471 | }
472 | .highlight .cp {
473 | color: #999;
474 | font-weight: 700;
475 | }
476 | .highlight .cs {
477 | color: #999;
478 | font-weight: 700;
479 | font-style: italic;
480 | }
481 | .highlight .gd {
482 | color: #000;
483 | background-color: #fdd;
484 | }
485 | .highlight .gi {
486 | color: #000;
487 | background-color: #dfd;
488 | }
489 | .highlight .gu {
490 | color: #aaa;
491 | }
492 | .highlight .ni {
493 | color: purple;
494 | }
495 | .highlight .nt {
496 | color: navy;
497 | }
498 | .highlight .w {
499 | color: #bbb;
500 | }
501 | .highlight .sr {
502 | color: olive;
503 | }
504 | [hidden],
505 | .button span {
506 | display: none;
507 | }
508 | b,
509 | strong,
510 | .highlight .k,
511 | .highlight .o,
512 | .highlight .gs,
513 | .highlight .kc,
514 | .highlight .kd,
515 | .highlight .kn,
516 | .highlight .kp,
517 | .highlight .kr,
518 | .highlight .ow {
519 | font-weight: 700;
520 | }
521 | dfn,
522 | .highlight .ge {
523 | font-style: italic;
524 | }
525 | .meta span,
526 | .meta .source {
527 | vertical-align: middle;
528 | }
529 | .meta .avatar,
530 | .comment-meta .avatar {
531 | width: 20px;
532 | height: 20px;
533 | border-radius: 2px;
534 | margin-right: 5px;
535 | }
536 | .meta .bio,
537 | .highlight .gh,
538 | .highlight .bp {
539 | color: #999;
540 | }
541 | .night .comment-meta .author,
542 | .night .content,
543 | .night .meta .author,
544 | .highlight .go {
545 | color: #888;
546 | }
547 | .night .headline-title,
548 | .night .headline-background .heading-content,
549 | .night .question-title {
550 | color: #B8B8B8;
551 | }
552 | .highlight .c,
553 | .highlight .cm,
554 | .highlight .c1 {
555 | color: #998;
556 | font-style: italic;
557 | }
558 | .highlight .gr,
559 | .highlight .gt {
560 | color: #a00;
561 | }
562 | .highlight .gp,
563 | .highlight .nn {
564 | color: #555;
565 | }
566 | .highlight .kt,
567 | .highlight .nc {
568 | color: #458;
569 | font-weight: 700;
570 | }
571 | .highlight .m,
572 | .highlight .mf,
573 | .highlight .mh,
574 | .highlight .mi,
575 | .highlight .mo,
576 | .highlight .il {
577 | color: #099;
578 | }
579 | .highlight .s,
580 | .highlight .sb,
581 | .highlight .sc,
582 | .highlight .sd,
583 | .highlight .s2,
584 | .highlight .se,
585 | .highlight .sh,
586 | .highlight .si,
587 | .highlight .sx,
588 | .highlight .s1,
589 | .highlight .ss {
590 | color: #d32;
591 | }
592 | .highlight .na,
593 | .highlight .nb,
594 | .highlight .no,
595 | .highlight .nv,
596 | .highlight .vc,
597 | .highlight .vg,
598 | .highlight .vi {
599 | color: teal;
600 | }
601 | .highlight .ne,
602 | .highlight .nf {
603 | color: #900;
604 | font-weight: 700;
605 | }
606 | .answer h1,
607 | .answer h2,
608 | .answer h3,
609 | .answer h4,
610 | .answer h5 {
611 | font-size: 19px;
612 | }
613 | @media only screen and (-webkit-min-device-pixel-ratio2), only screen and (min-device-pixel-ratio2) {
614 | .icon-arrow-right {
615 | background-image: url(http://static.daily.zhihu.com/img/share-icons@2x.png);
616 | -webkit-background-size: 82px 55px;
617 | background-size: 82px 55px;
618 | }
619 | .icon-vote,
620 | .icon-voted {
621 | background-image: url(http://static.daily.zhihu.com/img/app/Comment_Vote@2x.png) !important;
622 | background-size: 11px 12px;
623 | }
624 | .icon-voted {
625 | background-image: url(http://static.daily.zhihu.com/img/app/Comment_Voted@2x.png) !important;
626 | }
627 | .night .icon-vote {
628 | background-image: url(http://static.daily.zhihu.com/img/app/Dark_Comment_Vote@2x.png) !important;
629 | }
630 | .from-column {
631 | background-image: url(http://static.daily.zhihu.com/img/News_Column_Entrance@2x.png) !important;
632 | background-size: 280px 30px;
633 | }
634 | .from-column:active {
635 | background-image: url(http://static.daily.zhihu.com/img/News_Column_Entrance_Highlight@2x.png) !important;
636 | }
637 | .night .from-column {
638 | color: #2b82ac;
639 | background-image: url(http://static.daily.zhihu.com/img/Dark_News_Column_Entrance@2x.png) !important;
640 | }
641 | .night .from-column:active {
642 | background-image: url(http://static.daily.zhihu.com/img/Dark_News_Column_Entrance_Highlight@2x.png) !important;
643 | }
644 | }
645 | .meta .meta-item {
646 | width: 39%;
647 | overflow: hidden;
648 | white-space: nowrap;
649 | text-overflow: ellipsis;
650 | display: inline-block;
651 | color: #929292;
652 | margin-right: 7px;
653 | }
654 | .headline .meta {
655 | white-space: nowrap;
656 | text-overflow: ellipsis;
657 | overflow: hidden;
658 | font-size: 11px;
659 | color: #b8b8b8;
660 | margin: 20px 0;
661 | padding: 0 20px;
662 | }
663 | .headline .meta a,
664 | .headline .meta a:hover {
665 | margin-top: 2px;
666 | float: right;
667 | font-size: 11px;
668 | color: #0066cf;
669 | text-decoration: none;
670 | }
671 | .answer h1,
672 | .answer h2,
673 | .answer h3,
674 | .answer h4,
675 | .answer h5 {
676 | font-size: 19px;
677 | }
678 | .origin-source,
679 | a.origin-source:link {
680 | display: block;
681 | margin: 25px 0;
682 | height: 50px;
683 | overflow: hidden;
684 | background: #f0f0f0;
685 | color: #888;
686 | position: relative;
687 | -webkit-touch-callout: none;
688 | }
689 | .origin-source .source-logo,
690 | a.origin-source:link .source-logo {
691 | float: left;
692 | width: 50px;
693 | height: 50px;
694 | margin-right: 10px;
695 | }
696 | .origin-source .text,
697 | a.origin-source:link .text {
698 | line-height: 50px;
699 | height: 50px;
700 | font-size: 13px;
701 | }
702 | .origin-source.with-link .text {
703 | color: #333;
704 | }
705 | .origin-source.with-link:after {
706 | display: block;
707 | position: absolute;
708 | border-color: transparent transparent transparent #f0f0f0;
709 | border-width: 7px;
710 | border-style: solid;
711 | height: 0;
712 | width: 0;
713 | top: 18px;
714 | right: 4px;
715 | line-height: 0;
716 | content: "";
717 | }
718 | .origin-source.with-link:before {
719 | display: block;
720 | height: 0;
721 | width: 0;
722 | position: absolute;
723 | top: 18px;
724 | right: 3px;
725 | border-color: transparent transparent transparent #000;
726 | border-width: 7px;
727 | border-style: solid;
728 | line-height: 0;
729 | content: "";
730 | }
731 | .origin-source-wrap {
732 | position: relative;
733 | background: #f0f0f0;
734 | }
735 | .origin-source-wrap .focus-link {
736 | position: absolute;
737 | right: 0;
738 | top: 0;
739 | width: 45px;
740 | color: #00a2ed;
741 | height: 50px;
742 | display: none;
743 | text-align: center;
744 | font-size: 12px;
745 | -webkit-touch-callout: none;
746 | }
747 | .origin-source-wrap .focus-link .btn-label {
748 | text-align: center;
749 | display: block;
750 | margin-top: 8px;
751 | border-left: solid 1px #ccc;
752 | height: 34px;
753 | line-height: 34px;
754 | }
755 | .origin-source-wrap.unfocused .focus-link {
756 | display: block;
757 | }
758 | .origin-source-wrap.unfocused .origin-source:before,
759 | .origin-source-wrap.unfocused .origin-source:after {
760 | display: none;
761 | }
762 | .night .origin-source-wrap {
763 | background: #292929;
764 | }
765 | .night .origin-source-wrap .focus-link {
766 | color: #116f9e;
767 | }
768 | .night .origin-source-wrap .btn-label {
769 | border-left: solid 1px #3f3f3f;
770 | }
771 | .night .origin-source,
772 | .night .origin-source.with-link {
773 | background: #292929;
774 | color: #666;
775 | }
776 | .night .origin-source .text,
777 | .night .origin-source.with-link .text {
778 | color: #666;
779 | }
780 | .night .origin-source.with-link:after {
781 | border-color: transparent transparent transparent #292929;
782 | }
783 | .night .origin-source.with-link:before {
784 | border-color: transparent transparent transparent #666;
785 | }
786 |
--------------------------------------------------------------------------------