Mavzu: Baraka – Savdo online savdo tizimini loyihalash Reja


import com.google.android.gms.maps.model.LatLng import



Download 325,71 Kb.
bet13/13
Sana01.07.2022
Hajmi325,71 Kb.
#721978
1   ...   5   6   7   8   9   10   11   12   13
Bog'liq
b9ElG9exKYpl2zjoqrbhraAGvQ3X7jWQ

import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.MarkerOptions
import uz.bdm.base.R
import uz.bdm.base.base.BaseActivity
import uz.bdm.base.databinding.ActivityMakeOrderBinding
import uz.bdm.base.model.LocationModel
import uz.bdm.base.utils.Prefs

class MakeOrderActivity : BaseActivity(), OnMapReadyCallback {

private lateinit var googleMap: GoogleMap
var locationClient: FusedLocationProviderClient? = null
private var lastLocation
= LatLng(0.0,0.0)

override fun getViewBinding(): ActivityMakeOrderBinding =
ActivityMakeOrderBinding.inflate(layoutInflater)

override fun initViews() {

val mapFragment =
supportFragmentManager.findFragmentById(R.id.fallasMap) as SupportMapFragment?
mapFragment?.getMapAsync(this)

binding.imageMap.setOnTouchListener { v, event ->
if
(event.action == MotionEvent.ACTION_DOWN){
binding.scrollView.requestDisallowInterceptTouchEvent(true)
return@setOnTouchListener false
}
if (event.action == MotionEvent.ACTION_UP){
binding.scrollView.requestDisallowInterceptTouchEvent(false)
return@setOnTouchListener true
}
if (event.action == MotionEvent.ACTION_MOVE){
binding.scrollView.requestDisallowInterceptTouchEvent(true)
return@setOnTouchListener false
}
return@setOnTouchListener true
}
locationClient
= LocationServices.getFusedLocationProviderClient(this)

binding.back.setOnClickListener {
finish()
}

binding.checkbox.setOnClickListener {


if
(binding.checkbox.isChecked){
binding.lySaleOff.visibility = View.VISIBLE
} else {
binding.lySaleOff.visibility = View.GONE
}
}

binding.selfCall.setOnClickListener {


binding
.lyDelivery.visibility = View.GONE
binding.selfCall.setBackgroundResource(R.drawable.tip_selected_shape)
binding.selfCall.setTextColor(Color.WHITE )
binding.delivery.setBackgroundResource(R.drawable.tip_unselected_shape)
binding.delivery.setTextColor(Color.BLACK )
}
binding
.delivery.setOnClickListener {
binding
.lyDelivery.visibility = View.VISIBLE
binding.delivery.setBackgroundResource(R.drawable.tip_selected_shape)
binding.delivery.setTextColor(Color.WHITE )
binding.selfCall.setBackgroundResource(R.drawable.tip_unselected_shape)
binding.selfCall.setTextColor(Color.BLACK )
}
}

override fun loadData() {

}

override fun initData() {

}

override fun updateData() {

}

override fun onMapReady(map: GoogleMap) {


map.let {
googleMap
= it
googleMap
.resetMinMaxZoomPreference()
if (ActivityCompat.checkSelfPermission(
this,
Manifest.permission.ACCESS_FINE_LOCATION
) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
this,
Manifest.permission.ACCESS_COARSE_LOCATION
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this,
arrayOf(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
),
1002
)
return
}
googleMap.isMyLocationEnabled = true
googleMap
.uiSettings.isMyLocationButtonEnabled = true
googleMap
.uiSettings.isZoomControlsEnabled = true
locationClient
?.lastLocation?.addOnCompleteListener {
if
(it.result == null){
return@addOnCompleteListener
}
Prefs.setLocation(LocationModel(it.result.latitude, it.result.longitude))
googleMap.animateCamera(
CameraUpdateFactory.newLatLngZoom(
LatLng(it.result.latitude, it.result.longitude),
14.0F
)
)
lastLocation = LatLng(it.result.latitude, it.result.longitude)
googleMap.addMarker(MarkerOptions().position(lastLocation))

}

googleMap.setOnMapLongClickListener { latLng ->


googleMap
.clear()
map.addMarker(
MarkerOptions()
.position(latLng)
)
}
}

}
}



Foydalanilgan adabiyotlar.


https://www.w3schools.com/
https://www.youtube.com
https://developer.android.com/.

Download 325,71 Kb.

Do'stlaringiz bilan baham:
1   ...   5   6   7   8   9   10   11   12   13




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