Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ElBuenoPeso
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Matis SPINELLI
ElBuenoPeso
Commits
6c2fff6d
Commit
6c2fff6d
authored
Feb 16, 2024
by
m-spi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
J'ai fini ma journée ciao
parent
a90963cf
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
156 additions
and
71 deletions
+156
-71
MainActivity.kt
app/src/main/java/com/example/elbuenopeso/MainActivity.kt
+1
-1
AddFragment.kt
...c/main/java/com/example/elbuenopeso/ui/add/AddFragment.kt
+78
-0
AddViewModel.kt
.../main/java/com/example/elbuenopeso/ui/add/AddViewModel.kt
+2
-2
NotificationsFragment.kt
...ple/elbuenopeso/ui/notifications/NotificationsFragment.kt
+0
-42
fragment_add.xml
app/src/main/res/layout/fragment_add.xml
+68
-0
fragment_notifications.xml
app/src/main/res/layout/fragment_notifications.xml
+0
-22
bottom_nav_menu.xml
app/src/main/res/menu/bottom_nav_menu.xml
+1
-1
mobile_navigation.xml
app/src/main/res/navigation/mobile_navigation.xml
+3
-3
strings.xml
app/src/main/res/values/strings.xml
+3
-0
No files found.
app/src/main/java/com/example/elbuenopeso/MainActivity.kt
View file @
6c2fff6d
...
@@ -26,7 +26,7 @@ class MainActivity : AppCompatActivity() {
...
@@ -26,7 +26,7 @@ class MainActivity : AppCompatActivity() {
// menu should be considered as top level destinations.
// menu should be considered as top level destinations.
val
appBarConfiguration
=
AppBarConfiguration
(
val
appBarConfiguration
=
AppBarConfiguration
(
setOf
(
setOf
(
R
.
id
.
navigation_home
,
R
.
id
.
navigation_dashboard
,
R
.
id
.
navigation_
notifications
R
.
id
.
navigation_home
,
R
.
id
.
navigation_dashboard
,
R
.
id
.
navigation_
add
)
)
)
)
setupActionBarWithNavController
(
navController
,
appBarConfiguration
)
setupActionBarWithNavController
(
navController
,
appBarConfiguration
)
...
...
app/src/main/java/com/example/elbuenopeso/ui/add/AddFragment.kt
0 → 100644
View file @
6c2fff6d
package
com.example.elbuenopeso.ui.add
import
android.app.Activity
import
android.content.Intent
import
android.graphics.Bitmap
import
android.net.Uri
import
android.os.Bundle
import
android.provider.MediaStore
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.Button
import
android.widget.ImageView
import
androidx.activity.result.ActivityResult
import
androidx.activity.result.ActivityResultCallback
import
androidx.activity.result.ActivityResultLauncher
import
androidx.activity.result.contract.ActivityResultContracts
import
androidx.activity.result.registerForActivityResult
import
androidx.fragment.app.Fragment
import
androidx.lifecycle.ViewModelProvider
import
com.example.elbuenopeso.databinding.FragmentAddBinding
class
AddFragment
:
Fragment
()
{
private
var
_binding
:
FragmentAddBinding
?
=
null
// This property is only valid between onCreateView and
// onDestroyView.
private
val
binding
get
()
=
_binding
!!
var
camera_open_id
:
Button
?
=
null
var
gallery_open_id
:
Button
?
=
null
var
click_image_id
:
ImageView
?
=
null
private
val
galleryActivityResultLauncher
:
ActivityResultLauncher
<
Intent
>
=
registerForActivityResult
(
ActivityResultContracts
.
StartActivityForResult
(),
ActivityResultCallback
{
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?
)
{
if
(
resultCode
==
Activity
.
RESULT_OK
)
{
val
image
=
data
?.
data
as
Uri
click_image_id
!!
.
setImageURI
(
image
)
}
}
}
)
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
{
val
notificationsViewModel
=
ViewModelProvider
(
this
).
get
(
AddViewModel
::
class
.
java
)
_binding
=
FragmentAddBinding
.
inflate
(
inflater
,
container
,
false
)
val
root
:
View
=
binding
.
root
binding
.
image
.
setOnClickListener
{
val
gallery
=
Intent
(
Intent
.
ACTION_PICK
,
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
)
galleryActivityResultLauncher
.
launch
(
gallery
)
}
// val textView: TextView = binding.textNotifications
// notificationsViewModel.text.observe(viewLifecycleOwner) {
// textView.text = it
// }
return
root
}
override
fun
onDestroyView
()
{
super
.
onDestroyView
()
_binding
=
null
}
}
\ No newline at end of file
app/src/main/java/com/example/elbuenopeso/ui/
notifications/Notifications
ViewModel.kt
→
app/src/main/java/com/example/elbuenopeso/ui/
add/Add
ViewModel.kt
View file @
6c2fff6d
package
com.example.elbuenopeso.ui.
notifications
package
com.example.elbuenopeso.ui.
add
import
androidx.lifecycle.LiveData
import
androidx.lifecycle.LiveData
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.ViewModel
class
Notifications
ViewModel
:
ViewModel
()
{
class
Add
ViewModel
:
ViewModel
()
{
private
val
_text
=
MutableLiveData
<
String
>().
apply
{
private
val
_text
=
MutableLiveData
<
String
>().
apply
{
value
=
"This is notifications Fragment"
value
=
"This is notifications Fragment"
...
...
app/src/main/java/com/example/elbuenopeso/ui/notifications/NotificationsFragment.kt
deleted
100644 → 0
View file @
a90963cf
package
com.example.elbuenopeso.ui.notifications
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
androidx.fragment.app.Fragment
import
androidx.lifecycle.ViewModelProvider
import
com.example.elbuenopeso.databinding.FragmentNotificationsBinding
class
NotificationsFragment
:
Fragment
()
{
private
var
_binding
:
FragmentNotificationsBinding
?
=
null
// This property is only valid between onCreateView and
// onDestroyView.
private
val
binding
get
()
=
_binding
!!
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
{
val
notificationsViewModel
=
ViewModelProvider
(
this
).
get
(
NotificationsViewModel
::
class
.
java
)
_binding
=
FragmentNotificationsBinding
.
inflate
(
inflater
,
container
,
false
)
val
root
:
View
=
binding
.
root
val
textView
:
TextView
=
binding
.
textNotifications
notificationsViewModel
.
text
.
observe
(
viewLifecycleOwner
)
{
textView
.
text
=
it
}
return
root
}
override
fun
onDestroyView
()
{
super
.
onDestroyView
()
_binding
=
null
}
}
\ No newline at end of file
app/src/main/res/layout/fragment_add.xml
0 → 100644
View file @
6c2fff6d
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.add.AddFragment"
>
<ImageView
android:id=
"@+id/image"
android:layout_width=
"334dp"
android:layout_height=
"334dp"
android:layout_marginTop=
"50dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@android:drawable/ic_menu_report_image"
android:contentDescription=
"@string/todo"
/>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/titleLayout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"20dp"
android:layout_marginVertical=
"20dp"
android:hint=
"Title"
android:textColorHint=
"#6E6E6E"
app:layout_constraintTop_toBottomOf=
"@+id/image"
tools:layout_editor_absoluteX=
"20dp"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingHorizontal=
"36dp"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/addressLayout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"20dp"
android:layout_marginVertical=
"10dp"
android:hint=
"@string/address"
android:textColorHint=
"#6E6E6E"
app:layout_constraintTop_toBottomOf=
"@+id/titleLayout"
tools:layout_editor_absoluteX=
"20dp"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/address"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingHorizontal=
"36dp"
/>
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id=
"@+id/button"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/send"
android:textSize=
"20sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/addressLayout"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/fragment_notifications.xml
deleted
100644 → 0
View file @
a90963cf
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.notifications.NotificationsFragment"
>
<TextView
android:id=
"@+id/text_notifications"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:layout_marginTop=
"8dp"
android:layout_marginEnd=
"8dp"
android:textAlignment=
"center"
android:textSize=
"20sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/menu/bottom_nav_menu.xml
View file @
6c2fff6d
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
android:title=
"Market"
/>
android:title=
"Market"
/>
<item
<item
android:id=
"@+id/navigation_
notifications
"
android:id=
"@+id/navigation_
add
"
android:icon=
"@drawable/baseline_add_24"
android:icon=
"@drawable/baseline_add_24"
android:title=
"Add"
/>
android:title=
"Add"
/>
...
...
app/src/main/res/navigation/mobile_navigation.xml
View file @
6c2fff6d
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
tools:layout=
"@layout/fragment_dashboard"
/>
tools:layout=
"@layout/fragment_dashboard"
/>
<fragment
<fragment
android:id=
"@+id/navigation_
notifications
"
android:id=
"@+id/navigation_
add
"
android:name=
"com.example.elbuenopeso.ui.
notifications.Notifications
Fragment"
android:name=
"com.example.elbuenopeso.ui.
add.Add
Fragment"
android:label=
"@string/title_notifications"
android:label=
"@string/title_notifications"
tools:layout=
"@layout/fragment_
notifications
"
/>
tools:layout=
"@layout/fragment_
add
"
/>
</navigation>
</navigation>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
6c2fff6d
...
@@ -3,4 +3,7 @@
...
@@ -3,4 +3,7 @@
<string
name=
"title_home"
>
Home
</string>
<string
name=
"title_home"
>
Home
</string>
<string
name=
"title_dashboard"
>
Dashboard
</string>
<string
name=
"title_dashboard"
>
Dashboard
</string>
<string
name=
"title_notifications"
>
Notifications
</string>
<string
name=
"title_notifications"
>
Notifications
</string>
<string
name=
"todo"
>
TODO
</string>
<string
name=
"address"
>
Address
</string>
<string
name=
"send"
>
Send
</string>
</resources>
</resources>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment