Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NT-1943: UI/UX – Empty state (#1258)
* refactored commentsviewmodel and test * removed wild card imports * fixed lint errors * refactored viewmodel Co-authored-by: Sunday Onoriode <sunday-onoriode@Sunday-Onoriode-MacBook-Pro.local> Co-authored-by: Isabel Martin <arkariang@gmail.com>
- Loading branch information
1 parent
0615810
commit 0ce20f9
Showing
8 changed files
with
201 additions
and
43 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
app/src/main/java/com/kickstarter/mock/factories/CommentEnvelopeFactory.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,24 @@ | ||
package com.kickstarter.mock.factories | ||
|
||
import com.kickstarter.services.apiresponses.commentresponse.CommentEnvelope | ||
|
||
class CommentEnvelopeFactory { | ||
|
||
companion object { | ||
fun emptyCommentsEnvelope(): CommentEnvelope { | ||
return CommentEnvelope.builder() | ||
.totalCount(0) | ||
.comments(listOf()) | ||
.pageInfoEnvelope(null) | ||
.build() | ||
} | ||
|
||
fun commentsEnvelope(): CommentEnvelope { | ||
return CommentEnvelope.builder() | ||
.totalCount(1) | ||
.comments(listOf(CommentFactory.comment())) | ||
.pageInfoEnvelope(PageInfoEnvelopeFactory.pageInfoEnvelope()) | ||
.build() | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/kickstarter/mock/factories/PageInfoEnvelopeFactory.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,15 @@ | ||
package com.kickstarter.mock.factories | ||
|
||
import com.kickstarter.services.apiresponses.commentresponse.PageInfoEnvelope | ||
|
||
class PageInfoEnvelopeFactory { | ||
|
||
companion object { | ||
fun pageInfoEnvelope(): PageInfoEnvelope { | ||
return PageInfoEnvelope.builder() | ||
.endCursor("WzMyNDk1MzMzXQ==") | ||
.startCursor("WzMyNDk1MzMzXQ==") | ||
.build() | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,100 @@ | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.coordinatorlayout.widget.CoordinatorLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/root" | ||
android:background="@color/comment_background" | ||
tools:context="com.kickstarter.ui.activities.CommentsActivity" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:focusable="true" | ||
android:orientation="vertical"> | ||
android:layout_height="match_parent"> | ||
|
||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout | ||
android:id="@+id/comments_swipe_refresh_layout" | ||
<com.google.android.material.appbar.AppBarLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="0dp" | ||
app:layout_constraintBottom_toTopOf="@id/separtor" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
android:layout_height="wrap_content"> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/comments_recycler_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@color/kds_white" | ||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | ||
tools:listitem="@layout/comment_card" /> | ||
|
||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> | ||
|
||
<View | ||
android:id="@+id/separtor" | ||
android:layout_width="0dp" | ||
android:layout_height="1dp" | ||
android:background="@color/kds_support_200" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="@+id/comment_composer" /> | ||
|
||
<com.kickstarter.ui.views.CommentComposerView | ||
android:id="@+id/comment_composer" | ||
<com.kickstarter.ui.toolbars.KSToolbar | ||
style="@style/Toolbar" | ||
app:contentInsetLeft="0dp" | ||
app:contentInsetStart="0dp"> | ||
|
||
<RelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:gravity="center_vertical" | ||
android:orientation="horizontal"> | ||
|
||
<com.kickstarter.ui.views.IconButton | ||
android:id="@+id/back_button" | ||
style="@style/ToolbarIconBackButton" /> | ||
|
||
<TextView | ||
style="@style/ToolbarTitle" | ||
android:text="@string/project_menu_buttons_comments" /> | ||
</RelativeLayout> | ||
|
||
</com.kickstarter.ui.toolbars.KSToolbar> | ||
</com.google.android.material.appbar.AppBarLayout> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:composer_disabled="false" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
android:layout_height="match_parent" | ||
android:focusable="true" | ||
tools:context="com.kickstarter.ui.activities.CommentsActivity" | ||
app:layout_behavior="@string/appbar_scrolling_view_behavior" | ||
android:orientation="vertical"> | ||
|
||
<androidx.appcompat.widget.AppCompatTextView | ||
android:id="@+id/no_comments" | ||
android:visibility="gone" | ||
android:layout_marginTop="@dimen/grid_11" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
android:layout_width="wrap_content" | ||
android:text="@string/No_comments_yet" | ||
style="@style/CalloutSecondary" | ||
android:layout_height="wrap_content"/> | ||
|
||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout | ||
android:id="@+id/comments_swipe_refresh_layout" | ||
android:layout_width="match_parent" | ||
android:layout_height="0dp" | ||
app:layout_constraintBottom_toTopOf="@id/separtor" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/comments_recycler_view" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@color/kds_white" | ||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | ||
tools:listitem="@layout/comment_card" /> | ||
|
||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> | ||
|
||
<View | ||
android:id="@+id/separtor" | ||
android:layout_width="0dp" | ||
android:layout_height="1dp" | ||
android:background="@color/kds_support_200" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="@+id/comment_composer" /> | ||
|
||
<com.kickstarter.ui.views.CommentComposerView | ||
android:id="@+id/comment_composer" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:composer_disabled="false" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
|
||
</androidx.coordinatorlayout.widget.CoordinatorLayout> | ||
|
||
|
||
|
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