feat: refs#8300 crashlyticsReview
This commit is contained in:
parent
ab262dc328
commit
568c3e687b
|
@ -15,8 +15,8 @@ android {
|
|||
applicationId = "es.verdnatura"
|
||||
minSdk = 26
|
||||
targetSdk = 33 // se deja con target si no Play Protect la bloquea
|
||||
versionCode = 374
|
||||
versionName = "24.51"
|
||||
versionCode = 393 //JAF en informatica
|
||||
versionName = "25.0"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,14 @@ android {
|
|||
}
|
||||
create("general") {}
|
||||
}
|
||||
kapt {
|
||||
correctErrorTypes = true
|
||||
useBuildCache = true
|
||||
|
||||
kotlinOptions {
|
||||
languageVersion = "1.9"
|
||||
}
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
//compose = true
|
||||
|
@ -102,7 +109,9 @@ android {
|
|||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.recyclerview)
|
||||
implementation(libs.androidx.room.ktx)
|
||||
kapt(libs.androidx.room.compiler)
|
||||
//kapt(libs.androidx.room.compiler)
|
||||
ksp(libs.androidx.room.compiler)
|
||||
implementation(libs.androidx.room.runtime)
|
||||
implementation(libs.ink)
|
||||
implementation(libs.kotlin.stdlib.jdk7)
|
||||
implementation(libs.androidx.appcompat)
|
||||
|
|
|
@ -6,6 +6,7 @@ import androidx.room.Database
|
|||
import androidx.room.Delete
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.ProvidedTypeConverter
|
||||
import androidx.room.Query
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
|
@ -46,7 +47,10 @@ abstract class DeliveryDatabase : RoomDatabase() {
|
|||
return INSTANCE ?: synchronized(this) {
|
||||
val instance = Room.databaseBuilder(
|
||||
context.applicationContext, DeliveryDatabase::class.java, "expedition_database"
|
||||
).fallbackToDestructiveMigration().build()
|
||||
).fallbackToDestructiveMigration(true)
|
||||
.addTypeConverter(MapTypeConverter())
|
||||
.fallbackToDestructiveMigration(true)
|
||||
.build()
|
||||
INSTANCE = instance
|
||||
instance
|
||||
}
|
||||
|
@ -113,7 +117,7 @@ interface RoutesDao {
|
|||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertLoaded(routeLoaded: RouteLoaded)
|
||||
|
||||
|
||||
@Query("DELETE FROM routes WHERE dated != :today")
|
||||
suspend fun deleteLoaded(today: String)
|
||||
|
||||
|
@ -135,6 +139,7 @@ interface ClientTicketDao {
|
|||
|
||||
}
|
||||
|
||||
@ProvidedTypeConverter
|
||||
class MapTypeConverter {
|
||||
private val gson = Gson()
|
||||
|
||||
|
@ -182,13 +187,24 @@ class MapTypeConverter {
|
|||
}
|
||||
|
||||
@TypeConverter
|
||||
fun fromTickets(tickets: MutableList<Ticket?>): String? {
|
||||
fun fromTickets(tickets: MutableList<Ticket>): String? {
|
||||
return gson.toJson(tickets)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toTickets(json: String?): MutableList<Ticket?> {
|
||||
fun toTickets(json: String?): MutableList<Ticket> {
|
||||
val type = object : TypeToken<MutableList<Ticket>>() {}.type
|
||||
return gson.fromJson(json, type)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun fromNullableMap(map: MutableMap<String?, String?>): String {
|
||||
return gson.toJson(map)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toNullableMap(json: String): MutableMap<String?, String?> {
|
||||
val type = object : TypeToken<MutableMap<String?, String?>>() {}.type
|
||||
return gson.fromJson(json, type)
|
||||
}
|
||||
}
|
|
@ -70,6 +70,8 @@ object ConstAndValues {
|
|||
const val LIMITRECORDSSHELVINGLOG = 50
|
||||
const val RESERVATIONMODE = "operatorReservationMode"
|
||||
const val MODELWORKERTYPEACTIVITY = "APP"
|
||||
const val FLINGTHRESHOLDVELOCITY = 2000f
|
||||
const val FLINGTHRESHOLDVERTICAL = 500f
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Build
|
||||
import android.text.Html
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.EditText
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
|
@ -41,30 +43,37 @@ fun Any.toast(
|
|||
Html.fromHtml("<font color='$color' ><b>$this</b></font>", 0),
|
||||
duration
|
||||
)
|
||||
//toast2.setGravity(Gravity.TOP, 0, 0)
|
||||
toast.show()
|
||||
return toast.apply { show() }
|
||||
}
|
||||
|
||||
fun Context.showToastCenterWithBackground(textToShow: String) {
|
||||
val inflater = LayoutInflater.from(this)
|
||||
val layout = inflater.inflate(R.layout.ticket_toast_layout, null)
|
||||
val text = layout.findViewById<TextView>(R.id.toast_text)
|
||||
text.text = "$textToShow"
|
||||
text.setTextColor(this.getColor(R.color.verdnatura_orange_salix))
|
||||
text.textSize = 22f
|
||||
(this as? Activity)?.window?.decorView?.let { rootView ->
|
||||
TextView(this).apply {
|
||||
text = textToShow
|
||||
setTextColor(getColor(R.color.verdnatura_orange_salix))
|
||||
textSize = 22f
|
||||
gravity = Gravity.CENTER
|
||||
setPadding(32, 16, 32, 16)
|
||||
background = GradientDrawable().apply {
|
||||
setColor(Color.BLACK)
|
||||
cornerRadius = 16f
|
||||
alpha = 220
|
||||
}
|
||||
layoutParams = FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
).apply { gravity = Gravity.CENTER }
|
||||
alpha = 0f
|
||||
|
||||
val background = GradientDrawable().apply {
|
||||
setColor(Color.parseColor("#000000"))
|
||||
cornerRadius = 16f
|
||||
}
|
||||
layout.background = background
|
||||
(rootView as ViewGroup).addView(this)
|
||||
|
||||
Toast(this).apply {
|
||||
duration = Toast.LENGTH_LONG
|
||||
view = layout
|
||||
setGravity(Gravity.CENTER, 0, 0)
|
||||
show()
|
||||
animate().alpha(1f).setDuration(300).withEndAction {
|
||||
animate().alpha(0f).setStartDelay(1000).setDuration(300)
|
||||
.withEndAction { (rootView).removeView(this) }
|
||||
.start()
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
|||
import es.verdnatura.presentation.view.feature.articulo.model.ItemDetails
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
||||
import es.verdnatura.presentation.view.feature.calidad.model.Buyer
|
||||
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
||||
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.model.Reubication
|
||||
|
@ -36,9 +36,7 @@ import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
|||
import es.verdnatura.presentation.view.feature.delivery.model.TicketObservation
|
||||
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
|
||||
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
|
||||
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
|
||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
||||
import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalix
|
||||
|
@ -415,6 +413,11 @@ interface SalixService {
|
|||
fun collectionAssigned(
|
||||
): Call<Int>
|
||||
|
||||
@GET("ItemShelvings")
|
||||
fun itemShelvingsGet(
|
||||
@Query("filter") filter: String
|
||||
): Call<List<ItemShelvings>>
|
||||
|
||||
@POST("ItemShelvings/updateFromSale")
|
||||
fun itemShelvingUpdateFromSale(
|
||||
@Body params: Any
|
||||
|
@ -435,16 +438,6 @@ interface SalixService {
|
|||
@Body params: Any
|
||||
): Call<Any>
|
||||
|
||||
@POST("MachineWorkers/updateInTime")
|
||||
fun machineWorkerUpdateInTime(
|
||||
@Body params: Any
|
||||
): Call<Any>
|
||||
|
||||
@POST("MachineWorkers/add")
|
||||
fun machineWorkerAdd(
|
||||
@Query("plate") plate: Any
|
||||
): Call<Any>
|
||||
|
||||
@POST("SaleTrackings/updateTracking")
|
||||
fun saleTrackingUpdate(
|
||||
@Body params: Any
|
||||
|
@ -481,11 +474,6 @@ interface SalixService {
|
|||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
): Call<List<PlacementSupplyVO>>
|
||||
|
||||
@POST("Applications/machineWorker_getHistorical/execute-proc")
|
||||
fun machineWorkerGetHistorical(
|
||||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
): Call<List<ItemHistoricoVehiculo>>
|
||||
|
||||
@POST("Applications/expedition_getFromRoute/execute-proc")
|
||||
fun expeditionGetFromRoute(
|
||||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
|
@ -531,18 +519,6 @@ interface SalixService {
|
|||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
): Call<Any>
|
||||
|
||||
@GET("ItemShelvings/getListItemNewer")
|
||||
fun getListItemNewer(
|
||||
@Query("shelvingFk") shelvingFkIn: Any, @Query("parking") parking: Any? = null
|
||||
): Call<List<ItemShelvingNewer>>
|
||||
|
||||
@GET("ItemShelvings/getListItemNewer")
|
||||
fun getListItemNewerNew(
|
||||
@Query("shelvingFk") shelvingFkIn: Any,
|
||||
@Query("parking") parking: Any? = null,
|
||||
@Query("itemFk") itemFk: Any? = null
|
||||
): Call<List<ItemShelvingNewer>>
|
||||
|
||||
@GET("ItemShelvings/getItemsByReviewOrder")
|
||||
fun getItemsByReviewOrder(
|
||||
@Query("shelving") shelvingFkIn: Any,
|
||||
|
@ -565,11 +541,6 @@ interface SalixService {
|
|||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
): Call<Any>
|
||||
|
||||
/* @POST("Applications/machine_getWorkerPlate/execute-proc")
|
||||
fun machineGetWorkerPlate(
|
||||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
): Call<List<JsonObject>>*/
|
||||
|
||||
@POST("Applications/sectorCollection_get/execute-proc")
|
||||
fun sectorCollectionGet(
|
||||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
|
@ -640,11 +611,6 @@ interface SalixService {
|
|||
@Query("filter") filter: Any, @Query("schema") schema: String = "vn"
|
||||
): Call<List<TicketPickupResponse>>
|
||||
|
||||
@POST("Applications/workerMachinery_isRegistered/execute-func")
|
||||
fun workerMachineryIsRegistered(
|
||||
@Query("params") params: Any, @Query("schema") schema: String = "vn"
|
||||
): Call<String>
|
||||
|
||||
@POST("Applications/ticket_printLabelPrevious/execute-proc")
|
||||
fun ticketPrintLabelPrevious(
|
||||
@Query("params") params: Any, @Query("schema") schema: String = "vn"
|
||||
|
@ -712,17 +678,6 @@ interface SalixService {
|
|||
@Query("params") params: Any,
|
||||
): Call<Any>
|
||||
|
||||
@GET("ItemShelvingLogs")
|
||||
fun itemShelvingLogGet(
|
||||
@Query("filter") filter: String,
|
||||
): Call<List<ItemShelvingLog>>
|
||||
|
||||
@POST("Applications/itemshelving_getInfo/execute-proc")
|
||||
fun itemshelvingGetInfo(
|
||||
@Query("schema") schema: String = "vn",
|
||||
@Query("params") params: Any,
|
||||
): Call<List<ItemLocationVO>>
|
||||
|
||||
@POST("Applications/itemShelving_get/execute-proc")
|
||||
fun itemShelvingListNew(
|
||||
@Query("schema") schema: String = "vn",
|
||||
|
|
|
@ -17,6 +17,7 @@ import es.verdnatura.MobileApplication
|
|||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ToolbarFragmentBinding
|
||||
import es.verdnatura.db.DeliveryDatabase
|
||||
import es.verdnatura.db.MapTypeConverter
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import kotlin.reflect.KClass
|
||||
|
@ -170,7 +171,8 @@ fun database(myContext: Context): DeliveryDatabase {
|
|||
return Room.databaseBuilder(
|
||||
myContext,
|
||||
DeliveryDatabase::class.java, "expediciones.db"
|
||||
).build()
|
||||
).addTypeConverter(MapTypeConverter())
|
||||
.build()
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import android.os.Build
|
|||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.text.InputType
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
|
@ -169,7 +168,7 @@ fun Context.hideKeyboard(view: View) {
|
|||
|
||||
fun Context.showKeyboard() {
|
||||
val imm = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager?
|
||||
imm!!.toggleSoftInput(InputType.TYPE_CLASS_NUMBER, 0)
|
||||
imm!!.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package es.verdnatura.presentation.view.commom
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.print.PrintAttributes
|
||||
import android.print.PrintManager
|
||||
import android.view.GestureDetector
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.VelocityTracker
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebChromeClient
|
||||
|
@ -18,12 +15,13 @@ import android.webkit.WebViewClient
|
|||
import android.widget.ImageView
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.OnBackPressedDispatcher
|
||||
import androidx.core.view.GestureDetectorCompat
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentWebBinding
|
||||
import es.verdnatura.domain.ConstAndValues.FLINGTHRESHOLDVELOCITY
|
||||
import es.verdnatura.domain.ConstAndValues.FLINGTHRESHOLDVERTICAL
|
||||
import es.verdnatura.presentation.common.OnBackPressedListener
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||
|
@ -32,15 +30,14 @@ import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
|||
import org.json.JSONObject
|
||||
import kotlin.math.abs
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
class WebFragment(
|
||||
var entryPoint: String = ""
|
||||
) : Fragment(), OnBackPressedListener {
|
||||
private lateinit var gestureDetector: GestureDetectorCompat
|
||||
fun getLayoutId(): Int = R.layout.fragment_web
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private lateinit var backDispatcher: OnBackPressedDispatcher
|
||||
private lateinit var binding: FragmentWebBinding
|
||||
private var velocityTracker: VelocityTracker? = null
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = WebFragment(entryPoint)
|
||||
|
@ -50,7 +47,6 @@ class WebFragment(
|
|||
customDialog = CustomDialog(requireContext())
|
||||
setToolbar()
|
||||
setWeb()
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
|
@ -63,7 +59,6 @@ class WebFragment(
|
|||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner,
|
||||
|
@ -76,57 +71,69 @@ class WebFragment(
|
|||
}
|
||||
})
|
||||
|
||||
gestureDetector = GestureDetectorCompat(requireActivity(),
|
||||
object : GestureDetector.SimpleOnGestureListener() {
|
||||
override fun onFling(
|
||||
e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float
|
||||
): Boolean {
|
||||
val deltaX = (e2.x - e1?.x!!)
|
||||
val deltaY = (e2.y - e1.y)
|
||||
val deltaAbsX = abs(deltaX)
|
||||
val deltaAbsY = abs(deltaY)
|
||||
if (deltaAbsX > deltaAbsY) {
|
||||
if (velocityX > 2000 && velocityY < 500 && velocityY >= 0) {
|
||||
|
||||
binding.webView.goBack()
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return false
|
||||
}
|
||||
})
|
||||
init()
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility", "SetJavaScriptEnabled")
|
||||
@SuppressLint("ClickableViewAccessibility", "javaScriptEnabled")
|
||||
private fun setWeb() {
|
||||
binding.webView.apply {
|
||||
webChromeClient = WebChromeClient()
|
||||
|
||||
binding.webView.webChromeClient = WebChromeClient(
|
||||
settings.apply {
|
||||
javaScriptEnabled = true
|
||||
domStorageEnabled = true
|
||||
loadWithOverviewMode = true
|
||||
useWideViewPort = true
|
||||
builtInZoomControls = true
|
||||
displayZoomControls = false
|
||||
setSupportZoom(true)
|
||||
allowFileAccess = true
|
||||
}
|
||||
|
||||
)
|
||||
setOnTouchListener { _, event ->
|
||||
when (event.actionMasked) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
velocityTracker?.clear()
|
||||
velocityTracker = velocityTracker ?: VelocityTracker.obtain()
|
||||
velocityTracker?.addMovement(event)
|
||||
}
|
||||
|
||||
val webSettings = binding.webView.settings
|
||||
webSettings.javaScriptEnabled = true
|
||||
webSettings.domStorageEnabled = true
|
||||
webSettings.loadWithOverviewMode = true
|
||||
webSettings.useWideViewPort = true
|
||||
webSettings.builtInZoomControls = true
|
||||
webSettings.displayZoomControls = false
|
||||
webSettings.setSupportZoom(true)
|
||||
webSettings.allowFileAccess = true
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
velocityTracker?.addMovement(event)
|
||||
}
|
||||
|
||||
binding.webView.setOnTouchListener { v, event ->
|
||||
gestureDetector.onTouchEvent(event)
|
||||
}
|
||||
binding.webView.webViewClient = object : WebViewClient() {
|
||||
override fun shouldOverrideUrlLoading(
|
||||
view: WebView?, request: WebResourceRequest?
|
||||
): Boolean {
|
||||
binding.webView.loadUrl(request?.url.toString())
|
||||
return true
|
||||
MotionEvent.ACTION_UP -> {
|
||||
velocityTracker?.let { tracker ->
|
||||
tracker.computeCurrentVelocity(1000) // velocidad en píxeles por segundo
|
||||
val velocityX = tracker.xVelocity
|
||||
val velocityY = abs(tracker.yVelocity)
|
||||
|
||||
if (velocityX > FLINGTHRESHOLDVELOCITY &&
|
||||
velocityY < FLINGTHRESHOLDVERTICAL
|
||||
) {
|
||||
binding.webView.goBack()
|
||||
return@setOnTouchListener true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_CANCEL -> {
|
||||
velocityTracker?.recycle()
|
||||
velocityTracker = null
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
webViewClient = object : WebViewClient() {
|
||||
override fun shouldOverrideUrlLoading(
|
||||
view: WebView?,
|
||||
request: WebResourceRequest?
|
||||
): Boolean {
|
||||
request?.url?.toString()?.let { loadUrl(it) }
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,63 +142,33 @@ class WebFragment(
|
|||
}
|
||||
|
||||
private fun setToolbar() {
|
||||
|
||||
binding.mainToolbar.toolbarTitle.text = buildString {
|
||||
append(getString(R.string.item))
|
||||
append(JSONObject(entryPoint).get("entryPoint").toString())
|
||||
}
|
||||
|
||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||
val iconPrint = ImageView(context)
|
||||
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
|
||||
iconPrint.tooltipText = getString(R.string.print)
|
||||
|
||||
binding.mainToolbar.toolbarIcons.adapter =
|
||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
|
||||
when (item) {
|
||||
iconPrint.drawable -> createWebPrintJob(binding.webView)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
|
||||
}
|
||||
|
||||
private fun createWebPrintJob(webView: WebView) {
|
||||
|
||||
// Get a PrintManager instance
|
||||
(activity?.getSystemService(Context.PRINT_SERVICE) as? PrintManager)?.let { printManager ->
|
||||
|
||||
val jobName = "${getString(R.string.app_name)} Document"
|
||||
|
||||
// Get a print adapter instance
|
||||
val printAdapter = webView.createPrintDocumentAdapter(jobName)
|
||||
|
||||
// Create a print job with name and adapter instance
|
||||
printManager.print(
|
||||
jobName, printAdapter, PrintAttributes.Builder().build()
|
||||
).also { printJob ->
|
||||
println("job printed")
|
||||
// Save the job object for later status checking
|
||||
// printJobs += printJob
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBackPressedHandled(): Boolean {
|
||||
|
||||
if (binding.webView.canGoBack()) {
|
||||
binding.webView.goBack()
|
||||
} else {
|
||||
(context as MainActivity).onMyBackPressed()
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
velocityTracker?.recycle()
|
||||
velocityTracker = null
|
||||
}
|
||||
}
|
|
@ -100,15 +100,15 @@ class CustomDialogInput(context: Context) : Dialog(context, R.style.DialogTheme)
|
|||
fun setFocusText() {
|
||||
binding.customDialogValue.requestFocus()
|
||||
}
|
||||
|
||||
fun setFocusTextTwo() {
|
||||
binding.customDialogValueTwo.requestFocus()
|
||||
}
|
||||
|
||||
fun plusTextButton(view: View) {
|
||||
private fun plusTextButton(view: View) {
|
||||
|
||||
var sum = 0
|
||||
try {
|
||||
sum = getValue().toInt() + Integer.parseInt(view.tag.toString())
|
||||
val sum = getValue().toInt() + Integer.parseInt(view.tag.toString())
|
||||
setValue(sum.toString())
|
||||
} catch (ex: Exception) {
|
||||
setValue(view.tag.toString())
|
||||
|
|
|
@ -503,8 +503,4 @@ class SaleAdapter(
|
|||
notifyDataSetChanged() // Notifica al adaptador que los datos han cambiado
|
||||
}
|
||||
|
||||
fun orderSales(newSales: List<SaleVO>) {
|
||||
|
||||
notifyDataSetChanged() // Notifica al adaptador que los datos han cambiado
|
||||
}
|
||||
}
|
|
@ -5,9 +5,9 @@ import es.verdnatura.R
|
|||
import es.verdnatura.presentation.common.convertToDateString
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
|
||||
fun CollectionVO.map(context: Context): CollectionVO {
|
||||
try {
|
||||
|
@ -86,17 +86,8 @@ fun CollectionTicket.map(context: Context): CollectionTicket {
|
|||
}
|
||||
|
||||
private fun getCalendarFromDate(date: String, context: Context): Calendar {
|
||||
val sdf = SimpleDateFormat(context.getString(R.string.dateFormat))
|
||||
val sdf = SimpleDateFormat(context.getString(R.string.dateFormat), Locale.getDefault())
|
||||
val cal = Calendar.getInstance()
|
||||
cal.time = sdf.parse(date)!!
|
||||
return cal
|
||||
}
|
||||
|
||||
// para cuando se pase a Salix el modelo
|
||||
//Tarea 5134
|
||||
fun PlacementSupplyVO.proposal(context: Context): PlacementSupplyVO {
|
||||
try {
|
||||
} catch (ex: Exception) {
|
||||
}
|
||||
return this
|
||||
}
|
|
@ -273,7 +273,7 @@ class LoadUnloadFragment(
|
|||
ma.onMyBackPressed()
|
||||
}
|
||||
|
||||
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||
binding.scanInput.setOnEditorActionListener { _, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == EditorInfo.IME_ACTION_NEXT) {
|
||||
|
||||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
package es.verdnatura.presentation.view.feature.indoor
|
||||
|
||||
import android.Manifest
|
||||
import android.content.pm.PackageManager
|
||||
import android.location.Location
|
||||
import android.location.LocationListener
|
||||
import android.location.LocationManager
|
||||
import android.os.Bundle
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import es.verdnatura.R
|
||||
|
||||
class MainActivityIndoor : AppCompatActivity(), LocationListener {
|
||||
|
||||
private lateinit var locationManager: LocationManager
|
||||
private lateinit var textView: TextView
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.indoor_activity_main)
|
||||
|
||||
textView = findViewById(R.id.textViewLocation)
|
||||
|
||||
locationManager = getSystemService(LOCATION_SERVICE) as LocationManager
|
||||
|
||||
// Verificar permisos
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
|
||||
!= PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION), 1
|
||||
)
|
||||
} else {
|
||||
startLocationUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
private fun startLocationUpdates() {
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
|
||||
== PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
|
||||
locationManager.requestLocationUpdates(
|
||||
LocationManager.NETWORK_PROVIDER,
|
||||
5000, // Tiempo mínimo de actualización (5 segundos)
|
||||
10f, // Distancia mínima de actualización (10 metros)
|
||||
this
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: Location) {
|
||||
val latitude = location.latitude
|
||||
val longitude = location.longitude
|
||||
textView.text = "Lat: $latitude\nLon: $longitude"
|
||||
println(" $latitude:$longitude")
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<out String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (requestCode == 1 && grantResults.isNotEmpty()
|
||||
&& grantResults[0] == PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
startLocationUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) {}
|
||||
|
||||
override fun onProviderEnabled(provider: String) {}
|
||||
|
||||
override fun onProviderDisabled(provider: String) {}
|
||||
}
|
|
@ -44,7 +44,7 @@ class InventaryFragment :
|
|||
private lateinit var itemClicked: ItemInventaryVO
|
||||
private var buyerId: Number = -1
|
||||
private var filterItemType: String? = null
|
||||
private var myListBuyers = listOf<Buyer>()
|
||||
private var myListBuyers = mutableListOf<Buyer>()
|
||||
|
||||
companion object {
|
||||
fun newInstance() = InventaryFragment()
|
||||
|
@ -82,6 +82,7 @@ class InventaryFragment :
|
|||
}
|
||||
.distinct()
|
||||
.sortedBy { it.name }
|
||||
|
||||
setSearchable(distinctPackingTypes as MutableList<NameWithId>)
|
||||
binding.searchableRecyclerView.visibility = View.VISIBLE
|
||||
binding.searchableRecyclerView.setSearchHint(getString(R.string.BuyerSearch))
|
||||
|
@ -235,11 +236,11 @@ class InventaryFragment :
|
|||
with(viewModel) {
|
||||
|
||||
buyersByItemPackingList.observe(viewLifecycleOwner) { list ->
|
||||
myListBuyers = list.list
|
||||
myListBuyers = list.list.toMutableList()
|
||||
val distinctPackingTypes =
|
||||
list?.list?.map {
|
||||
NameWithId(
|
||||
1, it.itemPackingTypeFk ?: getString(R.string.allText)
|
||||
1, it.itemPackingTypeFk.ifEmpty { getString(R.string.allText) }
|
||||
)
|
||||
}
|
||||
?.distinct()
|
||||
|
|
|
@ -365,7 +365,7 @@ class EndSacadorFragment(
|
|||
responseCode.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
if (!goBack2) {
|
||||
if (it==null) {
|
||||
if (it == null) {
|
||||
customDialog.setTitle(getString(R.string.error))
|
||||
.setDescription(getString(R.string.itemNotValid))
|
||||
.setKoButton(getString(R.string.close)) {
|
||||
|
@ -609,7 +609,6 @@ class EndSacadorFragment(
|
|||
|
||||
private fun findSale(txtscan: String, position: Int) {
|
||||
var index = 0
|
||||
var isBreak = false
|
||||
var isOk = false
|
||||
|
||||
val saleVO = sales[position]
|
||||
|
@ -622,7 +621,6 @@ class EndSacadorFragment(
|
|||
if (mpok != null) mpok!!.start()
|
||||
isOk = true
|
||||
showShelving(position, shelvingIndex)
|
||||
isBreak = true
|
||||
break
|
||||
}
|
||||
shelvingIndex += 1
|
||||
|
@ -1005,11 +1003,10 @@ class EndSacadorFragment(
|
|||
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
|
||||
scanRequest()
|
||||
customDialogThreeButtons.dismiss()
|
||||
}catch (_:Exception){
|
||||
} catch (_: Exception) {
|
||||
getString(R.string.errorInput).toast(requireContext())
|
||||
}
|
||||
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
scanRequest()
|
||||
customDialogThreeButtons.dismiss()
|
||||
|
|
|
@ -2,6 +2,7 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.text.InputType
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
|
@ -22,9 +23,7 @@ import es.verdnatura.presentation.view.component.CustomDialogInput
|
|||
import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapter
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
|
||||
class SacadorFragment(
|
||||
var type: String
|
||||
) :
|
||||
class SacadorFragment :
|
||||
BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
|
||||
|
||||
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
||||
|
@ -34,9 +33,16 @@ class SacadorFragment(
|
|||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private var collectionsList: ArrayList<CollectionVO> = ArrayList()
|
||||
private var adapter: CollectionAdapter? = null
|
||||
private var type: String = ""
|
||||
|
||||
companion object {
|
||||
fun newInstance(type: String) = SacadorFragment(type)
|
||||
private const val ARG_TYPE = "arg_type"
|
||||
|
||||
fun newInstance(type: String) = SacadorFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(ARG_TYPE, type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
|
@ -44,6 +50,11 @@ class SacadorFragment(
|
|||
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
type = arguments?.getString(ARG_TYPE) ?: ""
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_sacador
|
||||
|
||||
override fun init() {
|
||||
|
@ -130,7 +141,7 @@ class SacadorFragment(
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
iconPrint.drawable -> {
|
||||
showPrintPrevious()
|
||||
}
|
||||
|
|
|
@ -1212,7 +1212,7 @@ class UbicadorFragment : BaseFragment<FragmentUbicadorBinding, UbicadorViewModel
|
|||
customDialogTwoButtons.dismiss()
|
||||
} else {
|
||||
printItem(
|
||||
item.buyFk!!, labelType, packing, copies
|
||||
item.buyFk, labelType, packing, copies
|
||||
)
|
||||
customDialogTwoButtons.dismiss()
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
Action.PARKINEAR -> setParking(shelving, parking!!)
|
||||
Action.TRANSFERIR -> {
|
||||
|
||||
itemShelvingTransfer(itemShelvingFk!!, shelving!!)
|
||||
itemShelvingTransfer(itemShelvingFk!!, shelving)
|
||||
}
|
||||
|
||||
null -> d("", "No action")
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewLocation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Esperando ubicación..."
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
|
@ -27,9 +27,7 @@ allprojects {
|
|||
maven {
|
||||
url = uri("https://jitpack.io")
|
||||
}
|
||||
maven {
|
||||
url = uri("https://maven.mozilla.org/maven2/")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
[versions]
|
||||
androidImagePicker = "3.0.0-beta5"
|
||||
appcompat = "1.7.0"
|
||||
composeBom = "2024.11.00"
|
||||
composeBom = "2025.01.01"
|
||||
constraintlayout = "2.2.0"
|
||||
converterGson = "2.0.2"
|
||||
core = "3.4.1"
|
||||
coreKtx = "1.13.0"
|
||||
datastorePreferences = "1.1.1"
|
||||
firebaseAnalyticsKtx = "22.1.2"
|
||||
firebaseCrashlyticsKtx = "19.2.1"
|
||||
coreKtx = "1.15.0"
|
||||
datastorePreferences = "1.1.2"
|
||||
firebaseAnalyticsKtx = "22.2.0"
|
||||
firebaseCrashlyticsKtx = "19.4.0"
|
||||
fragmentKtx = "1.8.5"
|
||||
geckoviewVersion = "133.0.20241209150345"
|
||||
glide = "4.16.0"
|
||||
googleWebrtc = "1.0.32006"
|
||||
ink = "1.0.0"
|
||||
koin = "2.1.6"
|
||||
kotlinStdlibJdk7 = "2.0.0"
|
||||
|
@ -20,20 +21,24 @@ lifecycleExtensions = "2.2.0"
|
|||
lifecycleViewmodelKtx = "2.8.7"
|
||||
lottieVersion = "3.4.0"
|
||||
material = "1.12.0"
|
||||
navigationFragmentKtx = "2.8.3"
|
||||
navigationUiKtx = "2.8.3"
|
||||
navigationFragmentKtx = "2.8.6"
|
||||
navigationUiKtx = "2.8.6"
|
||||
pjsipAndroid = "2.12.1"
|
||||
playServicesLocation = "21.3.0"
|
||||
recyclerview = "1.3.2"
|
||||
recyclerview = "1.4.0"
|
||||
retrofit = "2.3.0"
|
||||
roomCompiler = "2.6.1"
|
||||
roomCompiler = "2.7.0-alpha13"
|
||||
swiperefreshlayout = "1.1.0"
|
||||
zxingAndroidEmbedded = "4.3.0"
|
||||
googleDevtoolsKsp = "2.0.20-1.0.25"
|
||||
#cambiar ide para subir version
|
||||
androidGradlePlugin = "8.7.2"
|
||||
androidGradlePlugin = "8.7.3"
|
||||
kotlin = "2.0.20"
|
||||
googleServices = "4.4.2"
|
||||
firebaseCrashlytics = "3.0.2"
|
||||
protoliteWellKnownTypes = "18.0.0"
|
||||
junit = "4.12"
|
||||
material3Android = "1.3.1"
|
||||
|
||||
[libraries]
|
||||
#pickerImage
|
||||
|
@ -58,11 +63,11 @@ androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version
|
|||
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "roomCompiler" }
|
||||
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "roomCompiler" }
|
||||
#ui
|
||||
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "roomCompiler" }
|
||||
converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "converterGson" }
|
||||
converter-scalars = { module = "com.squareup.retrofit2:converter-scalars", version.ref = "retrofit" }
|
||||
#qr
|
||||
core = { module = "com.google.zxing:core", version.ref = "core" }
|
||||
geckoview = { module = "org.mozilla.geckoview:geckoview", version.ref = "geckoviewVersion" }
|
||||
zxing-android-embedded = { module = "com.journeyapps:zxing-android-embedded", version.ref = "zxingAndroidEmbedded" }
|
||||
#analytics
|
||||
firebase-analytics = { module = "com.google.firebase:firebase-analytics", version.ref = "firebaseAnalyticsKtx" }
|
||||
|
@ -93,6 +98,9 @@ androidGradlePlugin = { module = "com.android.tools.build:gradle", version.ref =
|
|||
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
googleServices = { module = "com.google.gms:google-services", version.ref = "googleServices" }
|
||||
firebaseCrashlyticsGradle = { module = "com.google.firebase:firebase-crashlytics-gradle", version.ref = "firebaseCrashlytics" }
|
||||
protolite-well-known-types = { group = "com.google.firebase", name = "protolite-well-known-types", version.ref = "protoliteWellKnownTypes" }
|
||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||
androidx-material3-android = { group = "androidx.compose.material3", name = "material3-android", version.ref = "material3Android" }
|
||||
|
||||
[plugins]
|
||||
google-devtools-ksp = { id = "com.google.devtools.ksp", version.ref = "googleDevtoolsKsp" }
|
||||
|
|
Loading…
Reference in New Issue