Skip to content

Commit

Permalink
2.0 (#25)
Browse files Browse the repository at this point in the history
* Updated gradle

* Updated Dependencies

* Added Apollo and conjugation query

* Added EntryQuery to DisplayActivity, now displays info from GraphQL
DisplayActivity now displays the POS and first definition from the GraphQL server
Removed error reporting for development purposes
Created SimpleCard Fragment, which will be used to display data
Rolled back Apollo dependencies due to error 400 issue

* Fixed margins in SimpleCard Fragment and Removed old string

* Added Cards for Note, Examples, Synonyms, and Antonyms
Doesn't fetch examples yet

* Added Button and Lists to SimpleCardFragment

* DisplayActivity now shows all conjugations using Conjugation Card
ConjugationCardFragment has been updated for GraphQL, along with its adapter
DisplayActivity uses one fragment to show all conjugations

* Updated Favorites Fragment and Its Util classes/functions
EntrySerializer has been updated to work with new Favorites
Section of Favorites Activity have been commented out, will be implemented later
Updated Favorites initialization in Main Activity
Updated Utils functions for set/getFavorites
Display Activity now uses a FavoritesFragment instead of a ConjugationCardFragment to display conjugations

* Removed getting arguements from onNewInstance in new Fragments
This pattern doesn't work because the arguments aren't serializable, so it shouldn't be implemented
These fragments will have to first be added to the view before supplying data

* Fixed layout and added string resource for Favorites Fragment

* Added HTTP Cache to GraphQL and Empty Conjugation Activity

* Fleshed out Conjugation Activity and Connected it to Favorites Fragment
Conjugation Activity now shows all conjugations from server. Conjugations are split into types and sorted alphabetically
Modified ConjugationCard Fragment to handle new usage in Conjugation Activity
Favorites Fragment now holds conjugation info needed for Conjugation Activity, it receives this info from Display Activity

* SpeechLevel string is modified for better display

* Fetching Conjugations now uses POS from Entry Query

* Created SearchQuery and Added GraphQL code to git

* Main Activity now uses Search Query and shows first result in Display
Fixed a bug in Fragments where UI elements might not be modified on the UI thread
DisplayActivity now checks if a word is a Verb or an Adjective before fetching Conjugations
Removed old comments from Main Activity

* Updated SearchResults Activity and connected it to Main Activity
SearchResults Activity queries the GraphQL server, whose response should be cached
Created a new item layout for SearchResults Activity, it shows term, pos, and up to three definitions
Add pos to search query
Updated doSearchQuery in Server to cache response

* Cleaned up Main and SearchResults Activity
Removed old methods and imports in both activities
Moved GraphQL request to its own method in SearchResults Activity, this is for Retry

* Main Activity now uses Search Activity for searching
All search logic is now in Search Activity
Replaced EditText in Main with a SearchView

* Better styled SearchView in Main Activity

* SearchResultsActivity now shows all Definitions for each entry
Each search result item has a LinearLayout that is filled with TextView
The next commit will make this setup more modular

* Created Custom View for Search Results
WordInfoView displays one result, it's modular enough to be reused in Display Activity
Removed unused EXTRA keys from SearchResults Activity

* Updated Apollo dependencies and Added a TODO

* Added Examples and New Card System
Display cards will now follow the View-Body format. Each card will implement the DisplayCardBody interface, which is then used by DisplayCardView to display data. An example has been made in DefPOSCard using WordInfoView.
Created examples GraphQL query and function in Server.
Created ExamplesFragment and added it to DisplayActivity.

* Updated WordInfoView and other views to better match design

* Added Conjugations, Updated views, and Removed old fragments
Created a Conjugation Display Card
Updated CardBodyBody interface because viewGroup is needed to inflate properly. getBodyView has been renamed to addBodyView, because it adds the body to the parent view, which should be DisplayCardView's Linear Layout.
Updated XMLs to better match design
Removed old fragments for DefPOS and Conjugations, they've been replaced with Display Cards

* Replaced Display Activity Ad with Ad Display Card

* Created Examples Card and Improved DisplayCardView
DisplayCardView now adds some bottom padding when hiding the button
Removed some old attributes from dcard_conj.xml
Removed bottom padding from view_word_info.xml because it's no longer needed

* Removed Examples Fragment and renamed dcard_conj
dcard_conj has been renamed to dcard_list because it's used in two Display Cards

* Created Synonym/Antonyms Card and Standarized Card text size
Example, Synonyms, Antonyms, and Conjugations all use the same text size, 24sp
Synonyms and Antonyms both use the same Display Card and view.

* Removed Synonym/Antonyms fragments and Simplified Network code in Display Activity
UI code in Apollo Callback's are all handled in a runOnUIThread Runnable to ensure there aren't any threading exceptions.
Also moved pos check to fetchConjugations method.

* Created NoteCard, Removed Note fragment, and Improved Display Activity code
Replaced note fragment with note display card, all fragments have now been replaced
Removed old fragment code and did some refactoring

* Updated Display's ActionBar to match design
The first Display Card now has a rectangle behind that mimics the action bar, so it looks like the card is on top of the action bar.

* Updated Gradle to remove deprecated warning

* Added Progress Bar to Display Activity and Fixed Maoni compile problem

* Added getButtonListener() to DisplayCardBody interface and Connected to Conjugation Activity
All other cards currently have null button listeners
Simplified Conjugation Activity's XML
Updated Conjugation Card for Conjugation Activitiy intent

* Created new Conjugation Card for Conjugation Activity
Old Conjugation Card has been renamed to Favorites Card
Lowered text size and added auto-resizing for conjugation item
Added Progress Bar to Conjugation Activity

* Created ConjugationInfoActivity and Connected it to Conjugation Activity
Created ConjInfo Card to display conjugation information
Modified ConjugationAdapter to include an onClick listener for conjugations
Deleted item_search_result.xml as it was no longer being used

* Removed Old Server code, Updated schema, and Fixed a bug in Display Activity
Removed all old server code from Server.java. Class only contains graphQL code now.
Updated schema to reflect new speech types
Fixed a bug in Display Activity where the view was never updated if the entry wasn't a verb/adj.

* Fixed Bug in item_conjugation and Hid unused cards in Display Activity
Fixed a bug where the korean text in item_conjugation was being resized incorrectly
Unused cards are now set to GONE

* Changed DisplayCard's heading style and Created title case utility
Conjugation and ConjInfo card's headings are now in title case

* Added honorific switch and Replaced LinearLayout with LinearListView

* Made DefPOSCard expandable and Modified how DisplayCard handles onClick
DisplayCardView now wraps its body's onClick in its own onClick method. This so it can refresh the button text, and possible more stuff, after the body's onClick is executed.
Changed DisplayCardBody's onClick method to act as an event listener itself, instead of returning an onClick listener.
DefPOSCard now displays all definitions when the button is clicked, or collapses if the card is already expanded. The button text is updated accordingly.

* Updated Exampled Card to show all examples, which ExampleAdapter was already doing

* Updated GraphQL schema and Modified other code for new schema
Made changes to account for the new name and parameter, which is currently not implemented

* Updated Favorites code to use a new Favorites class
Favorites information is now stored in a list of Favorite classes.
Overloaded doConjugationQuery function to include the new conjugations list parameter.

* DisplayActivity now queries each conjugation separately, accounting for honorifics
Modified Favorites Card and its adapter so conjugations could be added dynamically

* Modified Favorites Activity to show new Favorites format and added conjugationNames query
conjugationNames query implementation is currently incomplete.
Created an honorific chip drawable for Favorites Activity, can also be used in Conj Info Activity

* Modified AddFavoriteFragment to display data using new format

Updated xml for new design
AddFavoritesFragment doesn't yet add the favorite, but simply displays data

* AddFavoriteFragment now actually adds Favorites to the cache

* Implemented delete functionality and Removed rename functionality
Adding favorites is such a simple process now that it doesn't seem worthwhile to add editing functionality. The user can easily delete and recreate a favorite.

* Replaced add menu option with FAB and Updated Favorites item view

* Removed old classes and methods

* Created tests for Favorite an Utils and fixed bugs in Utils
Fixed a bug where an extra space was being added to the end of the string
Fixed a bug where characters weren't being converted to lowercase

* Created NoteCard Unit Test and Updated NoteCard for tests

* Created tests for DefPOS and SynAnt Cards, Added null checks to cards, and renamed a test
Renamed a test in NoteCard to match the method it tests

* Upgrade gradle version, Changed view ids, and Deleted old fragment

* Updated gradle dependencies for 28 and Deleted Volley dependency
Some error handling code has been commented out for now, it will be implemented later

* Created tests for Conjugation and Examples Cards

* Created tests for Ad and ConjInfo Cards and Modified cards accordingly

* Modified DefPOSCard and Utils unit tests to get better code coverage
Changed Utils unit to a regular test that used Robolectric for Android dependencies

* Moved Cards to their own package and Removed a line from Utils test

* Moved Conjugation and Display Activities and Deleted old resources
Moved activities to the display package
Deleted old Favorites Fragment
Delete old fragment layout files

* Moved card adapters to a separate package
FavoritesCard's adapter has been moved to its own class called FavoritesAdapter

* Fixed a bug in Favorites Activity where names weren't being sliced correctly

* Organized unit tests and Created a test for Favorites Adapter
Unit tests are now organized according to package

* Created a unit test for Conjugations Adapter and Improved Favorites Adapter
Removed redundant code in one of Favorites Adapter's tests

* Created unit test for Example Adapter

* Refactored ExplanationsAdapter and Created a unit test for it
ExplanationsAdapter has been moved from ConjInfoCard into its own class. This should take care of all adapters in the cards
Improved splicing logic for the adapter, now if a ( is no present, only the title is displayed and the subtitle is set to GONE

* Created a unit test for DisplayCardView and Modified DisplayCardView
Improved handling of the view's button listener
Added null checks
Fixed a bug where the headingView's visibility wasn't being updated

* Created test for ConjInfoActivity and Modified Gradle files for coverage

* Implemented jacoco coverage reports for entire testing suite

* WIP: Creating ConjugationActivity Test

* Fixed a bug where duplicate entries were being shown in search results

* Created Slide Animations for Display Activity
Cards now slide up from the bottom, and the app bar slide down to meet it
Refactored loading UI changes into one method
Extended Bar and root Linear Layout are now in a parent Relative Layout

* Migrated from android.support to Androidx

* Cleaned up Gradle files, fixed a bug, and updated gitignore file
Organized gradle file and upgraded dependencies
Removed unused dependency
Fixed a bug with DefPosCard
Added .idea folder to gitignore

* Display and Search Results animations now work in onResume
Refactored SearchResults animation into its own function

* Updated SearchResults Activity per design,and Refactored WordInfoView
Changed WordInfoView ids to prevent an id collision, also to make them clearer.
Created a SearchResults item view.
Updated SearchResults list to match design.
Added animations for SearchResults Activity, it's very similar to Display Activity.

* Disabled transition for Search Activity and Fixed Search Results button

* Fixed Gradle Warning
Fixed: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'. It will be removed at the end of 2019.

* Updated Conj Info and Conjugation Activities to match design
Both activities now have new slide in animations as well

* Fixed cut off shadows in CardViews and Improved padding

* Fixed crashing when no results are found, now shows a dialog

* Fixed returning to open keyboard and Removed old code from Main Activity

* Uses new Search Query, cursor not yet implemented.
Updated Server and other query related code to use the new query.

* Modified Search Results Activity to use Coordinator Layout

* Moved Search Results Activity and Implemented RecyclerView

* Got overlap working

* Search Results Adapter now uses different backgrounds to mimic a card
Backgrounds are also used for dividers
Created new values for backgrounds
Went back to RelativeLayout because App Bar based animations is a dead end

* Improved styling and Added Elevation

* Re-implemented Search Query with RxJava
Server now returns an Observable with basic work already done

* Cleaned up SearchResults Adapter
Removed unnecessary functions and privileges.
Replaced onClick with lambda, and made entire view clickable

* Implemented Pagination in Search Results Activity and Fixed stuttering
Fixed stuttering with extended bar animation

* Added sliding animations for extended bar when scrolling and Removed old code

* Fixed a bug where menu clicks triggered a scroll event

* Implemented RxJava for Entry and Conjugation fetching in DisplayActivity

* Implemented RxJava for Examples fetching in Display Activity

* Cleaned up Display Activity

* Fixed bug where non Verb/Adjective Entries would crash

* Adjusted padding so bottom ad doesn't block last entry

* Created Animation Handler for Search Results Activity

* Removed old function

* Created a Base Animation Handler, Used it for DisplayActivity, Cleaned up code
BaseAnimationHandler has the slide in transition used by multiple activities.
Modified Display Activity to use the new scroll animations
Removed old function from Display Activity

* Renamed Animation Handlers to denote Activity

* Implemented lambdas and Set Action Bar title in Conjugation Activity

* Added Honorific switch bar in Conjugation Activity

* Replaced LinearListView with RecyclerView and Fixed bug
Fixed a bug where only part of a conjugation could be clicked on to go to Conjugation Info Activity

* Moved Conjugation Activity to its own package

* Updated tests for Conjugation Activity

* Added animations to Conjugation Activity

* Created RecyclerView and Conjugation Animation Handlers, used in Conjugation Activity
RecyclerView Animation Handler is simply the Search Results handler. The Conjugation handler extends this and adds another animation.
Conjugation Activity now has the proper animations, except for swipe down for switch.

* Updated Conjugation Animation Handler for swipe down extended bar
Created a new implementation that uses a Gesture Detector, this can detect scrolls even if the view is can't be scrolled anymore.

* Implemented an Animation Handler for Conj Info Activity
Uses the same AnimationHandler as Display Activity, it's been renamed to ScrollViewAnimationHandler

* Set adcard height to be constant to improve look when loading

* Modified Main Activity to match design and removed landscape layout
Regular layout file will be modified to work in landscape too

* Main Activity status bar is now a lighter color

* Implemented lambda expressions

* Updated apollo version

* Updated server code for MongoDB

* Updated Main Activity to include extended bar

* Added animations to Main Activity

* Fixed a bug with card shadows and removed old code

* Removed old loading code and Created Word of the Day card

* Converted Search view into a Display Card and Removed old code

* Removed unused extras from Display Activity

* Connected Word of the Day to server and Fixed a scroll bug in Main Activity

* Rearranged cards and updated WOD Card text size

* Design changes to search card

* Created honorific chip for conjugation info cards

* Updated tests

* Created framework for Ad Free
Custom Application now handles displaying ads, because it will know if a user is AdFree or not

* Moved ad startup code to application

* App now uses regular/irregular boolean for conjugations
This fixes issues #13 and #7

* Removed old doConjugationQuery method and Implemented RxJava in ConjugationActivity

* Updated FavoritesActivity to use RxJava, and Removed old imports

* Improved formatting on add favorites fragment

* Added check for first 2.0 bootup, which handles old favorites

* Removed feeling lucky setting and Refactored code
Feeling lucky was kinda dumb, so I removed it from 2.0
Removed some warnings from Utils
Moved Utils to the utils package

* Created Ad free purchase and Added option in Main Activity
Custom Application connects to Google Play Billing on startup, and Utils handles showing the purchase menu.
Only implemented in Main activity right now
Not yet connected to the Play console, and doesn't hide ads yet

* Update FavoritesCard tests

* Ad Free upgrade now actually removes ads and is no longer consumed
App first checks shared preferences for ad-free status. If nothing is saved there then it fetches and checks the user's purchase history, and saves it in shared preferences.
App no longer consumes ad free upgrade purchase so it can't be bought again. Currently displays a toast when trying to purchase the upgrade again.
Upgraded billing gradle version

* Created BaseActivity that implements ad free upgrade, applied to DisplayActivity

* Applied BaseActivity to other activities, except Main
Excluded Main because it uses its own menu
This adds the menu and search function to Conjugation and ConjInfo Activities

* Added Toasts to indicate ad free upgrade progress

* Screenshot and message are now sent separately to avoid encoding issue
The text encoding problem is with uploadFile, so the message is now instead sent with postMessage so it displays correctly in Slack

* Hide Ad free menu option is already upgraded

* Added select content and select conjugation events
Added term and pos attributes to ConjugationCard and its Adapter
Updated tests for above changes

* Main Activity now uses Base Activity

* Moved logging code to a separate Logger class

* Fixed bug hiding the Remove Ads menu option and Added view_upgrade event

* Added logging events for search and adding favorites

* Changed how ads are handled so the unit id can be set properly
AdCard now creates AdView programmatically, so it can set the unit id and size
Assumes that XML created AdViews are already setup correctly
Added a unit id for ConjugationInfoActivity

* Put ad free back in

* Updated tests and Fixed issue with Looper being null

* Created github action

* Create unitTest.yml

* Deleted github action

* Updated actions

* Fixed bug in yaml

* Fixed bug in yaml part 2

* Added grant permissions for action

* Updated keys.txt path for GitHub Action

* Removed GitHub Actions

* Added network error handling

* Created launch screen for Main Activity and Updated app icon

* Created Launch Activity for onboarding

* Added remaining onboarding cards

* Added onboarding logic, Updated finish button text, and Fixed bug in MainActivity

* Updated handleError function to use error codes

* Re-implemented error handling with error codes and updated Crashlytics

* Updated utils test so it doesn't fail due to Firebase

* Updated search hint

* Updated IAP flow to include acknowledgement

* Version 2.0.0

* Updated dependencies to fix crashlytics and re-enabled it

* Version 2.0.1

* Replaced forked about-box with official version and Updated AboutLibraries
Closes issues #7 and #16

* Got unit tests working

* Added blank Conjugator Activity

* Scaffolded basic layout

* Connected conjugator's stem spinner to graphQL

* Conjugator Activity now properly handles loading state
Both the conjugations list and the menu are hidden while stems are being fetched. From then on only the conjugations list is hidden when it's being refreshed.

* Made Conjugator Activity scrollable

* Refactored code into a Conjugation Observer

* Implemented honorific switch

* Created Animation Handler for Conjugator Activity

* Updated Conjugator Activity to subclass Base Activity

* Updated No Results Fragment text and Improved Conjugator Activity animation

* Created tests for Conjugation Cards Adapter and No Results Fragment

* Removed typo

* Version 2.0.2

* Fixed multidex

* Version 2.0.3

* Create unit tests workflow (#21)

* Create unit tests workflow

* Fixed syntax bug in worflow

* Permission error for keys.txt

* Permission error for keys.txt

* Permission error for keys.txt

* Updated env variable

* Updated keys.txt path

* Added google-services creation to workflow

* Updated google-services step

* Updated path

* Updated env variable

* Fixed a bug with keys.txt

* Updated keys.txt to use secret

* Removed un-needed steps

* Added test reporter and minor edits

* Fixed Instrumented tests and Updated animations (#22)

* Create unit tests workflow

* Fixed syntax bug in worflow

* Permission error for keys.txt

* Permission error for keys.txt

* Permission error for keys.txt

* Updated env variable

* Updated keys.txt path

* Added google-services creation to workflow

* Updated google-services step

* Updated path

* Updated env variable

* Fixed a bug with keys.txt

* Updated keys.txt to use secret

* Removed un-needed steps

* Added test reporter and minor edits

* Updated gradle build version

* Re-implemented animation for sliding in views

* Re-implemented slide in conjugations animation

* Fixed Conj Info test

* Updated slide in views and conjugation animations

* Fixed honorificSwitch test with custom view action

* Removed unused animation resources

* Added acknowledgements and updated gradle dependencies (#24)

* Version 2.0.4
  • Loading branch information
Ninjaman494 authored Sep 20, 2020
1 parent 323acb8 commit 32b3396
Show file tree
Hide file tree
Showing 159 changed files with 8,655 additions and 3,019 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/unitTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Hanji Unit Testing

on:
push:
branches:
- master
pull_request:
branches:
- master
- 2.0

jobs:
run_tests:

runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Create keys.txt
env:
KEYS_TXT: ${{ secrets.KEYS_TXT }}
run: echo $KEYS_TXT > keys.txt
- name: Create google-services.json
env:
FIREBASE_SECRET: ${{ secrets.GOOGLE_SERVICES }}
run: echo $FIREBASE_SECRET > app/google-services.json
- name: Run unit tests
run: ./gradlew testDebugUnitTest --stacktrace
- name: Test Report
uses: asadmansr/[email protected]
if: ${{ always() }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/local.properties
/.idea/workspace.xml
/.idea/libraries
/.idea
.DS_Store
/build
/captures
Expand Down
139 changes: 105 additions & 34 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,71 +1,142 @@
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'jacoco'

jacoco {
toolVersion = '0.8.2'
}

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

// Our merge report task
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {

reports {
xml.enabled = true
html.enabled = true
}

def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"

sourceDirectories.from = files([mainSrc])
classDirectories.from = files([debugTree])
executionData.from = fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec', 'outputs/code_coverage/debugAndroidTest/connected/**/*.ec'
])
}

android {
compileSdkVersion 27
compileSdkVersion 29
defaultConfig {
applicationId "com.a494studios.koreanconjugator"
minSdkVersion 19
targetSdkVersion 27
targetSdkVersion 29
multiDexEnabled true
versionCode 13
versionName "1.4.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 21
versionName "2.0.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled = true
}
}

buildTypes.each {
it.buildConfigField("String", "SERVER_URL", getApiKey("serverURL"))
it.buildConfigField("String", "ADMOB_KEY", getApiKey("adMobKey"))
it.buildConfigField("String", "SLACK_KEY", getApiKey("slackKey"))
it.resValue("string", "DISPLAY_AD_ID" , getApiKey("displayAdID"))
it.resValue("string", "MAIN_AD_ID" , getApiKey("mainAdID"))
it.resValue("string", "SEARCH_AD_ID" , getApiKey("searchAdID"))
it.resValue("string", "SEARCH_RESULTS_AD_ID" , getApiKey("searchResultsAdID"))
it.resValue("string", "DISPLAY_AD_ID", getApiKey("displayAdID"))
it.resValue("string", "MAIN_AD_ID", getApiKey("mainAdID"))
it.resValue("string", "SEARCH_AD_ID", getApiKey("searchAdID"))
it.resValue("string", "SEARCH_RESULTS_AD_ID", getApiKey("searchResultsAdID"))
it.resValue("string", "CONJ_INFO_AD_ID", getApiKey("conjInfoAdID"))
}

configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}

testOptions {
execution 'ANDROIDX_TEST_ORCHESTRATOR'
animationsDisabled true
unitTests {
includeAndroidResources = true
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}

//return a MY API KEY from a properties file.
def getApiKey(String property){
def getApiKey(String property) {
Properties properties = new Properties()
properties.load(new FileInputStream("keys.txt"))
return "\"" + properties.getProperty(property) +"\""
return "\"" + properties.getProperty(property) + "\""
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:multidex:1.0.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-ads:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') { transitive = true }
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation 'com.google.android.material:material:1.2.1'
implementation 'org.jetbrains:annotations:16.0.2'
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.guava:guava:23.0-android'
implementation 'com.andkulikov:transitionseverywhere:1.7.8'
implementation 'com.codemybrainsout.onboarding:onboarder:1.0.4'

// Firebase
implementation 'com.google.firebase:firebase-core:17.4.3'
implementation 'com.google.firebase:firebase-ads:19.2.0'
implementation 'com.google.firebase:firebase-messaging:20.2.1'
implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.google.firebase:firebase-crashlytics:17.2.1'

// Favorites parsing
implementation 'com.google.code.gson:gson:2.8.5'
api 'com.google.guava:guava:28.0-android'

// Settings, About, Feedback
implementation 'com.codemybrainsout.rating:ratingdialog:1.0.8'
implementation project(':about-box')
implementation ('com.mikepenz:aboutlibraries:6.1.1@aar') { transitive = true }
implementation ('org.rm3l:maoni:6.0.0@aar') { transitive = true }
implementation 'com.github.eggheadgames:android-about-box:2.0.1'
implementation 'com.mikepenz:aboutlibraries:8.3.1'
implementation 'org.rm3l:maoni:6.0.0'
implementation 'org.rm3l:maoni-common:6.0.0'
implementation 'com.github.pschroen:slack-api-android:c66cc8d997'
implementation 'com.github.daniel-stoneuk:material-about-library:2.3.0'

// Apollo
implementation 'com.apollographql.apollo:apollo-runtime:1.2.3'
implementation 'com.apollographql.apollo:apollo-http-cache:1.0.1'
implementation 'com.apollographql.apollo:apollo-rx2-support:1.0.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'

// Google Play Billing
implementation 'com.android.billingclient:billing:3.0.0'

// Testing dependencies
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'org.robolectric:robolectric:4.2.1' // Can't be upgraded until #5454 is fixed
testImplementation 'androidx.test:core:1.3.0'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestUtil 'androidx.test:orchestrator:1.3.0'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.apollographql.android'
apply plugin: 'com.google.firebase.crashlytics'
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.a494studios.koreanconjugator;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;

import com.a494studios.koreanconjugator.display.ConjInfoActivity;
import com.linearlistview.LinearListView;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.ArrayList;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.allOf;
import static org.junit.Assert.assertEquals;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class ConjInfoActivityTest {
private final String EXTRA_NAME = "Name";
private final String EXTRA_CONJ = "conjugation";
private final String EXTRA_PRON = "pronunciation";
private final String EXTRA_ROME = "romanization";
private ArrayList<String> EXTRA_EXPL;

@Rule
public ActivityTestRule<ConjInfoActivity> activityRule = new ActivityTestRule<ConjInfoActivity>(ConjInfoActivity.class) {
@Override
protected Intent getActivityIntent() {
EXTRA_EXPL = new ArrayList<>();
EXTRA_EXPL.add("reason 1");
EXTRA_EXPL.add("reason 2");
EXTRA_EXPL.add("reason 3");

Intent intent = new Intent();
intent.putExtra(ConjInfoActivity.EXTRA_NAME,EXTRA_NAME);
intent.putExtra(ConjInfoActivity.EXTRA_CONJ,EXTRA_CONJ);
intent.putExtra(ConjInfoActivity.EXTRA_PRON,EXTRA_PRON);
intent.putExtra(ConjInfoActivity.EXTRA_ROME,EXTRA_ROME);
intent.putExtra(ConjInfoActivity.EXTRA_EXPL,EXTRA_EXPL);
return intent;
}
};

@Test
public void test_displaysData() {
checkUI();
}

@Test
public void test_displayAfterRotation() {
try {
activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Thread.sleep(100);
checkUI();
activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Thread.sleep(100);
checkUI();
} catch (InterruptedException e) {
e.printStackTrace();
}
}


private void checkUI() {
onView(allOf(withId(R.id.displayCard_heading), isDescendantOfA(withId(R.id.info_infoCard))))
.check(matches(isDisplayed()))
.check(matches(withText(EXTRA_NAME)));
onView(withId(R.id.conjInfo_conjugated))
.check(matches(isDisplayed()))
.check(matches(withText(EXTRA_CONJ)));
onView(withId(R.id.conjInfo_hpronc))
.check(matches(isDisplayed()))
.check(matches(withText(EXTRA_PRON)));
onView(withId(R.id.conjInfo_roman))
.check(matches(isDisplayed()))
.check(matches(withText(EXTRA_ROME)));

LinearListView listView = activityRule.getActivity().findViewById(R.id.conjInfo_explainList);
for(int i = 0;i<EXTRA_EXPL.size();i++) {
assertEquals(listView.getAdapter().getItem(i),EXTRA_EXPL.get(i));
}
}
}
Loading

0 comments on commit 32b3396

Please sign in to comment.