Skip to content

Commit

Permalink
Merge pull request #22 from NaJuDoRyeong/feature/#20-onboarding-detail
Browse files Browse the repository at this point in the history
Feature/#20 onboarding detail
  • Loading branch information
KDW03 authored Feb 12, 2023
2 parents 8d98cdb + 93a6405 commit 13fdb60
Show file tree
Hide file tree
Showing 74 changed files with 1,485 additions and 142 deletions.
17 changes: 0 additions & 17 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ android {
targetSdk 33
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -40,7 +39,7 @@ android {

dependencies {

api project(path: ':common-ui')

api project(path: ':story')
api project(path: ':home')
api project(path: ':setting')
Expand All @@ -50,8 +49,7 @@ dependencies {
// Hilt
implementation "com.google.dagger:hilt-android:$rootProject.hiltVersion"
kapt "com.google.dagger:hilt-android-compiler:$rootProject.hiltVersion"
kaptAndroidTest "com.google.dagger:hilt-android-compiler:$rootProject.hiltVersion"
androidTestImplementation "com.google.dagger:hilt-android-testing:$rootProject.hiltVersion"


implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
Expand All @@ -60,4 +58,8 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

kapt {
correctErrorTypes true
}
9 changes: 4 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET"/>

<application
android:name=".MineMeApplication"
android:allowBackup="true"
Expand All @@ -15,11 +17,8 @@
tools:targetApi="33">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
android:exported="false">

<meta-data
android:name="android.app.lib_name"
android:value="" />
Expand Down
31 changes: 7 additions & 24 deletions app/src/main/java/com/najudoryeong/mineme/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.najudoryeong.mineme
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.view.WindowManager
import androidx.activity.viewModels
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
Expand All @@ -14,9 +15,11 @@ import androidx.navigation.ui.NavigationUI
import androidx.navigation.ui.setupWithNavController
import com.najudoryeong.mineme.common_ui.MainActivityUtil
import com.najudoryeong.mineme.databinding.ActivityMainBinding
import dagger.hilt.android.AndroidEntryPoint


// 하위 모듈이 MainViewModel 코드에 접근할 수 있게 MainViewModelUtil 상속 구현
@AndroidEntryPoint
class MainActivity : AppCompatActivity(), MainActivityUtil {

private lateinit var binding: ActivityMainBinding
Expand All @@ -30,29 +33,10 @@ class MainActivity : AppCompatActivity(), MainActivityUtil {
binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
binding.viewModel = model


initAppBar()
initBottomNav()

setStartDestination(isLogin())

}


/**
* login 여부에 따른 startDestination 조작을 위해
* main graph를 가져와서 startDestination을 조작 후 변경내용을 적용한다.
* */

private fun setStartDestination(isLogin: Boolean) {
val navGraph = navController.navInflater.inflate(R.navigation.nav_main)
if (isLogin) navGraph.setStartDestination(R.id.nav_home)
else navGraph.setStartDestination(com.najudoryeong.mineme.onboarding.R.id.nav_onboarding)
navController.setGraph(navGraph, null)
}

// todo 로그인 체크 로직
private fun isLogin(): Boolean {
return true
}

private fun initBottomNav() {
Expand Down Expand Up @@ -89,15 +73,14 @@ class MainActivity : AppCompatActivity(), MainActivityUtil {
binding.topAppBar.visibility = View.VISIBLE
}




/** [MainActivityUtil] */
override fun setToolbarTitle(newTitle: String) {
binding.toolbar.title = newTitle
}

override fun navigateToHome(start: Fragment) {
start.findNavController().navigate(R.id.nav_home)
showAppBar()
}

override fun setVisibilityBottomAppbar(visibilityMode: Int) {
binding.bottomAppBar.visibility = visibilityMode
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/najudoryeong/mineme/MineMeApplication.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
package com.najudoryeong.mineme

import android.app.Application
import android.util.Log
import com.example.common.util.NATIVE_APP_KEY
import com.kakao.sdk.common.KakaoSdk
import com.kakao.sdk.common.util.Utility
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class MineMeApplication : Application() {
override fun onCreate() {
super.onCreate()
KakaoSdk.init(this, NATIVE_APP_KEY)
//printAppKeyHash()
}

private fun printAppKeyHash() {
val keyHash = Utility.getKeyHash(this)
Log.d("KeyHash", keyHash)
}
}
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
android:orientation="vertical">

<com.google.android.material.appbar.AppBarLayout

android:id="@+id/topAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -31,7 +32,7 @@
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_height="wrap_content"
app:titleCentered="true" />

</com.google.android.material.appbar.AppBarLayout>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/navigation/nav_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
android:id="@+id/nav_graph"
app:startDestination="@id/nav_home">
<include app:graph="@navigation/nav_home" />
<include app:graph="@navigation/nav_onboarding" />
<include app:graph="@navigation/nav_story" />
<include app:graph="@navigation/nav_setting" />
</navigation>
3 changes: 3 additions & 0 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Mineme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowTranslucentStatus">true</item>
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Mineme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="Theme.Mineme" parent="Theme.MaterialComponents.Light.NoActionBar">

<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
Expand All @@ -10,7 +11,8 @@
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">#00000000</item>
<!-- Customize your theme here. -->
</style>


</resources>
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@ buildscript {
google()
gradlePluginPortal()
mavenCentral()
maven { url 'https://devrepo.kakao.com/nexus/content/groups/public/'}
}

ext {
hiltVersion = '2.44'
nav_version = '2.5.3'
fragment_version = "1.5.5"
okHttpVersion = '4.10.0'
hiltVersion = '2.44'
kakao_version = '2.12.1'
dataStorePreferences_version = '1.0.0'
retrofit2Version = '2.9.0'

}

dependencies {
Expand All @@ -20,6 +27,7 @@ buildscript {
}

plugins {
id 'com.google.dagger.hilt.android' version '2.44' apply false
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
Expand Down
13 changes: 13 additions & 0 deletions common-ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'androidx.navigation.safeargs.kotlin'
id 'kotlin-kapt'
id 'com.google.dagger.hilt.android'
}

android {
Expand Down Expand Up @@ -50,6 +52,17 @@ dependencies {
api "androidx.fragment:fragment:$rootProject.fragment_version"
api "androidx.fragment:fragment-ktx:$rootProject.fragment_version"


// Hilt
implementation "com.google.dagger:hilt-android:$rootProject.hiltVersion"
kapt "com.google.dagger:hilt-android-compiler:$rootProject.hiltVersion"


// Glide
implementation 'com.github.bumptech.glide:glide:4.14.2'
kapt 'com.github.bumptech.glide:compiler:4.14.2'


implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.8.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.najudoryeong.mineme.common_ui

import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide


@BindingAdapter("photoUrl")
fun bindImageView(imageView: ImageView, photoUrl: String?) {
Glide.with(imageView.context)
.load(photoUrl)
.placeholder(R.drawable.img_profile)
.into(imageView)
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.najudoryeong.mineme.common_ui

import android.app.Dialog
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import com.najudoryeong.mineme.common_ui.databinding.DialogForPermissionBinding

class DialogForPermission(
context: Context,
private val message: String,
private val imgId: Int,
private val onClickButton: () -> Unit
) : Dialog(context){

private lateinit var binding: DialogForPermissionBinding


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DialogForPermissionBinding.inflate(layoutInflater).apply {
dialogTv.text = message
dialogIv.setImageResource(imgId)
dialogButton.setOnClickListener {
onClickButton.invoke()
dismiss()
}
}
setContentView(binding.root)

window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
}

class Builder(private val context: Context) {
private var message = ""
private var imgId = 0
private var onClickButton = {}

fun setMessage(message: String) = apply {
this.message = message
}

fun setImg(imgId: Int) = apply {
this.imgId = imgId
}

fun setOnClickButton(onClickButton: () -> Unit) = apply {
this.onClickButton = onClickButton
}

fun build() = DialogForPermission(
context,
message,
imgId,
onClickButton
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.fragment.app.Fragment

interface MainActivityUtil{
fun setToolbarTitle(newTitle: String)
fun navigateToHome(start : Fragment)
fun setVisibilityBottomAppbar(visibilityMode : Int)
fun setVisibilityTopAppBar(visibilityMode: Int)
}
Loading

0 comments on commit 13fdb60

Please sign in to comment.