O’quv amaliyot bo’yicha hisob ot 312-19 guruh talabasi Bajardi



Download 1,59 Mb.
bet3/4
Sana31.05.2023
Hajmi1,59 Mb.
#946818
1   2   3   4
Bog'liq
хисобот

Amaliy qism:
Ushbu amaliyot mo’baynida men yaratgan android dasturdan birining android studioda yozilgan kodi:
package uz.tbteam.newtaxidriver

import android.Manifest
import android.animation.Animator
import android.animation.Animator.AnimatorListener
import android.annotation.SuppressLint
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.pm.PackageManager
import android.content.res.ColorStateList
import android.content.res.Configuration
import android.graphics.Bitmap
import android.graphics.Color
import android.graphics.Rect
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.ColorDrawable
import android.location.Location
import android.location.LocationListener
import android.location.LocationManager
import android.net.ConnectivityManager
import android.net.Uri
import android.os.Bundle
import android.os.Looper
import android.provider.Settings
import android.util.Log
import android.view.*
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.children
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.fragment.findNavController
import androidx.navigation.ui.NavigationUI
import androidx.navigation.ui.NavigationUI.setupWithNavController
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.transition.Transition
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.Polygon
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.snackbar.Snackbar
import com.google.android.play.core.appupdate.AppUpdateManager
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
import com.google.android.play.core.install.model.AppUpdateType
import com.google.android.play.core.install.model.AppUpdateType.IMMEDIATE
import com.google.android.play.core.install.model.UpdateAvailability
import com.karumi.dexter.Dexter
import com.karumi.dexter.PermissionToken
import com.karumi.dexter.listener.PermissionDeniedResponse
import com.karumi.dexter.listener.PermissionGrantedResponse
import com.karumi.dexter.listener.PermissionRequest
import com.karumi.dexter.listener.single.PermissionListener
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import uz.tbteam.newtaxidriver.databinding.ActivityMainBinding
import uz.tbteam.newtaxidriver.dialogs.cityTaxi.OrderCancelledDialog
import uz.tbteam.newtaxidriver.fragments.mainActivity.cityTaxi.viewModel.GeoServiceViewModel
import uz.tbteam.newtaxidriver.modelApi.mainActivity.cityTaxi.getPolygon.GetPolygon
import uz.tbteam.newtaxidriver.modelApi.mainActivity.cityTaxi.tariffs.GetTariffsListModel
import uz.tbteam.newtaxidriver.models.cityTaxi.ActiveOrder
import uz.tbteam.newtaxidriver.responseApis.ResApis
import uz.tbteam.newtaxidriver.service.FloatingService
import uz.tbteam.newtaxidriver.service.MainBackgroundService
import uz.tbteam.newtaxidriver.utils.*
import java.lang.Exception
import java.text.SimpleDateFormat
import java.util.*

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {

private lateinit var binding: ActivityMainBinding
private lateinit var navController: NavController
private lateinit var geoViewModel: GeoServiceViewModel

override fun onCreate(savedInstanceState: Bundle?) {
setTheme()
checkUpdateNewVersion()
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
setUpBottomNavigationView()
setCheckOrder()
registerRecievers()

if (checkCallingOrSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
getSingleLocation()
} else {
requestPermissionForLocation()
}

geoViewModel = ViewModelProvider(this)[GeoServiceViewModel::class.java]
setViewModelListener()
reloadEnabledTariffs()
}

private fun setViewModelListener() {
geoViewModel.polygon.observe(this, polygonObserver)
}

private val polygonObserver = Observer> {
when (it) {
is ResApis.Error -> {
if (it.message.contains("no rows")) {
SharedPref.setCityPolygon(this, null)
SharedPref.setDistrictPolygon(this, null)
}
PolygonUtils.isSent = false
geoViewModel.polygon.postValue(ResApis.Loading())
}

is ResApis.Success -> {
if (it.data.content != null) {
SharedPref.setCityPolygon(this, it.data.content.city)
SharedPref.setDistrictPolygon(this, it.data.content.district)
} else {
SharedPref.setCityPolygon(this, null)
SharedPref.setDistrictPolygon(this, null)
}
PolygonUtils.isSent = false
geoViewModel.polygon.postValue(ResApis.Loading())
}

else -> {}
}
}
Ushbu amaliyot mo’baynida men yaratgan android dasturdan birining dizayni:

Korxonaning rasmlar:





Download 1,59 Mb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish