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

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ayltai committed Feb 26, 2018
2 parents 1a05e4e + d7f7804 commit a7c2b77
Show file tree
Hide file tree
Showing 100 changed files with 1,531 additions and 569 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ jobs:
command: gcloud auth activate-service-account [email protected] --key-file ${HOME}/client-secret.json
- run:
name: Run instrumented test on Firebase Test Lab
command: gcloud firebase test android run --type instrumentation --app mobile/build/outputs/apk/debug/mobile-debug.apk --test mobile/build/outputs/apk/androidTest/debug/mobile-debug-androidTest.apk --device model=Nexus5X,version=26,locale=en_US,orientation=portrait --environment-variables coverage=true,coverageFile=/sdcard/tmp/code-coverage/connected/coverage.ec --directories-to-pull=/sdcard/tmp --timeout 20m
command: gcloud firebase test android run --type instrumentation --app mobile/build/outputs/apk/debug/mobile-debug.apk --test mobile/build/outputs/apk/androidTest/debug/mobile-debug-androidTest.apk --device model=sailfish,version=26,locale=en_US,orientation=portrait --environment-variables coverage=true,coverageFile=/sdcard/tmp/code-coverage/connected/coverage.ec --directories-to-pull=/sdcard/tmp --timeout 20m
- run:
name: Create directory to store test results
command: mkdir firebase
Expand All @@ -228,7 +228,7 @@ jobs:
- *attach_firebase_workspace
- run:
name: Move Firebase coverage report
command: mkdir -p mobile/build/outputs/code-coverage/connected && cp firebase/Nexus5X-26-en_US-portrait/artifacts/coverage.ec mobile/build/outputs/code-coverage/connected/coverage.ec
command: mkdir -p mobile/build/outputs/code-coverage/connected && cp firebase/sailfish-26-en_US-portrait/artifacts/coverage.ec mobile/build/outputs/code-coverage/connected/coverage.ec
- *export_gservices_key
- *decode_gservices_key
- run:
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ An aggregated news app containing news from 10+ local news publishers in Hong Ko
* [Sky Post (晴報)](skypost.ulifestyle.com.hk)
* [Hong Kong Economic Journal (信報)](http://www.hkej.com)
* [RTHK (香港電台)](http://news.rthk.hk)
* [South China Morning Post (南華早報)](http://www.scmp.com/frontpage/hk)
* [The Standard (英文虎報)](http://www.thestandard.com.hk)
* [Wen Wei Po (文匯報)](http://news.wenweipo.com)

## Blog posts
* [All you need to know about CircleCI 2.0 with Firebase Test Lab](https://medium.com/@ayltai/all-you-need-to-know-about-circleci-2-0-with-firebase-test-lab-2a66785ff3c2)
Expand Down Expand Up @@ -59,7 +62,6 @@ This app is made with the support of open source projects:
* [Calligraphy](https://github.com/InflationX/Calligraphy)
* [AutoValue](https://github.com/google/auto/tree/master/value)
* [Gson](https://github.com/google/gson)
* [GNU Trove](https://bitbucket.org/trove4j/trove)
* [Espresso](https://google.github.io/android-testing-support-library)
* [JUnit 4](https://github.com/junit-team/junit4)
* [Mockito](https://github.com/mockito/mockito)
Expand Down
10 changes: 4 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ buildscript {
repositories {
jcenter()
google()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'io.realm:realm-gradle-plugin:4.3.1'
classpath 'com.google.gms:google-services:3.1.2'
classpath 'com.google.firebase:firebase-plugins:1.1.4'
classpath 'io.realm:realm-gradle-plugin:4.3.4'
classpath 'com.google.gms:google-services:3.2.0'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
classpath 'io.fabric.tools:gradle:1.25.1'
classpath 'org.jacoco:org.jacoco.core:0.7.9'
}
Expand All @@ -20,14 +19,13 @@ allprojects {
repositories {
jcenter()
google()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://dl.bintray.com/piasy/maven' }
maven { url 'http://dl.bintray.com/mockito/maven' }
}
}

task clean(type: Delete) {
task clean(type : Delete) {
delete rootProject.buildDir
}
Binary file modified design/screenshot_cozy_framed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/screenshot_dark_framed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
65 changes: 30 additions & 35 deletions mobile/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ String VERSION_HASH = 'git rev-parse --short HEAD'.execute().text.trim()

android {
compileSdkVersion 27
buildToolsVersion '27.0.2'
buildToolsVersion '27.0.3'
defaultConfig {
applicationId 'com.github.ayltai.newspaper'
minSdkVersion project.hasProperty('ciBuild') ? 16 : 21
targetSdkVersion 27
versionCode 27
versionName '3.9.' + VERSION_REVISION + '-' + VERSION_HASH
versionCode 28
versionName '3.10.' + VERSION_REVISION + '-' + VERSION_HASH

testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
testInstrumentationRunnerArguments disableAnalytics : 'true'
Expand Down Expand Up @@ -59,15 +59,12 @@ android {
}

testOptions {
execution 'ANDROID_TEST_ORCHESTRATOR'
animationsDisabled true

unitTests {
includeAndroidResources = true
returnDefaultValues = true

all {
jacoco {
includeNoLocationClasses true
}
}
}
}

Expand Down Expand Up @@ -103,16 +100,15 @@ configurations {
ext {
multidexVersion = '1.0.2'
supportLibraryVersion = '27.0.2'
architectureVersion = '1.0.0'
firebaseSdkVersion = '11.6.2'
daggerVersion = '2.13'
okhttpVersion = '3.9.1'
architectureVersion = '1.1.0'
firebaseSdkVersion = '11.8.0'
daggerVersion = '2.14.1'
retrofitVersion = '2.3.0'
frescoVersion = '1.5.0'
bigImageViewerVersion = '1.4.5'
exoPlayerVersion = '2.6.0'
frescoVersion = '1.8.1'
bigImageViewerVersion = '1.4.6'
exoPlayerVersion = '2.7.0'
leakCanaryVersion = '1.5.4'
robolectricVersion = '3.5.1'
robolectricVersion = '3.7.1'
powerMockVersion = '2.0.0-beta.5'
espressoVersion = '3.0.1'
}
Expand All @@ -131,9 +127,6 @@ dependencies {
androidTestImplementation "com.android.support:multidex-instrumentation:$multidexVersion"

// Android Architecture libraries
implementation ('android.arch.lifecycle:runtime:1.0.3') {
exclude group : 'com.android.support'
}
implementation ("android.arch.lifecycle:extensions:$architectureVersion") {
exclude group : 'com.android.support'
}
Expand All @@ -153,16 +146,15 @@ dependencies {
implementation "com.google.firebase:firebase-perf:$firebaseSdkVersion"

// Reactive programming
implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
implementation 'io.reactivex.rxjava2:rxjava:2.1.10'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'

// Dependency injection
implementation "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"

// Networking
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
Expand Down Expand Up @@ -192,29 +184,27 @@ dependencies {
implementation 'com.nex3z:flow-layout:1.1.0'

// Eye candies
implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
implementation 'io.supercharge:shimmerlayout:1.0.2'
implementation 'com.github.castorflex.smoothprogressbar:library:1.1.0'
implementation 'jp.wasabeef:recyclerview-animators:2.3.0'
implementation 'io.supercharge:shimmerlayout:2.0.0'
implementation 'com.github.castorflex.smoothprogressbar:library:1.3.0'
implementation 'pub.hanks:smallbang:1.2.2'
implementation 'com.flaviofaria:kenburnsview:1.0.7'
implementation 'com.gjiazhe:PanoramaImageView:1.0'
implementation 'io.github.inflationx:calligraphy3:3.0.0'

implementation 'net.sf.trove4j:trove4j:3.0.3'

// Code generation tools
compileOnly "com.jakewharton.auto.value:auto-value-annotations:1.5"
annotationProcessor "com.google.auto.value:auto-value:1.5.2"
annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'
annotationProcessor "com.google.auto.value:auto-value:1.5.3"
annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.6'
implementation 'com.google.code.gson:gson:2.8.2'

// Fabric
implementation ('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
implementation ('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') {
transitive = true
}

// Instabug
implementation 'com.instabug.library:instabug:4.5.0'
implementation 'com.instabug.library:instabug:4.10.2'

// Debugging
implementation 'com.akaita.java:rxjava2-debug:1.2.2'
Expand All @@ -223,14 +213,14 @@ dependencies {
testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"

// Unit testing
testImplementation 'org.mockito:mockito-core:2.13.0'
testImplementation 'org.mockito:mockito-core:2.15.3'
testImplementation "org.powermock:powermock-module-junit4:$powerMockVersion"
testImplementation "org.powermock:powermock-module-junit4-rule:$powerMockVersion"
testImplementation "org.powermock:powermock-api-mockito2:$powerMockVersion"
testImplementation "org.powermock:powermock-classloading-xstream:$powerMockVersion"
testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation "org.robolectric:shadows-multidex:$robolectricVersion"
testImplementation 'org.json:json:20171018'
testImplementation 'org.json:json:20180130'

// Instrumented testing
androidTestImplementation (name : 'cloudtestingscreenshotter_lib', ext : 'aar')
Expand All @@ -243,9 +233,10 @@ dependencies {
androidTestImplementation ("com.android.support.test.espresso:espresso-intents:$espressoVersion") {
exclude group : 'com.android.support'
}
androidTestUtil 'com.android.support.test:orchestrator:1.0.1'

// Code coverage by Codacy
codacy 'com.github.codacy:codacy-coverage-reporter:2.0.1'
codacy 'com.github.codacy:codacy-coverage-reporter:2.0.2'
}

configurations.all {
Expand Down Expand Up @@ -282,6 +273,10 @@ def coverageSourceDirs = [
'src/debug/java'
]

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}

task jacocoTestReport(type : JacocoReport, dependsOn : 'testDebugUnitTest') {
group = 'Reporting'
description = 'Generate JaCoCo coverage reports'
Expand Down
16 changes: 9 additions & 7 deletions mobile/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}

## Retrolambda
-dontwarn java.lang.invoke.*
-dontwarn **$$Lambda$*
-dontwarn javax.**

## Facebook Fresco

Expand All @@ -34,15 +32,11 @@
-dontwarn com.facebook.infer.**

## Realm
-dontwarn javax.**
-dontwarn io.realm.**

## Retrofit
-dontwarn retrofit2.**

## BottomBar
-dontwarn com.roughike.bottombar.**

## SearchView
-keep class android.support.v7.widget.SearchView { *; }

Expand All @@ -53,3 +47,11 @@
@org.simpleframework.xml.* <fields>;
public <init>();
}

## BottomNavigationView
-keepclassmembers class android.support.design.internal.BottomNavigationMenuView {
boolean mShiftingMode;
}

## Instabug
-dontwarn com.instabug.**
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public final class Constants {
public static final int INITIAL_RETRY_DELAY = 2;
public static final int MAX_RETRIES = 5;
public static final int CONNECTION_TIMEOUT = 5;
public static final int REFRESH_TIMEOUT = 10;
public static final int REFRESH_TIMEOUT = 7;
public static final int HOUSEKEEP_TIME = 72 * 60 * 60 * 1000;
public static final int REMOTE_CONFIG_CACHE_EXPIRATION = 30 * 60 * 1000;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import android.arch.lifecycle.LifecycleObserver;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.Nullable;
Expand All @@ -14,6 +15,8 @@
import android.util.SparseIntArray;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.Window;
import android.view.WindowManager;

import com.google.firebase.perf.FirebasePerformance;
import com.google.firebase.perf.metrics.Trace;
Expand Down Expand Up @@ -74,6 +77,12 @@ protected void onCreate(@Nullable final Bundle savedInstanceState) {

this.setTheme(this.userConfig.getTheme() == Constants.THEME_LIGHT ? R.style.AppTheme_Light : R.style.AppTheme_Dark);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final Window window = this.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(ContextUtils.getColor(this, R.attr.primaryColorDark));
}

if (!DevUtils.isRunningUnitTest()) this.initInstabug();

Single.<Realm>create(emitter -> emitter.onSuccess(ComponentFactory.getInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private void initFresco() {
ImagePipelineConfig.getDefaultImageRequestConfig()
.setProgressiveRenderingEnabled(true);

Fresco.initialize(this, OkHttpImagePipelineConfigFactory.newBuilder(this, DaggerHttpComponent.builder()
if (!DevUtils.isRunningUnitTest()) Fresco.initialize(this, OkHttpImagePipelineConfigFactory.newBuilder(this, DaggerHttpComponent.builder()
.build()
.httpClient())
.setDownsampleEnabled(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import java.lang.ref.SoftReference;

import android.animation.Animator;
import android.app.Activity;
import android.graphics.Point;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.Pair;
import android.view.animation.Animation;
import android.view.View;

import com.github.ayltai.newspaper.R;
import com.github.ayltai.newspaper.analytics.ViewEvent;
import com.github.ayltai.newspaper.app.data.model.Item;
import com.github.ayltai.newspaper.app.view.DetailsPresenter;
Expand All @@ -23,6 +24,8 @@
import flow.Direction;

final class MainFlow extends RxFlow {


MainFlow(@NonNull final Activity activity) {
super(activity);
}
Expand All @@ -35,11 +38,10 @@ protected Object getDefaultKey() {

@Nullable
@Override
protected Animation getAnimation(@NonNull final Direction direction, @Nullable final Runnable onStart, @Nullable final Runnable onEnd) {
if (direction == Direction.FORWARD) return Animations.getAnimation(this.getContext(), R.anim.reveal_enter, android.R.integer.config_mediumAnimTime, onStart, onEnd);
if (direction == Direction.BACKWARD) return Animations.getAnimation(this.getContext(), R.anim.reveal_exit, android.R.integer.config_mediumAnimTime, onStart, onEnd);
protected Animator getAnimator(@NonNull final View view, @NonNull final Direction direction, @Nullable final Point location, @Nullable final Runnable onStart, @Nullable final Runnable onEnd) {
if (direction == Direction.FORWARD || direction == Direction.BACKWARD) return Animations.createDefaultAnimator(view, direction, location, onStart, onEnd);

return super.getAnimation(direction, onStart, onEnd);
return super.getAnimator(view, direction, location, onStart, onEnd);
}

@SuppressWarnings({ "unchecked", "CyclomaticComplexity" })
Expand Down
Loading

0 comments on commit a7c2b77

Please sign in to comment.