-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract the presentation to a module
There are still some issues with the Android P tests The View/ViewObject models are still not mapped or extracted (the UI should not use the FavoriteView anywhere) #29
- Loading branch information
1 parent
7770ce2
commit 7b30a00
Showing
38 changed files
with
370 additions
and
127 deletions.
There are no files selected for viewing
This file contains 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 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 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
20 changes: 20 additions & 0 deletions
20
...le-ui/src/androidTest/java/com/joaquimley/transporteta/ui/test/util/EspressoExtensions.kt
This file contains 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,20 @@ | ||
package com.joaquimley.transporteta.ui.test.util | ||
|
||
import android.app.Activity | ||
import android.support.test.espresso.Espresso.onView | ||
import android.support.test.espresso.action.ViewActions | ||
import android.support.test.espresso.action.ViewActions.typeText | ||
import android.support.test.espresso.assertion.ViewAssertions.matches | ||
import android.support.test.espresso.matcher.RootMatchers.withDecorView | ||
import android.support.test.espresso.matcher.ViewMatchers.* | ||
import android.support.test.rule.ActivityTestRule | ||
import org.hamcrest.CoreMatchers.not | ||
|
||
fun Int.click() = onView(withId(this)).perform(ViewActions.click()) | ||
fun Int.write(text: String) = onView(withId(this)).perform(typeText(text)) | ||
fun Int.textEquals(text: String) = onView(withId(this)).check(matches(withText(text))) | ||
|
||
infix fun <T : Activity> ActivityTestRule<T>.containsToast(message: String) = | ||
onView(withText(message)) | ||
.inRoot(withDecorView(not(activity.window.decorView))) | ||
.check(matches(isDisplayed())) |
2 changes: 1 addition & 1 deletion
2
.../src/debug/java/com/joaquimley/transporteta/ui/testing/factory/TestFactoryFavoriteView.kt
This file contains 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 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 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 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 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
3 changes: 0 additions & 3 deletions
3
...port-eta-android/mobile-ui/src/main/java/com/joaquimley/transporteta/ui/model/Favorite.kt
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...ndroid/mobile-ui/src/main/java/com/joaquimley/transporteta/ui/model/FavoriteViewObject.kt
This file contains 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,7 @@ | ||
package com.joaquimley.transporteta.ui.model | ||
|
||
import android.os.Parcelable | ||
import kotlinx.android.parcel.Parcelize | ||
|
||
@Parcelize | ||
class FavoriteViewObject(val code: Int = -1, val latestEta: String = "", val originalText: String = ""): Parcelable |
44 changes: 22 additions & 22 deletions
44
...eta-android/mobile-ui/src/main/java/com/joaquimley/transporteta/ui/model/data/Resource.kt
This file contains 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 |
---|---|---|
@@ -1,22 +1,22 @@ | ||
package com.joaquimley.transporteta.ui.model.data | ||
|
||
open class Resource<out T> constructor(val status: ResourceState, val data: T? = null, val message: String? = null) { | ||
|
||
companion object { | ||
fun <T> success(data: T): Resource<T> { | ||
return Resource(ResourceState.SUCCESS, data, null) | ||
} | ||
|
||
fun <T> empty(): Resource<T> { | ||
return Resource(ResourceState.EMPTY, null, null) | ||
} | ||
|
||
fun <T> error(message: String): Resource<T> { | ||
return Resource(ResourceState.ERROR, null, message) | ||
} | ||
|
||
fun <T> loading(): Resource<T> { | ||
return Resource(ResourceState.LOADING, null, null) | ||
} | ||
} | ||
} | ||
//package com.joaquimley.transporteta.ui.model.data | ||
// | ||
//open class Resource<out T> constructor(val status: ResourceState, val data: T? = null, val message: String? = null) { | ||
// | ||
// companion object { | ||
// fun <T> success(data: T): com.joaquimley.transporteta.presentation.data.Resource<T> { | ||
// return Resource(ResourceState.SUCCESS, data, null) | ||
// } | ||
// | ||
// fun <T> empty(): com.joaquimley.transporteta.presentation.data.Resource<T> { | ||
// return Resource(ResourceState.EMPTY, null, null) | ||
// } | ||
// | ||
// fun <T> error(message: String): com.joaquimley.transporteta.presentation.data.Resource<T> { | ||
// return Resource(ResourceState.ERROR, null, message) | ||
// } | ||
// | ||
// fun <T> loading(): com.joaquimley.transporteta.presentation.data.Resource<T> { | ||
// return Resource(ResourceState.LOADING, null, null) | ||
// } | ||
// } | ||
//} |
16 changes: 8 additions & 8 deletions
16
...ndroid/mobile-ui/src/main/java/com/joaquimley/transporteta/ui/model/data/ResourceState.kt
This file contains 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package com.joaquimley.transporteta.ui.model.data | ||
|
||
/** | ||
* Represents the state in which a [Resource] is currently in | ||
*/ | ||
enum class ResourceState { | ||
LOADING, SUCCESS, EMPTY, ERROR | ||
} | ||
//package com.joaquimley.transporteta.ui.model.data | ||
// | ||
///** | ||
// * Represents the state in which a [Resource] is currently in | ||
// */ | ||
//enum class ResourceState { | ||
// LOADING, SUCCESS, EMPTY, ERROR | ||
//} |
35 changes: 0 additions & 35 deletions
35
...mobile-ui/src/main/java/com/joaquimley/transporteta/ui/presentation/home/HomeViewModel.kt
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
...va/com/joaquimley/transporteta/ui/presentation/home/favorite/FavoritesViewModelFactory.kt
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 @@ | ||
/build |
Oops, something went wrong.