-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from ttoklip/feat/#3_우리동네_화면_구현
Feat/#3 우리동네 화면 구현
- Loading branch information
Showing
57 changed files
with
4,294 additions
and
87 deletions.
There are no files selected for viewing
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
60 changes: 0 additions & 60 deletions
60
app/src/main/java/com/umc/ttoklip/presentation/TownFragment.kt
This file was deleted.
Oops, something went wrong.
125 changes: 125 additions & 0 deletions
125
app/src/main/java/com/umc/ttoklip/presentation/hometown/CommunicationActivity.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,125 @@ | ||
package com.umc.ttoklip.presentation.hometown | ||
|
||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import com.umc.ttoklip.R | ||
import com.umc.ttoklip.databinding.ActivityCommunicationBinding | ||
import com.umc.ttoklip.presentation.base.BaseActivity | ||
import com.umc.ttoklip.presentation.hometown.adapter.Communication | ||
import com.umc.ttoklip.presentation.hometown.adapter.CommunicationAdapter | ||
import com.umc.ttoklip.presentation.hometown.adapter.OnItemClickListener | ||
import com.umc.ttoklip.presentation.mypage.SortSpinnerAdapter | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class CommunicationActivity : | ||
BaseActivity<ActivityCommunicationBinding>(R.layout.activity_communication), | ||
OnItemClickListener { | ||
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) | ||
) | ||
binding.honeyTipFilterSpinner.adapter = | ||
SortSpinnerAdapter(this, sortFilters) | ||
binding.honeyTipFilterSpinner.setSelection(0) | ||
|
||
val honeyTipList = listOf( | ||
Communication( | ||
"똑똑이", | ||
"음식물 쓰레기 냄새 방지!!", | ||
"집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", | ||
"1일전", | ||
0 | ||
), | ||
Communication( | ||
"똑똑이", | ||
"음식물 쓰레기 냄새 방지!!", | ||
"집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", | ||
"1일전", | ||
0 | ||
), | ||
Communication( | ||
"똑똑이", | ||
"음식물 쓰레기 냄새 방지!!", | ||
"집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", | ||
"1일전", | ||
0 | ||
), | ||
Communication( | ||
"똑똑이", | ||
"음식물 쓰레기 냄새 방지!!", | ||
"집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", | ||
"1일전", | ||
0 | ||
), | ||
Communication( | ||
"똑똑이", | ||
"음식물 쓰레기 냄새 방지!!", | ||
"집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", | ||
"1일전", | ||
0 | ||
), | ||
Communication( | ||
"똑똑이", | ||
"음식물 쓰레기 냄새 방지!!", | ||
"집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", | ||
"1일전", | ||
0 | ||
), | ||
Communication( | ||
"똑똑이", | ||
"음식물 쓰레기 냄새 방지!!", | ||
"집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", | ||
"1일전", | ||
0 | ||
), | ||
Communication( | ||
"똑똑이", | ||
"음식물 쓰레기 냄새 방지!!", | ||
"집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", | ||
"1일전", | ||
0 | ||
), | ||
Communication( | ||
"똑똑이", | ||
"음식물 쓰레기 냄새 방지!!", | ||
"집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", | ||
"1일전", | ||
0 | ||
), | ||
Communication( | ||
"똑똑이", | ||
"음식물 쓰레기 냄새 방지!!", | ||
"집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", | ||
"1일전", | ||
0 | ||
), | ||
Communication( | ||
"똑똑이", | ||
"음식물 쓰레기 냄새 방지!!", | ||
"집에 가끔씩이지만 나타나는 바퀴벌레, 잘못 처리하면 알깐다고도...", | ||
"1일전", | ||
0 | ||
), | ||
) | ||
val adapter = CommunicationAdapter(this) | ||
binding.communicationRv.layoutManager = LinearLayoutManager(this) | ||
binding.communicationRv.adapter = adapter | ||
adapter.submitList(honeyTipList) | ||
|
||
binding.backBtn.setOnClickListener { | ||
finish() | ||
} | ||
} | ||
|
||
override fun initObserver() { | ||
|
||
} | ||
|
||
override fun onClick(communication: Communication) { | ||
|
||
} | ||
|
||
} |
128 changes: 128 additions & 0 deletions
128
app/src/main/java/com/umc/ttoklip/presentation/hometown/MyHometownFragment.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,128 @@ | ||
package com.umc.ttoklip.presentation.hometown | ||
|
||
import android.content.Intent | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import com.umc.ttoklip.R | ||
import com.umc.ttoklip.databinding.FragmentMyHometownBinding | ||
import com.umc.ttoklip.presentation.alarm.AlarmActivity | ||
import com.umc.ttoklip.presentation.base.BaseFragment | ||
import com.umc.ttoklip.presentation.hometown.adapter.OnTogetherClickListener | ||
import com.umc.ttoklip.presentation.hometown.adapter.Together | ||
import com.umc.ttoklip.presentation.hometown.adapter.TogetherAdapter | ||
import com.umc.ttoklip.presentation.mypage.MyHometownAddressActivity | ||
import com.umc.ttoklip.presentation.mypage.SortSpinnerAdapter | ||
import com.umc.ttoklip.presentation.search.SearchActivity | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class MyHometownFragment : BaseFragment<FragmentMyHometownBinding>(R.layout.fragment_my_hometown), | ||
OnTogetherClickListener { | ||
private val togetherAdapter by lazy { | ||
TogetherAdapter( | ||
this, | ||
getString(R.string.together_title) | ||
) | ||
} | ||
private val communicationAdapter by lazy { | ||
TogetherAdapter( | ||
this, | ||
getString(R.string.communication_title) | ||
) | ||
} | ||
|
||
override fun initObserver() { | ||
|
||
} | ||
|
||
override fun initView() { | ||
binding.seeDetailTogetherBtn.setOnClickListener { | ||
val intent = Intent(requireContext(), TogetherActivity::class.java) | ||
startActivity(intent) | ||
} | ||
|
||
binding.seeDetailCommunicationBtn.setOnClickListener { | ||
val intent = Intent(requireContext(), CommunicationActivity::class.java) | ||
startActivity(intent) | ||
} | ||
binding.bellBtn.setOnClickListener { | ||
startActivity(AlarmActivity.newIntent(requireContext())) | ||
} | ||
binding.searchBtn.setOnClickListener { | ||
startActivity(SearchActivity.newIntent(requireContext())) | ||
} | ||
binding.myHometownFilterSpinner.setOnLongClickListener { | ||
val intent = Intent(requireContext(), MyHometownAddressActivity::class.java) | ||
startActivity(intent) | ||
true | ||
} | ||
binding.writeTogetherBtn.setOnClickListener { | ||
val intent = Intent(requireContext(), WriteTogetherActivity::class.java) | ||
startActivity(intent) | ||
} | ||
binding.writeTogetherPlus.setOnClickListener { | ||
val intent = Intent(requireContext(), WriteTogetherActivity::class.java) | ||
startActivity(intent) | ||
} | ||
binding.writeCommunicationBtn.setOnClickListener { | ||
val intent = Intent(requireContext(), WriteCommunicationActivity::class.java) | ||
startActivity(intent) | ||
} | ||
binding.writeCommunicationPlus.setOnClickListener { | ||
val intent = Intent(requireContext(), WriteCommunicationActivity::class.java) | ||
startActivity(intent) | ||
} | ||
initDropdownSortFilter() | ||
initTogetherRv() | ||
initCommunicationRv() | ||
} | ||
|
||
private fun initCommunicationRv() { | ||
val togethers = listOf( | ||
Together("같이 햇반 대량 구매하실 분?", "상록구 해양동 한양대학로 12"), | ||
Together("같이 햇반 대량 구매하실 분?", "상록구 해양동 한양대학로 12"), | ||
Together("같이 햇반 대량 구매하실 분?", "상록구 해양동 한양대학로 12") | ||
) | ||
|
||
binding.communicationRv.apply { | ||
adapter = communicationAdapter | ||
layoutManager = LinearLayoutManager(requireContext()) | ||
} | ||
communicationAdapter.submitList(togethers) | ||
} | ||
|
||
private fun initTogetherRv() { | ||
val togethers = listOf( | ||
Together("같이 햇반 대량 구매하실 분?", "상록구 해양동 한양대학로 12"), | ||
Together("같이 햇반 대량 구매하실 분?", "상록구 해양동 한양대학로 12"), | ||
Together("같이 햇반 대량 구매하실 분?", "상록구 해양동 한양대학로 12") | ||
) | ||
|
||
binding.togetherRv.apply { | ||
adapter = togetherAdapter | ||
layoutManager = LinearLayoutManager(requireContext()) | ||
} | ||
togetherAdapter.submitList(togethers) | ||
} | ||
|
||
private fun initDropdownSortFilter() { | ||
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) | ||
) | ||
binding.myHometownFilterSpinner.adapter = | ||
SortSpinnerAdapter(requireContext(), sortFilters) | ||
binding.myHometownFilterSpinner.setSelection(0) | ||
} | ||
|
||
override fun onClick(items: Together, type: String) { | ||
if (type == getString(R.string.together_title)) { | ||
val intent = Intent(requireContext(), ReadTogetherActivity::class.java) | ||
startActivity(intent) | ||
} else { | ||
val intent = Intent(requireContext(), ReadCommunicationActivity::class.java) | ||
startActivity(intent) | ||
} | ||
} | ||
} |
Oops, something went wrong.