스팀 앱 - 개발 중: 블로그 화면 개발 (2)

스팀 앱 - 개발 중: 블로그 화면 개발 (2)

2024. 02. 22 (목) | Written by @dorian-mobileapp

작업 내용

  • 화면 이동 구현
    • ProfileFragment to BlogFragment: 프로필 화면에서 Blog 버튼 클릭하면, 블로그 화면으로 이동
    • 수정 클래스: ProfileFragment
      • Blog 버튼 클릭 처리하는 리스너 추가
  • 블로그 화면 레이아웃 작성

Blog 버튼 클릭 처리하는 리스너

private val menuItem2ClickListener = OnClickListener { v ->
    val state = viewModel.profileState.value
    val author = when  {
        (state is State.Success<SteemitProfile>) -> state.data.account
        else -> ""
    }

    val action = ProfileFragmentDirections.actionNavigationProfileToNavigationBlog(author)
    findNavController().navigate(action)
}

블로그 화면 레이아웃

<?xml version="1.0" encoding="utf-8"?>
<layout
    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">

    <data>
        <variable
            name="viewModel"
            type="lee.dorian.steem_ui.ui.post.blog.BlogViewModel" />
        <variable
            name="activityViewModel"
            type="lee.dorian.steem_ui.MainViewModel" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
            android:id="@+id/swipe_refresh_blog"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/list_blog_post_item"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                tools:listitem="@layout/layout_post_item" />

        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

    </androidx.constraintlayout.widget.ConstraintLayout>

</layout>

마치며...

작업 시간이 대략 30분 조금 더 되는 거 같네요. 이렇게라도 조금씩 개발을 진행할 수 있으면 좋겠습니다. 밤 12시가 지나면, 조금 더 작업을 하고자 합니다.


Layout provided by Steemit Enhancer hommage by ayogom


Posted through the ECblog app (https://blog.etain.club)
Sort:  

Thank you, friend!
I'm @steem.history, who is steem witness.
Thank you for witnessvoting for me.
image.png
please click it!
image.png
(Go to https://steemit.com/~witnesses and type fbslo at the bottom of the page)

The weight is reduced because of the lack of Voting Power. If you vote for me as a witness, you can get my little vote.

안녕하세요.
SteemitKorea팀에서 제공하는 'steemit-enhancer'를 사용해 주셔서 감사합니다. 개선 사항이 있으면 언제나 저에게 연락을 주시면 되고, 관심이 있으신 분들은 https://cafe.naver.com/steemitkorea/425 에서 받아보실 수 있습니다. 사용시 @응원해 가 포함이 되며, 악용시에는 모든 서비스에서 제외될 수 있음을 알려드립니다.

[광고] STEEM 개발자 커뮤니티에 참여 하시면, 다양한 혜택을 받을 수 있습니다.


안녕하세요.
이 글은 SteemitKorea팀(@ayogom)님께서 저자이신 @dorian-mobileapp님을 응원하는 글입니다.
소정의 보팅을 해드렸습니다 ^^ 항상 좋은글 부탁드립니다
SteemitKorea팀에서는 보다 즐거운 steemit 생활을 위해 노력하고 있습니다.
이 글은 다음날 다시 한번 포스팅을 통해 소개 될 예정입니다. 감사합니다!

Upvoted! Thank you for supporting witness @jswit.

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.030
BTC 58012.92
ETH 3065.94
USDT 1.00
SBD 2.24