Skip to content
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

Implement activity of SNS Feed(Post) #13

Merged
merged 13 commits into from Sep 2, 2021
Merged

Implement activity of SNS Feed(Post) #13

merged 13 commits into from Sep 2, 2021

Conversation

lijm1358
Copy link
Collaborator

@lijm1358 lijm1358 commented Sep 2, 2021

This revision includes

Changes

1. Add new activity&layout to display SNS feed from server (SnsFeedActivity)

2. Add interfaces, data classses for SNS related communication (API/ServerClient, Model/PostFeedItem)

3. Add new retrofit2 instance object (API/ServerPostAPI)

4. Add ViewPager, Recycler layout&adapter to show comments, images of post (image_viewpager.xml, commnet_recycler.xml, ImageSliderAdapter, CommentRecyclerAdapter)

5. Add dependencies for processing request and images

Documents

@lijm1358 lijm1358 changed the title Implement view of SNS Feed(Post) Implement activity of SNS Feed(Post) Sep 2, 2021
Comment on lines 224 to 248
class SnsFeedInformation(postInfo: PostFeedItem, baseurl : String) {
val postId: Int = postInfo.postID
val writerName: String = postInfo.writer.username
val writerImage: String = baseurl + postInfo.writer.picture
val postcontent: String = postInfo.contents
val postTime: String = postInfo.postTime.split(".")[0].replace("T", " ")
val postLat: Double = postInfo.location.lat
val postLong: Double = postInfo.location.lng
val liker = postInfo.like
var likerCount: Int = 0
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class SnsFeedInformation(postInfo: PostFeedItem, baseurl : String) {
val postId: Int = postInfo.postID
val writerName: String = postInfo.writer.username
val writerImage: String = baseurl + postInfo.writer.picture
val postcontent: String = postInfo.contents
val postTime: String = postInfo.postTime.split(".")[0].replace("T", " ")
val postLat: Double = postInfo.location.lat
val postLong: Double = postInfo.location.lng
val liker = postInfo.like
var likerCount: Int = 0
}
/** class of informations of sns feed */
data class SnsFeedInformation(
val postId: Int,
val writerName: String,
val writerImage: String,
val postcontent: String,
val postTime: String,
val postLat: Double,
val postLong: Double,
val liker: List<Like>,
var likerCount: Int,
) {
constructor(postInfo: PostFeedItem, baseurl : String) : this(
postInfo.postID,
postInfo.writer.username,
baseurl + postInfo.writer.picture,
postInfo.contents,
postInfo.postTime.split(".")[0].replace("T", " "),
postInfo.location.lat,
postInfo.location.lng,
postInfo.like,
0,
)
}

This kind of class have an advantage when declare it as a data class, as it kvm automatically add equals,
hashCode, etc.. Although it may seems little bit more verbose, I think this is a more kotlinic way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your suggestion, I'll commit this right away!

Copy link
Contributor

@Snowapril Snowapril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Applying above my suggestion is up to you .You do not have to change it in this PR

@lijm1358 lijm1358 force-pushed the snsfeed branch 2 times, most recently from 5f06a37 to 388473c Compare September 2, 2021 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants