diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 659bf43..fb7f4a8 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
new file mode 100644
index 0000000..e42c194
--- /dev/null
+++ b/.idea/deploymentTargetDropDown.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 625b371..7b46144 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -7,14 +7,13 @@
-
+
-
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 4fba2c3..03f6fbf 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,6 +3,17 @@
-
+
diff --git a/app/build.gradle b/app/build.gradle
index d47eacf..643a3d6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,8 +1,8 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
-
id 'com.google.gms.google-services'
+ id 'kotlin-android-extensions'
}
android {
@@ -34,24 +34,33 @@ android {
buildFeatures {
viewBinding true
}
+ buildToolsVersion '30.0.3'
}
dependencies {
- implementation 'androidx.core:core-ktx:1.7.0'
- implementation 'androidx.appcompat:appcompat:1.4.0'
- implementation 'com.google.android.material:material:1.4.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
- implementation 'androidx.annotation:annotation:1.3.0'
- implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
- implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
- implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
- implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
- testImplementation 'junit:junit:4.+'
+ implementation 'androidx.core:core-ktx:1.8.0'
+ implementation 'androidx.appcompat:appcompat:1.4.2'
+ implementation 'com.google.android.material:material:1.6.1'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+ implementation 'androidx.annotation:annotation:1.4.0'
+ implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
+ implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
+ implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
+ implementation 'androidx.navigation:navigation-ui-ktx:2.4.2'
+ implementation 'com.google.firebase:firebase-firestore:24.2.0'
+ implementation 'com.google.android.material:material:1.6.1'
+ implementation 'com.google.firebase:firebase-database:20.0.5'
+ implementation 'com.google.firebase:firebase-auth-ktx:21.0.6'
+ implementation 'com.google.firebase:firebase-functions-ktx:20.1.0'
+ implementation 'com.google.firebase:firebase-database-ktx:20.0.5'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'androidx.cardview:cardview:1.0.0'
+ testImplementation 'junit:junit:'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
- implementation platform('com.google.firebase:firebase-bom:29.1.0')
+ implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-auth-ktx' //авторизация
implementation 'com.google.firebase:firebase-firestore-ktx' //база данных
diff --git a/app/google-services.json b/app/google-services.json
index ed1fc56..ac5cdce 100644
--- a/app/google-services.json
+++ b/app/google-services.json
@@ -1,41 +1,33 @@
{
"project_info": {
- "project_number": "616512963878",
- "project_id": "needit-d5458",
- "storage_bucket": "needit-d5458.appspot.com"
+ "project_number": "795793707622",
+ "project_id": "needitdatabase",
+ "storage_bucket": "needitdatabase.appspot.com"
},
"client": [
{
"client_info": {
- "mobilesdk_app_id": "1:616512963878:android:77990f2f50bf9860616de7",
+ "mobilesdk_app_id": "1:795793707622:android:7e2e8c39717f12f41493a7",
"android_client_info": {
"package_name": "com.example.needit"
}
},
"oauth_client": [
{
- "client_id": "616512963878-nccs5llrdekuphj9ppelb7nm23lennsu.apps.googleusercontent.com",
- "client_type": 1,
- "android_info": {
- "package_name": "com.example.needit",
- "certificate_hash": "29283c9cdaef3f327e3a28f8cdb15bed876e6ddc"
- }
- },
- {
- "client_id": "616512963878-bu9fga62pcao7npqgokigjpsm96brla9.apps.googleusercontent.com",
+ "client_id": "795793707622-8ohbiprm058j4mskthgg5p6clmmh54u1.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
- "current_key": "AIzaSyBZNktC30xrxQ8FYJgYM2vyJRC6VfS2dd0"
+ "current_key": "AIzaSyD8t70MlvibD4bk5Qa6IsxiKmtYGX-V0kU"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
- "client_id": "616512963878-bu9fga62pcao7npqgokigjpsm96brla9.apps.googleusercontent.com",
+ "client_id": "795793707622-8ohbiprm058j4mskthgg5p6clmmh54u1.apps.googleusercontent.com",
"client_type": 3
}
]
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d30b684..b5b1658 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -9,8 +9,6 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.NeedIt">
-
-
@@ -24,6 +22,9 @@
+
\ No newline at end of file
diff --git a/app/src/main/java/com/example/needit/activityes/Navigation_Activity.kt b/app/src/main/java/com/example/needit/activityes/Navigation_Activity.kt
index fe065a5..638f984 100644
--- a/app/src/main/java/com/example/needit/activityes/Navigation_Activity.kt
+++ b/app/src/main/java/com/example/needit/activityes/Navigation_Activity.kt
@@ -1,37 +1,39 @@
package com.example.needit.activityes
import android.os.Bundle
-import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.appcompat.app.AppCompatActivity
-import androidx.navigation.findNavController
-import androidx.navigation.ui.AppBarConfiguration
-import androidx.navigation.ui.setupActionBarWithNavController
-import androidx.navigation.ui.setupWithNavController
+import androidx.fragment.app.Fragment
import com.example.needit.R
+import com.example.needit.activityes.ui.dashboard.DashboardFragment
+import com.example.needit.activityes.ui.notifications.NotificationsFragment
import com.example.needit.databinding.ActivityNavigationBinding
+import kotlinx.android.synthetic.main.activity_navigation.*
class Navigation_Activity : AppCompatActivity() {
- private lateinit var binding: ActivityNavigationBinding
+ private val dashboardFragment = DashboardFragment()
+ private val notificationsFragment = NotificationsFragment()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_navigation)
+ replaceFragment(dashboardFragment)
+
+ nav_view.setOnNavigationItemSelectedListener {
+ when(it.itemId) {
+ R.id.navigation_dashboard -> replaceFragment(dashboardFragment)
+ R.id.navigation_notifications -> replaceFragment(notificationsFragment)
+ }
+ true
+ }
+ }
- binding = ActivityNavigationBinding.inflate(layoutInflater)
- setContentView(binding.root)
-
- val navView: BottomNavigationView = binding.navView
-
- val navController = findNavController(R.id.nav_host_fragment_activity_navigation)
- // Passing each menu ID as a set of Ids because each
- // menu should be considered as top level destinations.
- val appBarConfiguration = AppBarConfiguration(
- setOf(
- R.id.navigation_notifications , R.id.navigation_dashboard //, R.id.navigation_home
- )
- )
- setupActionBarWithNavController(navController, appBarConfiguration)
- navView.setupWithNavController(navController)
+ private fun replaceFragment(fragment: Fragment) {
+ if(fragment !=null) {
+ val transition = supportFragmentManager.beginTransaction()
+ transition.replace(R.id.nav_host_fragment_activity_navigation, fragment)
+ transition.commit()
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/needit/activityes/ui/dashboard/DashAdapter.kt b/app/src/main/java/com/example/needit/activityes/ui/dashboard/DashAdapter.kt
index 09e8f29..d3f0555 100644
--- a/app/src/main/java/com/example/needit/activityes/ui/dashboard/DashAdapter.kt
+++ b/app/src/main/java/com/example/needit/activityes/ui/dashboard/DashAdapter.kt
@@ -1,41 +1,60 @@
package com.example.needit.activityes.ui.dashboard
+import android.service.autofill.OnClickAction
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.Toast
import androidx.recyclerview.widget.RecyclerView
import com.example.needit.R
import com.example.needit.databinding.RecyclerViewItemBinding
+import kotlinx.android.synthetic.main.recycler_view_item.view.*
//Stegancev
-class DashAdapter:RecyclerView.Adapter() {
- val requestList=ArrayList()
- class DashHolder(item:View):RecyclerView.ViewHolder(item){
- val binding=RecyclerViewItemBinding.bind(item)
- fun bind(personRequest: PersonRequest) = with(binding){
- textView1.text=personRequest.Name
- textView2.text=personRequest.Description
- ImageVievTest.setImageResource(R.drawable.ic_baseline_settings_applications_24)
- Contacts.text="+7999999999"
+class DashAdapter(private val onClickLis: onClickLis) :
+ RecyclerView.Adapter() {
+ val requestList = ArrayList()
- }
- }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DashHolder {
-val view= LayoutInflater.from(parent.context).inflate(R.layout.recycler_view_item,parent,false)
+ val view =
+ LayoutInflater.from(parent.context).inflate(R.layout.recycler_view_item, parent, false)
return DashHolder(view)
}
override fun onBindViewHolder(holder: DashHolder, position: Int) {
- holder.bind(requestList[position],)
+
+ holder.bind(requestList[position])
+ holder.itemView.button.setOnClickListener {
+ holder.itemView.helpIcon.visibility= View.VISIBLE
+ }
+ holder.itemView.setOnClickListener {
+ onClickLis.onClikeded(position)
+ }
+
}
override fun getItemCount(): Int {
- return requestList.size
+ return requestList.size
}
- fun addReq(personRequest: PersonRequest){
+
+
+ fun addReq(personRequest: PersonRequest) {
requestList.add(personRequest)
notifyDataSetChanged()
}
+
+
+ class DashHolder(item: View) : RecyclerView.ViewHolder(item) {
+ val binding = RecyclerViewItemBinding.bind(item)
+ fun bind(personRequest: PersonRequest) = with(binding) {
+ textView1.text = personRequest.name
+ textView2.text = personRequest.description
+ ImageVievTest.setImageResource(R.drawable.ic_baseline_settings_applications_24)
+ Contacts.text = "+7999999999"
+
+
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/needit/activityes/ui/dashboard/DashboardFragment.kt b/app/src/main/java/com/example/needit/activityes/ui/dashboard/DashboardFragment.kt
index 0074b38..58b3fe3 100644
--- a/app/src/main/java/com/example/needit/activityes/ui/dashboard/DashboardFragment.kt
+++ b/app/src/main/java/com/example/needit/activityes/ui/dashboard/DashboardFragment.kt
@@ -1,111 +1,82 @@
package com.example.needit.activityes.ui.dashboard
+import android.app.ProgressDialog
+import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import android.widget.HorizontalScrollView
-import android.widget.TextView
+import android.widget.ArrayAdapter
import androidx.fragment.app.Fragment
-import androidx.lifecycle.Observer
-import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
-import com.example.needit.databinding.FragmentDashboardBinding
-import com.example.needit.firebase.firestore.PostFirestore
-import com.example.needit.firebase.models.Post
-import kotlinx.coroutines.withContext
+import androidx.recyclerview.widget.RecyclerView
+import com.example.needit.R
+import com.google.firebase.firestore.FirebaseFirestore
+import kotlinx.android.synthetic.main.fragment_dashboard.*
+import kotlinx.coroutines.NonDisposableHandle.parent
import java.util.*
+import kotlin.collections.ArrayList
//Stegancev
class DashboardFragment : Fragment() {
- private lateinit var dashboardViewModel: DashboardViewModel
- private var _binding: FragmentDashboardBinding? = null
+ private lateinit var personaList : ArrayList
+ private lateinit var personAdapter: DashAdapter
+ private var check = false
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ init()
+ val type_of_stuff = arrayOf("Электроника", "Мебель", "Одежда", "Обувь", "Игрушки", "Книги")
+ val arrayAdapter = context?.let { ArrayAdapter(it, android.R.layout.simple_spinner_dropdown_item, type_of_stuff) }
+ spinner2.adapter = arrayAdapter
+ }
- // This property is only valid between onCreateView and
- // onDestroyView.
- private val binding get() = _binding!!
- private val adapter=DashAdapter()
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
- dashboardViewModel =
- ViewModelProvider(this).get(DashboardViewModel::class.java)
-
- _binding = FragmentDashboardBinding.inflate(inflater, container, false)
- val root: View = binding.root
-
- val textView: TextView = binding.textDashboard
- dashboardViewModel.text.observe(viewLifecycleOwner, Observer {
- textView.text = it
- })
-
- init1()
- init()
- init()
- init()
- init()
- init()
- init()
- init()
- init()
- init()
- init()
- init()
- return root
+ return inflater.inflate(R.layout.fragment_dashboard, container, false)
}
- private fun init()= with(binding) {
- RecycledVievDash.layoutManager= LinearLayoutManager(activity)
- RecycledVievDash.adapter=adapter
+ private fun init() {
+ recycledVievDash.layoutManager = LinearLayoutManager(context)
+ var progressDialog = ProgressDialog(context) // Окно загрузки данных при ожидании
try {
- val postFire: PostFirestore = PostFirestore()
- val post: Post =
- Post(
- "",
- "",
- "",
- "",
- "",
- post_type = Post.PostType.GIVE_AWAY,
- object_type = Post.ObjectType.LEISURE_GOODS,
- "",
- "",
- Date()
- )
- } catch (e:NoSuchElementException){null}
- val personRequest=PersonRequest(1,"Yasha","Lava","I need new boots 43 size","Need","Pushkin street Kolotushkin House")
- adapter.addReq(personRequest)
+ progressDialog.setCanceledOnTouchOutside(false)
+ progressDialog.setMessage("Загружаем данные...")
+ progressDialog.show() // Показываем окно загрузки
+ val db = FirebaseFirestore.getInstance() // Подключение к БД
+ db.collection("Stuff") // Просматриваем все элементы коллекции
+ .get()
+ .addOnSuccessListener {
+ result ->
+ personaList = ArrayList()
+ for (document in result) {
+ personaList.add(
+ PersonRequest( // Из БД инициализируем список объектов PersonalRequest
+ document["imageID"].toString().toInt(),
+ document["name"].toString(),
+ document["surname"].toString(),
+ document["description"].toString(),
+ document["typeReq"].toString(),
+ document["address"].toString()
+ )
+ )
+ }
+ progressDialog.dismiss() // Убираем окно загрузки
+ personAdapter = context?.let { DashAdapter(it, personaList) }!!
+ recycledVievDash.adapter = personAdapter
+ check = true
+ }
- }
- private fun init1()= with(binding) {
+ } catch (e:NoSuchElementException){ null }
+ }
- RecycledVievDash.layoutManager= LinearLayoutManager(activity)
- RecycledVievDash.adapter=adapter
- try {
- val postFire: PostFirestore = PostFirestore()
- val post: Post =
- Post(
- "",
- "",
- "",
- "",
- "",
- post_type = Post.PostType.GIVE_AWAY,
- object_type = Post.ObjectType.LEISURE_GOODS,
- "",
- "",
- Date()
- )
- } catch (e:NoSuchElementException){null}
- val personRequest=PersonRequest(0,"Alex","Tumbaev","I need a wooden box","Need","Pushkin street Kolotushkin House")
- adapter.addReq(personRequest)
+ companion object {
- }
- override fun onDestroyView() {
- super.onDestroyView()
- _binding = null
+ @JvmStatic
+ fun newInstance() = DashboardFragment()
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/needit/activityes/ui/dashboard/DetailDashActivity.kt b/app/src/main/java/com/example/needit/activityes/ui/dashboard/DetailDashActivity.kt
new file mode 100644
index 0000000..9c591d4
--- /dev/null
+++ b/app/src/main/java/com/example/needit/activityes/ui/dashboard/DetailDashActivity.kt
@@ -0,0 +1,20 @@
+package com.example.needit.activityes.ui.dashboard
+
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import com.example.needit.R
+import kotlinx.android.synthetic.main.activity_detail_dash.*
+
+class DetailDashActivity : AppCompatActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_detail_dash)
+
+ val person = intent
+ if(person != null) {
+ stuff_title.text = person.getStringExtra("name")
+ stuff_description.text = person.getStringExtra("description")
+ stuff_address.text = person.getStringExtra("address")
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/needit/activityes/ui/dashboard/PersonRequest.kt b/app/src/main/java/com/example/needit/activityes/ui/dashboard/PersonRequest.kt
index 23e6d96..1b4a358 100644
--- a/app/src/main/java/com/example/needit/activityes/ui/dashboard/PersonRequest.kt
+++ b/app/src/main/java/com/example/needit/activityes/ui/dashboard/PersonRequest.kt
@@ -1,4 +1,4 @@
package com.example.needit.activityes.ui.dashboard
-data class PersonRequest(val ImageId:Int, val Name:String,val Surname:String,val Description:String,val typeReq:String, val adress:String)
+data class PersonRequest(val imageID:Int, val name:String, val surname:String, val description:String, val typeReq:String, val address:String)
//Stegancev
\ No newline at end of file
diff --git a/app/src/main/java/com/example/needit/activityes/ui/dashboard/onClickLis.kt b/app/src/main/java/com/example/needit/activityes/ui/dashboard/onClickLis.kt
new file mode 100644
index 0000000..99602d8
--- /dev/null
+++ b/app/src/main/java/com/example/needit/activityes/ui/dashboard/onClickLis.kt
@@ -0,0 +1,7 @@
+package com.example.needit.activityes.ui.dashboard
+
+import android.content.ClipData
+
+interface onClickLis {
+ fun onClikeded(id_num:Int )
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/needit/activityes/ui/home/HomeFragment.kt b/app/src/main/java/com/example/needit/activityes/ui/home/HomeFragment.kt
index 4456945..7ebe0be 100644
--- a/app/src/main/java/com/example/needit/activityes/ui/home/HomeFragment.kt
+++ b/app/src/main/java/com/example/needit/activityes/ui/home/HomeFragment.kt
@@ -4,14 +4,18 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.ArrayAdapter
+import android.widget.Spinner
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
+import com.example.needit.R
import com.example.needit.activityes.ui.dashboard.DashAdapter
import com.example.needit.activityes.ui.dashboard.PersonRequest
import com.example.needit.databinding.FragmentHomeBinding
+import kotlinx.android.synthetic.main.fragment_dashboard.*
class HomeFragment : Fragment() {
@@ -37,7 +41,9 @@ class HomeFragment : Fragment() {
homeViewModel.text.observe(viewLifecycleOwner, Observer {
textView.text = it
})
+
init()
+
return root
}
private fun init()= with(binding) {
diff --git a/app/src/main/java/com/example/needit/activityes/ui/notifications/NotificationsFragment.kt b/app/src/main/java/com/example/needit/activityes/ui/notifications/NotificationsFragment.kt
index 9c464c6..99bc559 100644
--- a/app/src/main/java/com/example/needit/activityes/ui/notifications/NotificationsFragment.kt
+++ b/app/src/main/java/com/example/needit/activityes/ui/notifications/NotificationsFragment.kt
@@ -4,75 +4,71 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import android.widget.TextView
-import androidx.core.view.isGone
-import androidx.core.view.isVisible
+import android.widget.ArrayAdapter
+import android.widget.Spinner
import androidx.fragment.app.Fragment
-import androidx.lifecycle.Observer
-import androidx.lifecycle.ViewModelProvider
import com.example.needit.R
-import com.example.needit.databinding.FragmentNotificationsBinding
-import com.example.needit.firebase.firestore.PostFirestore
-import com.example.needit.firebase.models.Post
-import java.util.*
+import com.example.needit.activityes.ui.dashboard.PersonRequest
+import com.google.firebase.firestore.ktx.firestore
+import com.google.firebase.ktx.Firebase
+import kotlinx.android.synthetic.main.fragment_dashboard.*
+import kotlinx.android.synthetic.main.fragment_notifications.*
class NotificationsFragment : Fragment() {
- private lateinit var notificationsViewModel: NotificationsViewModel
- 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? {
- notificationsViewModel =
- ViewModelProvider(this).get(NotificationsViewModel::class.java)
+ return inflater.inflate(R.layout.fragment_notifications, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ val db = Firebase.firestore
+ val spinner: Spinner = spinner
+// Create an ArrayAdapter using the string array and a default spinner layout
+ context?.let {
+ ArrayAdapter.createFromResource(
+ it,
+ R.array.spinner_moment,
+ android.R.layout.simple_spinner_item
+ ).also { adapter ->
+ // Specify the layout to use when the list of choices appears
+ adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
+ // Apply the adapter to the spinner
+ spinner.adapter = adapter
+ }
+ }
+ button_submit.setOnClickListener {
+ button_submit.setText(R.string.Retry1)
+ val NeedOrGive: String // Проверка на свич (Give или Need)
+ if (switch1.isChecked) {
+ NeedOrGive = "Give"
+ } else {
+ NeedOrGive = "Need"
+ }
+ spinner.selectedItem.toString() //добить в бд надо
+ val personalRequest = PersonRequest(1, // Создаём объект PersonalRequest
+ editTextTextPersonName.text.toString(),
+ "Null",
+ editTextTextMultiLine.text.toString(),
+ NeedOrGive,
+ "Lenina, 53"
+ )
+ db.collection("Stuff") // Добавляем его в БД
+ .document(editTextTextPersonName
+ .text.toString())
+ .set(personalRequest)
- _binding = FragmentNotificationsBinding.inflate(inflater, container, false)
- val root: View = binding.root
-var tr:Boolean=true
- // val textView: TextView = binding.textNotifications
- // notificationsViewModel.text.observe(viewLifecycleOwner, Observer {
- // textView.text = it
- // }
- // )
- val but = binding.button1
- val text1=binding.editTextTextMultiLine
- val text2=binding.editTextTextPersonName
- val switch1=binding.switch1
- but.setOnClickListener {
- if (tr) {
- but.setText(R.string.Retry1)
- text1.visibility = View.GONE
- text2.visibility = View.GONE
- switch1.visibility= View.GONE
- tr=false
- // try {
- // var post:Post = Post(text1.text.toString(),"","","Barnaul","+7999999999",Post.PostType.REQUIRE,Post.ObjectType.LEISURE_GOODS,"","", Date())
- // if (switch1.isActivated){
- // post.post_type=Post.PostType.GIVE_AWAY
- // }
- // val send:PostFirestore = PostFirestore()
- // send.set(post)}catch (e:NoSuchElementException){null}
- } else{
- text1.visibility = View.VISIBLE
- text2.visibility = View.VISIBLE
- switch1.visibility= View.VISIBLE
- but.setText(R.string.Submit)
- tr=true}
}
- return root
- }
+ }
- override fun onDestroyView() {
- super.onDestroyView()
- _binding = null
+ companion object {
+ @JvmStatic
+ fun newInstance() = NotificationsFragment()
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/needit/firebase/firestore/PostFirestore.kt b/app/src/main/java/com/example/needit/firebase/firestore/PostFirestore.kt
deleted file mode 100644
index fe58316..0000000
--- a/app/src/main/java/com/example/needit/firebase/firestore/PostFirestore.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.example.needit.firebase.firestore
-
-import com.example.needit.firebase.models.Post
-import com.example.needit.firebase.utils.Constants
-import com.google.firebase.firestore.FirebaseFirestore
-import com.google.firebase.firestore.SetOptions
-import com.google.firebase.firestore.ktx.toObject
-
-class PostFirestore {
- private val firestore = FirebaseFirestore.getInstance()
-
- fun set(post: Post){
- firestore.collection(Constants.POSTS).document(post.id).set(post, SetOptions.merge())
- .addOnFailureListener{e -> throw e }
- }
-
- fun delete(postId: String){
- firestore.collection(Constants.POSTS).document(postId).delete()
- .addOnFailureListener{ e -> throw e }
- }
-
- //TODO getOne не работает
- fun getOne(postId: String): Post {
- var post = firestore.collection(Constants.POSTS).document(postId).get()
- .addOnSuccessListener { document ->
- if (document == null){
- throw NoSuchElementException()
- }
- }
- .addOnFailureListener{ e -> throw e }
-
- return post.result.toObject()!!
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/needit/firebase/models/Post.kt b/app/src/main/java/com/example/needit/firebase/models/Post.kt
deleted file mode 100644
index 898a7d0..0000000
--- a/app/src/main/java/com/example/needit/firebase/models/Post.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.example.needit.firebase.models
-
-import java.util.*
-
-class Post(
- val surname: String,
- val name: String,
- val patronymic: String? = null,
- var address: String,
- val phone: String,
- var post_type: PostType,
- val object_type: ObjectType,
- val language: String,
- val photo_reference: String? = null,
- val creation_date: Date
-)
-{
- enum class PostType{
- GIVE_AWAY, REQUIRE
- }
- enum class ObjectType{
- CLOTHES, APPLIANCES, LEISURE_GOODS
- }
-
- val id: String = UUID.randomUUID().toString()
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/needit/firebase/utils/Constants.kt b/app/src/main/java/com/example/needit/firebase/utils/Constants.kt
deleted file mode 100644
index 9a42d80..0000000
--- a/app/src/main/java/com/example/needit/firebase/utils/Constants.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.example.needit.firebase.utils
-
-//класс для названий коллекций
-object Constants {
- const val POSTS: String = "posts"
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/needit/utils/spinner_adapter.kt b/app/src/main/java/com/example/needit/utils/spinner_adapter.kt
new file mode 100644
index 0000000..54c6bd2
--- /dev/null
+++ b/app/src/main/java/com/example/needit/utils/spinner_adapter.kt
@@ -0,0 +1,16 @@
+package com.example.needit.utils
+
+import android.app.Activity
+import android.view.View
+import android.widget.AdapterView
+
+class spinner_adapter:Activity(), AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(parent: AdapterView<*>, view: View?, pos: Int, id: Long) {
+ // An item was selected. You can retrieve the selected item using
+ parent.getItemAtPosition(pos)
+ }
+
+ override fun onNothingSelected(parent: AdapterView<*>) {
+ // Another interface callback
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-v24/boots.png b/app/src/main/res/drawable-v24/boots.png
new file mode 100644
index 0000000..bef7be3
Binary files /dev/null and b/app/src/main/res/drawable-v24/boots.png differ
diff --git a/app/src/main/res/layout/activity_detail_dash.xml b/app/src/main/res/layout/activity_detail_dash.xml
new file mode 100644
index 0000000..35155f7
--- /dev/null
+++ b/app/src/main/res/layout/activity_detail_dash.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index fb48e01..af1cb1a 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -11,7 +11,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="57dp"
- android:layout_marginTop="21dp"
+ android:layout_marginTop="8dp"
android:text="Adress"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/surname" />
@@ -21,7 +21,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="57dp"
- android:layout_marginTop="11dp"
+ android:layout_marginTop="8dp"
android:text="Email"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView12" />
@@ -31,7 +31,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="57dp"
- android:layout_marginTop="17dp"
+ android:layout_marginTop="8dp"
android:text="Phone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView8" />
@@ -40,7 +40,7 @@
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="144dp"
+ android:layout_marginStart="100dp"
android:layout_marginTop="25dp"
app:layout_constraintStart_toEndOf="@+id/surname"
app:layout_constraintTop_toTopOf="parent"
@@ -60,65 +60,83 @@
android:id="@+id/surname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="13dp"
+ android:layout_marginStart="57dp"
+ android:layout_marginTop="8dp"
android:text="Surname"
- app:layout_constraintTop_toBottomOf="@+id/name"
- tools:layout_editor_absoluteX="57dp" />
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/name" />
+ android:layout_marginStart="20dp"
+ android:layout_marginTop="32dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/textView13"
+ app:srcCompat="@android:drawable/btn_star_big_on" />
+ android:layout_marginStart="24dp"
+ app:layout_constraintBottom_toBottomOf="@+id/imageView2"
+ app:layout_constraintStart_toEndOf="@+id/imageView2"
+ app:layout_constraintTop_toTopOf="@+id/imageView2"
+ app:srcCompat="@android:drawable/ic_dialog_info" />
+ android:layout_marginStart="24dp"
+ app:layout_constraintBottom_toBottomOf="@+id/imageView3"
+ app:layout_constraintStart_toEndOf="@+id/imageView3"
+ app:layout_constraintTop_toTopOf="@+id/imageView3"
+ app:srcCompat="@android:drawable/ic_menu_camera" />
+ android:textAlignment="center"
+ app:layout_constraintEnd_toEndOf="@+id/imageView2"
+ app:layout_constraintStart_toStartOf="@+id/imageView2"
+ app:layout_constraintTop_toBottomOf="@+id/imageView2" />
+ android:textAlignment="center"
+ app:layout_constraintEnd_toEndOf="@+id/imageView3"
+ app:layout_constraintStart_toStartOf="@+id/imageView3"
+ app:layout_constraintTop_toBottomOf="@+id/imageView3" />
+ android:textAlignment="center"
+ app:layout_constraintEnd_toEndOf="@+id/imageView4"
+ app:layout_constraintStart_toStartOf="@+id/imageView4"
+ app:layout_constraintTop_toBottomOf="@+id/imageView4" />
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/textView10" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_navigation.xml b/app/src/main/res/layout/activity_navigation.xml
index 9a50999..7ec4735 100644
--- a/app/src/main/res/layout/activity_navigation.xml
+++ b/app/src/main/res/layout/activity_navigation.xml
@@ -1,34 +1,36 @@
-
-
diff --git a/app/src/main/res/layout/fragment_dashboard.xml b/app/src/main/res/layout/fragment_dashboard.xml
index 7bcef2f..ddb926e 100644
--- a/app/src/main/res/layout/fragment_dashboard.xml
+++ b/app/src/main/res/layout/fragment_dashboard.xml
@@ -6,63 +6,49 @@
android:layout_height="match_parent"
tools:context=".activityes.ui.dashboard.DashboardFragment">
-
-
-
-
-
+ android:layout_height="wrap_content">
-
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
index bd60bb3..0458d53 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -7,14 +7,13 @@
tools:context=".activityes.ui.home.HomeFragment">
diff --git a/app/src/main/res/layout/fragment_notifications.xml b/app/src/main/res/layout/fragment_notifications.xml
index 25689a9..486994a 100644
--- a/app/src/main/res/layout/fragment_notifications.xml
+++ b/app/src/main/res/layout/fragment_notifications.xml
@@ -10,10 +10,11 @@
+ app:layout_constraintTop_toTopOf="@+id/spinner" />
+ app:layout_constraintTop_toBottomOf="@+id/imageView5"
+ tools:ignore="UseSwitchCompatOrMaterialXml" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/recycler_view_item.xml b/app/src/main/res/layout/recycler_view_item.xml
index 7e63668..3ac3221 100644
--- a/app/src/main/res/layout/recycler_view_item.xml
+++ b/app/src/main/res/layout/recycler_view_item.xml
@@ -1,43 +1,68 @@
-
+ android:visibility="visible"
+ app:cardUseCompatPadding="true"
+ app:cardElevation="5dp"
+ app:contentPadding="10dp"
+ app:cardCornerRadius="10dp"
+ app:cardBackgroundColor="@color/color_background"
+ >
-
+
-
+
-
+
-
+
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/recycler_view_item_1.xml b/app/src/main/res/layout/recycler_view_item_1.xml
deleted file mode 100644
index c820a76..0000000
--- a/app/src/main/res/layout/recycler_view_item_1.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
index ecba7a8..de7b9d7 100644
--- a/app/src/main/res/values-night/themes.xml
+++ b/app/src/main/res/values-night/themes.xml
@@ -1,6 +1,6 @@
-