Skip to content

Commit

Permalink
Merge pull request #55 from ttoklip/feat/#4_honey_tips_fragment
Browse files Browse the repository at this point in the history
Feat/#2 스크랩 화면 수정
  • Loading branch information
hangunhee39 authored Feb 19, 2024
2 parents e2a2f31 + 01230af commit 39bd565
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 113 deletions.
11 changes: 11 additions & 0 deletions app/src/main/java/com/umc/ttoklip/data/api/MyPage2Api.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.umc.ttoklip.data.api

import com.umc.ttoklip.data.model.ResponseBody
import com.umc.ttoklip.data.model.mypage.MyPageInfo
import retrofit2.Response
import retrofit2.http.GET

interface MyPage2Api {
@GET("/api/v1/my-page")
suspend fun getMyPageInfo(): Response<ResponseBody<MyPageInfo>>
}
12 changes: 12 additions & 0 deletions app/src/main/java/com/umc/ttoklip/data/model/mypage/MyPageInfo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.umc.ttoklip.data.model.mypage

data class MyPageInfo(
var street: String

)
/*
street": null,
"nickname": "플램",
"profileImage": "https://ddoklipbk.s3.ap-northeast-2.amazonaws.com/photo/1000000033.jpg.jpg",
"independentYear": 0,
"independentMonth": 9*/
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ class HoneyTipFragment: BaseFragment<FragmentShareHoneyTipBinding>(R.layout.frag
override fun initView() {
initCategoryViewPager()
initPopularHoneyTipsViewPager(65, 30)
binding.scrollV.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
/*binding.scrollV.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
if ((!v.canScrollVertically(1))) {
if(!isLast) {
viewModel.getHoneyTipByCategory(category, page++)
}
}
}
}*/

binding.categoryTablayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener{
override fun onTabSelected(tab: TabLayout.Tab?) {
category = tabTextToCategory(tab?.text.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class QuestionCommentRVA (val replyComment: (Int) -> Unit, val ReportOrDelete: (
)
}
binding.likeBtn.setOnClickListener {
Log.d("commentId", data.commentId.toString())
like(data.commentId, data.writer == TtoklipApplication.prefs.getString("nickname", ""))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ class HouseWorkHoneyTipListFragment :
)
)
binding.rv.adapter = honeyTipListRVA
binding.rv.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
val lastVisibleItemPosition =
(recyclerView.layoutManager as LinearLayoutManager?)!!.findLastCompletelyVisibleItemPosition()
val totalItemViewCount = recyclerView.adapter!!.itemCount - 1

if (newState == 2 && !recyclerView.canScrollVertically(1)
&& lastVisibleItemPosition == totalItemViewCount
) {
Log.d("end", "end")
//viewModel.getHoneyTipByCategory("HOUSE", page++)
}
}

})
}

override fun onClick(honeyTip: HoneyTipMain) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
package com.umc.ttoklip.presentation.intro

import android.content.Intent
import android.os.Handler
import android.os.Looper
import com.umc.ttoklip.R
import com.umc.ttoklip.TtoklipApplication
import com.umc.ttoklip.databinding.ActivitySplashBinding
import com.umc.ttoklip.presentation.MainActivity
import com.umc.ttoklip.presentation.base.BaseActivity
import com.umc.ttoklip.presentation.login.LoginActivity

class SplashActivity:BaseActivity<ActivitySplashBinding>(R.layout.activity_splash) {
override fun initView() {
val handler= Handler(Looper.getMainLooper())
handler.postDelayed({
val spf=getSharedPreferences("first", MODE_PRIVATE)
val firstRun=spf.getBoolean("firstRun",true)
val jwt=TtoklipApplication.prefs.getString("jwt","")
val isFirstLogin=TtoklipApplication.prefs.getBoolean("isFirstLogin",true)
if(firstRun){
startActivity(Intent(this, IntroActivity::class.java))
finish()
}else if(jwt.isNotEmpty()&&!isFirstLogin){
startActivity(Intent(this,MainActivity::class.java))
finish()
} else{
startActivity(Intent(this, LoginActivity::class.java))
finish()
}
},2000)
}
override fun initObserver() {
}
package com.umc.ttoklip.presentation.intro

import android.content.Intent
import android.os.Handler
import android.os.Looper
import com.umc.ttoklip.R
import com.umc.ttoklip.TtoklipApplication
import com.umc.ttoklip.databinding.ActivitySplashBinding
import com.umc.ttoklip.presentation.MainActivity
import com.umc.ttoklip.presentation.base.BaseActivity
import com.umc.ttoklip.presentation.login.LoginActivity

class SplashActivity:BaseActivity<ActivitySplashBinding>(R.layout.activity_splash) {
override fun initView() {
val handler= Handler(Looper.getMainLooper())
handler.postDelayed({
val spf=getSharedPreferences("first", MODE_PRIVATE)
val firstRun=spf.getBoolean("firstRun",true)
//TtoklipApplication.prefs.setBoolean("isFirstLogin", true)
val jwt=TtoklipApplication.prefs.getString("jwt","")
val isFirstLogin=TtoklipApplication.prefs.getBoolean("isFirstLogin",true)
if(firstRun){
startActivity(Intent(this, IntroActivity::class.java))
finish()
}else if(jwt.isNotEmpty()&&!isFirstLogin){
startActivity(Intent(this,MainActivity::class.java))
finish()
} else{
startActivity(Intent(this, LoginActivity::class.java))
finish()
}
},2000)
}
override fun initObserver() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ class SavedHoneyTipActivity :
BaseActivity<ActivitySavedHoneyTipBinding>(R.layout.activity_saved_honey_tip),
OnSpinnerItemClickListener {
override fun initView() {
val sortFilters = listOf(
getString(R.string.sort_most_recent),
getString(R.string.sort_popularity),
getString(R.string.sort_most_comments),
getString(R.string.sort_most_scrap)

val boardFilters = listOf(
"꿀팁 공유",
"뉴스레터",
"소통해요"
)
binding.honeyTipFilterSpinner.adapter =
SortSpinnerAdapter(this@SavedHoneyTipActivity, sortFilters)
binding.honeyTipFilterSpinner.setSelection(0)

binding.boardFilterSpinner.adapter =
SortSpinnerAdapter(this@SavedHoneyTipActivity, boardFilters)
binding.boardFilterSpinner.setSelection(0)

val honeyTipList = listOf(
HoneyTip("똑똑이", "음식물 쓰레기 냄새 방지!!", "집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", "1일전", 0),
Expand Down
138 changes: 69 additions & 69 deletions app/src/main/res/layout/activity_saved_honey_tip.xml
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
<?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>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="24dp"
app:layout_constraintTop_toTopOf="parent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/saved_honey_tip_title"
android:textAppearance="@style/TextAppearance.App.16sp_600"
android:textColor="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/saved_honey_tip_back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@drawable/ic_arrow_back_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

<Spinner
android:id="@+id/honey_tip_filter_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="68dp"
android:layout_marginEnd="24dp"
android:paddingStart="10dp"
android:paddingEnd="6dp"
android:paddingVertical="7dp"
android:background="@drawable/rectangle_corner_10_strok_1"
android:spinnerMode="dropdown"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:popupBackground="@drawable/sort_spinner_dropdown"
android:dropDownWidth="wrap_content"
android:dropDownVerticalOffset="32dp" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/saved_honey_tip_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="124dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/item_saved_honey_tip" />
</androidx.constraintlayout.widget.ConstraintLayout>
<?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>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="24dp"
app:layout_constraintTop_toTopOf="parent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="내가 스크랩한 글"
android:textAppearance="@style/TextAppearance.App.16sp_600"
android:textColor="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/saved_honey_tip_back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@drawable/ic_arrow_back_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

<Spinner
android:id="@+id/board_filter_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="68dp"
android:layout_marginEnd="24dp"
android:paddingStart="10dp"
android:paddingEnd="6dp"
android:paddingVertical="7dp"
android:background="@drawable/rectangle_corner_10_strok_1"
android:spinnerMode="dropdown"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:popupBackground="@drawable/sort_spinner_dropdown"
android:dropDownWidth="wrap_content"
android:dropDownVerticalOffset="32dp" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/saved_honey_tip_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="124dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/item_saved_honey_tip" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

0 comments on commit 39bd565

Please sign in to comment.