-
Notifications
You must be signed in to change notification settings - Fork 16
HW-52584 receipt list #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
2c0cca9
HW-53053. Split ui modules
azakrevska-epam 9ba8f51
HW-53053. Added jacoco settings
azakrevska-epam 7949065
Merge with package changes + multi module build
fmattos-hw 7218015
HW-53053. Changed publishing
azakrevska-epam ad0970e
Remove comments and unnecessary plugin usages
fmattos-hw 6a9b6b2
move sonar config
fmattos-hw 89d922e
HW-53053. Moved font, styles, colors to common module
azakrevska-epam d4867c7
Merge remote-tracking branch 'origin/task/HW-53053-ui-splitted-module…
azakrevska-epam ec3b001
Merge branch 'development' into task/HW-53053-ui-splitted-modules
azakrevska-epam 57121d4
HW-53053. Fixed moved style
azakrevska-epam 16bce86
HW-53053. Updated lint (added exceptions for overdraw)
azakrevska-epam ab7b653
HW-52584 draft receipt list
f5fbb62
HW-52584 draft test
b9f84d9
added test and test templates for receipts
551a0af
removed junit4 runner
b1f98dc
removed currency symbol
2bf85b8
ui changes from requirements and adding ellipsis support
4fa2e7b
added new icon set
500f702
added Event live data pattern
b7fcec4
improve ellipsis
bf880f2
Merge branch 'development' into task/HW-53053-ui-splitted-modules
azakrevska-epam 7c6b5d9
HW-53053. Updated library versions
azakrevska-epam e574593
add receipt transaction description
fmattos-hw eb22f26
initial receipt type integration
a230034
Merge remote-tracking branch 'remotes/origin/task/HW-53053-ui-splitte…
fbf2721
renamed test
bf8599c
updated diff and order of fields
92b910f
added test
d8c0bb3
Merge remote-tracking branch 'remotes/origin/development' into task/H…
a53786b
Moving equals implementation in core
a22bd77
fixed integration test
905bb6a
fixed ellipsis approach
9fbc21d
added constants
cd017a3
added transfer method status query in list transfer method ui module
77ea3ca
addressed comments
ab3cb53
removed locale changes
6ba7e59
ui updates
e65b897
added sync ui fix
192a1ae
divider improvement
c2b3374
added timezone default
c23374d
fixed multi-timezone support
f3f8578
added license
41384fe
comment
fa4f4d3
added fix for HW-53592
2c58aa6
added header check
ef55dda
added header check first element
eee9009
HW-53401. Added ui tests for list receipts (#34)
azakrevska-epam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
common/src/main/java/com/hyperwallet/android/common/util/DateUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| /* | ||
| * The MIT License (MIT) | ||
| * Copyright (c) 2019 Hyperwallet Systems Inc. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and | ||
| * associated documentation files (the "Software"), to deal in the Software without restriction, | ||
| * including without limitation the rights to use, copy, modify, merge, publish, distribute, | ||
| * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT | ||
| * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
| * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| */ | ||
| package com.hyperwallet.android.common.util; | ||
|
|
||
| import androidx.annotation.NonNull; | ||
| import androidx.annotation.VisibleForTesting; | ||
|
|
||
| import java.text.ParseException; | ||
| import java.text.SimpleDateFormat; | ||
| import java.util.Date; | ||
| import java.util.Locale; | ||
| import java.util.TimeZone; | ||
|
|
||
| /** | ||
| * Common HW-SDK UI Date Utility class, that will assist on safe presentation of date whatever the mobile device setting | ||
| * is set Locale, Timezone and etc... that dictates how that dates are being presented | ||
| * | ||
| * Moreover all date string to {@link Date} object conversion is automatically converted from | ||
| * GMT date string from API to locale Date set by the phone | ||
| */ | ||
| public final class DateUtils { | ||
|
|
||
| private static final String DATE_FORMAT = "yyyy-MM-dd"; | ||
| private static final String DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; | ||
| private static final String DATE_TIME_FORMAT_MILLISECONDS = "yyyy-MM-dd'T'HH:mm:ss.SSS"; | ||
| private static final TimeZone API_TIMEZONE = TimeZone.getTimeZone("GMT"); | ||
|
|
||
| private DateUtils() { | ||
peter-joseph marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| /** | ||
| * Creates a string date format: <code>yyyy-MM-dd</code> | ||
| * | ||
| * @param date Date object | ||
| * @return string date in <code>yyyy-MM-dd</code> format | ||
| */ | ||
| public static String toDateFormat(@NonNull final Date date) { | ||
| SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT, Locale.getDefault()); | ||
| dateFormat.setTimeZone(TimeZone.getDefault()); | ||
| return dateFormat.format(date); | ||
| } | ||
|
|
||
| /** | ||
| * Creates a string date in specified format | ||
| * | ||
| * @param date Date object | ||
| * @param format specify desired format of date | ||
| * @return formatted date string based on format specified | ||
| */ | ||
| public static String toDateFormat(@NonNull final Date date, @NonNull final String format) { | ||
| SimpleDateFormat dateFormat = new SimpleDateFormat(format, Locale.getDefault()); | ||
| dateFormat.setTimeZone(TimeZone.getDefault()); | ||
| return dateFormat.format(date); | ||
| } | ||
|
|
||
| /** | ||
| * Creates a string date format | ||
| * | ||
| * @param date Date object | ||
| * @return formatted string in <code>yyyy-MM-dd'T'HH:mm:ss</code> format | ||
| */ | ||
| public static String toDateTimeFormat(@NonNull final Date date) { | ||
| SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_TIME_FORMAT, Locale.getDefault()); | ||
| dateFormat.setTimeZone(TimeZone.getDefault()); | ||
| return dateFormat.format(date); | ||
| } | ||
|
|
||
| /** | ||
| * Creates a string date format | ||
| * | ||
| * @param date Date object | ||
| * @return formatted string in <code>yyyy-MM-dd'T'HH:mm:ss.SSS</code> format | ||
| */ | ||
| public static String toDateTimeMillisFormat(@NonNull final Date date) { | ||
| SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_TIME_FORMAT_MILLISECONDS, Locale.getDefault()); | ||
| dateFormat.setTimeZone(TimeZone.getDefault()); | ||
| return dateFormat.format(date); | ||
| } | ||
|
|
||
| /** | ||
| * Creates a Date object from string date using API Timezone | ||
| * | ||
| * @param dateString String date from API with GMT timezone | ||
| * @return date Date object converted to local timezone | ||
| * @throws IllegalArgumentException when string is un-parsable | ||
| */ | ||
| public static Date fromDateTimeString(@NonNull final String dateString) { | ||
| try { | ||
| SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_TIME_FORMAT, Locale.getDefault()); | ||
| dateFormat.setTimeZone(API_TIMEZONE); | ||
| return dateFormat.parse(dateString); | ||
| } catch (ParseException e) { | ||
| throw new IllegalArgumentException("An exception occurred when attempting to parse " + | ||
| "the date " + dateString, e); | ||
| } | ||
| } | ||
|
|
||
| @VisibleForTesting | ||
| static Date fromDateTimeString(@NonNull final String dateString, @NonNull final String format) { | ||
| try { | ||
| SimpleDateFormat dateFormat = new SimpleDateFormat(format, Locale.getDefault()); | ||
| dateFormat.setTimeZone(API_TIMEZONE); | ||
| return dateFormat.parse(dateString); | ||
| } catch (ParseException e) { | ||
| throw new IllegalArgumentException("An exception occurred when attempting to parse " + | ||
| "the date " + dateString, e); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
common/src/main/java/com/hyperwallet/android/common/viewmodel/Event.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* | ||
| * The MIT License (MIT) | ||
| * Copyright (c) 2019 Hyperwallet Systems Inc. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and | ||
| * associated documentation files (the "Software"), to deal in the Software without restriction, | ||
| * including without limitation the rights to use, copy, modify, merge, publish, distribute, | ||
| * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT | ||
| * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
| * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| */ | ||
| package com.hyperwallet.android.common.viewmodel; | ||
|
|
||
| import androidx.annotation.NonNull; | ||
| import androidx.annotation.Nullable; | ||
|
|
||
| /** | ||
| * Class that represents {@link androidx.lifecycle.LiveData} event with content | ||
| */ | ||
| public class Event<T> { | ||
peter-joseph marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| private final T content; | ||
| private boolean mIsContentConsumed; | ||
|
|
||
| public Event(@NonNull final T t) { | ||
| content = t; | ||
| } | ||
|
|
||
| /** | ||
| * @return content of this event, will also mark {@link Event#mIsContentConsumed} to <code>true</code> | ||
| * that will also mean that {@link Event#getContentIfNotConsumed()} will also return <code>true</code> | ||
| */ | ||
| @NonNull | ||
| public T getContent() { | ||
| mIsContentConsumed = true; | ||
| return content; | ||
| } | ||
|
|
||
| /** | ||
| * @return <code>true</code> if content assigned to event is already referenced | ||
| * from {@link Event#getContent()}; <code>false</code> otherwise. | ||
| */ | ||
| public boolean isContentConsumed() { | ||
| return mIsContentConsumed; | ||
| } | ||
|
|
||
| /** | ||
| * Retrieve assigned content based on if and only if content has not been referenced from {@link Event#getContent()} | ||
| * | ||
| * @return content if content is not yet consumed; otherwise null | ||
| */ | ||
| @Nullable | ||
| public T getContentIfNotConsumed() { | ||
| if (!mIsContentConsumed) { | ||
| mIsContentConsumed = true; | ||
| return content; | ||
| } | ||
| return null; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
common/src/test/java/com/hyperwallet/android/common/util/DateUtilsTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| package com.hyperwallet.android.common.util; | ||
|
|
||
| import static org.hamcrest.CoreMatchers.is; | ||
| import static org.hamcrest.CoreMatchers.notNullValue; | ||
| import static org.hamcrest.MatcherAssert.assertThat; | ||
|
|
||
| import org.junit.Before; | ||
| import org.junit.Test; | ||
|
|
||
| import java.util.Date; | ||
| import java.util.TimeZone; | ||
|
|
||
| public class DateUtilsTest { | ||
peter-joseph marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| @Before | ||
| public void setTestLocalTimezone() { | ||
| TimeZone.setDefault(TimeZone.getTimeZone("PST")); | ||
| } | ||
|
|
||
| @Test | ||
| public void testToDateFormat_returnsExpectedStringFormat() { | ||
| String dateString = "2019-05-27"; | ||
| Date dateTarget = DateUtils.fromDateTimeString("2019-05-27T15:57:49"); | ||
|
|
||
| // test | ||
| String targetDate = DateUtils.toDateFormat(dateTarget); | ||
| assertThat(targetDate, is(notNullValue())); | ||
| assertThat(targetDate, is(dateString)); | ||
| } | ||
|
|
||
| @Test | ||
| public void testToDateFormat_returnsExpectedStringFormatFromParameter() { | ||
| String dateString = "November 2019"; | ||
| Date dateTarget = DateUtils.fromDateTimeString("2019-11-27T15:57:49"); | ||
|
|
||
| // test | ||
| String targetDate = DateUtils.toDateFormat(dateTarget, "MMMM yyyy"); | ||
| assertThat(targetDate, is(notNullValue())); | ||
| assertThat(targetDate, is(dateString)); | ||
| } | ||
|
|
||
| @Test | ||
| public void testToDateTimeFormat_returnsExpectedStringFormat() { | ||
| String localTime = "2019-11-27T07:57:00"; | ||
| Date dateTarget = DateUtils.fromDateTimeString("2019-11-27T15:57:00"); | ||
|
|
||
| // test | ||
| String targetDate = DateUtils.toDateTimeFormat(dateTarget); | ||
| assertThat(targetDate, is(notNullValue())); | ||
| assertThat(targetDate, is(localTime)); | ||
| } | ||
|
|
||
| @Test | ||
| public void testToDateTimeMillisFormat_returnsExpectedStringFormat() { | ||
| String localTime = "2019-11-27T07:57:00.000"; | ||
| Date dateTarget = DateUtils.fromDateTimeString("2019-11-27T15:57:00.000", "yyyy-MM-dd'T'HH:mm:ss.SSS"); | ||
|
|
||
| // test | ||
| String targetDate = DateUtils.toDateTimeMillisFormat(dateTarget); | ||
| assertThat(targetDate, is(notNullValue())); | ||
| assertThat(targetDate, is(localTime)); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| package="com.hyperwallet.android.receipt.test"> | ||
|
|
||
| <application android:name="com.hyperwallet.android.HyperwalletInstrumentedTestApplication"> | ||
|
|
||
| </application> | ||
|
|
||
| </manifest> |
31 changes: 31 additions & 0 deletions
31
.../src/androidTest/java/com/hyperwallet/android/HyperwalletInstrumentedTestApplication.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package com.hyperwallet.android; | ||
|
|
||
|
|
||
| import android.app.Application; | ||
|
|
||
| import com.squareup.leakcanary.InstrumentationLeakDetector; | ||
| import com.squareup.leakcanary.LeakCanary; | ||
|
|
||
| public class HyperwalletInstrumentedTestApplication extends Application { | ||
|
|
||
| @Override | ||
| public void onCreate() { | ||
|
|
||
| super.onCreate(); | ||
| if (LeakCanary.isInAnalyzerProcess(this)) { | ||
| // This process is dedicated to LeakCanary for heap analysis. | ||
| // You should not init your app in this process. | ||
| return; | ||
| } | ||
| installLeakCanary(); | ||
| } | ||
|
|
||
|
|
||
| protected void installLeakCanary() { | ||
|
|
||
| InstrumentationLeakDetector.instrumentationRefWatcher(this) | ||
| .buildAndInstall(); | ||
|
|
||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.