Mustaqil ishi Mavzu: Murojaatchi mobil ilovasini loyihalash. Bajardi: Shavkatov Behroʻz toshkent – 2023 mundarija kirish
Download 1.41 Mb.
|
Shavktov Behro’z Murojaatchi(individual loyiha) (1)
Internet saytlari
https://elearningindustry.com/directory/software-categories/learning-management-systems/deployment/mobile https://ru.wikipedia.org/wiki/Java https://apptractor.ru/develop/chistaya-arhitektura-na-android-i-ios.html https://www.google.com/search?q=learning+management+system+apps&source=lmns&bih=714&biw=1536&hl=en&sa=X&ved=2ahUKEwirwarso_n7AhUnmIsKHflRDq8Q_AUoAHoECAEQAA https://www.efrontlearning.com/ ILOVA package com.example.projectforumrzoqaka.ui import android.annotation.SuppressLint import android.app.AlertDialog import android.content.DialogInterface import android.graphics.Color import android.graphics.drawable.ColorDrawable import android.os.Bundle import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.navigation.fragment.findNavController import com.example.projectforumrzoqaka.R import com.example.projectforumrzoqaka.adapters.ApplicationAdapter import com.example.projectforumrzoqaka.database.AppDatabase import com.example.projectforumrzoqaka.databinding.DialogDesignBinding import com.example.projectforumrzoqaka.databinding.FragmentApplicationBinding import com.example.projectforumrzoqaka.entity.Application import com.zhuinden.fragmentviewbindingdelegatekt.viewBinding import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.schedulers.Schedulers private const val ARG_PARAM1 = "param1" private const val ARG_PARAM2 = "param2" class ApplicationFragment : Fragment(R.layout.fragment_application) { private var param1: String? = null private var param2: String? = null private val binding by viewBinding(FragmentApplicationBinding::bind) lateinit var appDatabase: AppDatabase lateinit var applicationAdapter: ApplicationAdapter @SuppressLint("CheckResult") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) appDatabase = AppDatabase.getInstance(requireContext()) binding.apply { addBtn.setOnClickListener { findNavController().navigate(R.id.addApplication) } back.setOnClickListener { findNavController().popBackStack() } } appDatabase.applicantDao().getAllApplicants().subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()).subscribe({ it1 -> if (it1.isNotEmpty()) { appDatabase.applicationDao().getAllApplications().subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()).subscribe({ it1 -> if (it1.isNotEmpty()) { binding.noData.visibility = View.GONE binding.rv.visibility = View.VISIBLE applicationAdapter = ApplicationAdapter( object : ApplicationAdapter.OnItemClickListener { override fun onItemClick( application: Application, position: Int ) { val bundle = Bundle() bundle.putSerializable("application", application) findNavController().navigate( R.id.applicationDataFragment, bundle ) } override fun onItemEditClick( application: Application, position: Int ) { val alertDialog = AlertDialog.Builder(requireContext()) val itemDialogBinding = DialogDesignBinding.inflate( LayoutInflater.from(requireContext()) ) val create = alertDialog.create() create.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) alertDialog.setView(itemDialogBinding.root) itemDialogBinding.description.setText(application.description) itemDialogBinding.createdDate.setText(application.createdAt) itemDialogBinding.editBtn.setOnClickListener { val description = itemDialogBinding.description.text.trim() .toString() val createdDate = itemDialogBinding.createdDate.text.trim() .toString() var application = Application( id = application.id, applicantId = application.applicantId, description = description, createdAt = createdDate ) appDatabase.applicationDao() .editApplication(application) } alertDialog.show() } override fun onItemDelete( application: Application, position: Int ) { val alertDialog = AlertDialog.Builder(requireContext()) alertDialog.setMessage("Do you want to delete this application?") alertDialog.setPositiveButton( "Yes, of course" ) { dialogInterface, i -> appDatabase.applicationDao() .deleteApplication(application) } alertDialog.setNegativeButton( "No, cancel" ) { p0, p1 -> p0.dismiss() } alertDialog.show() } }) applicationAdapter.submitList(it1) binding.rv.adapter = applicationAdapter } else { binding.noData.visibility = View.VISIBLE binding.rv.visibility = View.GONE } }, { })
binding.noData.visibility = View.VISIBLE binding.noData.text = "You should register in applicant part. You do not have any account for apply job." binding.rv.visibility = View.GONE } }, {}) } private var closeDialogAction: () -> Unit = {} override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) arguments?.let { param1 = it.getString(ARG_PARAM1) param2 = it.getString(ARG_PARAM2) } } override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_application, container, false) } companion object { @JvmStatic fun newInstance(param1: String, param2: String) = ApplicationFragment().apply { arguments = Bundle().apply { putString(ARG_PARAM1, param1) putString(ARG_PARAM2, param2) } } } } package com.example.projectforumrzoqaka.ui import android.annotation.SuppressLint import android.os.Bundle import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Toast import androidx.navigation.fragment.findNavController import com.example.projectforumrzoqaka.R import com.example.projectforumrzoqaka.database.AppDatabase import com.example.projectforumrzoqaka.databinding.FragmentAddApplicationBinding import com.example.projectforumrzoqaka.entity.Application import com.zhuinden.fragmentviewbindingdelegatekt.viewBinding import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.schedulers.Schedulers // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private const val ARG_PARAM1 = "param1" private const val ARG_PARAM2 = "param2" class AddApplication : Fragment(R.layout.fragment_add_application) { // TODO: Rename and change types of parameters private var param1: String? = null private var param2: String? = null private val binding by viewBinding(FragmentAddApplicationBinding::bind) lateinit var appDatabase: AppDatabase @SuppressLint("CheckResult") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) appDatabase = AppDatabase.getInstance(requireContext()) binding.apply { back.setOnClickListener { findNavController().popBackStack() } saveBtn.setOnClickListener { val description = description.text.trim().toString() val createdDate = createdDate.text.trim().toString() when { description == "" -> { Toast.makeText( requireContext(), "Description field is empty!", Toast.LENGTH_SHORT ).show() } createdDate == "" -> { Toast.makeText( requireContext(), "Created Date field is empty!", Toast.LENGTH_SHORT ).show() } else -> { appDatabase.applicantDao().getAllApplicants().subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()).subscribe({ it1 -> val applicant = it1[0] appDatabase.applicationDao().addApplication( Application( applicantId = applicant.id, description = description, createdAt = createdDate ) ) findNavController().popBackStack() }, { })
} }
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) arguments?.let { param1 = it.getString(ARG_PARAM1) param2 = it.getString(ARG_PARAM2) } } override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_add_application, container, false) } companion object { @JvmStatic fun newInstance(param1: String, param2: String) = AddApplication().apply { arguments = Bundle().apply { putString(ARG_PARAM1, param1) putString(ARG_PARAM2, param2) } } } } package com.example.projectforumrzoqaka.ui import android.os.Bundle import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Toast import androidx.navigation.fragment.findNavController import com.example.projectforumrzoqaka.R import com.example.projectforumrzoqaka.database.AppDatabase import com.example.projectforumrzoqaka.databinding.FragmentRegisterBinding import com.example.projectforumrzoqaka.entity.Applicant import com.zhuinden.fragmentviewbindingdelegatekt.viewBinding // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private const val ARG_PARAM1 = "param1" private const val ARG_PARAM2 = "param2" /
* Use the [RegisterFragment.newInstance] factory method to * create an instance of this fragment. */ class RegisterFragment : Fragment(R.layout.fragment_register) { // TODO: Rename and change types of parameters private var param1: String? = null private var param2: String? = null private val binding by viewBinding(FragmentRegisterBinding::bind) lateinit var appDatabase: AppDatabase override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) appDatabase = AppDatabase.getInstance(requireContext()) binding.back.setOnClickListener { findNavController().popBackStack() } binding.apply { registerBtn.setOnClickListener { val fullname = fullname.text.trim().toString() val birthday = birthday.text.trim().toString() val country = country.text.trim().toString() val region = region.text.trim().toString() val district = district.text.trim().toString() val job = job.text.trim().toString() when {
Toast.makeText(requireContext(), "Fullname is empty", Toast.LENGTH_SHORT) .show() } birthday == "" -> { Toast.makeText(requireContext(), "Birthday is empty", Toast.LENGTH_SHORT) .show() } country == "" -> { Toast.makeText(requireContext(), "Country is empty", Toast.LENGTH_SHORT) .show() } region == "" -> { Toast.makeText(requireContext(), "Region is empty", Toast.LENGTH_SHORT) .show() } district == "" -> { Toast.makeText(requireContext(), "District is empty", Toast.LENGTH_SHORT) .show() } job == "" -> { Toast.makeText(requireContext(), "Job is empty", Toast.LENGTH_SHORT).show() } else -> { val applicant = Applicant( fullName = fullname, birthDay = birthday, country = country, region = region, district = district, job = job ) appDatabase.applicantDao().addApplicant(applicant) findNavController().popBackStack() } } } } } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) arguments?.let { param1 = it.getString(ARG_PARAM1) param2 = it.getString(ARG_PARAM2) } } override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_register, container, false) } companion object { / * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment RegisterFragment. */ // TODO: Rename and change types and number of parameters @JvmStatic fun newInstance(param1: String, param2: String) = RegisterFragment().apply { arguments = Bundle().apply { putString(ARG_PARAM1, param1) putString(ARG_PARAM2, param2) } } } } Download 1.41 Mb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling