-
Notifications
You must be signed in to change notification settings - Fork 2
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 #13 from Nbti/feat-mpz7
Feat mpz7
- Loading branch information
Showing
62 changed files
with
2,156 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,11 +1,121 @@ | ||
package com.nbit.Idear | ||
|
||
import android.content.Intent | ||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import androidx.core.view.GravityCompat | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import com.nbit.Idear.databinding.ActivityMainBinding | ||
import com.nbit.Idear.databinding.MainIncludeDrawerBinding | ||
import com.nbit.Idear.home.ProxyWriteAdapter | ||
import com.nbit.Idear.home.ProxyWriteData | ||
import com.nbit.Idear.home.WriteSubData | ||
import com.nbit.Idear.mypage.MyPageActivity | ||
import com.nbit.Idear.write.WriteActivity | ||
|
||
// 메인 페이지 | ||
class MainActivity : AppCompatActivity() { | ||
// ViewBinding Setting | ||
lateinit var drawerBinding: MainIncludeDrawerBinding // 메뉴 Drawer | ||
lateinit var mainBinding: ActivityMainBinding // 메인 페이지 | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
|
||
// 메뉴 Drawer ViewBinding | ||
drawerBinding = MainIncludeDrawerBinding.inflate(layoutInflater) | ||
setContentView(drawerBinding.root) | ||
|
||
// 메인 페이지 viewBinding | ||
mainBinding = drawerBinding.includeMainActivity | ||
|
||
// 메뉴 열기 버튼 누르면 열림 | ||
mainBinding.btnOpenMenu.setOnClickListener { | ||
drawerBinding.mainDrawerLayout.openDrawer((GravityCompat.END)) | ||
} | ||
|
||
// 마이페이지 메뉴 버튼 선택 | ||
drawerBinding.btnMenuMypage.setOnClickListener { | ||
// 마이페이지 이동 | ||
val intent = Intent(this, MyPageActivity::class.java) | ||
startActivity(intent) | ||
|
||
// 메뉴 닫기 | ||
drawerBinding.mainDrawerLayout.closeDrawer((GravityCompat.END)) | ||
} | ||
|
||
// 즐겨찾기 메뉴 버튼 선택 | ||
drawerBinding.btnMenuBookmark.setOnClickListener { | ||
// 즐겨찾기 목록 이동 | ||
|
||
// 메뉴 닫기 | ||
drawerBinding.mainDrawerLayout.closeDrawer((GravityCompat.END)) | ||
} | ||
|
||
// 환경설정 메뉴 버튼 선택 | ||
drawerBinding.btnMenuSetting.setOnClickListener { | ||
// 환경설정 이동 | ||
|
||
// 메뉴 닫기 | ||
drawerBinding.mainDrawerLayout.closeDrawer((GravityCompat.END)) | ||
} | ||
|
||
// 로그인/로그아웃 메뉴 버튼 선택 | ||
drawerBinding.btnMenuLoginLogout.setOnClickListener { | ||
// 로그인/로그아웃 이동 | ||
|
||
// 메뉴 닫기 | ||
drawerBinding.mainDrawerLayout.closeDrawer((GravityCompat.END)) | ||
} | ||
|
||
|
||
// mainBinding=ActivityMainBinding.inflate(layoutInflater) | ||
|
||
val dataDataList:ArrayList<ProxyWriteData> = arrayListOf() | ||
|
||
dataDataList.apply{ | ||
/* add(ProxyWriteData(2023,6,12,"친구에게 전하는 생일 편지", | ||
"생일 축하해! 이 특별한 날을 기념하여 마음 가득한 축하의 말을 전하고 싶어요. " + | ||
"너의 생일은 항상 특별한 순간이야. 너의 유쾌한 에너지와 친절한 마음으로 언제나 우리 주위를 환하게 " + | ||
"비춰줘서 고마워! 정말...",null)) | ||
*/ | ||
add(ProxyWriteData(2023,6,12,"친구에게 전하는 생일 편지","생일 축하해! 이 특별한 날을 기념하여 마음 가득한 축하의 말을 전하고 싶어요. 너의 생일은 항상 특별한 순간이야. 너의 유쾌한 에너지와 친절한 마음으로 언제나 우리 주위를 환하게 비춰줘...", | ||
arrayListOf(WriteSubData("너는 내게 있어서 특별한 존재야. 우리가 ..."), | ||
WriteSubData("너는 내게 있어서 특별한 존재야. 우리가...")))) | ||
|
||
/* | ||
*/ | ||
add(ProxyWriteData(2023,6,12,"친구에게 전하는 생일 편지","생일 축하해! 이 특별한 날을 기념하여 마음 가득한 축하의 말을 전하고 싶어요. 너의 생일은 항상 특별한 순간이야. 너의 유쾌한 에너지와 친절한 마음으로 언제나 우리 주위를 환하게 비춰줘...", | ||
arrayListOf(WriteSubData("너는 내게 있어서 특별한 존재야. 우리가..."), | ||
WriteSubData("너는 내게 있어서 특별한 존재야. 우리가..."), | ||
WriteSubData("너는 내게 있어서 특별한 존재야. 우리가...")))) | ||
|
||
add(ProxyWriteData(2023,6,12,"친구에게 전하는 생일 축하", | ||
"생일 축하해! 이 특별한 날을 기념하여 마음 가득한 축하의 말을 전하고 싶어요. " + | ||
"너의 생일은 항상 특별한 순간이야. 너의 유쾌한 에너지와 친절한 마음으로 언제나 우리 주위를 환하게 " + | ||
"비춰줘서...",null)) | ||
|
||
} | ||
|
||
mainBinding.mainRecyclerView.layoutManager=LinearLayoutManager(this) | ||
val adapter=ProxyWriteAdapter(dataDataList) | ||
mainBinding.mainRecyclerView.adapter=adapter | ||
|
||
mainBinding.fab.setOnClickListener { | ||
|
||
val intent = Intent(this, WriteActivity::class.java) | ||
startActivity(intent) | ||
} | ||
|
||
//val retrofit = Retrofit.Builder() | ||
// .baseUrl("https://api.example.com/") // 서버의 baseUrl을 설정합니다. | ||
// .addConverterFactory(GsonConverterFactory.create()) // JSON 데이터 변환을 위한 Gson 변환기를 추가합니다. | ||
// .build() | ||
|
||
// val apiService = retrofit.create(RetrofitInterface::class.java) | ||
// val apiService = RetrofitInterface.create() | ||
|
||
|
||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
app/src/main/java/com/nbit/Idear/home/ProxyWriteAdapter.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,81 @@ | ||
package com.nbit.Idear.home | ||
|
||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.nbit.Idear.R | ||
import com.nbit.Idear.databinding.ItemWriteBinding | ||
|
||
class ProxyWriteAdapter (private val dataList:ArrayList<ProxyWriteData>): | ||
RecyclerView.Adapter<ProxyWriteAdapter.DataViewHolder>() { | ||
inner class DataViewHolder(private val viewBinding: ItemWriteBinding) : RecyclerView.ViewHolder(viewBinding.root) { | ||
// var chk=false; | ||
fun bind(data: ProxyWriteData) { | ||
viewBinding.yearText.text = data.year.toString() | ||
viewBinding.monthText.text = data.month.toString() | ||
viewBinding.dayText.text = data.day.toString() | ||
viewBinding.titleText.text=data.title | ||
|
||
viewBinding.mainContent.text = data.content | ||
|
||
|
||
viewBinding.upBtn.setOnClickListener { | ||
if (data.additionalContent!= null) { | ||
if (!viewBinding.upBtn.isSelected) { | ||
viewBinding.upBtn.setImageResource(R.drawable.downbtn) | ||
viewBinding.subCardView.visibility=View.VISIBLE | ||
viewBinding.recyclerView.visibility = View.VISIBLE | ||
|
||
|
||
viewBinding.recyclerView.apply { | ||
setHasFixedSize(true) | ||
layoutManager = LinearLayoutManager(viewBinding.root.context) | ||
adapter = SubAdapter(data.additionalContent) | ||
} | ||
viewBinding.upBtn.isSelected = true | ||
} else { | ||
viewBinding.upBtn.setImageResource(R.drawable.upbtn) | ||
viewBinding.subCardView.visibility=View.GONE | ||
viewBinding.recyclerView.visibility = View.GONE | ||
|
||
viewBinding.upBtn.isSelected = false | ||
} | ||
|
||
} | ||
else{ | ||
if (!viewBinding.upBtn.isSelected) { | ||
viewBinding.subCardView.visibility=View.VISIBLE | ||
viewBinding.upBtn.isSelected = true | ||
|
||
} | ||
else { | ||
viewBinding.subCardView.visibility=View.GONE | ||
viewBinding.upBtn.isSelected = false | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProxyWriteAdapter.DataViewHolder { | ||
val binding = ItemWriteBinding.inflate(LayoutInflater.from(parent.context), parent, false) | ||
return DataViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: DataViewHolder, position: Int) { | ||
holder.bind(dataList[position]) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return dataList.size | ||
} | ||
|
||
|
||
} |
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,9 @@ | ||
package com.nbit.Idear.home | ||
|
||
data class ProxyWriteData(val year:Int, | ||
val month:Int, | ||
val day:Int, | ||
val title:String, | ||
val content:String, | ||
val additionalContent:ArrayList<WriteSubData>?) | ||
//val phoneNumArray:ArrayList<WriteSubData>) |
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,34 @@ | ||
package com.nbit.Idear.home | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.nbit.Idear.databinding.ItemSubWriteBinding | ||
|
||
class SubAdapter(private val dataList:ArrayList<WriteSubData>): | ||
RecyclerView.Adapter<SubAdapter.DataViewHolder>(){ | ||
inner class DataViewHolder(private val viewBinding:ItemSubWriteBinding) :RecyclerView.ViewHolder(viewBinding.root){ | ||
|
||
fun bind(data:WriteSubData){ | ||
viewBinding.subContentText.text=data.subContent | ||
|
||
viewBinding.cardView.setOnClickListener { | ||
|
||
} | ||
} | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SubAdapter.DataViewHolder { | ||
val viewBinding = ItemSubWriteBinding.inflate(LayoutInflater.from(parent.context), parent, false) | ||
return DataViewHolder(viewBinding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: DataViewHolder, position: Int) { | ||
holder.bind(dataList[position]) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return dataList.size | ||
} | ||
|
||
} |
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,3 @@ | ||
package com.nbit.Idear.home | ||
|
||
data class WriteSubData (val subContent:String) |
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/nbit/Idear/mypage/AddProfileFragment.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,25 @@ | ||
package com.nbit.Idear.mypage | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.nbit.Idear.R | ||
import com.nbit.Idear.databinding.FragmentAddProfileBinding | ||
|
||
|
||
// 프로필 추가/수정 | ||
class AddProfileFragment : Fragment() { | ||
// ViewBinding Setting | ||
lateinit var binding: FragmentAddProfileBinding | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
// ViewBinding Setting | ||
binding = FragmentAddProfileBinding.inflate(layoutInflater) | ||
return binding.root | ||
} | ||
} |
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,20 @@ | ||
package com.nbit.Idear.mypage | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import com.nbit.Idear.R | ||
import com.nbit.Idear.databinding.ActivityMyPageBinding | ||
|
||
// 마이 페이지: 프로필 리스트 | ||
class MyPageActivity : AppCompatActivity() { | ||
// ViewBinding Setting | ||
lateinit var binding: ActivityMyPageBinding | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
// ViewBinding Setting | ||
binding = ActivityMyPageBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
} | ||
} |
Oops, something went wrong.