Skip to content

Commit

Permalink
新增旺報
Browse files Browse the repository at this point in the history
香港蘋果新增壹週Plus,飲食男女,Ketchupe
東森新聞雲新增鍵盤大檸檬
修復聯合新聞網
修復光明日報
  • Loading branch information
ccjeng committed May 28, 2017
1 parent 765adb7 commit 6c62e7d
Show file tree
Hide file tree
Showing 13 changed files with 462 additions and 446 deletions.
546 changes: 285 additions & 261 deletions .idea/workspace.xml

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,24 @@
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="butterknife-7.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gass-10.2.6" level="project" />
<orderEntry type="library" exported="" name="mopub-sdk-native-video-4.12.0" level="project" />
<orderEntry type="library" exported="" name="fragmentation-0.10.3" level="project" />
<orderEntry type="library" exported="" name="exoplayer-r2.0.3" level="project" />
<orderEntry type="library" exported="" name="mopub-sdk-4.12.0" level="project" />
<orderEntry type="library" exported="" name="play-services-tagmanager-v4-impl-10.2.4" level="project" />
<orderEntry type="library" exported="" name="play-services-gass-10.2.4" level="project" />
<orderEntry type="library" exported="" name="transition-25.3.1" level="project" />
<orderEntry type="library" exported="" name="play-services-tagmanager-v4-impl-10.2.6" level="project" />
<orderEntry type="library" exported="" name="jsoup-1.10.2" level="project" />
<orderEntry type="library" exported="" name="firebase-core-10.2.4" level="project" />
<orderEntry type="library" exported="" name="firebase-core-10.2.6" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-24.0.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="multidex-instrumentation-1.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-analytics-impl-10.2.4" level="project" />
<orderEntry type="library" exported="" name="play-services-analytics-impl-10.2.6" level="project" />
<orderEntry type="library" exported="" name="audience-network-sdk-4.20.0" level="project" />
<orderEntry type="library" exported="" name="firebase-common-10.2.4" level="project" />
<orderEntry type="library" exported="" name="fastadapter-1.6.0" level="project" />
<orderEntry type="library" exported="" name="firebase-common-10.2.6" level="project" />
<orderEntry type="library" exported="" name="rxjava-1.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-10.2.4" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-10.2.6" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-10.2.6" level="project" />
<orderEntry type="library" exported="" name="support-v4-25.3.1" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-25.3.1" level="project" />
<orderEntry type="library" exported="" name="materialish-progress-1.7" level="project" />
Expand All @@ -125,34 +126,33 @@
<orderEntry type="library" exported="" name="iconics-core-2.7.1" level="project" />
<orderEntry type="library" exported="" name="okio-1.9.0" level="project" />
<orderEntry type="library" exported="" name="fragmentation-swipeback-0.7.9" level="project" />
<orderEntry type="library" exported="" name="firebase-analytics-10.2.4" level="project" />
<orderEntry type="library" exported="" name="play-services-base-10.2.4" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-10.2.4" level="project" />
<orderEntry type="library" exported="" name="firebase-analytics-10.2.6" level="project" />
<orderEntry type="library" exported="" name="design-25.3.1" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-25.3.1" level="project" />
<orderEntry type="library" exported="" name="community-material-typeface-1.5.54.1" level="project" />
<orderEntry type="library" exported="" name="firebase-iid-10.2.4" level="project" />
<orderEntry type="library" exported="" name="play-services-clearcut-10.2.4" level="project" />
<orderEntry type="library" exported="" name="play-services-base-10.2.6" level="project" />
<orderEntry type="library" exported="" name="firebase-iid-10.2.6" level="project" />
<orderEntry type="library" exported="" name="glide-3.7.0" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-25.3.1" level="project" />
<orderEntry type="library" exported="" name="support-fragment-25.3.1" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-10.2.4" level="project" />
<orderEntry type="library" exported="" name="mopub-sdk-interstitial-4.12.0" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-10.2.6" level="project" />
<orderEntry type="library" exported="" name="play-services-clearcut-10.2.6" level="project" />
<orderEntry type="library" exported="" name="mopub-sdk-banner-4.12.0" level="project" />
<orderEntry type="library" exported="" name="mopub-volley-1.1.0" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-10.2.4" level="project" />
<orderEntry type="library" exported="" name="firebase-analytics-impl-10.2.4" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-10.2.6" level="project" />
<orderEntry type="library" exported="" name="firebase-analytics-impl-10.2.6" level="project" />
<orderEntry type="library" exported="" name="mopub-sdk-native-static-4.12.0" level="project" />
<orderEntry type="library" exported="" name="vpadn-sdk-obf464-21407102-1704121104-cdcc646" level="project" />
<orderEntry type="library" exported="" name="rxandroid-1.2.1" level="project" />
<orderEntry type="library" exported="" name="aboutlibraries-5.7.1" level="project" />
<orderEntry type="library" exported="" name="play-services-analytics-10.2.4" level="project" />
<orderEntry type="library" exported="" name="multidex-1.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" name="okhttp-3.4.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-25.3.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-25.3.1" level="project" />
<orderEntry type="library" exported="" name="play-services-analytics-10.2.6" level="project" />
<orderEntry type="library" exported="" name="mopub-sdk-base-4.12.0" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-25.3.1" level="project" />
</component>
Expand Down
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.ccjeng.news"
minSdkVersion 16
targetSdkVersion 23
versionCode 45
versionName '1.8.7.051217SN'
versionCode 46
versionName '1.8.8.052817SN'
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
Expand Down Expand Up @@ -39,11 +39,11 @@ dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-analytics:10.2.4'
compile 'com.google.android.gms:play-services-ads:10.2.4'
compile 'com.google.android.gms:play-services-analytics:10.2.6'
compile 'com.google.android.gms:play-services-ads:10.2.6'
//for FAN, don't move
compile 'com.google.firebase:firebase-core:10.2.4'
releaseCompile 'com.google.firebase:firebase-crash:10.2.4'
compile 'com.google.firebase:firebase-core:10.2.6'
releaseCompile 'com.google.firebase:firebase-crash:10.2.6'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.mikepenz:iconics-core:2.7.1@aar'
compile 'com.mikepenz:community-material-typeface:1.5.54.1@aar'
Expand Down
56 changes: 40 additions & 16 deletions app/src/main/java/com/ccjeng/news/parser/rss/CustomFeedParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,62 @@
public class CustomFeedParser {

public RSSFeed getFeeds(String url, String content) {
final String TAG = "CustomFeedParser";
RSSFeed feed = new RSSFeed();
RSSItem item;
Document doc = Jsoup.parse(content);
Elements links;
Element link;
String root;

try {

if (url.contains("hkm.appledaily.com")) {
links = doc.select("ul li a");
root = "http://hkm.appledaily.com/";

for (Element k : links) {
if (k.attr("href").contains("detail.php")) {

String u = k.attr("href");

if(url.contains("category=magazine")) { //壹週
links = doc.select("div.slider");
for (Element k : links) {
item = new RSSItem();
item.setTitle(k.select("p").text());
item.setLink(root + u);

if (url.contains("=daily")) {
//日報
item.setPubDate(u.substring(u.length() - 8));
} else if (url.contains("=instant")) {
//即時新聞
item.setPubDate(k.select("label").text());
}
item.setTitle(k.select("p.caption").text());
item.setLink(root + k.select("a").attr("href"));
item.setDescription("");
item.setImg(k.select("div.background").attr("style").replace("background-image:url('","").replace("')",""));
feed.addItem(item);
}
links = doc.select("div.item");
for (Element k : links) {
item = new RSSItem();
item.setTitle(k.select("p").get(1).text());
item.setLink(root + k.select("a").attr("href"));
item.setDescription("");
item.setImg(k.select("img").first().absUrl("src"));
feed.addItem(item);
}

} else {
links = doc.select("ul li a");
for (Element k : links) {
if (k.attr("href").contains("detail.php")) {

String u = k.attr("href");

item = new RSSItem();
item.setTitle(k.select("p").text());
item.setLink(root + u);

if (url.contains("=daily")) {
//日報
item.setPubDate(u.substring(u.length() - 8));
} else if (url.contains("=instant")) {
//即時新聞
item.setPubDate(k.select("label").text());
}
item.setDescription("");
item.setImg(k.select("img").first().absUrl("src"));
feed.addItem(item);
}
}
}

} else if (url.contains("am730.com.hk")) {
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/java/com/ccjeng/news/parser/sg/Guangming.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ public String parseHtml(final String link, String content) throws IOException {
String time = "";

try {
title = doc.select("h2.title").text();
time = doc.select("div.submitted").text();
body = doc.select("div.content_wrapper").html() + "<p>"
+ doc.select("ul#spotlight").html();
title = doc.select("h1").text();
time = doc.select("div.article-create-date").text();
body = doc.select("article > div.content").html();
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
10 changes: 8 additions & 2 deletions app/src/main/java/com/ccjeng/news/parser/tw/UDN.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ public String parseHtml(final String link, String content) throws IOException {
} else {
title = doc.select("h1").text();
}
time = doc.select("div#story_bady_info h3").text();
body = doc.select("div#story_body_content").html();

if (link.contains("stars.udn.com")) {
time = doc.select("time").text();
body = doc.select("figure").html() + "<p>"+ doc.select("div#story").html();
} else {
time = doc.select("div#story_bady_info h3").text();
body = doc.select("div#story_body_content").html();
}
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
51 changes: 28 additions & 23 deletions app/src/main/java/com/ccjeng/news/utils/Category.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,30 @@ public String[] getCategory(String tab, int position) {
category = context.getResources().getStringArray(R.array.newscatsChinaTimes);
break;
case 6:
category = context.getResources().getStringArray(R.array.newscatsStorm);
category = context.getResources().getStringArray(R.array.newscatsCommercial);
break;
case 7:
category = context.getResources().getStringArray(R.array.newscatsCommercial);
category = context.getResources().getStringArray(R.array.newscatsWant);
break;
case 8:
category = context.getResources().getStringArray(R.array.newscatsEttoday);
category = context.getResources().getStringArray(R.array.newscatsStorm);
break;
case 9:
category = context.getResources().getStringArray(R.array.newscatsCNYes);
category = context.getResources().getStringArray(R.array.newscatsEttoday);
break;
case 10:
category = context.getResources().getStringArray(R.array.newscatsNewsTalk);
category = context.getResources().getStringArray(R.array.newscatsCNYes);
break;
case 11:
category = context.getResources().getStringArray(R.array.newscatsLibertyTimes);
category = context.getResources().getStringArray(R.array.newscatsNewsTalk);
break;
case 12:
category = context.getResources().getStringArray(R.array.newscatsAppDaily);
category = context.getResources().getStringArray(R.array.newscatsLibertyTimes);
break;
case 13:
category = context.getResources().getStringArray(R.array.newscatsAppDaily);
break;
case 14:
category = context.getResources().getStringArray(R.array.newsCatsTheNewsLens);
break;
}
Expand Down Expand Up @@ -169,27 +172,30 @@ public String[] getFeedURL(String tab, int position) {
feedURL = context.getResources().getStringArray(R.array.newsfeedsChinaTimes);
break;
case 6:
feedURL = context.getResources().getStringArray(R.array.newsfeedsStorm);
feedURL = context.getResources().getStringArray(R.array.newsfeedsCommercial);
break;
case 7:
feedURL = context.getResources().getStringArray(R.array.newsfeedsCommercial);
feedURL = context.getResources().getStringArray(R.array.newsfeedsWant);
break;
case 8:
feedURL = context.getResources().getStringArray(R.array.newsfeedsEttoday);
feedURL = context.getResources().getStringArray(R.array.newsfeedsStorm);
break;
case 9:
feedURL = context.getResources().getStringArray(R.array.newsfeedsCNYes);
feedURL = context.getResources().getStringArray(R.array.newsfeedsEttoday);
break;
case 10:
feedURL = context.getResources().getStringArray(R.array.newsfeedsNewsTalk);
feedURL = context.getResources().getStringArray(R.array.newsfeedsCNYes);
break;
case 11:
feedURL = context.getResources().getStringArray(R.array.newsfeedsLibertyTimes);
feedURL = context.getResources().getStringArray(R.array.newsfeedsNewsTalk);
break;
case 12:
feedURL = context.getResources().getStringArray(R.array.newsfeedsAppDaily);
feedURL = context.getResources().getStringArray(R.array.newsfeedsLibertyTimes);
break;
case 13:
feedURL = context.getResources().getStringArray(R.array.newsfeedsAppDaily);
break;
case 14:
feedURL = context.getResources().getStringArray(R.array.newsFeedsTheNewsLens);
break;
}
Expand Down Expand Up @@ -268,30 +274,29 @@ public AbstractNews getNewsParser(String tab, int position) {
parser = new YamNews();
break;
case 5:
parser = new ChinaTimes();
break;
case 6:
parser = new Storm();
break;
case 7:
parser = new ChinaTimes();
break;
case 8:
parser = new ETToday();
parser = new Storm();
break;
case 9:
parser = new CNYes();
parser = new ETToday();
break;
case 10:
parser = new NewTalk();
parser = new CNYes();
break;
case 11:
parser = new LibertyTimes();
parser = new NewTalk();
break;
case 12:
parser = new AppleDaily();
parser = new LibertyTimes();
break;
case 13:
parser = new AppleDaily();
break;
case 14:
parser = new TheNewsLens();
break;
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rCN/update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
tools:ignore="MissingTranslation">

<string-array name="updates">
<item>v1.8.7\n修复ETNet
<item>v1.8.8\n新增旺报\n香港苹果新增壹周Plus,饮食男女,Ketchupe\n东森新闻云新增键盘大柠檬\n修复联合新闻网\n修复光明日报
</item>
</string-array>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values/news_tw.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<item>聯合財經網</item>
<item>蕃薯藤新聞</item>
<item>中時電子報</item>
<item>工商時報</item>
<item>旺報</item>
<item>風傳媒</item>
<item>工商時報</item>
<item>東森新聞雲</item>
<item>鉅亨網</item>
<item>新頭殼</item>
Expand Down
Loading

0 comments on commit 6c62e7d

Please sign in to comment.