Skip to content

Commit

Permalink
[MIN-44] feat: story item 구현 및 데이터 바인딩 적용 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
KDW03 committed Feb 11, 2023
1 parent 693ef29 commit 763cea2
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 17 deletions.
10 changes: 5 additions & 5 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/src/main/java/com/najudoryeong/mineme/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.najudoryeong.mineme
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.view.WindowManager
import androidx.activity.viewModels
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -32,6 +33,7 @@ class MainActivity : AppCompatActivity(), MainActivityUtil {
binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
binding.viewModel = model


initAppBar()
initBottomNav()

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
android:orientation="vertical">

<com.google.android.material.appbar.AppBarLayout

android:id="@+id/topAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -31,7 +32,7 @@
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_height="wrap_content"
app:titleCentered="true" />

</com.google.android.material.appbar.AppBarLayout>
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Mineme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowTranslucentStatus">true</item>
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Mineme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="Theme.Mineme" parent="Theme.MaterialComponents.Light.NoActionBar">

<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
Expand All @@ -10,7 +11,8 @@
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">#00000000</item>
<!-- Customize your theme here. -->
</style>


</resources>
78 changes: 78 additions & 0 deletions common-ui/src/main/res/layout/item_story.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?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">

<data>

<variable
name="imgUrl"
type="String" />

<variable
name="region"
type="String" />

<variable
name="date"
type="String" />

</data>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">


<ImageView
photoUrl="@{imgUrl}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/img_profile" />


<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="#99C9C9C9">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/cafe24_ssurround"
android:padding="16dp"
android:text="@{region}"
android:textColor="#FFFFFF"
android:textSize="17sp" />


<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/cafe24_ssurround"
android:gravity="end"
android:padding="16dp"
android:text="@{date}"
android:textColor="#FFFFFF"
android:textSize="17sp" />


</LinearLayout>

</FrameLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
</layout>
61 changes: 52 additions & 9 deletions home/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<data>

<import type="android.view.View"/>
<import type="android.view.View" />

<variable
name="vm"
Expand All @@ -28,22 +28,22 @@

<ImageView
android:id="@+id/home_profileIV1"
photoUrl="@{vm.homeData.couple.me.profileImage}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
android:layout_marginTop="48dp"
photoUrl="@{vm.homeData.couple.me.profileImage}"
app:layout_constraintEnd_toStartOf="@+id/home_heartIV"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/home_profileIV2"
photoUrl="@{vm.homeData.couple.mine.profileImage}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="25dp"
photoUrl="@{vm.homeData.couple.mine.profileImage}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/home_heartIV"
Expand Down Expand Up @@ -111,6 +111,33 @@
app:layout_constraintTop_toBottomOf="@id/home_profileNameTV2" />


<TextView
android:id="@+id/insta_Id1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="@font/cafe24_ssurround_air"
android:gravity="center"
android:textSize="12sp"
android:text="@{vm.homeData.couple.me.instaId}"
app:layout_constraintEnd_toEndOf="@id/home_profileExplanation1"
app:layout_constraintStart_toStartOf="@id/home_profileExplanation1"
app:layout_constraintTop_toBottomOf="@id/home_profileExplanation1" />

<TextView
android:id="@+id/insta_Id2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="@font/cafe24_ssurround_air"
android:gravity="center"
android:textSize="12sp"
android:text="@{vm.homeData.couple.mine.instaId}"
app:layout_constraintEnd_toEndOf="@id/home_profileExplanation2"
app:layout_constraintStart_toStartOf="@id/home_profileExplanation2"
app:layout_constraintTop_toBottomOf="@id/home_profileExplanation2" />


<ImageView
android:id="@+id/home_topLineIV"
android:layout_width="310dp"
Expand All @@ -134,11 +161,11 @@
app:layout_constraintTop_toBottomOf="@id/home_topLineIV" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/home_todayStoryLO"
android:id="@+id/home_noStoryLayout"
android:layout_width="348dp"
android:layout_height="348dp"
android:layout_marginTop="24dp"
android:visibility="@{vm.isNewStory ? View.VISIBLE : View.INVISIBLE}"
android:visibility="@{vm.isNewStory ? View.INVISIBLE : View.VISIBLE}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/home_storyTV">
Expand All @@ -159,10 +186,25 @@
app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>



<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=""
android:layout_height=""
android:id="@+id/home_newStroyLayout"
android:layout_width="348dp"
android:layout_height="348dp"
android:layout_marginTop="24dp"
android:visibility="@{vm.isNewStory ? View.VISIBLE : View.INVISIBLE}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/home_storyTV">

<include
layout="@layout/item_story"
app:date="@{vm.homeData.newStory.date}"
app:region="@{vm.homeData.newStory.region}"
app:imgUrl="@{vm.homeData.newStory.thumbnailImage}" />

</androidx.constraintlayout.widget.ConstraintLayout>


<TextView
Expand All @@ -173,9 +215,10 @@
android:fontFamily="@font/cafe24_ssurround_air"
android:text="오늘의 스토리를 작성해주세요:)"
android:textSize="20sp"
android:visibility="@{vm.isNewStory ? View.INVISIBLE : View.VISIBLE}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/home_todayStoryLO" />
app:layout_constraintTop_toBottomOf="@id/home_noStoryLayout" />

<ImageView
android:id="@+id/home_bottomLineIV"
Expand Down

0 comments on commit 763cea2

Please sign in to comment.