Skip to content

Commit 3dc9bfe

Browse files
[화면추가] Navigation을 통한 기본 화면 추가
0 parents  commit 3dc9bfe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1246
-0
lines changed

.gitignore

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
*.apk
2+
*.ap_
3+
*.aab
4+
5+
*.dex
6+
7+
*.class
8+
9+
bin/
10+
gen/
11+
out/
12+
13+
.gradle
14+
.gradle/
15+
build/
16+
17+
.signing/
18+
19+
local.properties
20+
21+
proguard/
22+
23+
*.log
24+
25+
/*/build/
26+
/*/local.properties
27+
/*/out
28+
/*/*/build
29+
/*/*/production
30+
captures/
31+
.navigation/
32+
*.ipr
33+
*~
34+
*.swp
35+
36+
*.jks
37+
*.keystore
38+
39+
gen-external-apklibs
40+
41+
.externalNativeBuild
42+
43+
obj/
44+
45+
*.iml
46+
*.iws
47+
/out/
48+
49+
.idea/caches/
50+
.idea/libraries/
51+
.idea/shelf/
52+
.idea/workspace.xml
53+
.idea/tasks.xml
54+
.idea/.name
55+
.idea/compiler.xml
56+
.idea/copyright/profiles_settings.xml
57+
.idea/encodings.xml
58+
.idea/misc.xml
59+
.idea/modules.xml
60+
.idea/scopes/scope_settings.xml
61+
.idea/dictionaries
62+
.idea/vcs.xml
63+
.idea/jsLibraryMappings.xml
64+
.idea/datasources.xml
65+
.idea/dataSources.ids
66+
.idea/sqlDataSources.xml
67+
.idea/dynamic.xml
68+
.idea/uiDesigner.xml
69+
.idea/assetWizardSettings.xml
70+
.idea/gradle.xml
71+
.idea/jarRepositories.xml
72+
.idea/navEditor.xml
73+
74+
.classpath
75+
.project
76+
.cproject
77+
.settings/
78+
79+
.mtj.tmp/
80+
81+
*.war
82+
*.ear
83+
84+
hs_err_pid*
85+
86+
.idea_modules/
87+
88+
atlassian-ide-plugin.xml
89+
90+
.idea/mongoSettings.xml
91+
92+
com_crashlytics_export_strings.xml
93+
crashlytics.properties
94+
crashlytics-build.properties
95+
fabric.properties
96+
97+
!/gradle/wrapper/gradle-wrapper.jar

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
id 'androidx.navigation.safeargs.kotlin' // AAC Navigation
5+
id 'kotlin-parcelize'
6+
}
7+
8+
android {
9+
namespace 'com.gun.android_marvel_example'
10+
compileSdk 33
11+
12+
defaultConfig {
13+
applicationId "com.gun.android_marvel_example"
14+
minSdk 24
15+
targetSdk 33
16+
versionCode 1
17+
versionName "1.0"
18+
19+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
20+
}
21+
22+
buildTypes {
23+
release {
24+
minifyEnabled false
25+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
26+
}
27+
}
28+
compileOptions {
29+
sourceCompatibility JavaVersion.VERSION_1_8
30+
targetCompatibility JavaVersion.VERSION_1_8
31+
}
32+
kotlinOptions {
33+
jvmTarget = '1.8'
34+
}
35+
36+
dataBinding {
37+
enabled = true
38+
}
39+
}
40+
41+
dependencies {
42+
def nav_version = "2.5.3"
43+
44+
implementation 'androidx.core:core-ktx:1.7.0'
45+
implementation 'androidx.appcompat:appcompat:1.6.1'
46+
implementation 'com.google.android.material:material:1.8.0'
47+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
48+
testImplementation 'junit:junit:4.13.2'
49+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
50+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
51+
52+
// AAC Navigation
53+
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
54+
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
55+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.gun.android_marvel_example
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.gun.android_marvel_example", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:dataExtractionRules="@xml/data_extraction_rules"
8+
android:fullBackupContent="@xml/backup_rules"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:supportsRtl="true"
12+
android:theme="@style/Theme.Android_Marvel_Example"
13+
tools:targetApi="31">
14+
<activity
15+
android:name=".ui.main.MainActivity"
16+
android:exported="true">
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN" />
19+
20+
<category android:name="android.intent.category.LAUNCHER" />
21+
</intent-filter>
22+
</activity>
23+
</application>
24+
25+
</manifest>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.gun.android_marvel_example.data
2+
3+
import android.os.Parcelable
4+
import androidx.annotation.Keep
5+
import kotlinx.parcelize.Parcelize
6+
7+
@Keep
8+
@Parcelize
9+
data class TestData(val title: String): Parcelable
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package com.gun.android_marvel_example.ui.favorite
2+
3+
import android.os.Bundle
4+
import androidx.fragment.app.Fragment
5+
import android.view.LayoutInflater
6+
import android.view.View
7+
import android.view.ViewGroup
8+
import com.gun.android_marvel_example.R
9+
10+
// TODO: Rename parameter arguments, choose names that match
11+
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
12+
private const val ARG_PARAM1 = "param1"
13+
private const val ARG_PARAM2 = "param2"
14+
15+
/**
16+
* A simple [Fragment] subclass.
17+
* Use the [FavoriteFragment.newInstance] factory method to
18+
* create an instance of this fragment.
19+
*/
20+
class FavoriteFragment : Fragment() {
21+
// TODO: Rename and change types of parameters
22+
private var param1: String? = null
23+
private var param2: String? = null
24+
25+
override fun onCreate(savedInstanceState: Bundle?) {
26+
super.onCreate(savedInstanceState)
27+
arguments?.let {
28+
param1 = it.getString(ARG_PARAM1)
29+
param2 = it.getString(ARG_PARAM2)
30+
}
31+
}
32+
33+
override fun onCreateView(
34+
inflater: LayoutInflater, container: ViewGroup?,
35+
savedInstanceState: Bundle?
36+
): View? {
37+
// Inflate the layout for this fragment
38+
return inflater.inflate(R.layout.fragment_favorite, container, false)
39+
}
40+
41+
companion object {
42+
/**
43+
* Use this factory method to create a new instance of
44+
* this fragment using the provided parameters.
45+
*
46+
* @param param1 Parameter 1.
47+
* @param param2 Parameter 2.
48+
* @return A new instance of fragment FavoriteFragment.
49+
*/
50+
// TODO: Rename and change types and number of parameters
51+
@JvmStatic
52+
fun newInstance(param1: String, param2: String) =
53+
FavoriteFragment().apply {
54+
arguments = Bundle().apply {
55+
putString(ARG_PARAM1, param1)
56+
putString(ARG_PARAM2, param2)
57+
}
58+
}
59+
}
60+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.gun.android_marvel_example.ui.home
2+
3+
import android.os.Bundle
4+
import androidx.fragment.app.Fragment
5+
import android.view.LayoutInflater
6+
import android.view.View
7+
import android.view.ViewGroup
8+
import com.gun.android_marvel_example.R
9+
10+
class HomeFragment : Fragment() {
11+
override fun onCreate(savedInstanceState: Bundle?) {
12+
super.onCreate(savedInstanceState)
13+
}
14+
15+
override fun onCreateView(
16+
inflater: LayoutInflater, container: ViewGroup?,
17+
savedInstanceState: Bundle?
18+
): View? {
19+
return inflater.inflate(R.layout.fragment_home, container, false)
20+
}
21+
22+
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
23+
super.onViewCreated(view, savedInstanceState)
24+
}
25+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.gun.android_marvel_example.ui.main
2+
3+
import android.os.Bundle
4+
import androidx.appcompat.app.AppCompatActivity
5+
import androidx.databinding.DataBindingUtil
6+
import androidx.navigation.fragment.NavHostFragment
7+
import androidx.navigation.fragment.findNavController
8+
import androidx.navigation.ui.setupWithNavController
9+
import com.gun.android_marvel_example.R
10+
import com.gun.android_marvel_example.databinding.ActivityMainBinding
11+
12+
class MainActivity : AppCompatActivity() {
13+
private val binding by lazy<ActivityMainBinding> { DataBindingUtil.setContentView(this, R.layout.activity_main) }
14+
15+
override fun onCreate(savedInstanceState: Bundle?) {
16+
super.onCreate(savedInstanceState)
17+
binding.lifecycleOwner = this
18+
19+
val navHostFragment = supportFragmentManager.findFragmentById(binding.navHostFragment.id) as NavHostFragment
20+
val navController = navHostFragment.findNavController()
21+
22+
binding.bottomNavigation.setupWithNavController(navController)
23+
}
24+
}

0 commit comments

Comments
 (0)