Skip to content

Commit b38638a

Browse files
chore: Release v1.7.1 (#2747)
chore: Release v1.7.1
2 parents 1362750 + 124fe89 commit b38638a

File tree

225 files changed

+54017
-53762
lines changed

Some content is hidden

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

225 files changed

+54017
-53762
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,14 @@ before_script:
7575
- ./scripts/prepare_avd.sh
7676

7777
script:
78+
- ./gradlew spotlessCheck
7879
- ./scripts/copy_opencv.sh
7980
- ./scripts/main_script.sh
8081

8182
after_success:
8283
- bash <(curl -s https://codecov.io/bash)
8384
- bash scripts/prep-key.sh
84-
- 'if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./scripts/uploadapk_updated_script.sh; fi'
85+
- bash scripts/update-apk.sh
8586

8687
notifications:
8788
slack: fossasia:JgzycrBUs0nKnmJhsAxCB4bL

app/build.gradle

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
}
5+
dependencies {
6+
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
7+
}
8+
}
9+
10+
plugins {
11+
id "com.diffplug.gradle.spotless" version "3.16.0"
12+
}
13+
114
apply plugin: 'com.android.application'
215
apply plugin: 'jacoco-android'
316
apply plugin: 'realm-android'
@@ -14,7 +27,7 @@ android {
1427

1528
defaultConfig {
1629
applicationId "org.fossasia.phimpme"
17-
minSdkVersion 17
30+
minSdkVersion 21
1831
targetSdkVersion 26
1932
multiDexEnabled true
2033
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
@@ -91,6 +104,12 @@ repositories {
91104
maven { url "https://mvnrepository.com/artifact/com.box/box-android-sdk" }
92105
}
93106

107+
spotless {
108+
java {
109+
googleJavaFormat()
110+
target '**/*.java'
111+
}
112+
}
94113

95114
dependencies {
96115
compile fileTree(include: ['*.jar'], dir: 'libs')
@@ -188,14 +207,5 @@ dependencies {
188207

189208
}
190209

191-
buildscript {
192-
repositories {
193-
jcenter()
194-
}
195-
dependencies {
196-
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
197-
}
198-
}
199-
200210
apply plugin: 'com.android.application'
201211
apply plugin: 'jacoco-android'
Lines changed: 102 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package org.fossasia.phimpme.leafpic.activities;
22

3+
import static android.content.Context.KEYGUARD_SERVICE;
4+
import static android.support.test.espresso.Espresso.onView;
5+
import static android.support.test.espresso.assertion.ViewAssertions.matches;
6+
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
7+
import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;
8+
import static android.support.test.espresso.matcher.ViewMatchers.withId;
9+
import static org.hamcrest.Matchers.allOf;
310

411
import android.app.Activity;
512
import android.app.KeyguardManager;
@@ -12,7 +19,6 @@
1219
import android.view.ViewGroup;
1320
import android.view.ViewParent;
1421
import android.view.WindowManager;
15-
1622
import org.fossasia.phimpme.R;
1723
import org.fossasia.phimpme.gallery.activities.LFMainActivity;
1824
import org.hamcrest.Description;
@@ -24,115 +30,108 @@
2430
import org.junit.Test;
2531
import org.junit.runner.RunWith;
2632

27-
import static android.content.Context.KEYGUARD_SERVICE;
28-
import static android.support.test.espresso.Espresso.onView;
29-
import static android.support.test.espresso.assertion.ViewAssertions.matches;
30-
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
31-
import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;
32-
import static android.support.test.espresso.matcher.ViewMatchers.withId;
33-
import static org.hamcrest.Matchers.allOf;
34-
3533
@Ignore
3634
@LargeTest
3735
@RunWith(AndroidJUnit4.class)
3836
public class HomeScreenTest {
3937

40-
@Rule
41-
public ActivityTestRule<LFMainActivity> mActivityTestRule = new ActivityTestRule<>(LFMainActivity.class);
42-
43-
@UiThreadTest
44-
@Before
45-
public void setUp() throws Exception {
46-
final Activity activity = mActivityTestRule.getActivity();
47-
try {
48-
mActivityTestRule.runOnUiThread(new Runnable() {
49-
@Override
50-
public void run() {
51-
KeyguardManager mKG = (KeyguardManager) activity.getSystemService(KEYGUARD_SERVICE);
52-
KeyguardManager.KeyguardLock mLock = mKG.newKeyguardLock(KEYGUARD_SERVICE);
53-
mLock.disableKeyguard();
54-
55-
//turn the screen on
56-
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
57-
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
58-
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
59-
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
60-
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);
61-
}
62-
});
63-
} catch (Throwable throwable) {
64-
throwable.printStackTrace();
65-
}
66-
}
67-
68-
@Test
69-
public void homeScreenTest() {
70-
// Added a sleep statement to match the app's execution delay.
71-
// The recommended way to handle such scenarios is to use Espresso idling resources:
72-
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
73-
try {
74-
Thread.sleep(1000);
75-
} catch (InterruptedException e) {
76-
e.printStackTrace();
77-
}
78-
79-
ViewInteraction frameLayout = onView(
80-
allOf(withId(R.id.navigation_accounts), withContentDescription("Accounts"),
81-
childAtPosition(
82-
childAtPosition(
83-
withId(R.id.bottombar),
84-
0),
85-
2),
86-
isDisplayed()));
87-
frameLayout.check(matches(isDisplayed()));
88-
89-
ViewInteraction frameLayout3 = onView(
90-
allOf(withId(R.id.navigation_camera), withContentDescription("Camera"),
91-
childAtPosition(
92-
childAtPosition(
93-
withId(R.id.bottombar),
94-
0),
95-
0),
96-
isDisplayed()));
97-
frameLayout3.check(matches(isDisplayed()));
98-
99-
ViewInteraction frameLayout4 = onView(
100-
allOf(withId(R.id.navigation_home),
101-
childAtPosition(
102-
childAtPosition(
103-
withId(R.id.bottombar),
104-
0),
105-
1),
106-
isDisplayed()));
107-
frameLayout4.check(matches(isDisplayed()));
108-
109-
// Added a sleep statement to match the app's execution delay.
110-
// The recommended way to handle such scenarios is to use Espresso idling resources:
111-
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
112-
try {
113-
Thread.sleep(100);
114-
} catch (InterruptedException e) {
115-
e.printStackTrace();
116-
}
117-
118-
}
119-
120-
private static Matcher<View> childAtPosition(
121-
final Matcher<View> parentMatcher, final int position) {
122-
123-
return new TypeSafeMatcher<View>() {
38+
@Rule
39+
public ActivityTestRule<LFMainActivity> mActivityTestRule =
40+
new ActivityTestRule<>(LFMainActivity.class);
41+
42+
@UiThreadTest
43+
@Before
44+
public void setUp() throws Exception {
45+
final Activity activity = mActivityTestRule.getActivity();
46+
try {
47+
mActivityTestRule.runOnUiThread(
48+
new Runnable() {
12449
@Override
125-
public void describeTo(Description description) {
126-
description.appendText("Child at position " + position + " in parent ");
127-
parentMatcher.describeTo(description);
50+
public void run() {
51+
KeyguardManager mKG = (KeyguardManager) activity.getSystemService(KEYGUARD_SERVICE);
52+
KeyguardManager.KeyguardLock mLock = mKG.newKeyguardLock(KEYGUARD_SERVICE);
53+
mLock.disableKeyguard();
54+
55+
// turn the screen on
56+
activity
57+
.getWindow()
58+
.addFlags(
59+
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
60+
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
61+
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
62+
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
63+
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);
12864
}
65+
});
66+
} catch (Throwable throwable) {
67+
throwable.printStackTrace();
68+
}
69+
}
70+
71+
@Test
72+
public void homeScreenTest() {
73+
// Added a sleep statement to match the app's execution delay.
74+
// The recommended way to handle such scenarios is to use Espresso idling resources:
75+
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
76+
try {
77+
Thread.sleep(1000);
78+
} catch (InterruptedException e) {
79+
e.printStackTrace();
80+
}
12981

130-
@Override
131-
public boolean matchesSafely(View view) {
132-
ViewParent parent = view.getParent();
133-
return parent instanceof ViewGroup && parentMatcher.matches(parent)
134-
&& view.equals(((ViewGroup) parent).getChildAt(position));
135-
}
136-
};
82+
ViewInteraction frameLayout =
83+
onView(
84+
allOf(
85+
withId(R.id.navigation_accounts),
86+
withContentDescription("Accounts"),
87+
childAtPosition(childAtPosition(withId(R.id.bottombar), 0), 2),
88+
isDisplayed()));
89+
frameLayout.check(matches(isDisplayed()));
90+
91+
ViewInteraction frameLayout3 =
92+
onView(
93+
allOf(
94+
withId(R.id.navigation_camera),
95+
withContentDescription("Camera"),
96+
childAtPosition(childAtPosition(withId(R.id.bottombar), 0), 0),
97+
isDisplayed()));
98+
frameLayout3.check(matches(isDisplayed()));
99+
100+
ViewInteraction frameLayout4 =
101+
onView(
102+
allOf(
103+
withId(R.id.navigation_home),
104+
childAtPosition(childAtPosition(withId(R.id.bottombar), 0), 1),
105+
isDisplayed()));
106+
frameLayout4.check(matches(isDisplayed()));
107+
108+
// Added a sleep statement to match the app's execution delay.
109+
// The recommended way to handle such scenarios is to use Espresso idling resources:
110+
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
111+
try {
112+
Thread.sleep(100);
113+
} catch (InterruptedException e) {
114+
e.printStackTrace();
137115
}
116+
}
117+
118+
private static Matcher<View> childAtPosition(
119+
final Matcher<View> parentMatcher, final int position) {
120+
121+
return new TypeSafeMatcher<View>() {
122+
@Override
123+
public void describeTo(Description description) {
124+
description.appendText("Child at position " + position + " in parent ");
125+
parentMatcher.describeTo(description);
126+
}
127+
128+
@Override
129+
public boolean matchesSafely(View view) {
130+
ViewParent parent = view.getParent();
131+
return parent instanceof ViewGroup
132+
&& parentMatcher.matches(parent)
133+
&& view.equals(((ViewGroup) parent).getChildAt(position));
134+
}
135+
};
136+
}
138137
}
Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,50 @@
11
package org.fossasia.phimpme.leafpic.activities;
22

3+
import static android.support.test.espresso.Espresso.onView;
4+
import static android.support.test.espresso.assertion.ViewAssertions.matches;
5+
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
6+
import static android.support.test.espresso.matcher.ViewMatchers.withId;
7+
import static org.hamcrest.Matchers.allOf;
38

49
import android.support.test.espresso.ViewInteraction;
510
import android.support.test.rule.ActivityTestRule;
611
import android.support.test.runner.AndroidJUnit4;
712
import android.test.suitebuilder.annotation.LargeTest;
8-
913
import org.fossasia.phimpme.R;
1014
import org.fossasia.phimpme.opencamera.Camera.PhotoActivity;
1115
import org.junit.Ignore;
1216
import org.junit.Rule;
1317
import org.junit.Test;
1418
import org.junit.runner.RunWith;
1519

16-
import static android.support.test.espresso.Espresso.onView;
17-
import static android.support.test.espresso.assertion.ViewAssertions.matches;
18-
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
19-
import static android.support.test.espresso.matcher.ViewMatchers.withId;
20-
import static org.hamcrest.Matchers.allOf;
21-
2220
@Ignore
2321
@LargeTest
2422
@RunWith(AndroidJUnit4.class)
2523
public class PhotoActivityTest {
2624

27-
@Rule
28-
public ActivityTestRule<PhotoActivity> mActivityTestRule = new ActivityTestRule<>(PhotoActivity.class);
25+
@Rule
26+
public ActivityTestRule<PhotoActivity> mActivityTestRule =
27+
new ActivityTestRule<>(PhotoActivity.class);
2928

30-
@Test
31-
public void photoActivityTest() {
29+
@Test
30+
public void photoActivityTest() {
3231

33-
try {
34-
Thread.sleep(10000);
35-
} catch (InterruptedException e) {
36-
e.printStackTrace();
37-
}
38-
39-
ViewInteraction actionMenuItemView = onView(
40-
allOf(withId(R.id.menu_share), isDisplayed()));
41-
actionMenuItemView.check(matches(isDisplayed()));
42-
43-
ViewInteraction buttonDelete = onView(
44-
allOf(withId(R.id.save), isDisplayed()));
45-
buttonDelete.check(matches(isDisplayed()));
32+
try {
33+
Thread.sleep(10000);
34+
} catch (InterruptedException e) {
35+
e.printStackTrace();
36+
}
4637

47-
ViewInteraction buttonSave = onView(
48-
allOf(withId(R.id.delete), isDisplayed()));
49-
buttonSave.check(matches(isDisplayed()));
38+
ViewInteraction actionMenuItemView = onView(allOf(withId(R.id.menu_share), isDisplayed()));
39+
actionMenuItemView.check(matches(isDisplayed()));
5040

51-
ViewInteraction buttonEdit = onView(
52-
allOf(withId(R.id.edit), isDisplayed()));
53-
buttonEdit.check(matches(isDisplayed()));
41+
ViewInteraction buttonDelete = onView(allOf(withId(R.id.save), isDisplayed()));
42+
buttonDelete.check(matches(isDisplayed()));
5443

55-
}
44+
ViewInteraction buttonSave = onView(allOf(withId(R.id.delete), isDisplayed()));
45+
buttonSave.check(matches(isDisplayed()));
5646

47+
ViewInteraction buttonEdit = onView(allOf(withId(R.id.edit), isDisplayed()));
48+
buttonEdit.check(matches(isDisplayed()));
49+
}
5750
}

0 commit comments

Comments
 (0)