Skip to content

Commit

Permalink
[BUD-56] feat : onboarding 부분 이미지 추가(#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
KDW03 committed Apr 11, 2023
1 parent ece1d9f commit edc5d71
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 286 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ enum class PermissionType(val permissionArray: Array<String>) {
)
),
CAMERA(arrayOf(Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE)),
NOTIFICATION(arrayOf(Manifest.permission.POST_NOTIFICATIONS))
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,22 @@ import dagger.hilt.android.AndroidEntryPoint
//todo companion?
private val messageArray = arrayOf(
"주위 동물병원 찾기 및 산책 지수 제공을 위한 GPS접근 동의가 필요해요.",
"진달을 위해서 갤러리 및 카메라 접근 동의가 필요해요." ,
"버디들의 진단 정보 나 상태 정보 제공을 위한 알림 권한 동의가 필요해요"
"진단을 위해서 갤러리 및 카메라 접근 동의가 필요해요."
)

private val imageArray = arrayOf(R.drawable.img_gps, R.drawable.img_gps, R.drawable.img_gps)



@AndroidEntryPoint
class OnBoardingViewPagerFragment : Fragment(), PermissionCallback {


companion object{
var viewpagerNum = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) 3 else 2
}


var viewpagerNum = 2
private var _binding: FragmentOnBoardingViewPagerBinding? = null
private val binding
get() = _binding!!
private val requestPermissionLauncher = PermissionObject.checkPermission(this, { onSuccess() }, { onFail() })
get() = _binding!!
private val requestPermissionLauncher =
PermissionObject.checkPermission(this, { onSuccess() }, { onFail() })


override fun onCreateView(
Expand Down Expand Up @@ -80,26 +75,28 @@ class OnBoardingViewPagerFragment : Fragment(), PermissionCallback {
}



private inner class OnBoardingViewPagerAdapter(fragment: Fragment) :
FragmentStateAdapter(fragment) {

override fun getItemCount(): Int = viewpagerNum
override fun createFragment(position: Int): Fragment {
return when (position) {
0 -> OnBoarding1Fragment.newInstance()
1 -> OnBoarding2Fragment.newInstance()
else -> OnBoarding3Fragment.newInstance()
0 -> {
binding.onboardingBack.setBackgroundResource(R.drawable.img_onboarding1)
OnBoarding1Fragment.newInstance()
}
else -> {
binding.onboardingBack.setBackgroundResource(R.drawable.img_onboarding2)
OnBoarding2Fragment.newInstance()
}
}
}


}

override fun onSuccess() {
if (binding.viewpager2.currentItem == viewpagerNum - 1) {
findNavController().navigate(R.id.next)
}else{
} else {
binding.viewpager2.currentItem++
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class SplashActivity : AppCompatActivity() {
splashViewModel.withJsonWebToken { JWT ->
if (JWT != null) {
Log.d("buddyTest","$JWT")
LoginUtil.startMainActivity(this, mainActivityClass)
initNav()

//LoginUtil.startMainActivity(this, mainActivityClass)
} else {
Log.d("buddyTest","JWT널")
initNav()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import javax.inject.Inject
import kotlin.math.log

@HiltViewModel
class SplashViewModel @Inject constructor(
Expand All @@ -29,15 +30,18 @@ class SplashViewModel @Inject constructor(
try {
val response = authUseCase.login(token)
dataStoreUseCase.editJsonWebToken(response.body()?.data?.jwt!!)
if (response.code() == 200) {
loginCallback.invoke()
} else {
createCallback.invoke()
}
Log.d("responsecode",response.code().toString())
// if (response.code() == 200) {
// loginCallback.invoke()
// } else if (response.code() == 201) {
// }
// else{
// Log.d("responsecode",response.code().toString())
// }
createCallback.invoke()
} catch (e: Exception) {
Log.d("buddyTest", e.message.toString())
}

}
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
200 changes: 0 additions & 200 deletions onboarding/src/main/res/drawable/img_onboarding2.xml

This file was deleted.

7 changes: 4 additions & 3 deletions onboarding/src/main/res/layout/fragment_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
android:text="BuddyVet"
android:textColor="@color/black"
android:textSize="24sp"
android:fontFamily="@font/cafe24_ssurround"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/app_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img_onboarding2"
android:layout_width="200dp"
android:layout_height="200dp"
app:layout_constraintBottom_toTopOf="@id/kakao_login_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:src="@drawable/img_dog"
app:layout_constraintTop_toBottomOf="@id/app_name" />

<com.google.android.material.button.MaterialButton
Expand Down
12 changes: 8 additions & 4 deletions onboarding/src/main/res/layout/fragment_on_boarding1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
tools:context=".ui.OnBoarding1Fragment">


<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_marginTop="16dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/cafe24_ssurround"
android:gravity="center"
android:text="1"
android:textSize="50sp" />
android:text="현재 시간의 산책 지수를\n 실시간으로 받아봐요"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="22sp" />


</FrameLayout>

Expand Down
14 changes: 7 additions & 7 deletions onboarding/src/main/res/layout/fragment_on_boarding2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">


<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.OnBoarding2Fragment">

<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_marginTop="16dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/cafe24_ssurround"
android:gravity="center"
android:text="2"
android:textSize="50sp" />

android:text="휴대폰 카메라로 간단하게\n 우리 아이의 안구 질환을 검사해요"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="22sp" />
</FrameLayout>

</layout>
23 changes: 0 additions & 23 deletions onboarding/src/main/res/layout/fragment_on_boarding3.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
xmlns:tools="http://schemas.android.com/tools">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/onboarding_back"
android:background="@drawable/img_onboarding1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.OnBoardingViewPagerFragment">
Expand Down

0 comments on commit edc5d71

Please sign in to comment.