Skip to content

Commit c5e9d16

Browse files
committed
Initial commit
0 parents  commit c5e9d16

Some content is hidden

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

53 files changed

+1151
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
}
5+
6+
android {
7+
compileSdk 32
8+
9+
defaultConfig {
10+
applicationId "com.junkfood.Seal"
11+
minSdk 24
12+
targetSdk 32
13+
versionCode 1
14+
versionName "1.0"
15+
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
compileOptions {
26+
sourceCompatibility JavaVersion.VERSION_1_8
27+
targetCompatibility JavaVersion.VERSION_1_8
28+
}
29+
kotlinOptions {
30+
jvmTarget = '1.8'
31+
}
32+
buildFeatures {
33+
viewBinding true
34+
}
35+
}
36+
37+
dependencies {
38+
39+
implementation 'androidx.core:core-ktx:1.7.0'
40+
implementation 'androidx.appcompat:appcompat:1.4.1'
41+
implementation 'com.google.android.material:material:1.5.0'
42+
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
43+
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
44+
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
45+
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
46+
implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
47+
testImplementation 'junit:junit:4.13.2'
48+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
49+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
50+
}

app/proguard-rules.pro

+21
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.junkfood.Seal
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.junkfood.Seal", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.junkfood.Seal">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/Theme.Seal">
12+
<activity
13+
android:name=".MainActivity"
14+
android:exported="true"
15+
android:label="@string/app_name">
16+
<intent-filter>
17+
<action android:name="android.intent.action.MAIN" />
18+
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
</application>
23+
24+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.junkfood.Seal
2+
3+
import android.os.Bundle
4+
import com.google.android.material.bottomnavigation.BottomNavigationView
5+
import androidx.appcompat.app.AppCompatActivity
6+
import androidx.navigation.findNavController
7+
import androidx.navigation.ui.AppBarConfiguration
8+
import androidx.navigation.ui.setupActionBarWithNavController
9+
import androidx.navigation.ui.setupWithNavController
10+
import com.junkfood.Seal.databinding.ActivityMainBinding
11+
12+
class MainActivity : AppCompatActivity() {
13+
14+
private lateinit var binding: ActivityMainBinding
15+
16+
override fun onCreate(savedInstanceState: Bundle?) {
17+
super.onCreate(savedInstanceState)
18+
19+
binding = ActivityMainBinding.inflate(layoutInflater)
20+
setContentView(binding.root)
21+
22+
val navView: BottomNavigationView = binding.navView
23+
24+
val navController = findNavController(R.id.nav_host_fragment_activity_main)
25+
// Passing each menu ID as a set of Ids because each
26+
// menu should be considered as top level destinations.
27+
val appBarConfiguration = AppBarConfiguration(
28+
setOf(
29+
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications
30+
)
31+
)
32+
setupActionBarWithNavController(navController, appBarConfiguration)
33+
navView.setupWithNavController(navController)
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.junkfood.Seal.ui.dashboard
2+
3+
import android.os.Bundle
4+
import android.view.LayoutInflater
5+
import android.view.View
6+
import android.view.ViewGroup
7+
import android.widget.TextView
8+
import androidx.fragment.app.Fragment
9+
import androidx.lifecycle.ViewModelProvider
10+
import com.junkfood.Seal.databinding.FragmentDashboardBinding
11+
12+
class DashboardFragment : Fragment() {
13+
14+
private var _binding: FragmentDashboardBinding? = null
15+
16+
// This property is only valid between onCreateView and
17+
// onDestroyView.
18+
private val binding get() = _binding!!
19+
20+
override fun onCreateView(
21+
inflater: LayoutInflater,
22+
container: ViewGroup?,
23+
savedInstanceState: Bundle?
24+
): View {
25+
val dashboardViewModel =
26+
ViewModelProvider(this).get(DashboardViewModel::class.java)
27+
28+
_binding = FragmentDashboardBinding.inflate(inflater, container, false)
29+
val root: View = binding.root
30+
31+
val textView: TextView = binding.textDashboard
32+
dashboardViewModel.text.observe(viewLifecycleOwner) {
33+
textView.text = it
34+
}
35+
return root
36+
}
37+
38+
override fun onDestroyView() {
39+
super.onDestroyView()
40+
_binding = null
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.junkfood.Seal.ui.dashboard
2+
3+
import androidx.lifecycle.LiveData
4+
import androidx.lifecycle.MutableLiveData
5+
import androidx.lifecycle.ViewModel
6+
7+
class DashboardViewModel : ViewModel() {
8+
9+
private val _text = MutableLiveData<String>().apply {
10+
value = "This is dashboard Fragment"
11+
}
12+
val text: LiveData<String> = _text
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.junkfood.Seal.ui.home
2+
3+
import android.os.Bundle
4+
import android.view.LayoutInflater
5+
import android.view.View
6+
import android.view.ViewGroup
7+
import android.widget.TextView
8+
import androidx.fragment.app.Fragment
9+
import androidx.lifecycle.ViewModelProvider
10+
import com.junkfood.Seal.databinding.FragmentHomeBinding
11+
12+
class HomeFragment : Fragment() {
13+
14+
private var _binding: FragmentHomeBinding? = null
15+
16+
// This property is only valid between onCreateView and
17+
// onDestroyView.
18+
private val binding get() = _binding!!
19+
20+
override fun onCreateView(
21+
inflater: LayoutInflater,
22+
container: ViewGroup?,
23+
savedInstanceState: Bundle?
24+
): View {
25+
val homeViewModel =
26+
ViewModelProvider(this).get(HomeViewModel::class.java)
27+
28+
_binding = FragmentHomeBinding.inflate(inflater, container, false)
29+
val root: View = binding.root
30+
31+
val textView: TextView = binding.textHome
32+
homeViewModel.text.observe(viewLifecycleOwner) {
33+
textView.text = it
34+
}
35+
return root
36+
}
37+
38+
override fun onDestroyView() {
39+
super.onDestroyView()
40+
_binding = null
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.junkfood.Seal.ui.home
2+
3+
import androidx.lifecycle.LiveData
4+
import androidx.lifecycle.MutableLiveData
5+
import androidx.lifecycle.ViewModel
6+
7+
class HomeViewModel : ViewModel() {
8+
9+
private val _text = MutableLiveData<String>().apply {
10+
value = "This is home Fragment"
11+
}
12+
val text: LiveData<String> = _text
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.junkfood.Seal.ui.notifications
2+
3+
import android.os.Bundle
4+
import android.view.LayoutInflater
5+
import android.view.View
6+
import android.view.ViewGroup
7+
import android.widget.TextView
8+
import androidx.fragment.app.Fragment
9+
import androidx.lifecycle.ViewModelProvider
10+
import com.junkfood.Seal.databinding.FragmentNotificationsBinding
11+
12+
class NotificationsFragment : Fragment() {
13+
14+
private var _binding: FragmentNotificationsBinding? = null
15+
16+
// This property is only valid between onCreateView and
17+
// onDestroyView.
18+
private val binding get() = _binding!!
19+
20+
override fun onCreateView(
21+
inflater: LayoutInflater,
22+
container: ViewGroup?,
23+
savedInstanceState: Bundle?
24+
): View {
25+
val notificationsViewModel =
26+
ViewModelProvider(this).get(NotificationsViewModel::class.java)
27+
28+
_binding = FragmentNotificationsBinding.inflate(inflater, container, false)
29+
val root: View = binding.root
30+
31+
val textView: TextView = binding.textNotifications
32+
notificationsViewModel.text.observe(viewLifecycleOwner) {
33+
textView.text = it
34+
}
35+
return root
36+
}
37+
38+
override fun onDestroyView() {
39+
super.onDestroyView()
40+
_binding = null
41+
}
42+
}

0 commit comments

Comments
 (0)