-
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 #31 from ttoklip/feat/#15_첫화면로그인_구현
Feat/#15 첫화면로그인 구현
- Loading branch information
Showing
180 changed files
with
8,396 additions
and
3,179 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,16 @@ | ||
package com.umc.ttoklip.data.api | ||
|
||
import com.umc.ttoklip.R | ||
import com.umc.ttoklip.data.model.KakaoResponse | ||
import retrofit2.Call | ||
import retrofit2.http.GET | ||
import retrofit2.http.Header | ||
import retrofit2.http.Query | ||
|
||
interface KakaoApi { | ||
@GET("v2/local/search/keyword.json") | ||
fun getSearchKeyword( | ||
@Header("Authorization") key: String, | ||
@Query("query") query:String | ||
): Call<KakaoResponse.ResultSearchKeyword> | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/umc/ttoklip/data/model/KakaoResponse.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,15 @@ | ||
package com.umc.ttoklip.data.model | ||
|
||
class KakaoResponse{ | ||
data class ResultSearchKeyword( | ||
var documents: List<Place> // 검색 결과 | ||
) | ||
data class Place( | ||
var id: String, // 장소 ID | ||
var place_name: String, // 장소명, 업체명 | ||
var address_name: String, // 전체 지번 주소 | ||
var road_address_name: String, // 전체 도로명 주소 | ||
var x: String, // X 좌표값 혹은 longitude | ||
var y: String // Y 좌표값 혹은 latitude | ||
) | ||
} |
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,2 +1,32 @@ | ||
package com.umc.ttoklip.di | ||
|
||
import com.umc.ttoklip.R | ||
import com.umc.ttoklip.data.api.KakaoApi | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import retrofit2.Retrofit | ||
import retrofit2.converter.gson.GsonConverterFactory | ||
import retrofit2.create | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object appModul { | ||
class kakaoAddress { | ||
companion object { | ||
var BASE_URL = R.string.kakao.toString() | ||
var API_KEY = R.string.kakao_api_key.toString() | ||
} | ||
|
||
object kakaoApiRetrofitClient { | ||
private val retrofit: Retrofit.Builder by lazy { | ||
Retrofit.Builder() | ||
.baseUrl(BASE_URL) | ||
.addConverterFactory(GsonConverterFactory.create()) | ||
} | ||
val apiService: KakaoApi by lazy { | ||
retrofit.build().create(KakaoApi::class.java) | ||
} | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/umc/ttoklip/presentation/honeytip/HoneyTipConst.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,5 @@ | ||
package com.umc.ttoklip.presentation.honeytip | ||
|
||
const val BOARD = "board" | ||
const val HONEY_TIP = "꿀팁 공유" | ||
const val ASK = "질문해요" |
150 changes: 81 additions & 69 deletions
150
app/src/main/java/com/umc/ttoklip/presentation/honeytip/HoneyTipFragment.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 |
---|---|---|
@@ -1,70 +1,82 @@ | ||
package com.umc.ttoklip.presentation.honeytip | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.util.Log | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.core.content.ContextCompat.startActivity | ||
import androidx.fragment.app.Fragment | ||
import com.google.android.material.tabs.TabLayout | ||
import com.google.android.material.tabs.TabLayout.OnTabSelectedListener | ||
import com.google.android.material.tabs.TabLayoutMediator | ||
import com.umc.ttoklip.R | ||
import com.umc.ttoklip.databinding.FragmentHoneyTipBinding | ||
import com.umc.ttoklip.presentation.base.BaseFragment | ||
import com.umc.ttoklip.presentation.honeytip.adapter.HoneyTipAndQuestionVPA | ||
import com.umc.ttoklip.presentation.honeytip.write.WriteHoneyTipActivity | ||
|
||
|
||
class HoneyTipFragment: BaseFragment<FragmentHoneyTipBinding>(R.layout.fragment_honey_tip) { | ||
private var board = 0 | ||
override fun initObserver() { | ||
|
||
} | ||
|
||
override fun initView() { | ||
|
||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
initTabLayout() | ||
view | ||
binding.writeFab.setOnClickListener { | ||
val intent = Intent(activity, WriteHoneyTipActivity::class.java) | ||
intent.putExtra("caller", "writeFab") | ||
startActivity(intent) | ||
} | ||
} | ||
private fun initTabLayout(){ | ||
val tabTitles = listOf("꿀팁 공유", "질문해요") | ||
binding.boardVp.adapter = HoneyTipAndQuestionVPA(this) | ||
binding.boardVp.isUserInputEnabled = false | ||
|
||
TabLayoutMediator(binding.boardTablayout, binding.boardVp){ tab, position -> | ||
for (i in tabTitles.indices){ | ||
tab.text = tabTitles[position] | ||
} | ||
}.attach() | ||
binding.boardTablayout.addOnTabSelectedListener(object : OnTabSelectedListener{ | ||
override fun onTabSelected(tab: TabLayout.Tab?) { | ||
|
||
} | ||
|
||
override fun onTabUnselected(tab: TabLayout.Tab?) { | ||
|
||
} | ||
|
||
override fun onTabReselected(tab: TabLayout.Tab?) { | ||
|
||
} | ||
|
||
}) | ||
} | ||
fun updateBoard(){ | ||
board = binding.boardTablayout.selectedTabPosition | ||
Log.d("board", board.toString()) | ||
} | ||
package com.umc.ttoklip.presentation.honeytip | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.util.Log | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.core.content.ContextCompat.startActivity | ||
import androidx.fragment.app.Fragment | ||
import androidx.fragment.app.activityViewModels | ||
import androidx.fragment.app.viewModels | ||
import androidx.lifecycle.ViewModelProvider | ||
import androidx.lifecycle.get | ||
import com.google.android.material.tabs.TabLayout | ||
import com.google.android.material.tabs.TabLayout.OnTabSelectedListener | ||
import com.google.android.material.tabs.TabLayoutMediator | ||
import com.umc.ttoklip.R | ||
import com.umc.ttoklip.databinding.FragmentHoneyTipBinding | ||
import com.umc.ttoklip.presentation.alarm.AlarmActivity | ||
import com.umc.ttoklip.presentation.base.BaseFragment | ||
import com.umc.ttoklip.presentation.honeytip.adapter.HoneyTipAndQuestionVPA | ||
import com.umc.ttoklip.presentation.honeytip.write.WriteHoneyTipActivity | ||
import com.umc.ttoklip.presentation.search.SearchActivity | ||
|
||
|
||
class HoneyTipFragment: BaseFragment<FragmentHoneyTipBinding>(R.layout.fragment_honey_tip) { | ||
private var board = "꿀팁 공유" | ||
private val viewModel: HoneyTipViewModel by activityViewModels() | ||
|
||
override fun initObserver() { | ||
|
||
} | ||
|
||
override fun initView() { | ||
initTabLayout() | ||
binding.writeFab.setOnClickListener { | ||
val intent = Intent(activity, WriteHoneyTipActivity::class.java) | ||
board = viewModel.boardLiveData.value ?: "" | ||
intent.putExtra(BOARD, board) | ||
Log.d("GoWriteHoneyTip", board) | ||
startActivity(intent) | ||
} | ||
|
||
binding.searchBtn.setOnClickListener { | ||
startActivity(SearchActivity.newIntent(requireContext())) | ||
} | ||
|
||
binding.alarmBtn.setOnClickListener { | ||
startActivity(AlarmActivity.newIntent(requireContext())) | ||
} | ||
} | ||
|
||
private fun initTabLayout(){ | ||
val tabTitles = listOf("꿀팁 공유", "질문해요") | ||
binding.boardVp.adapter = HoneyTipAndQuestionVPA(this) | ||
binding.boardVp.isUserInputEnabled = false | ||
Log.d("position", binding.boardTablayout.selectedTabPosition.toString()) | ||
|
||
TabLayoutMediator(binding.boardTablayout, binding.boardVp){ tab, position -> | ||
for (i in tabTitles.indices){ | ||
tab.text = tabTitles[position] | ||
} | ||
}.attach() | ||
binding.boardTablayout.addOnTabSelectedListener(object : OnTabSelectedListener{ | ||
override fun onTabSelected(tab: TabLayout.Tab?) { | ||
board = tab?.text.toString() | ||
viewModel.setBoardLiveData(board) | ||
Log.d("HoneyTipFragment", board) | ||
} | ||
|
||
override fun onTabUnselected(tab: TabLayout.Tab?) { | ||
|
||
} | ||
|
||
override fun onTabReselected(tab: TabLayout.Tab?) { | ||
|
||
} | ||
|
||
}) | ||
} | ||
} |
Oops, something went wrong.