refs #4677 Modificar pantalla delivery en picking
This commit is contained in:
parent
8618425413
commit
d93e34e13b
|
@ -73,12 +73,16 @@ abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
|
||||||
return ContextCompat.checkSelfPermission(
|
return ContextCompat.checkSelfPermission(
|
||||||
this,
|
this,
|
||||||
Manifest.permission.ACCESS_FINE_LOCATION
|
Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
|
) == PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(
|
||||||
|
this,
|
||||||
|
Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
) == PackageManager.PERMISSION_GRANTED
|
) == PackageManager.PERMISSION_GRANTED
|
||||||
}
|
}
|
||||||
|
|
||||||
fun requestLocationUpdates(
|
fun requestLocationUpdates(
|
||||||
fusedLocationClient: FusedLocationProviderClient
|
fusedLocationClient: FusedLocationProviderClient
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (ActivityCompat.checkSelfPermission(
|
if (ActivityCompat.checkSelfPermission(
|
||||||
this,
|
this,
|
||||||
Manifest.permission.ACCESS_FINE_LOCATION
|
Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
|
@ -87,16 +91,10 @@ abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
|
||||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||||
) != PackageManager.PERMISSION_GRANTED
|
) != PackageManager.PERMISSION_GRANTED
|
||||||
) {
|
) {
|
||||||
/*Debes aceptar permisos*/
|
|
||||||
ActivityCompat.requestPermissions(
|
|
||||||
this,
|
|
||||||
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
|
|
||||||
1
|
|
||||||
)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
println("location running")
|
|
||||||
fusedLocationClient.requestLocationUpdates(
|
fusedLocationClient.requestLocationUpdates(
|
||||||
locationRequest,
|
locationRequest,
|
||||||
locationCallback,
|
locationCallback,
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
package es.verdnatura.presentation.view.feature.delivery.activity
|
package es.verdnatura.presentation.view.feature.delivery.activity
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import android.content.DialogInterface
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.location.Location
|
import android.location.Location
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.google.android.gms.location.LocationResult
|
import com.google.android.gms.location.LocationResult
|
||||||
import com.google.android.gms.location.LocationServices
|
import com.google.android.gms.location.LocationServices
|
||||||
|
@ -91,7 +96,31 @@ class SignedActivity : BaseActivity<ActivitySignBinding>(), LocationUpdateCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (locationCurrent.distanceTo(locationClient) > 100 && locationClient.latitude != null && locationClient.longitude != null) {
|
if (clientTicket.Latitude != null && clientTicket.Longitude != null) {
|
||||||
|
if (locationCurrent.distanceTo(locationClient) > 100 ) {
|
||||||
|
|
||||||
|
val customDialogDistance = CustomDialog(this)
|
||||||
|
customDialogDistance.setTitle(getString(R.string.confirm))
|
||||||
|
.setDescription(getString(R.string.locationDiferent)+ getString(R.string.distance) + locationCurrent.distanceTo(locationClient))
|
||||||
|
.setOkButton(getString(R.string.keep)) {
|
||||||
|
|
||||||
|
uploadImage(MyLocation(locationClient.latitude, locationClient.longitude))
|
||||||
|
customDialogDistance.dismiss()
|
||||||
|
|
||||||
|
}.setKoButton(getString(R.string.modify)) {
|
||||||
|
uploadImage(lastLocationCurrent)
|
||||||
|
customDialogDistance.dismiss()
|
||||||
|
}
|
||||||
|
.show()
|
||||||
|
}else{
|
||||||
|
uploadImage(MyLocation(locationClient.longitude, locationClient.latitude))
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
uploadImage(lastLocationCurrent)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if (locationCurrent.distanceTo(locationClient) > 100 && clientTicket.Latitude != null && clientTicket.Longitude != null) {
|
||||||
|
|
||||||
|
|
||||||
val customDialogDistance = CustomDialog(this)
|
val customDialogDistance = CustomDialog(this)
|
||||||
customDialogDistance.setTitle(getString(R.string.confirm))
|
customDialogDistance.setTitle(getString(R.string.confirm))
|
||||||
|
@ -112,7 +141,7 @@ class SignedActivity : BaseActivity<ActivitySignBinding>(), LocationUpdateCallba
|
||||||
} else {
|
} else {
|
||||||
uploadImage(MyLocation(locationCurrent.longitude, locationCurrent.latitude))
|
uploadImage(MyLocation(locationCurrent.longitude, locationCurrent.latitude))
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
|
@ -208,12 +237,79 @@ class SignedActivity : BaseActivity<ActivitySignBinding>(), LocationUpdateCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setLocation() {
|
private fun setLocation() {
|
||||||
|
ActivityCompat.requestPermissions(
|
||||||
|
this,
|
||||||
|
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
|
||||||
|
111
|
||||||
|
)
|
||||||
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
|
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
|
||||||
locationUpdateCallback = this
|
locationUpdateCallback = this
|
||||||
if (checkLocationPermission()) {
|
requestLocationUpdates(fusedLocationClient)
|
||||||
requestLocationUpdates(fusedLocationClient)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRequestPermissionsResult(
|
||||||
|
requestCode: Int,
|
||||||
|
permissions: Array<out String>,
|
||||||
|
grantResults: IntArray
|
||||||
|
) {
|
||||||
|
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||||
|
val permission = Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
|
if (requestCode == 111) {
|
||||||
|
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
requestLocationUpdates(fusedLocationClient)
|
||||||
|
} else {
|
||||||
|
if (!shouldShowRequestPermissionRationale(permission)) {
|
||||||
|
|
||||||
|
val builder = AlertDialog.Builder(this)
|
||||||
|
builder.apply {
|
||||||
|
setTitle(getString(R.string.permissionRequired))
|
||||||
|
setMessage(getString(R.string.manuallyPermission))
|
||||||
|
setPositiveButton(
|
||||||
|
"Aceptar"
|
||||||
|
) { dialog, which ->
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
val dialog = builder.create()
|
||||||
|
dialog.show()
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
val activity = this
|
||||||
|
val builder = AlertDialog.Builder(this)
|
||||||
|
builder.apply {
|
||||||
|
setTitle(getString(R.string.permissionRequired))
|
||||||
|
setMessage(getString(R.string.advicePermission))
|
||||||
|
setPositiveButton(
|
||||||
|
getString(R.string.accept)
|
||||||
|
) { dialog, which ->
|
||||||
|
dialog.dismiss()
|
||||||
|
ActivityCompat.requestPermissions(
|
||||||
|
activity,
|
||||||
|
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
|
||||||
|
111
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
setNegativeButton(
|
||||||
|
getString(R.string.cancel)
|
||||||
|
) { dialog, which ->
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val dialog = builder.create()
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLocationReceived(location: LocationResult) {
|
override fun onLocationReceived(location: LocationResult) {
|
||||||
|
@ -222,7 +318,7 @@ class SignedActivity : BaseActivity<ActivitySignBinding>(), LocationUpdateCallba
|
||||||
lastLocationCurrent.Latitude = location.locations.last().latitude
|
lastLocationCurrent.Latitude = location.locations.last().latitude
|
||||||
println("ubicación - Latitud: $lastLocationCurrent.Latitude, Longitud: $lastLocationCurrent.Longitude")
|
println("ubicación - Latitud: $lastLocationCurrent.Latitude, Longitud: $lastLocationCurrent.Longitude")
|
||||||
} else {
|
} else {
|
||||||
println("ubicación vacía")
|
println("ubicación vacía")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,7 @@ import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
|
|
||||||
class RoutesFragment(
|
class RoutesFragment(
|
||||||
|
@ -46,7 +44,7 @@ class RoutesFragment(
|
||||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||||
private lateinit var myListRoute: MutableList<RouteInfo>
|
private lateinit var myListRoute: MutableList<RouteInfo>
|
||||||
private lateinit var db: DeliveryDatabase
|
private lateinit var db: DeliveryDatabase
|
||||||
private lateinit var myListRouteLoaded:List <RouteLoaded>
|
private lateinit var myListRouteLoaded: List<RouteLoaded>
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(title: String) =
|
fun newInstance(title: String) =
|
||||||
|
@ -67,7 +65,6 @@ class RoutesFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private fun pendingOperations() {
|
private fun pendingOperations() {
|
||||||
db = database(requireContext().applicationContext)
|
db = database(requireContext().applicationContext)
|
||||||
if (mobileApplication.hasNetwork) {
|
if (mobileApplication.hasNetwork) {
|
||||||
|
@ -242,16 +239,15 @@ class RoutesFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.scanInput.addTextChangedListener(object : TextWatcher {
|
binding.scanInput.addTextChangedListener(object : TextWatcher {
|
||||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||||
val searchText = s.toString().lowercase()
|
val searchText = s.toString().lowercase()
|
||||||
val filteredList = myListRoute.filter { route ->
|
filteredList(s.toString().lowercase())
|
||||||
route.toString().lowercase().contains(searchText)
|
|
||||||
}.toMutableList()
|
|
||||||
adapter!!.updateList(filteredList)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
override fun afterTextChanged(s: Editable?) {
|
||||||
|
@ -261,6 +257,14 @@ class RoutesFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun filteredList(searchText: String) {
|
||||||
|
|
||||||
|
val filteredList = myListRoute.filter { route ->
|
||||||
|
route.toString().lowercase().contains(searchText)
|
||||||
|
}.toMutableList()
|
||||||
|
adapter!!.updateList(filteredList)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
|
@ -333,6 +337,7 @@ class RoutesFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
// myListRoute = list
|
// myListRoute = list
|
||||||
|
|
||||||
adapter = RouteAdapter(
|
adapter = RouteAdapter(
|
||||||
myListRoute,
|
myListRoute,
|
||||||
object : OnItemImageRouteRowClickListener {
|
object : OnItemImageRouteRowClickListener {
|
||||||
|
@ -359,7 +364,7 @@ class RoutesFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},myListRouteLoaded
|
}, myListRouteLoaded
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.routeRecyclerview.addItemDecoration(
|
binding.routeRecyclerview.addItemDecoration(
|
||||||
|
@ -373,6 +378,9 @@ class RoutesFragment(
|
||||||
binding.routeRecyclerview.layoutManager =
|
binding.routeRecyclerview.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
adapter!!.notifyDataSetChanged()
|
adapter!!.notifyDataSetChanged()
|
||||||
|
if (!binding.scanInput.text.isNullOrBlank()) {
|
||||||
|
filteredList(binding.scanInput.text.toString())
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import android.widget.TextView
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
|
@ -28,6 +29,7 @@ import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.base.database
|
import es.verdnatura.presentation.base.database
|
||||||
import es.verdnatura.presentation.common.*
|
import es.verdnatura.presentation.common.*
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogInputNotes
|
import es.verdnatura.presentation.view.component.CustomDialogInputNotes
|
||||||
|
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
import es.verdnatura.presentation.view.feature.delivery.adapters.TicketAdapter
|
import es.verdnatura.presentation.view.feature.delivery.adapters.TicketAdapter
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||||
|
@ -55,6 +57,7 @@ class TicketsFragment(
|
||||||
private var showSettings = false
|
private var showSettings = false
|
||||||
private lateinit var db: DeliveryDatabase
|
private lateinit var db: DeliveryDatabase
|
||||||
private var isBack = false
|
private var isBack = false
|
||||||
|
private lateinit var customDialogList: CustomDialogList
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(title: String, entryPoint: String) =
|
fun newInstance(title: String, entryPoint: String) =
|
||||||
|
@ -85,6 +88,7 @@ class TicketsFragment(
|
||||||
} else {
|
} else {
|
||||||
"0/0"
|
"0/0"
|
||||||
}
|
}
|
||||||
|
customDialogList = CustomDialogList(requireContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun callBack(callBackEndPoint: Unit) {
|
private fun callBack(callBackEndPoint: Unit) {
|
||||||
|
@ -195,7 +199,7 @@ class TicketsFragment(
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
if (isBack){
|
if (isBack) {
|
||||||
callBack(viewModel.getTickets(route.id))
|
callBack(viewModel.getTickets(route.id))
|
||||||
isBack = false
|
isBack = false
|
||||||
}
|
}
|
||||||
|
@ -242,26 +246,14 @@ class TicketsFragment(
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
binding.mainToolbar.backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
setSettingsRoute()
|
if (!binding.itemcardLayout.isVisible) {
|
||||||
|
requireActivity().onBackPressed()
|
||||||
|
} else {
|
||||||
|
setSettingsRoute()
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setSettingsRoute()
|
setSettingsRoute()
|
||||||
/* binding.scanInput.addTextChangedListener(object : TextWatcher {
|
|
||||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
|
||||||
val searchText = s.toString().lowercase()
|
|
||||||
val filteredList = myListClientTicket.filter { route ->
|
|
||||||
route.toString().lowercase().contains(searchText)
|
|
||||||
}.toMutableList()
|
|
||||||
adapter!!.updateList(filteredList)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setSettingsRoute() {
|
private fun setSettingsRoute() {
|
||||||
|
@ -379,7 +371,7 @@ class TicketsFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
//db.clienTicketDao().delete()
|
//db.clienTicketDao().delete()
|
||||||
myListClientTicketAux.forEach{
|
myListClientTicketAux.forEach {
|
||||||
it.route = route.id
|
it.route = route.id
|
||||||
}
|
}
|
||||||
db.clienTicketDao().insert(myListClientTicketAux)
|
db.clienTicketDao().insert(myListClientTicketAux)
|
||||||
|
@ -557,40 +549,73 @@ class TicketsFragment(
|
||||||
|
|
||||||
fun showPhones(clientClicked: ClientTicket) {
|
fun showPhones(clientClicked: ClientTicket) {
|
||||||
|
|
||||||
if (!clientClicked.Phones.isNullOrEmpty()) {
|
val phones: MutableList<GeneralItem> = mutableListOf()
|
||||||
val phones = mutableListOf<String>().apply {
|
|
||||||
addAll(clientClicked.Phones!!)
|
|
||||||
if (!clientClicked.SalePersonPhone.isNullOrEmpty())
|
|
||||||
add(clientClicked.SalePersonPhone!!)
|
|
||||||
}
|
|
||||||
val builder = AlertDialog.Builder(context)
|
|
||||||
builder.setTitle(getString(R.string.phones))
|
|
||||||
val listPhones = phones.toTypedArray()
|
|
||||||
builder.setItems(listPhones) { dialog, which ->
|
|
||||||
|
|
||||||
if (ContextCompat.checkSelfPermission(
|
if (clientClicked.Phones != null && clientClicked.Phones!!.isNotEmpty()) {
|
||||||
requireContext(),
|
for (t in clientClicked.Phones!!) {
|
||||||
Manifest.permission.CALL_PHONE
|
phones.add(
|
||||||
) == PackageManager.PERMISSION_GRANTED
|
GeneralItem(
|
||||||
) {
|
text = "${getString(R.string.Cliente)}:$t",
|
||||||
val callIntent = Intent(Intent.ACTION_CALL)
|
code = t
|
||||||
callIntent.data = Uri.parse("tel:$which]")
|
|
||||||
startActivity(callIntent)
|
|
||||||
} else {
|
|
||||||
ActivityCompat.requestPermissions(
|
|
||||||
context as Activity,
|
|
||||||
arrayOf(Manifest.permission.CALL_PHONE),
|
|
||||||
REQUEST_CALL_PERMISSION
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!clientClicked.SalePersonPhone.isNullOrEmpty())
|
||||||
|
phones.add(
|
||||||
|
GeneralItem(
|
||||||
|
text = "${getString(R.string.comercial)}:${clientClicked.SalePersonPhone}",
|
||||||
|
code =
|
||||||
|
clientClicked.SalePersonPhone.toString()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
customDialogList.setValueVisibility(View.GONE)
|
||||||
|
customDialogList.setTitle(getString(R.string.phones))
|
||||||
|
.setKoButton(
|
||||||
|
getString(
|
||||||
|
R.string.cancel
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
customDialogList.dismiss()
|
||||||
|
}.hideDialog().show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val listPhonesAdapter =
|
||||||
|
GeneralAdapter(phones, object : OnGeneralItemRowClickListener {
|
||||||
|
override fun OnGeneralItemRowClickListener(item: GeneralItem) {
|
||||||
|
phones.forEach {
|
||||||
|
if (it.code == item.code) {
|
||||||
|
if (ContextCompat.checkSelfPermission(
|
||||||
|
requireContext(),
|
||||||
|
Manifest.permission.CALL_PHONE
|
||||||
|
) == PackageManager.PERMISSION_GRANTED
|
||||||
|
) {
|
||||||
|
|
||||||
|
val callIntent = Intent(Intent.ACTION_CALL)
|
||||||
|
callIntent.data = Uri.parse("tel:${it.code}")
|
||||||
|
startActivity(callIntent)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ActivityCompat.requestPermissions(
|
||||||
|
context as Activity,
|
||||||
|
arrayOf(Manifest.permission.CALL_PHONE),
|
||||||
|
REQUEST_CALL_PERMISSION
|
||||||
|
)
|
||||||
|
}
|
||||||
|
customDialogList.dismiss()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
})
|
||||||
val dialog = builder.create()
|
|
||||||
dialog.show()
|
customDialogList.getRecyclerView().adapter = listPhonesAdapter
|
||||||
} else {
|
|
||||||
getString(R.string.no_phones).toast(requireContext())
|
customDialogList.getRecyclerView().layoutManager =
|
||||||
}
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun goMaps(item: ClientTicket) {
|
fun goMaps(item: ClientTicket) {
|
||||||
|
@ -635,14 +660,17 @@ class TicketsFragment(
|
||||||
|
|
||||||
private fun isGoogleMapsInstalled(): Boolean {
|
private fun isGoogleMapsInstalled(): Boolean {
|
||||||
|
|
||||||
return try {
|
return true
|
||||||
val packageName = "com.google.android.apps.maps"
|
/*val packageManager = mobileApplication.packageManager
|
||||||
val packageManager = context?.packageManager
|
try {
|
||||||
packageManager?.getPackageInfoCompat(packageName)
|
packageManager.getApplicationInfo(
|
||||||
true
|
"com.google.android.apps.maps",
|
||||||
} catch (e: Exception) {
|
PackageManager.GET_ACTIVITIES
|
||||||
false
|
)
|
||||||
}
|
return true
|
||||||
|
} catch (e: PackageManager.NameNotFoundException) {
|
||||||
|
return false
|
||||||
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,3 +693,9 @@ class TicketsFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class PhonesTicket(
|
||||||
|
var label: String,
|
||||||
|
var phone: String
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/divider"
|
app:layout_constraintStart_toEndOf="@+id/divider"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/main_toolbar"
|
app:layout_constraintTop_toBottomOf="@+id/main_toolbar"
|
||||||
tools:visibility="visible">
|
tools:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView20"
|
android:id="@+id/textView20"
|
||||||
|
@ -277,10 +277,6 @@
|
||||||
tools:listitem="@layout/item_ticket_row"
|
tools:listitem="@layout/item_ticket_row"
|
||||||
tools:visibility="gone"/>
|
tools:visibility="gone"/>
|
||||||
|
|
||||||
<TextClock
|
|
||||||
android:id="@+id/textClock"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@
|
||||||
<string name="scanItem">Escanea un artículo</string>
|
<string name="scanItem">Escanea un artículo</string>
|
||||||
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
||||||
<string name="errorOperation">Error al realizar la operación</string>
|
<string name="errorOperation">Error al realizar la operación</string>
|
||||||
<string name="scanLabelExpedition">Escanea expedición.</string>
|
<string name="scanLabelExpedition">Escanea expedición</string>
|
||||||
<string name="buffer">Buffer:</string>
|
<string name="buffer">Buffer:</string>
|
||||||
<string name="packingSave">Packing guardado</string>
|
<string name="packingSave">Packing guardado</string>
|
||||||
<string name="previousCollected">Previa recogida</string>
|
<string name="previousCollected">Previa recogida</string>
|
||||||
|
@ -624,9 +624,11 @@
|
||||||
<string name="sin_internet">NO INTERNET</string>
|
<string name="sin_internet">NO INTERNET</string>
|
||||||
<string name="deliveryApp">Asegúrate de tener la app de reparto instalada</string>
|
<string name="deliveryApp">Asegúrate de tener la app de reparto instalada</string>
|
||||||
<string name="phones">Teléfonos</string>
|
<string name="phones">Teléfonos</string>
|
||||||
|
<string name="phone">Teléfono</string>
|
||||||
<string name="km">Kilómetros</string>
|
<string name="km">Kilómetros</string>
|
||||||
<string name="hours">Horas</string>
|
<string name="hours">Horas</string>
|
||||||
<string name="km_init">Km de inicio</string>
|
<string name="km_init">Km de inicio</string>
|
||||||
|
<string name="comercial">Comercial</string>
|
||||||
<string name="km_end">Km de fin</string>
|
<string name="km_end">Km de fin</string>
|
||||||
<string name="hour_start">Hora de inicio</string>
|
<string name="hour_start">Hora de inicio</string>
|
||||||
<string name="hour_end">Hora de fin</string>
|
<string name="hour_end">Hora de fin</string>
|
||||||
|
@ -643,6 +645,7 @@
|
||||||
<string name="listInventoryEmpty">La lista del inventario está vacía</string>
|
<string name="listInventoryEmpty">La lista del inventario está vacía</string>
|
||||||
<string name="sureSign">¿Estás seguro de firmar?</string>
|
<string name="sureSign">¿Estás seguro de firmar?</string>
|
||||||
<string name="locationDiferent">La última posición \nobtenida es distinta \na la actual. ¿Quieres modificar la posición o mantener la registrada?</string>
|
<string name="locationDiferent">La última posición \nobtenida es distinta \na la actual. ¿Quieres modificar la posición o mantener la registrada?</string>
|
||||||
|
<string name="distance">Distancia al último punto en que se firmó la descarga en metros:</string>
|
||||||
<string name="keep">Mantener</string>
|
<string name="keep">Mantener</string>
|
||||||
<string name="sign">Firmar tickets</string>
|
<string name="sign">Firmar tickets</string>
|
||||||
<string name="signCmr">Firmar CMR</string>
|
<string name="signCmr">Firmar CMR</string>
|
||||||
|
@ -652,6 +655,9 @@
|
||||||
<string name="signed">Ver firmados</string>
|
<string name="signed">Ver firmados</string>
|
||||||
<string name="offline">Offline</string>
|
<string name="offline">Offline</string>
|
||||||
<string name="no_phones">No hay teléfonos</string>
|
<string name="no_phones">No hay teléfonos</string>
|
||||||
|
<string name="permissionRequired">Permiso de Ubicación Requerido</string>
|
||||||
|
<string name="advicePermission">Para usar esta aplicación, debes otorgar permisos de ubicación.</string>
|
||||||
|
<string name="manuallyPermission">Habilita manualmente el permiso de ubicación.</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -232,7 +232,7 @@
|
||||||
<string name="scanItem">Escanear artículo</string>
|
<string name="scanItem">Escanear artículo</string>
|
||||||
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
||||||
<string name="errorOperation">Error al realizar la operación</string>
|
<string name="errorOperation">Error al realizar la operación</string>
|
||||||
<string name="scanLabelExpedition">Escanea expedición.</string>
|
<string name="scanLabelExpedition">Escanea expedición</string>
|
||||||
<string name="buffer">Buffer:</string>
|
<string name="buffer">Buffer:</string>
|
||||||
<string name="packingSave">Packing guardado</string>
|
<string name="packingSave">Packing guardado</string>
|
||||||
<string name="previousCollected">Previa recogida</string>
|
<string name="previousCollected">Previa recogida</string>
|
||||||
|
@ -624,9 +624,11 @@
|
||||||
<string name="sin_internet">NO INTERNET</string>
|
<string name="sin_internet">NO INTERNET</string>
|
||||||
<string name="deliveryApp">Assurez-vous que l\'application de livraison est installée</string>
|
<string name="deliveryApp">Assurez-vous que l\'application de livraison est installée</string>
|
||||||
<string name="phones">Téléphone</string>
|
<string name="phones">Téléphone</string>
|
||||||
|
<string name="phone">Téléphone</string>
|
||||||
<string name="km">Kilomètres</string>
|
<string name="km">Kilomètres</string>
|
||||||
<string name="hours">Heures</string>
|
<string name="hours">Heures</string>
|
||||||
<string name="km_init">Kilométrage de départ</string>
|
<string name="km_init">Kilométrage de départ</string>
|
||||||
|
<string name="comercial">Comercial</string>
|
||||||
<string name="km_end">Kilométrage de fin</string>
|
<string name="km_end">Kilométrage de fin</string>
|
||||||
<string name="hour_start">Heure de départ</string>
|
<string name="hour_start">Heure de départ</string>
|
||||||
<string name="hour_end">Heure de fin</string>
|
<string name="hour_end">Heure de fin</string>
|
||||||
|
@ -643,6 +645,7 @@
|
||||||
<string name="listInventoryEmpty">La lista del inventario está vacía</string>
|
<string name="listInventoryEmpty">La lista del inventario está vacía</string>
|
||||||
<string name="sureSign">Êtes-vous sûr de vouloir signer ?</string>
|
<string name="sureSign">Êtes-vous sûr de vouloir signer ?</string>
|
||||||
<string name="locationDiferent">La dernière position obtenue est différente de la position actuelle. Voulez-vous modifier la position ou la conserver enregistrée?</string>
|
<string name="locationDiferent">La dernière position obtenue est différente de la position actuelle. Voulez-vous modifier la position ou la conserver enregistrée?</string>
|
||||||
|
<string name="distance">Distance jusqu\'au dernier point où la livraison a été signée en mètres :</string>
|
||||||
<string name="keep">Maintenir</string>
|
<string name="keep">Maintenir</string>
|
||||||
<string name="sign">Signature tickets</string>
|
<string name="sign">Signature tickets</string>
|
||||||
<string name="signCmr">Signature CMR</string>
|
<string name="signCmr">Signature CMR</string>
|
||||||
|
@ -652,5 +655,8 @@
|
||||||
<string name="signed">Voir les tickets signés</string>
|
<string name="signed">Voir les tickets signés</string>
|
||||||
<string name="offline">Offline</string>
|
<string name="offline">Offline</string>
|
||||||
<string name="no_phones">Téléphone absent</string>
|
<string name="no_phones">Téléphone absent</string>
|
||||||
|
<string name="permissionRequired">Permission de Localisation Requise</string>
|
||||||
|
<string name="advicePermission">Pour utiliser cette application, vous devez accorder des autorisations de localisation.</string>
|
||||||
|
<string name="manuallyPermission">Activez manuellement l\'autorisation de localisation.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -232,7 +232,7 @@
|
||||||
<string name="scanItem">Escanear artículo</string>
|
<string name="scanItem">Escanear artículo</string>
|
||||||
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
|
||||||
<string name="errorOperation">Error al realizar la operación</string>
|
<string name="errorOperation">Error al realizar la operación</string>
|
||||||
<string name="scanLabelExpedition">Escanea expedición.</string>
|
<string name="scanLabelExpedition">Escanea expedición</string>
|
||||||
<string name="buffer">Buffer:</string>
|
<string name="buffer">Buffer:</string>
|
||||||
<string name="packingSave">Packing guardado</string>
|
<string name="packingSave">Packing guardado</string>
|
||||||
<string name="previousCollected">Previa recogida</string>
|
<string name="previousCollected">Previa recogida</string>
|
||||||
|
@ -624,9 +624,11 @@
|
||||||
<string name="sin_internet">NO INTERNET</string>
|
<string name="sin_internet">NO INTERNET</string>
|
||||||
<string name="deliveryApp">Certifique-se de ter o aplicativo de entrega instalado</string>
|
<string name="deliveryApp">Certifique-se de ter o aplicativo de entrega instalado</string>
|
||||||
<string name="phones">Telefone</string>
|
<string name="phones">Telefone</string>
|
||||||
|
<string name="phone">Telefone</string>
|
||||||
<string name="km">Kilometros</string>
|
<string name="km">Kilometros</string>
|
||||||
<string name="hours">Horas</string>
|
<string name="hours">Horas</string>
|
||||||
<string name="km_init">Km de inicio</string>
|
<string name="km_init">Km de inicio</string>
|
||||||
|
<string name="comercial">Comercial</string>
|
||||||
<string name="km_end">Km fim</string>
|
<string name="km_end">Km fim</string>
|
||||||
<string name="hour_start">Hora de inicio</string>
|
<string name="hour_start">Hora de inicio</string>
|
||||||
<string name="hour_end">Hora fim</string>
|
<string name="hour_end">Hora fim</string>
|
||||||
|
@ -643,6 +645,7 @@
|
||||||
<string name="listInventoryEmpty">La lista del inventario está vacía</string>
|
<string name="listInventoryEmpty">La lista del inventario está vacía</string>
|
||||||
<string name="sureSign">Tens certeza que queres assinar?</string>
|
<string name="sureSign">Tens certeza que queres assinar?</string>
|
||||||
<string name="locationDiferent">A última posição obtida é diferente à atual. Queres modificar a posição ou manter a registrada?</string>
|
<string name="locationDiferent">A última posição obtida é diferente à atual. Queres modificar a posição ou manter a registrada?</string>
|
||||||
|
<string name="distance">Distancia ao último ponto em que se assinou a descarga em metros:</string>
|
||||||
<string name="keep">Manter</string>
|
<string name="keep">Manter</string>
|
||||||
<string name="sign">Assinatura tickets</string>
|
<string name="sign">Assinatura tickets</string>
|
||||||
<string name="signCmr">Assinatura CMR</string>
|
<string name="signCmr">Assinatura CMR</string>
|
||||||
|
@ -652,5 +655,8 @@
|
||||||
<string name="signed">Ver assinados</string>
|
<string name="signed">Ver assinados</string>
|
||||||
<string name="offline">Offline</string>
|
<string name="offline">Offline</string>
|
||||||
<string name="no_phones">No telefone</string>
|
<string name="no_phones">No telefone</string>
|
||||||
|
<string name="permissionRequired">Permissão de Localização Necessária</string>
|
||||||
|
<string name="advicePermission">Para usar este aplicativo, você deve conceder permissões de localização.</string>
|
||||||
|
<string name="manuallyPermission">Habilite manualmente a permissão de localização.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -623,9 +623,11 @@
|
||||||
<string name="sin_internet">NO INTERNET</string>
|
<string name="sin_internet">NO INTERNET</string>
|
||||||
<string name="deliveryApp">Make sure you have the delivery app installed</string>
|
<string name="deliveryApp">Make sure you have the delivery app installed</string>
|
||||||
<string name="phones">Phones</string>
|
<string name="phones">Phones</string>
|
||||||
|
<string name="phone">Phone</string>
|
||||||
<string name="km">Kilometers</string>
|
<string name="km">Kilometers</string>
|
||||||
<string name="hours">Hours</string>
|
<string name="hours">Hours</string>
|
||||||
<string name="km_init">Start km</string>
|
<string name="km_init">Start km</string>
|
||||||
|
<string name="comercial">Sales person</string>
|
||||||
<string name="km_end">Finish km</string>
|
<string name="km_end">Finish km</string>
|
||||||
<string name="hour_start">Start hour</string>
|
<string name="hour_start">Start hour</string>
|
||||||
<string name="hour_end">Finish hour</string>
|
<string name="hour_end">Finish hour</string>
|
||||||
|
@ -651,5 +653,9 @@
|
||||||
<string name="signed">Show signed tickets</string>
|
<string name="signed">Show signed tickets</string>
|
||||||
<string name="offline">App Offline</string>
|
<string name="offline">App Offline</string>
|
||||||
<string name="no_phones">Not phones</string>
|
<string name="no_phones">Not phones</string>
|
||||||
|
<string name="distance">Distance to the last point signed:</string>
|
||||||
|
<string name="permissionRequired">Location Permission Required</string>
|
||||||
|
<string name="advicePermission">To use this application, you must grant location permissions.</string>
|
||||||
|
<string name="manuallyPermission">Manually Enable Location Permission.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue