Version 9.2.1 Refactor Inicio
This commit is contained in:
parent
aa27073b22
commit
0c87ae654b
|
@ -153,6 +153,7 @@
|
|||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/buyers_fragment.xml" value="0.18333333333333332" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_dialog.xml" value="0.3333333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_edit_dialog.xml" value="0.3333333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_edit_dialog_three_values.xml" value="0.2" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_edit_dialog_two_values.xml" value="0.2203125" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_hour.xml" value="0.3333333333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_list_dialog.xml" value="0.3333333333333333" />
|
||||
|
@ -240,6 +241,7 @@
|
|||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_smarttag_row.xml" value="0.20153985507246377" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_toolbar_row.xml" value="0.15307971014492755" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_ubication_row.xml" value="0.11822916666666666" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_work_forms_row.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_worker_image.xml" value="0.23177083333333334" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_workermistake_row.xml" value="0.4466666666666667" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/qauality_fragment.xml" value="0.15353260869565216" />
|
||||
|
|
|
@ -13,7 +13,7 @@ android {
|
|||
applicationId "es.verdnatura"
|
||||
minSdkVersion 21 //21
|
||||
targetSdkVersion 30
|
||||
versionCode 133
|
||||
versionCode 134
|
||||
versionName = "9"
|
||||
//versionName = "9.2Beta" versionCode 133
|
||||
//versionName = "9" versionCode 133
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 133,
|
||||
"versionCode": 134,
|
||||
"versionName": "9",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -30,19 +30,22 @@ import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
|
|||
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.common.mediaCurrentVolume
|
||||
import es.verdnatura.presentation.view.feature.login.model.WorkForms
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import org.json.JSONObject
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import timber.log.Timber
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.Map.*
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
|
||||
abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelClass: KClass<V>) :
|
||||
Fragment(), TextToSpeech.OnInitListener, RecognitionListener {
|
||||
|
||||
protected val TAG = "VERDNATURA"
|
||||
protected val TAG = "VERDNATURA::"
|
||||
protected val PREFS_USER = "es.verdnatura.user.prefs"
|
||||
protected val PREFS_SERVER = "es.verdnatura.server.prefs"
|
||||
protected val USERFK = "userFk"
|
||||
protected val USER = "user"
|
||||
protected val PASSWORD = "password"
|
||||
|
@ -58,6 +61,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
protected val DEVICENAME = "devicename"
|
||||
protected val TRAINNAME = "trainName"
|
||||
protected val TRAINFK = "trainFk"
|
||||
protected val WORKFORMSELECTED="workFormSelected"
|
||||
|
||||
protected val ITEMPACKING = "itemPackingType"
|
||||
protected val ITEMPACKINGFK = "itemPackingTypeFk"
|
||||
|
@ -546,6 +550,8 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
TRAINNAME -> prefs.getString(name, "").toString()
|
||||
ITEMPACKING -> prefs.getString(name, "").toString()
|
||||
ITEMPACKINGFK -> prefs.getString(name, "").toString()
|
||||
WORKFORMSELECTED->prefs.getString(name, "Producción").toString()
|
||||
|
||||
|
||||
"base_url" -> {
|
||||
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
@ -587,6 +593,91 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
|
||||
}
|
||||
|
||||
fun saveWorkForm(workForm: WorkForms) {
|
||||
var prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_SERVER, 0)
|
||||
var editor = prefs.edit()
|
||||
var gson = Gson()
|
||||
var json = gson.toJson(workForm)
|
||||
editor.putString(workForm.name, json)
|
||||
editor.commit()
|
||||
|
||||
saveData("base_url", workForm.urlSilex)
|
||||
saveData("base_urlSalix", workForm.urlSalix)
|
||||
}
|
||||
|
||||
fun deleteWorkForm(nameWorkForm: String) {
|
||||
var prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_SERVER, 0)
|
||||
var editor = prefs.edit()
|
||||
editor.remove(nameWorkForm).commit()
|
||||
}
|
||||
|
||||
fun getWorkForm(): List<WorkForms> {
|
||||
var listForms: ArrayList<WorkForms> = ArrayList()
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_SERVER, 0)
|
||||
val editor = prefs.edit()
|
||||
|
||||
val keys: Map<String, *> = prefs.all
|
||||
for (Map in keys) {
|
||||
|
||||
|
||||
var json2 = JSONObject(Map.value.toString())
|
||||
|
||||
listForms.add(
|
||||
WorkForms(
|
||||
Map.key,
|
||||
json2.get("urlSilex").toString(),
|
||||
json2.get("urlSalix").toString(),
|
||||
json2.get("isShowDelete").toString().toBoolean(),
|
||||
json2.get("created") as Long
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
editor.commit()
|
||||
if (listForms.isEmpty()) {
|
||||
createWorksDefault()
|
||||
}
|
||||
|
||||
return listForms.sortedBy { it.created }
|
||||
}
|
||||
|
||||
fun createWorksDefault() {
|
||||
saveWorkForm(
|
||||
WorkForms(
|
||||
"Producción",
|
||||
"https://app.verdnatura.es",
|
||||
"https://salix.verdnatura.es/api/"
|
||||
)
|
||||
)
|
||||
saveWorkForm(
|
||||
WorkForms(
|
||||
"Test",
|
||||
"https://test-app.verdnatura.es",
|
||||
urlSalix = "https://test-salix.verdnatura.es/api/"
|
||||
)
|
||||
)
|
||||
saveWorkForm(
|
||||
WorkForms(
|
||||
"Sergio",
|
||||
"httpsergiodt://10.1.4.42:9000",
|
||||
urlSalix = "https://test-salix.verdnatura.es/api/"
|
||||
)
|
||||
)
|
||||
|
||||
saveWorkForm(
|
||||
WorkForms(
|
||||
"Añadir...",
|
||||
"",
|
||||
"",
|
||||
created = Calendar.getInstance().timeInMillis+Calendar.getInstance().timeInMillis
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun saveData(name: String, value: String) {
|
||||
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package es.verdnatura.presentation.common
|
||||
|
||||
import java.sql.Time
|
||||
import java.util.*
|
||||
|
||||
class ResponseItemVO(
|
||||
var response: String = "",
|
||||
var isError: Boolean = false,
|
||||
|
@ -33,3 +36,5 @@ class GeneralItem(
|
|||
var code: String? = "",
|
||||
var text: String? = ""
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
|||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.WorkForms
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
||||
|
@ -60,6 +61,12 @@ interface OnSmartTagRowClickListener {
|
|||
interface OnGeneralItemRowClickListener {
|
||||
fun OnGeneralItemRowClickListener(item: GeneralItem)
|
||||
}
|
||||
interface OnWorkFormsItemRowClickListener {
|
||||
fun OnWorkFormsItemRowClickListener(item: WorkForms)
|
||||
}
|
||||
interface OnTrashItemRowClickListener {
|
||||
fun OnTrashItemRowClickListener(item: WorkForms)
|
||||
}
|
||||
|
||||
interface OnLocationRowClickListener {
|
||||
fun onLocationRowClickListener(item: ItemLocationVO)
|
||||
|
|
|
@ -0,0 +1,142 @@
|
|||
package es.verdnatura.presentation.view.component
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.text.InputType
|
||||
import android.view.View
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ComponentCustomEditDialogThreeValuesBinding
|
||||
import es.verdnatura.databinding.ComponentCustomEditDialogTwoValuesBinding
|
||||
|
||||
|
||||
class CustomDialogInputThreeValues(context: Context) : Dialog(context, R.style.DialogTheme) {
|
||||
|
||||
private var binding: ComponentCustomEditDialogThreeValuesBinding =
|
||||
ComponentCustomEditDialogThreeValuesBinding.inflate(layoutInflater)
|
||||
|
||||
|
||||
init {
|
||||
|
||||
setContentView(binding.root)
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun getEditText(): TextInputEditText {
|
||||
|
||||
return binding.customDialogValueOne
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun getEditTextTwo(): TextInputEditText {
|
||||
|
||||
return binding.customDialogValueTwo
|
||||
|
||||
}
|
||||
|
||||
fun getValue(): String {
|
||||
|
||||
return binding.customDialogValueOne.text.toString()
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun getValueTwo(): String {
|
||||
|
||||
return binding.customDialogValueTwo.text.toString()
|
||||
|
||||
}
|
||||
fun getValueThree(): String {
|
||||
|
||||
return binding.customDialogValueThree.text.toString()
|
||||
|
||||
}
|
||||
|
||||
fun setValue(value: String): CustomDialogInputThreeValues {
|
||||
|
||||
binding.customDialogValueOne.setText(value)
|
||||
binding.customDialogValueOne.visibility = View.VISIBLE
|
||||
|
||||
|
||||
return this
|
||||
}
|
||||
fun setValueTwo(value: String): CustomDialogInputThreeValues {
|
||||
|
||||
binding.customDialogValueTwo.setText(value)
|
||||
binding.customDialogValueOne.visibility = View.VISIBLE
|
||||
|
||||
|
||||
return this
|
||||
}
|
||||
fun setEnableValue(isEnabled: Boolean): CustomDialogInputThreeValues {
|
||||
|
||||
binding.customDialogValueOne.isEnabled=isEnabled
|
||||
|
||||
|
||||
return this
|
||||
}
|
||||
fun setTitle(title: String): CustomDialogInputThreeValues {
|
||||
|
||||
binding.customDialogTitle.visibility = View.VISIBLE
|
||||
binding.customDialogTitle.text = title
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
fun setDescription(description: String): CustomDialogInputThreeValues {
|
||||
|
||||
binding.customDialogDescription.visibility = View.VISIBLE
|
||||
binding.customDialogDescription.text = description
|
||||
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogInputThreeValues {
|
||||
|
||||
binding.customDialogButtonOk.visibility = View.VISIBLE
|
||||
binding.customDialogButtonOk.text = text
|
||||
binding.customDialogButtonOk.setOnClickListener { onButtonClicked() }
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogInputThreeValues {
|
||||
|
||||
binding.customDialogButtonKo.visibility = View.VISIBLE
|
||||
binding.customDialogButtonKo.text = text
|
||||
binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }
|
||||
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
fun setInfoTex(text:String,text2:String,text3:String){
|
||||
binding.textinputlayoutOne.hint = text
|
||||
binding.textinputlayoutTwo.hint = text2
|
||||
binding.textinputlayoutThree.hint = text3
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun setInputTextTwoVisibility() {
|
||||
binding.textinputlayoutTwo.visibility = View.VISIBLE
|
||||
}
|
||||
fun setInputTextVisibility(visibility:Int) {
|
||||
binding.textinputlayoutTwo.visibility = visibility
|
||||
}
|
||||
|
||||
fun setFocusText() {
|
||||
binding.customDialogValueOne.requestFocus()
|
||||
}
|
||||
|
||||
fun setFocusTextTwo() {
|
||||
binding.customDialogValueTwo.requestFocus()
|
||||
}
|
||||
fun setFocusTextThree() {
|
||||
binding.customDialogValueThree.requestFocus()
|
||||
}
|
||||
}
|
|
@ -128,5 +128,10 @@ class CustomDialogList (context: Context) : Dialog(context, R.style.DialogTheme)
|
|||
//custom_dialog_value.visibility = View.GONE
|
||||
return this
|
||||
}
|
||||
fun hideDescription():CustomDialogList{
|
||||
binding.customDialogDescription.visibility = View.GONE
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package es.verdnatura.presentation.view.feature.login.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.databinding.ItemWorkFormsRowBinding
|
||||
import es.verdnatura.presentation.common.OnTrashItemRowClickListener
|
||||
import es.verdnatura.presentation.common.OnWorkFormsItemRowClickListener
|
||||
import es.verdnatura.presentation.view.feature.login.model.WorkForms
|
||||
|
||||
class WorkFormAdapter(
|
||||
private val items: List<WorkForms>,
|
||||
private val OnWorkFormsItemRowClickListener: OnWorkFormsItemRowClickListener,
|
||||
private val OnTrashItemRowClickListener: OnTrashItemRowClickListener
|
||||
// private var showDelete: Boolean = false
|
||||
) : RecyclerView.Adapter<WorkFormAdapter.ItemHolder>() {
|
||||
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
return ItemHolder(
|
||||
ItemWorkFormsRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
|
||||
holder.binding.root.setOnClickListener {
|
||||
OnWorkFormsItemRowClickListener.OnWorkFormsItemRowClickListener(items[position])
|
||||
}
|
||||
holder.binding.itemImage.setOnClickListener{
|
||||
OnTrashItemRowClickListener.OnTrashItemRowClickListener(items[position])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
inner class ItemHolder(
|
||||
val binding: ItemWorkFormsRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
//private val res = binding.root.context.resources
|
||||
fun bind(item: WorkForms) {
|
||||
binding.apply {
|
||||
this.item = item
|
||||
if (item.isShowDelete) {
|
||||
itemImage.visibility = View.VISIBLE
|
||||
}
|
||||
else itemImage.visibility = View.GONE
|
||||
|
||||
itemImage.setOnClickListener{
|
||||
//deleteWorkForm(item.name)
|
||||
}
|
||||
//itemCode.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,33 +1,39 @@
|
|||
package es.verdnatura.presentation.view.feature.login.fragment
|
||||
|
||||
//import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.provider.Settings
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentLoginBinding
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.hideKeyboard
|
||||
import es.verdnatura.presentation.common.OnTrashItemRowClickListener
|
||||
import es.verdnatura.presentation.common.OnWorkFormsItemRowClickListener
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.component.CustomDialogInputThreeValues
|
||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||
import es.verdnatura.presentation.view.feature.login.adapter.WorkFormAdapter
|
||||
import es.verdnatura.presentation.view.feature.login.model.WorkForms
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import kotlinx.coroutines.*
|
||||
import java.lang.Boolean.TRUE
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
|
||||
class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginViewModel::class) {
|
||||
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private lateinit var customNewForm: CustomDialogInputThreeValues
|
||||
private var workFormAdapter: WorkFormAdapter? = null
|
||||
private lateinit var customDialogList: CustomDialogList
|
||||
private lateinit var listForms: List<WorkForms>
|
||||
|
||||
companion object {
|
||||
fun newInstance() = LoginFragment()
|
||||
|
@ -36,6 +42,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
override fun getLayoutId(): Int = R.layout.fragment_login
|
||||
|
||||
override fun init() {
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
saveIdentifiers()
|
||||
|
@ -59,9 +66,10 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
}
|
||||
|
||||
|
||||
// binding.edittextServer.setText(getData(getString(R.string.baseurl)))
|
||||
binding.edittextServer.setText(getData(WORKFORMSELECTED))
|
||||
|
||||
binding.edittextServer.setText(getData(getString(R.string.baseurl)))
|
||||
binding.edittextServer.setOnKeyListener { _, keyCode, event ->
|
||||
/* binding.edittextServer.setOnKeyListener { _, keyCode, event ->
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
|
||||
|
||||
saveData(
|
||||
|
@ -112,18 +120,86 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
|
||||
}
|
||||
false
|
||||
}
|
||||
}*/
|
||||
|
||||
// se crean/listan las opciones de formas de trabajo
|
||||
listForms = getWorkForm().sortedBy { it.created }
|
||||
|
||||
binding.textviewWelcome.setOnLongClickListener {
|
||||
binding.edittextServer.isEnabled = TRUE
|
||||
binding.edittextServer.keyListener = null
|
||||
|
||||
binding.edittextServer.setOnLongClickListener {
|
||||
showWorkingForms()
|
||||
true
|
||||
}
|
||||
binding.edittextUsername.requestFocus()
|
||||
|
||||
binding.edittextServer.setOnClickListener {
|
||||
// showWorkingForms()
|
||||
}
|
||||
|
||||
private fun setAdapter(listWorkForms: List<WorkForms>) {
|
||||
|
||||
workFormAdapter = WorkFormAdapter(listWorkForms, object : OnWorkFormsItemRowClickListener {
|
||||
|
||||
override fun OnWorkFormsItemRowClickListener(item: WorkForms) {
|
||||
|
||||
when (item.name) {
|
||||
"Añadir..." -> {
|
||||
showNewForm()
|
||||
}
|
||||
else -> {
|
||||
|
||||
binding.edittextServer.setText(item.name)
|
||||
|
||||
saveData("base_url", item.urlSilex)
|
||||
saveData("base_urlSalix", item.urlSalix)
|
||||
saveData(WORKFORMSELECTED, item.name)
|
||||
|
||||
customDialogList.dismiss()
|
||||
requireActivity().recreate()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}, object : OnTrashItemRowClickListener {
|
||||
override fun OnTrashItemRowClickListener(workForm: WorkForms) {
|
||||
|
||||
customDialog.setTitle(getString(R.string.deleteWorkForm))
|
||||
.setDescription(getString(R.string.deleteWorkFormConfirmation))
|
||||
.setOkButton(getString(R.string.cancel)) {
|
||||
customDialog.dismiss()
|
||||
}
|
||||
.setOkButton(getString(R.string.ok)) {
|
||||
deleteWorkForm(workForm.name)
|
||||
workFormAdapter!!.notifyDataSetChanged()
|
||||
|
||||
customDialog.dismiss()
|
||||
customDialogList.dismiss()
|
||||
saveData(WORKFORMSELECTED, "Producción")
|
||||
requireActivity().recreate()
|
||||
|
||||
}
|
||||
.show()
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
customDialogList.getRecyclerView().adapter = workFormAdapter
|
||||
customDialogList.getRecyclerView().layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
|
||||
customDialogList.setTitle(getString(R.string.selectWorkingForm))
|
||||
.hideDescription()
|
||||
.hideDialog()
|
||||
.setOkButton(getString(R.string.cancel)) {
|
||||
customDialogList.dismiss()
|
||||
// customNewForm.dismiss()
|
||||
// customDialog.dismiss()
|
||||
}
|
||||
.show()
|
||||
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("HardwareIds")
|
||||
|
@ -137,63 +213,43 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
|
||||
private fun showWorkingForms() {
|
||||
|
||||
val listForms: ArrayList<workForms> = ArrayList()
|
||||
listForms = getWorkForm().sortedBy { it.created }
|
||||
setAdapter(listForms)
|
||||
|
||||
listForms.add(
|
||||
workForms(
|
||||
"Producción",
|
||||
"https://app.verdnatura.es",
|
||||
"https://salix.verdnatura.es"
|
||||
)
|
||||
)
|
||||
listForms.add(
|
||||
workForms(
|
||||
"Test",
|
||||
"https://test-app.verdnatura.es",
|
||||
"https://test-salix.verdnatura.es"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
listForms.add(
|
||||
workForms(
|
||||
"Sergio",
|
||||
"https://test-app.verdnatura.es",
|
||||
"https://test-salix.verdnatura.es",
|
||||
private fun showNewForm() {
|
||||
customNewForm = CustomDialogInputThreeValues(requireContext())
|
||||
.setTitle(getString(R.string.workFormAdd))
|
||||
.setDescription(getString(R.string.workFormDescrip))
|
||||
customNewForm.setInfoTex(
|
||||
getString(R.string.name),
|
||||
getString(R.string.silexServer),
|
||||
getString(R.string.salixServer)
|
||||
)
|
||||
customNewForm.setFocusText()
|
||||
customNewForm.setOkButton(getString(R.string.save)) {
|
||||
saveWorkForm(
|
||||
WorkForms(
|
||||
customNewForm.getValue(),
|
||||
customNewForm.getValueTwo(),
|
||||
customNewForm.getValueThree(),
|
||||
true
|
||||
)
|
||||
)
|
||||
|
||||
listForms.add(workForms("Añadir otra forma", " ", " "))
|
||||
binding.edittextServer.setText(customNewForm.getValue())
|
||||
saveData(WORKFORMSELECTED, customNewForm.getValue())
|
||||
customNewForm.dismiss()
|
||||
customDialogList.dismiss()
|
||||
requireActivity().recreate()
|
||||
|
||||
val array = arrayOfNulls<String>(listForms.size)
|
||||
var showList: ArrayList<String> = ArrayList()
|
||||
|
||||
for (l in listForms) {
|
||||
showList.add(l.name)
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customNewForm.dismiss()
|
||||
}
|
||||
|
||||
val builder = AlertDialog.Builder(this.context)
|
||||
builder.setTitle(getString(R.string.selectWorkingForm))
|
||||
builder.setItems(showList.toArray(array)) { _, which ->
|
||||
val selected = array[which]
|
||||
showList.forEach {
|
||||
if (it == selected) {
|
||||
customNewForm.show()
|
||||
|
||||
binding.edittextServer.setText(it)
|
||||
saveData(
|
||||
"base_urlSalix",
|
||||
it
|
||||
)
|
||||
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
val dialog = builder.create()
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun checkUser() {
|
||||
|
@ -557,4 +613,3 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
|
||||
}
|
||||
|
||||
data class workForms(val name: String, val urlSilex: String, val urlSalix: String,val isShowDelete:Boolean=false)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package es.verdnatura.presentation.view.feature.login.model
|
||||
|
||||
import java.util.*
|
||||
|
||||
class WorkForms(
|
||||
val name: String,
|
||||
val urlSilex: String,
|
||||
val urlSalix: String,
|
||||
val isShowDelete: Boolean = false,
|
||||
val created: Long = Calendar.getInstance().timeInMillis
|
||||
)
|
|
@ -1,5 +1,7 @@
|
|||
package es.verdnatura.presentation.view.feature.login.model
|
||||
|
||||
import java.util.*
|
||||
|
||||
class errorMessage (
|
||||
val message: String = ""
|
||||
){
|
||||
|
@ -7,3 +9,4 @@ class errorMessage (
|
|||
return "${this.message}"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package es.verdnatura.presentation.view.feature.pasillero.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.DividerItemDecoration
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
|
@ -37,9 +37,16 @@ class PasilleroFragment(
|
|||
|
||||
when (tagName) {
|
||||
getString(R.string.main) -> {
|
||||
if (getData(WORKFORMSELECTED) != "Producción") {
|
||||
binding.mainToolbarDesign.toolbarTitle.setBackgroundColor(Color.RED)
|
||||
"En modo " + getData(WORKFORMSELECTED)
|
||||
binding.mainToolbarDesign.toolbarTitle.text =
|
||||
"En modo " + getData(WORKFORMSELECTED)
|
||||
binding.mainToolbarDesign.backButton.visibility = View.GONE
|
||||
} else {
|
||||
binding.mainToolbarDesign.imageViewMenu.visibility = View.VISIBLE
|
||||
binding.mainToolbarDesign.backButton.visibility = View.GONE
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
tagName -> {
|
||||
|
@ -66,9 +73,10 @@ class PasilleroFragment(
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
|
||||
when (tagName) {
|
||||
getString(R.string.titleCorridors) -> { viewModel.inititializeDefaultData() }
|
||||
getString(R.string.titleCorridors) -> {
|
||||
viewModel.inititializeDefaultData()
|
||||
}
|
||||
getString(R.string.titlePalletizers) -> viewModel.inititializeDefaultPallet()
|
||||
getString(R.string.titleBufferManegement) -> viewModel.inititializeDefaultBuffer()
|
||||
getString(R.string.main) -> viewModel.inititializeDefaultDataInit()
|
||||
|
@ -99,7 +107,12 @@ class PasilleroFragment(
|
|||
context,
|
||||
LinearLayoutManager.VERTICAL
|
||||
)
|
||||
dividerItemDecoration.setDrawable(requireContext().resources.getDrawable(R.drawable.list_divider_items,requireContext().theme))
|
||||
dividerItemDecoration.setDrawable(
|
||||
requireContext().resources.getDrawable(
|
||||
R.drawable.list_divider_items,
|
||||
requireContext().theme
|
||||
)
|
||||
)
|
||||
binding.pasillerosItems.addItemDecoration(dividerItemDecoration)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/DialogTheme"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/layout_margin_1"
|
||||
app:cardBackgroundColor="@color/verdnatura_black_8"
|
||||
app:cardCornerRadius="@dimen/dialog_radius">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/default_layout_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/custom_dialog_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/layout_margin_3"
|
||||
android:layout_marginBottom="@dimen/default_layout_margin"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/h6"
|
||||
android:textStyle="bold"
|
||||
android:visibility="visible"
|
||||
tools:text="¿Estás seguro de que deseas eliminar el dispositivo de celia?"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/custom_dialog_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body1"
|
||||
android:visibility="gone"
|
||||
tools:text="Este cambio no podrá deshacerse a no ser que vuelvas a vincular el dispositivo"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textinputlayout_one"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/layout_margin_min"
|
||||
android:textColorHint="@android:color/darker_gray">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/custom_dialog_value_one"
|
||||
style="@style/DefaultButton.NormalButton"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/background_round"
|
||||
android:enabled="true"
|
||||
android:hint="@string/quantity"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:visibility="visible" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textinputlayout_two"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/layout_margin_min"
|
||||
android:hint="@string/scanShelving"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:visibility="visible">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/custom_dialog_value_two"
|
||||
style="@style/DefaultButton.NormalButton"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/background_round"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textColorHint="@android:color/darker_gray" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textinputlayout_three"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/layout_margin_min"
|
||||
android:hint="@string/scanShelving"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:visibility="visible">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/custom_dialog_value_three"
|
||||
style="@style/DefaultButton.NormalButton"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/background_round"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textColorHint="@android:color/darker_gray" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<Button
|
||||
android:id="@+id/custom_dialog_button_ok"
|
||||
style="@style/DefaultButton.NormalButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="@dimen/default_layout_margin"
|
||||
android:visibility="gone"
|
||||
tools:text="@string/delete"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/custom_dialog_button_ko"
|
||||
style="@style/DefaultButton.TransparentButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="@dimen/default_layout_margin"
|
||||
android:layout_marginBottom="@dimen/default_layout_margin"
|
||||
android:visibility="gone"
|
||||
tools:text="@string/cancel"
|
||||
tools:visibility="visible" />
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
|
||||
|
@ -33,6 +34,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textinputlayout_server"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -40,7 +42,8 @@
|
|||
android:layout_marginTop="0dp"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
app:layout_constraintStart_toStartOf="@id/textview_welcome"
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_welcome">
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_welcome"
|
||||
>
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edittext_server"
|
||||
|
@ -49,13 +52,17 @@
|
|||
android:layout_margin="8dp"
|
||||
android:backgroundTint="@android:color/white"
|
||||
android:hint="Server:"
|
||||
android:enabled="false"
|
||||
inputType="none"
|
||||
android:clickable="true"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textColorHint="@android:color/darker_gray" />
|
||||
<!-- android:drawableRight="@drawable/ic_chevron_right_black_24dp" -->
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
|
||||
android:drawableRight="@drawable/ic_chevron_right_black_24dp" />
|
||||
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
|
|
|
@ -49,10 +49,10 @@
|
|||
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_marginLeft="@dimen/default_layout_margin"
|
||||
android:id="@+id/item_image"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/default_layout_margin"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_chevron_right_black_24dp" />
|
||||
</LinearLayout>
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="item"
|
||||
type="es.verdnatura.presentation.view.feature.login.model.WorkForms" />
|
||||
</data>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:id="@+id/item_row_layout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/verdnatura_black_5"
|
||||
android:padding="@dimen/pasilleros_margin_main_menu">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_code"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@{item.name}"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/h7"
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="visible"
|
||||
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@{item.urlSalix}"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/h7"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"
|
||||
android:visibility="gone"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_marginLeft="@dimen/default_layout_margin"
|
||||
android:id="@+id/item_image"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="27dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_delete_black_24dp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/verdnatura_black_9"/>
|
||||
</LinearLayout>
|
||||
</layout>
|
|
@ -479,5 +479,13 @@
|
|||
<string name="itemFilter">Filtro ítem</string>
|
||||
<string name="itemUpdated">Actualizado</string>
|
||||
<string name="errorCmrNotScanned">CMR no escaneado</string>
|
||||
<string name="selectWorkingForm">Selecciona la forma de trabajo:</string>
|
||||
<string name="selectWorkingForm">Selecciona la forma de trabajo de la app:</string>
|
||||
<string name="workFormAdd">Añadir forma de trabajo</string>
|
||||
<string name="workFormDescrip">Proporciona un nombre y url de los servidores a los que la app se conectará</string>
|
||||
<string name="silexServer">Servidor Silex</string>
|
||||
<string name="salixServer">Servidor Salix</string>
|
||||
<string name="name">Nombre</string>
|
||||
<string name="deleteWorkForm">Borrar forma trabajo</string>
|
||||
<string name="deleteWorkFormConfirmation">¿Desea borrar definitivamente la forma de trabajo?</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -480,6 +480,13 @@
|
|||
<string name="settingsTitleItemPacking">Packing type</string>
|
||||
<string name="NoItemPackingType">No item packing type</string>
|
||||
<string name="selectTrain">Select ticket type</string>
|
||||
<string name="workFormAdd">Add work way</string>
|
||||
<string name="workFormDescrip">Give a name and urls of the servers</string>
|
||||
<string name="silexServer">Server Silex</string>
|
||||
<string name="salixServer">Server Salix</string>
|
||||
<string name="name">Name</string>
|
||||
<string name="deleteWorkForm">Delete work form</string>
|
||||
<string name="deleteWorkFormConfirmation">¿Do you delete definitely?</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue