Skip to content

Commit

Permalink
Merge pull request #31 from ttoklip/feat/#15_첫화면로그인_구현
Browse files Browse the repository at this point in the history
Feat/#15 첫화면로그인 구현
  • Loading branch information
40food authored Feb 6, 2024
2 parents a86b51a + 243e0f2 commit 3ce6b84
Show file tree
Hide file tree
Showing 180 changed files with 8,396 additions and 3,179 deletions.
6 changes: 5 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ dependencies {
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.6'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.6'

//flexBox(flexLayout)
implementation 'com.google.android.flexbox:flexbox:3.0.0'

//naver map
//implementation "com.naver.maps:map-sdk:3.16.2"
implementation "com.naver.maps:map-sdk:3.17.0"
implementation "com.google.android.gms:play-services-location:21.1.0"
}
kapt {
correctErrorTypes true
Expand Down
58 changes: 53 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />


<application
android:name=".TtoklipApplication"
android:allowBackup="true"
android:usesCleartextTraffic="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/ic_logo"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_logo_round"
android:supportsRtl="true"
android:theme="@style/Theme.Ttoklip"
android:usesCleartextTraffic="true"
tools:targetApi="31">

<meta-data
android:name="com.naver.maps.map.CLIENT_ID"
android:value="a6zjlu88zi"/>

<activity
android:name=".presentation.mypage.ManageMyInfoActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".presentation.honeytip.read.ReadActivity"
Expand All @@ -38,25 +44,67 @@
android:exported="false" />
<activity
android:name=".presentation.mypage.SetAnnouncementActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".presentation.mypage.ManageUsageActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".presentation.mypage.MyHometownAddressActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".presentation.mypage.ManageAccountActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
android:exported="false" />
<activity
android:name=".presentation.MainActivity"
android:name=".presentation.mypage.NoticeSettingActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".presentation.mypage.CustomerServiceCenterActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".presentation.mypage.TermsPolicesActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".presentation.mypage.TransactionHistoryActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".presentation.mypage.SavedHoneyTipActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".presentation.mypage.MyHoneyTipActivity"
android:screenOrientation="portrait"
android:exported="false" />
<activity android:name=".presentation.intro.IntroActivity"
android:exported="false"/>
<activity android:name=".presentation.login.LoginActivity"
android:exported="false"/>
<activity android:name=".presentation.signup.SignupActivity"
android:exported="false"/>
<activity android:name=".presentation.signup.LocationActivity"
android:exported="false"/>
<activity android:name=".presentation.signup.DirectLocationActivity"
android:exported="false"/>

<activity
android:name=".presentation.intro.SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".presentation.MainActivity"
android:exported="false"/>

<service
android:name="com.google.android.gms.metadata.ModuleDependencies"
Expand Down
Binary file added app/src/main/ic_logo-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions app/src/main/java/com/umc/ttoklip/data/api/KakaoApi.kt
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 app/src/main/java/com/umc/ttoklip/data/model/KakaoResponse.kt
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
)
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/umc/ttoklip/di/NetworkModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object NetworkModule {
fun provideRetrofit(okHttpClient: OkHttpClient): Retrofit {
return Retrofit.Builder()
.client(okHttpClient)
.baseUrl(TtoklipApplication.getString(R.string.base_url))
.baseUrl("")
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.build()
Expand Down
30 changes: 30 additions & 0 deletions app/src/main/java/com/umc/ttoklip/di/appModul.kt
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)
}
}
}
}
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 = "질문해요"
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?) {

}

})
}
}
Loading

0 comments on commit 3ce6b84

Please sign in to comment.