-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xullas so'z fragment navigation maps o'zgartirildi #1
Open
Dilmurod55
wants to merge
1
commit into
Smart-Soft-Development:master
Choose a base branch
from
Dilmurod55:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
app/src/main/java/com/example/autoservice/AppMap/MapsFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package com.example.autoservice.AppMap | ||
|
||
import android.Manifest | ||
import android.content.pm.PackageManager | ||
import android.location.Location | ||
import androidx.fragment.app.Fragment | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.core.app.ActivityCompat | ||
import com.example.autoservice.R | ||
import com.example.autoservice.databinding.FragmentMapsBinding | ||
import com.google.android.gms.location.FusedLocationProviderClient | ||
import com.google.android.gms.location.LocationServices | ||
|
||
import com.google.android.gms.maps.CameraUpdateFactory | ||
import com.google.android.gms.maps.GoogleMap | ||
import com.google.android.gms.maps.OnMapReadyCallback | ||
import com.google.android.gms.maps.SupportMapFragment | ||
import com.google.android.gms.maps.model.LatLng | ||
import com.google.android.gms.maps.model.Marker | ||
import com.google.android.gms.maps.model.MarkerOptions | ||
|
||
class MapsFragment : Fragment(R.layout.fragment_maps),GoogleMap.OnMarkerClickListener{ | ||
private var _binding :FragmentMapsBinding?=null | ||
private lateinit var lastlocation:Location | ||
private val Location_request_code = 1 | ||
private lateinit var map:GoogleMap | ||
private lateinit var fusedLocationProviderClient: FusedLocationProviderClient | ||
private val binding get() = _binding!! | ||
private val callback = OnMapReadyCallback { googleMap -> | ||
map = googleMap | ||
map.uiSettings.isZoomControlsEnabled = true | ||
map.setOnMarkerClickListener(this) | ||
|
||
setupmap() | ||
|
||
val sydney = LatLng(-34.0, 151.0) | ||
map.addMarker(MarkerOptions().position(sydney).title("Marker in Sydney")) | ||
map.moveCamera(CameraUpdateFactory.newLatLng(sydney)) | ||
} | ||
|
||
|
||
|
||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
_binding = FragmentMapsBinding.bind(view) | ||
fusedLocationProviderClient =LocationServices.getFusedLocationProviderClient(binding.root.context) | ||
val mapFragment = childFragmentManager.findFragmentById(R.id.map) as SupportMapFragment? | ||
|
||
mapFragment?.getMapAsync(callback) | ||
} | ||
|
||
|
||
|
||
private fun setupmap() { | ||
if (ActivityCompat.checkSelfPermission( | ||
binding.root.context, | ||
Manifest.permission.ACCESS_FINE_LOCATION | ||
) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission( | ||
binding.root.context, | ||
Manifest.permission.ACCESS_COARSE_LOCATION | ||
) != PackageManager.PERMISSION_GRANTED | ||
) { | ||
ActivityCompat.requestPermissions(requireActivity(), arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION),Location_request_code) | ||
return | ||
} | ||
map.isMyLocationEnabled = true | ||
fusedLocationProviderClient.lastLocation.addOnSuccessListener(requireActivity()){ | ||
loc -> | ||
if (loc !=null){ | ||
lastlocation = loc | ||
val currentlanglat = LatLng(loc.latitude,loc.longitude) | ||
placemarekermap(currentlanglat) | ||
map.animateCamera(CameraUpdateFactory.newLatLngZoom(currentlanglat,12f)) | ||
} | ||
} | ||
} | ||
|
||
private fun placemarekermap(currentlanglat:LatLng){ | ||
var markeroption = MarkerOptions().position(currentlanglat) | ||
markeroption.title("$currentlanglat") // izoh | ||
map.addMarker(markeroption) | ||
} | ||
|
||
override fun onMarkerClick(p0: Marker?)=false | ||
|
||
|
||
|
||
override fun onDestroy() { | ||
super.onDestroy() | ||
_binding = null | ||
} | ||
|
||
} |
3 changes: 2 additions & 1 deletion
3
.../autoservice/AdminRegistrationFragment.kt → ...ce/Fragments/AdminRegistrationFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
app/src/main/java/com/example/autoservice/Fragments/ForgotFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.example.autoservice.Fragments | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.example.autoservice.R | ||
import com.example.autoservice.databinding.FragmentForgotBinding | ||
|
||
// 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" | ||
|
||
/** | ||
* A simple [Fragment] subclass. | ||
* Use the [ForgotFragment.newInstance] factory method to | ||
* create an instance of this fragment. | ||
*/ | ||
class ForgotFragment : Fragment(R.layout.fragment_forgot) { | ||
// TODO: Rename and change types of parameters | ||
private var param1: String? = null | ||
private var param2: String? = null | ||
private var _binding:FragmentForgotBinding?=null | ||
private val binding get() = _binding | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
arguments?.let { | ||
param1 = it.getString(ARG_PARAM1) | ||
param2 = it.getString(ARG_PARAM2) | ||
} | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
_binding = FragmentForgotBinding.bind(view) | ||
} | ||
|
||
override fun onDestroy() { | ||
super.onDestroy() | ||
_binding = null | ||
} | ||
|
||
|
||
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 ForgotFragment. | ||
*/ | ||
// TODO: Rename and change types and number of parameters | ||
@JvmStatic | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JVMStatic shartmas bu yerda |
||
fun newInstance(param1: String, param2: String) = | ||
ForgotFragment().apply { | ||
arguments = Bundle().apply { | ||
putString(ARG_PARAM1, param1) | ||
putString(ARG_PARAM2, param2) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val
larni eng tepaga qo'yadi.var
keyin yozasz.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keyin Code format qiling xar doim
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tepaga chiqaring