Skip to content
This repository was archived by the owner on May 7, 2019. It is now read-only.

Commit 4e3b55b

Browse files
authored
Merge pull request #47 from ayltai/feature/45-aggregate-sources
Feature/45 aggregate sources
2 parents 8cb4924 + deaa037 commit 4e3b55b

File tree

97 files changed

+3269
-1722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+3269
-1722
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,32 @@ Newspaper
33

44
[![Release](https://img.shields.io/github/release/ayltai/Newspaper.svg?label=release&maxAge=1800)](https://171-77390316-gh.circle-artifacts.com/2/tmp/circle-artifacts.2FZq5Se/app-release.apk) [![Build Status](https://circleci.com/gh/ayltai/Newspaper.svg?style=shield)](https://circleci.com/gh/ayltai/Newspaper) [![Code Quality](https://api.codacy.com/project/badge/Grade/89d745ac9331474e9cf9f3203782a72f)](https://www.codacy.com/app/ayltai/Newspaper?utm_source=github.com&utm_medium=referral&utm_content=ayltai/Newspaper&utm_campaign=Badge_Grade) [![Code Coverage](https://api.codacy.com/project/badge/Coverage/89d745ac9331474e9cf9f3203782a72f)](https://www.codacy.com/app/ayltai/Newspaper?utm_source=github.com&utm_medium=referral&utm_content=ayltai/Newspaper&utm_campaign=Badge_Coverage) [![Code Coverage](https://codecov.io/gh/ayltai/Newspaper/branch/master/graph/badge.svg)](https://codecov.io/gh/ayltai/Newspaper) [![Dependency Status](https://www.versioneye.com/user/projects/586396dc7c01f00031549c16/badge.svg?style=shield)](https://www.versioneye.com/user/projects/586396dc7c01f00031549c16) [![Android API](https://img.shields.io/badge/API-16%2B-blue.svg?style=flat&label=API&maxAge=300)](https://www.android.com/history/) [![License](https://img.shields.io/badge/License-apache%202.0-blue.svg?label=license&maxAge=1800)](https://github.com/ayltai/Newspaper/blob/master/LICENSE)
55

6-
A Yahoo news app clone that is better than the original. Made with ❤
6+
An aggreated news app containing news from 10+ local news publishers in Hong Kong. Made with ❤
77

88
![Screenshot (Compact)](screenshots/screenshot_compact_framed.resized.png "Screenshot (Compact)") ![Screenshot (Dark)](screenshots/screenshot_dark_framed.resized.png "Screenshot (Dark)")
99

1010
## Features
11-
* Run much faster than the [original app](https://play.google.com/store/apps/details?id=com.yahoo.infohub)
11+
* Fast. Just fast.
1212
* [Auto face centering](https://developers.google.com/vision/face-detection-concepts) for image previews. No more weird cropping
1313
* Fancy showcases - [Ken Burns effect](https://en.wikipedia.org/wiki/Ken_Burns_effect) and [Panoramic effect](https://en.wikipedia.org/wiki/Panoramic_photography)
14-
* Read news from all available [categories](https://hk.news.yahoo.com/sitemap/)
15-
* Bookmark any news without the need of a [Yahoo account](https://techcrunch.com/2016/12/14/yahoo-discloses-hack-of-1-billion-accounts/)
14+
* Read news from 10+ news publishers
15+
* Bookmark any news
1616
* No ads. We hate ads as much as you do
1717
* Remember where you were reading
1818
* Exactly the features we need. No bloat
1919

20+
## Aggregated news publishers
21+
* [Apple Daily (蘋果日報)](http://hk.apple.nextmedia.com)
22+
* [Oriental Daily (東方日報)](http://orientaldaily.on.cc)
23+
* [Sing Tao (星島日報)](http://std.stheadline.com)
24+
* [Hong Kong Economic Times (經濟日報)](http://www.hket.com)
25+
* [Sing Pao (成報)](https://www.singpao.com.hk)
26+
* [Ming Pao (明報)](http://www.mingpao.com)
27+
* [Headline (頭條日報)](http://hd.stheadline.com)
28+
* [Sky Post (晴報)](skypost.ulifestyle.com.hk)
29+
* [Hong Kong Economic Journal (信報)](http://www.hkej.com)
30+
* [RTHK (香港電台)](http://news.rthk.hk)
31+
2032
## Requirements
2133
This app supports Android 4.1 Jelly Bean (API 16) or later.
2234

@@ -49,7 +61,6 @@ This app is made with the support of open source software:
4961
* [Robolectric](http://robolectric.org)
5062
* [Facebook Stetho](http://facebook.github.io/stetho)
5163
* [LeakCanary](https://github.com/square/leakcanary)
52-
* [BlockCanaryEx](https://github.com/seiginonakama/BlockCanaryEx)
5364
* [Takt](https://github.com/wasabeef/Takt)
5465

5566
… and closed source software:

app/build.gradle

Lines changed: 68 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ apply plugin: 'com.google.firebase.firebase-crash'
33
apply plugin: 'io.fabric'
44
apply plugin: 'me.tatarka.retrolambda'
55
apply plugin: 'realm-android'
6-
apply plugin: 'blockcanaryex'
76
apply plugin: 'checkstyle'
87
apply plugin: 'findbugs'
98
apply plugin: 'jacoco'
@@ -18,14 +17,13 @@ String VERSION_HASH = 'git rev-parse --short HEAD'.execute().text.trim()
1817

1918
android {
2019
compileSdkVersion 25
21-
buildToolsVersion '25.0.2'
22-
20+
buildToolsVersion '25.0.3'
2321
defaultConfig {
24-
applicationId 'com.github.ayltai.newspaper'
25-
minSdkVersion 16
22+
applicationId 'com.github.ayltai.newspaper'
23+
minSdkVersion 16
2624
targetSdkVersion 25
27-
versionCode 12
28-
versionName '1.2.7r' + VERSION_REVISION + '-' + VERSION_HASH
25+
versionCode 13
26+
versionName '2.0.0r' + VERSION_REVISION + '-' + VERSION_HASH
2927

3028
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
3129
testInstrumentationRunnerArguments disableAnalytics: 'true'
@@ -67,6 +65,7 @@ android {
6765

6866
lintOptions {
6967
abortOnError false
68+
disable 'RestrictedApi'
7069
}
7170

7271
dexOptions {
@@ -92,52 +91,72 @@ configurations {
9291
codacy
9392
}
9493

94+
ext {
95+
supportLibraryVersion = '25.3.1'
96+
firebaseSdkVersion = '10.2.4'
97+
daggerVersion = '2.10'
98+
frescoVersion = '1.3.0'
99+
bigImageViewerVersion = '1.2.9'
100+
debugDrawerVersion = '0.7.0'
101+
stethoVersion = '1.5.0'
102+
leakCanaryVersion = '1.5.1'
103+
espressoVersion = '2.2.2'
104+
}
105+
95106
dependencies {
96107
compile fileTree(dir: 'libs', include: ['*.jar'])
97108

98-
// Android
99-
compile 'com.android.support:support-annotations:25.3.1'
100-
compile 'com.android.support:appcompat-v7:25.3.1'
101-
compile 'com.android.support:support-compat:25.3.1'
102-
compile 'com.android.support:support-v13:25.3.1'
103-
compile 'com.android.support:support-v4:25.3.1'
104-
compile 'com.android.support:design:25.3.1'
105-
compile 'com.android.support:recyclerview-v7:25.3.1'
106-
compile 'com.android.support:cardview-v7:25.3.1'
107-
compile 'com.android.support:support-core-utils:25.3.1'
108-
compile 'com.android.support:preference-v7:25.3.1'
109-
compile 'com.android.support:preference-v14:25.3.1'
109+
// Android Support libraries
110+
compile "com.android.support:support-annotations:${supportLibraryVersion}"
111+
compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
112+
compile "com.android.support:support-compat:${supportLibraryVersion}"
113+
compile "com.android.support:support-v13:${supportLibraryVersion}"
114+
compile "com.android.support:support-v4:${supportLibraryVersion}"
115+
compile "com.android.support:design:${supportLibraryVersion}"
116+
compile "com.android.support:recyclerview-v7:${supportLibraryVersion}"
117+
compile "com.android.support:cardview-v7:${supportLibraryVersion}"
118+
compile "com.android.support:support-core-utils:${supportLibraryVersion}"
119+
compile "com.android.support:preference-v7:${supportLibraryVersion}"
120+
compile "com.android.support:preference-v14:${supportLibraryVersion}"
110121
compile ('com.takisoft.fix:preference-v7:25.3.1.0') {
111122
exclude group: 'com.android.support', module: 'preference-v7'
112123
exclude group: 'com.android.support', module: 'preference-v14'
113124
}
114125

115126
// Firebase
116-
compile ('com.google.firebase:firebase-core:10.2.1') {
127+
compile ("com.google.firebase:firebase-core:${firebaseSdkVersion}") {
117128
exclude group: 'com.android.support', module: 'support-annotations'
118129
exclude group: 'com.android.support', module: 'support-v4'
119130
}
120-
compile ('com.google.firebase:firebase-crash:10.2.1') {
131+
compile ("com.google.firebase:firebase-crash:${firebaseSdkVersion}") {
121132
exclude group: 'com.android.support', module: 'support-annotations'
122133
exclude group: 'com.android.support', module: 'support-v4'
123134
}
124-
compile ('com.google.firebase:firebase-config:10.2.1') {
135+
compile ("com.google.firebase:firebase-config:${firebaseSdkVersion}") {
125136
exclude group: 'com.android.support', module: 'support-annotations'
126137
exclude group: 'com.android.support', module: 'support-v4'
127138
}
128-
compile ('com.google.firebase:firebase-invites:10.2.1') {
139+
compile ("com.google.firebase:firebase-invites:${firebaseSdkVersion}") {
129140
exclude group: 'com.android.support', module: 'support-annotations'
130141
exclude group: 'com.android.support', module: 'support-v4'
131142
}
132143

133144
// Fabric
134-
releaseCompile('io.fabric.sdk.android:fabric:1.3.16@aar') { transitive = true; }
135-
releaseCompile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') { transitive = true; }
136-
releaseCompile('com.crashlytics.sdk.android:answers:1.3.12@aar') { transitive = true; }
137-
testCompile('com.crashlytics.sdk.android:answers:1.3.12@aar') { transitive = true; }
145+
releaseCompile('io.fabric.sdk.android:fabric:1.3.16@aar') {
146+
transitive = true;
147+
}
148+
releaseCompile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
149+
transitive = true;
150+
}
151+
releaseCompile('com.crashlytics.sdk.android:answers:1.3.12@aar') {
152+
transitive = true;
153+
}
154+
testCompile('com.crashlytics.sdk.android:answers:1.3.12@aar') {
155+
transitive = true;
156+
}
138157

139158
// ReactiveX
140-
compile 'io.reactivex:rxjava:1.2.10'
159+
compile 'io.reactivex:rxjava:1.3.0'
141160
compile ('io.reactivex:rxandroid:1.2.1') {
142161
exclude group: 'io.reactivex', module: 'rxjava'
143162
}
@@ -148,8 +167,8 @@ dependencies {
148167
}
149168

150169
// Dagger 2
151-
compile 'com.google.dagger:dagger:2.10'
152-
annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
170+
compile "com.google.dagger:dagger:${daggerVersion}"
171+
annotationProcessor "com.google.dagger:dagger-compiler:${daggerVersion}"
153172

154173
// Flow by Square
155174
compile ('com.squareup.flow:flow:1.0.0-alpha3') {
@@ -163,26 +182,26 @@ dependencies {
163182
compile 'io.realm:android-adapters:2.0.0'
164183

165184
// Image processing
166-
compile 'com.facebook.fresco:fresco:1.3.0'
167-
compile 'com.facebook.fresco:imagepipeline-okhttp3:1.3.0'
185+
compile "com.facebook.fresco:fresco:${frescoVersion}"
186+
compile "com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}"
168187
compile ('com.github.stfalcon:frescoimageviewer:0.5.0') {
169188
exclude group: 'com.facebook.fresco', module: 'fresco'
170189
}
171-
compile ('com.google.android.gms:play-services-vision:10.2.1') {
190+
compile ("com.google.android.gms:play-services-vision:${firebaseSdkVersion}") {
172191
exclude group: 'com.android.support', module: 'support-annotations'
173192
exclude group: 'com.android.support', module: 'support-v4'
174193
}
175194
compile ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') {
176195
exclude group: 'com.android.support', module: 'support-annotations'
177196
}
178-
compile ('com.github.piasy:BigImageViewer:1.2.8') {
197+
compile ("com.github.piasy:BigImageViewer:${bigImageViewerVersion}") {
179198
exclude group: 'com.android.support', module: 'support-annotations'
180199
exclude group: 'com.davemorrissey.labs', module: 'subsampling-scale-image-view'
181200
}
182-
compile ('com.github.piasy:FrescoImageLoader:1.2.8') {
201+
compile ("com.github.piasy:FrescoImageLoader:${bigImageViewerVersion}") {
183202
exclude group: 'com.facebook.fresco', module: 'fresco'
184203
}
185-
compile 'com.github.piasy:ProgressPieIndicator:1.2.8'
204+
compile "com.github.piasy:ProgressPieIndicator:${bigImageViewerVersion}"
186205

187206
// Eye candies
188207
compile ('hanks.xyz:smallbang-library:0.1.2') {
@@ -212,45 +231,43 @@ dependencies {
212231

213232
// Debugging
214233
debugCompile 'jp.wasabeef:takt:1.0.4'
215-
debugCompile ('io.palaima.debugdrawer:debugdrawer:0.7.0') {
234+
debugCompile ("io.palaima.debugdrawer:debugdrawer:${debugDrawerVersion}") {
216235
exclude group: 'com.android.support', module: 'support-annotations'
217236
exclude group: 'com.android.support', module: 'support-v4'
218237
exclude group: 'com.android.support', module: 'appcompat-v7'
219238
}
220-
debugCompile ('io.palaima.debugdrawer:debugdrawer-commons:0.7.0') {
239+
debugCompile ("io.palaima.debugdrawer:debugdrawer-commons:${debugDrawerVersion}") {
221240
exclude group: 'com.android.support', module: 'support-annotations'
222241
}
223-
debugCompile ('io.palaima.debugdrawer:debugdrawer-actions:0.7.0') {
242+
debugCompile ("io.palaima.debugdrawer:debugdrawer-actions:${debugDrawerVersion}") {
224243
exclude group: 'com.android.support', module: 'support-annotations'
225244
}
226-
debugCompile ('io.palaima.debugdrawer:debugdrawer-fps:0.7.0') {
245+
debugCompile ("io.palaima.debugdrawer:debugdrawer-fps:${debugDrawerVersion}") {
227246
exclude group: 'com.android.support', module: 'support-annotations'
228247
}
229-
debugCompile 'com.facebook.stetho:stetho:1.5.0'
230-
debugCompile 'com.facebook.stetho:stetho-okhttp3:1.5.0'
231-
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
232-
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
233-
debugCompile 'com.letv.sarrsdesktop:BlockCanaryExJRT:0.9.5.2'
234-
testCompile 'com.letv.sarrsdesktop:BlockCanaryExJRTNoOp:0.9.5.2'
248+
debugCompile "com.facebook.stetho:stetho:${stethoVersion}"
249+
debugCompile "com.facebook.stetho:stetho-okhttp3:${stethoVersion}"
250+
debugCompile "com.squareup.leakcanary:leakcanary-android:${leakCanaryVersion}"
251+
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}"
235252

236253
// Tests
237254
testCompile 'junit:junit:4.12'
238-
testCompile 'org.mockito:mockito-core:1.10.19'
255+
testCompile 'org.mockito:mockito-core:2.7.22'
239256
testCompile 'org.robolectric:robolectric:3.3.2'
240257
androidTestCompile ('com.android.support.test:runner:0.5') {
241258
exclude group: 'com.android.support', module: 'support-annotations'
242259
}
243-
androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.2') {
260+
androidTestCompile ("com.android.support.test.espresso:espresso-core:${espressoVersion}") {
244261
exclude group: 'com.android.support', module: 'support-annotations'
245262
}
246-
androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2.2') {
263+
androidTestCompile ("com.android.support.test.espresso:espresso-contrib:${espressoVersion}") {
247264
exclude group: 'com.android.support', module: 'support-annotations'
248265
exclude group: 'com.android.support', module: 'support-v4'
249266
exclude group: 'com.android.support', module: 'appcompat-v7'
250267
exclude group: 'com.android.support', module: 'design'
251268
exclude group: 'com.android.support', module: 'recyclerview-v7'
252269
}
253-
androidTestCompile ('com.android.support.test.espresso:espresso-intents:2.2.2') {
270+
androidTestCompile ("com.android.support.test.espresso:espresso-intents:${espressoVersion}") {
254271
exclude group: 'com.android.support', module: 'support-annotations'
255272
}
256273

@@ -370,7 +387,7 @@ task (codacyDepsize) << {
370387

371388
task (codacyLocs) << {
372389
configurations.codacy.each {
373-
String jarName = it
390+
String jarName = it
374391
println jarName
375392
}
376393
}

app/src/androidTest/java/com/github/ayltai/newspaper/MainActivityTest.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,13 @@ public void openFirstItemThenSwipeThroughAllTabs() {
5858
.perform(ViewActions.click());
5959

6060
// Swipes through all tabs
61-
final String[] shortCategories = InstrumentationRegistry.getTargetContext().getResources().getStringArray(R.array.pref_category_short_entries);
62-
final String[] longCategories = InstrumentationRegistry.getTargetContext().getResources().getStringArray(R.array.pref_category_entries);
63-
64-
for (int i = 0; i < shortCategories.length; i++) {
65-
final String longCategory = longCategories[i];
61+
final String[] categories = InstrumentationRegistry.getTargetContext().getResources().getStringArray(R.array.categories);
6662

63+
for (int i = 0; i < categories.length; i++) {
6764
Espresso.onView(ViewMatchers.withId(R.id.collapsingToolbarLayout))
68-
.check(ViewAssertions.matches(MoreViewMatchers.withTitle(longCategory)));
65+
.check(ViewAssertions.matches(MoreViewMatchers.withTitle(categories[i])));
6966

70-
Espresso.onView(Matchers.allOf(ViewMatchers.withText(shortCategories[i]), ViewMatchers.isDescendantOfA(ViewMatchers.withId(R.id.tabLayout))))
67+
Espresso.onView(Matchers.allOf(ViewMatchers.withText(categories[i]), ViewMatchers.isDescendantOfA(ViewMatchers.withId(R.id.tabLayout))))
7168
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()));
7269

7370
Espresso.onView(ViewMatchers.withId(R.id.navigate_next))

app/src/debug/java/com/github/ayltai/newspaper/BaseApplication.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
import com.facebook.common.logging.FLog;
77
import com.facebook.stetho.Stetho;
88
import com.github.ayltai.newspaper.util.TestUtils;
9-
import com.letv.sarrsdesktop.blockcanaryex.jrt.BlockCanaryEx;
10-
import com.letv.sarrsdesktop.blockcanaryex.jrt.Config;
11-
import com.letv.sarrsdesktop.blockcanaryex.jrt.FrequentMethodInfo;
12-
import com.letv.sarrsdesktop.blockcanaryex.jrt.MethodInfo;
139
import com.squareup.leakcanary.LeakCanary;
1410

1511
public abstract class BaseApplication extends Application {
@@ -34,27 +30,6 @@ public void onCreate() {
3430

3531
if (!LeakCanary.isInAnalyzerProcess(this)) LeakCanary.install(this);
3632

37-
if (!BlockCanaryEx.isInSamplerProcess(this)) BlockCanaryEx.install(new Config(this) {
38-
private static final double FRAME_DURATION = (long)(1000.0 / 60.0);
39-
private static final double BLOCK_THRESHOLD = 3 * 2 * FRAME_DURATION;
40-
private static final int FREQUENT_THRESHOLD = 5;
41-
42-
@Override
43-
public boolean isBlock(final long startTime, final long endTime, final long startThreadTime, final long endThreadTime) {
44-
return endTime - startTime > BLOCK_THRESHOLD;
45-
}
46-
47-
@Override
48-
public boolean isHeavyMethod(final MethodInfo methodInfo) {
49-
return methodInfo.getCostRealTimeMs() > FRAME_DURATION;
50-
}
51-
52-
@Override
53-
public boolean isFrequentMethod(final FrequentMethodInfo frequentMethodInfo) {
54-
return frequentMethodInfo.getTotalCostRealTimeMs() > FRAME_DURATION && frequentMethodInfo.getCalledTimes() >= FREQUENT_THRESHOLD;
55-
}
56-
});
57-
5833
FLog.setMinimumLoggingLevel(FLog.WARN);
5934
Stetho.initializeWithDefaults(this);
6035
}

0 commit comments

Comments
 (0)