Commit 08caedf9d21ff53f58df650c93fc3613b06a2646

Authored by Mauricio Sanchez
1 parent 2734bbec87
Exists in master

25022020 2126

1 apply plugin: 'com.android.application' 1 apply plugin: 'com.android.application'
2 apply plugin: 'kotlin-android' 2 apply plugin: 'kotlin-android'
3 apply plugin: 'kotlin-android-extensions' 3 apply plugin: 'kotlin-android-extensions'
4 apply plugin: 'kotlin-kapt' 4 apply plugin: 'kotlin-kapt'
5 5
6 android { 6 android {
7 compileSdkVersion 30 7 compileSdkVersion 30
8 buildToolsVersion "29.0.3" 8 buildToolsVersion "29.0.3"
9 9
10 defaultConfig { 10 defaultConfig {
11 applicationId "com.focasoftware.deboinventariov20" 11 applicationId "com.focasoftware.deboinventariov20"
12 minSdkVersion 26 12 minSdkVersion 26
13 targetSdkVersion 30 13 targetSdkVersion 30
14 versionCode 1 14 versionCode 1
15 versionName "1.0" 15 versionName "1.0"
16 16
17 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18 } 18 }
19 19
20 buildTypes { 20 buildTypes {
21 release { 21 release {
22 minifyEnabled false 22 minifyEnabled false
23 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24 } 24 }
25 } 25 }
26 compileOptions { 26 compileOptions {
27 sourceCompatibility JavaVersion.VERSION_1_8 27 sourceCompatibility JavaVersion.VERSION_1_8
28 targetCompatibility JavaVersion.VERSION_1_8 28 targetCompatibility JavaVersion.VERSION_1_8
29 } 29 }
30 kotlinOptions { 30 kotlinOptions {
31 jvmTarget = '1.8' 31 jvmTarget = '1.8'
32 } 32 }
33 } 33 }
34 34
35 dependencies { 35 dependencies {
36 implementation fileTree(dir: "libs", include: ["*.jar"]) 36 implementation fileTree(dir: "libs", include: ["*.jar"])
37 implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 37 implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
38 implementation 'androidx.core:core-ktx:1.3.1' 38 implementation 'androidx.core:core-ktx:1.3.1'
39 implementation 'androidx.appcompat:appcompat:1.2.0' 39 implementation 'androidx.appcompat:appcompat:1.2.0'
40 implementation 'androidx.legacy:legacy-support-v4:1.0.0' 40 implementation 'androidx.legacy:legacy-support-v4:1.0.0'
41 implementation 'com.google.android.material:material:1.2.0' 41 implementation 'com.google.android.material:material:1.2.0'
42 implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 42 implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
43 implementation 'androidx.navigation:navigation-fragment:2.3.0' 43 implementation 'androidx.navigation:navigation-fragment:2.3.0'
44 implementation 'androidx.navigation:navigation-ui:2.3.0' 44 implementation 'androidx.navigation:navigation-ui:2.3.0'
45 implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' 45 implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
46 implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0' 46 implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
47 implementation 'androidx.navigation:navigation-ui-ktx:2.3.0' 47 implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
48 implementation 'androidx.recyclerview:recyclerview:1.1.0' 48 implementation 'androidx.recyclerview:recyclerview:1.1.0'
49 testImplementation 'junit:junit:4.13' 49 testImplementation 'junit:junit:4.13'
50 androidTestImplementation 'androidx.test.ext:junit:1.1.1' 50 androidTestImplementation 'androidx.test.ext:junit:1.1.1'
51 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 51 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
52 52
53 53
54 //Room 54 //Room
55 implementation 'androidx.room:room-ktx:2.2.5' 55 implementation 'androidx.room:room-ktx:2.2.5'
56 implementation "androidx.room:room-runtime:2.2.5" 56 implementation "androidx.room:room-runtime:2.2.5"
57 kapt "androidx.room:room-compiler:2.2.5" 57 kapt "androidx.room:room-compiler:2.2.5"
58 58
59 //Retrofit 59 //Retrofit
60 implementation 'com.squareup.retrofit2:retrofit:2.9.0' 60 implementation 'com.squareup.retrofit2:retrofit:2.9.0'
61 implementation 'com.google.code.gson:gson:2.8.6' 61 implementation 'com.google.code.gson:gson:2.8.6'
62 implementation 'com.squareup.retrofit2:converter-gson:2.9.0' 62 implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
63 implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1' 63 implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1'
64 64
65 //Gson library 65 //Gson library
66 implementation "com.google.code.gson:gson:2.8.6" 66 implementation "com.google.code.gson:gson:2.8.6"
67 annotationProcessor 'androidx.room:room-compiler:2.2.5' 67 annotationProcessor 'androidx.room:room-compiler:2.2.5'
68 68
69 69
70 70 implementation 'com.afollestad.material-dialogs:bottomsheets:3.2.1'
71 implementation 'com.afollestad.material-dialogs:core:3.3.0' 71 implementation 'com.afollestad.material-dialogs:core:3.3.0'
72 implementation 'com.afollestad.material-dialogs:input:3.3.0' 72 implementation 'com.afollestad.material-dialogs:input:3.3.0'
73 } 73 }
app/src/main/AndroidManifest.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="com.focasoftware.deboinventariov20"> 3 package="com.focasoftware.deboinventariov20">
4 4
5 <uses-permission android:name="android.permission.VIBRATE" /> 5 <uses-permission android:name="android.permission.VIBRATE" />
6 <uses-permission android:name="android.permission.INTERNET" /> 6 <uses-permission android:name="android.permission.INTERNET" />
7 7
8 <application 8 <application
9 android:allowBackup="true" 9 android:allowBackup="true"
10 android:icon="@mipmap/ic_launcher" 10 android:icon="@drawable/icono_inventario_big"
11 android:label="@string/app_name" 11 android:label="@string/app_name"
12 android:roundIcon="@mipmap/ic_launcher_round" 12 android:roundIcon="@drawable/icono_inventario_big"
13 android:supportsRtl="true" 13 android:supportsRtl="true"
14 android:theme="@style/AppTheme" 14 android:theme="@style/AppTheme"
15 android:usesCleartextTraffic="true"> 15 android:usesCleartextTraffic="true">
16 <activity 16 <activity
17 android:name=".ui.SplashActivity" 17 android:name=".ui.SplashActivity"
18 android:label="@string/app_name" 18 android:label="@string/app_name"
19 android:theme="@style/AppTheme.NoActionBar"> 19 android:theme="@style/AppTheme.NoActionBar">
20 <intent-filter> 20 <intent-filter>
21 <action android:name="android.intent.action.MAIN" /> 21 <action android:name="android.intent.action.MAIN" />
22 22
23 <category android:name="android.intent.category.LAUNCHER" /> 23 <category android:name="android.intent.category.LAUNCHER" />
24 </intent-filter> 24 </intent-filter>
25 </activity> 25 </activity>
26 <activity 26 <activity
27 android:name=".ui.MainActivity" 27 android:name=".ui.MainActivity"
28 android:label="@string/app_name" 28 android:label="@string/app_name"
29 android:theme="@style/AppTheme.NoActionBar"> 29 android:theme="@style/AppTheme.NoActionBar">
30 30
31 </activity> 31 </activity>
32 </application> 32 </application>
33 33
34 </manifest> 34 </manifest>
app/src/main/java/com/focasoftware/deboinventariov20/DB/DAO/ArticulosDAO.kt
1 package com.focasoftware.deboinventariov20.DB.DAO 1 package com.focasoftware.deboinventariov20.DB.DAO
2 2
3 import androidx.room.* 3 import androidx.room.*
4 import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART 4 import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART
5 import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B 5 import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B
6 import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H 6 import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H
7 import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV 7 import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV
8 import com.focasoftware.deboinventariov20.Model.* 8 import com.focasoftware.deboinventariov20.Model.*
9 9
10 @Dao 10 @Dao
11 interface ArticulosDAO { 11 interface ArticulosDAO {
12 12
13 // TABLA ARTICULOS 13 // TABLA ARTICULOS
14 @Insert(onConflict = OnConflictStrategy.REPLACE) 14 @Insert(onConflict = OnConflictStrategy.REPLACE)
15 suspend fun insertArticulos(articulos: Articles?) 15 suspend fun insertArticulos(articulos: Articles?)
16 16
17 @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC") 17 @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC")
18 suspend fun findAllArticulos(): List<Articles> 18 suspend fun findAllArticulos(): List<Articles>
19 19
20 @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") 20 @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES")
21 suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles> 21 suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles>
22 22
23 @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") 23 @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra")
24 suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? 24 suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles?
25 25
26 @Query("DELETE FROM $TABLA_ART") 26 @Query("DELETE FROM $TABLA_ART")
27 suspend fun deleteAllArticulos() 27 suspend fun deleteAllArticulos()
28 } 28 }
29 29
30 @Dao 30 @Dao
31 interface InvHeadDAO { 31 interface InvHeadDAO {
32 @Insert() 32 @Insert()
33 suspend fun insertInvHead(invHead: InvHead?) 33 suspend fun insertInvHead(invHead: InvHead?)
34 34
35 @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") 35 @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC")
36 suspend fun findLastInv(): Int 36 suspend fun findLastInv(): Int
37 37
38 @Query("DELETE FROM $TABLA_INV_H") 38 @Query("DELETE FROM $TABLA_INV_H")
39 suspend fun deleteAllArticulos() 39 suspend fun deleteAllArticulos()
40 40
41 @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") 41 @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven")
42 suspend fun deleteinvHead(inven: Int) 42 suspend fun deleteinvHead(inven: Int)
43 43
44 @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") 44 @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI")
45 suspend fun fetchAllInvHead(): List<InvHead> 45 suspend fun fetchAllInvHead(): List<InvHead>
46 } 46 }
47 47
48 @Dao 48 @Dao
49 interface InvBodyDAO { 49 interface InvBodyDAO {
50 @Insert() 50 @Insert()
51 suspend fun insertInvBody(invBody: InvBody?) 51 suspend fun insertInvBody(invBody: InvBody?)
52 52
53 @Query("DELETE FROM $TABLA_INV_B") 53 @Query("DELETE FROM $TABLA_INV_B")
54 suspend fun deleteAllInvBody() 54 suspend fun deleteAllInvBody()
55 55
56 @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") 56 @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven")
57 suspend fun deleteInvBody(inven: Int) 57 suspend fun deleteInvBody(inven: Int)
58 58
59 @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") 59 @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod")
60 suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) 60 suspend fun UpdateInvBody(cant: Float, sec: String, cod: String)
61 61
62 @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") 62 @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC")
63 suspend fun fetchAllInvBody(inven:Int): List<InvBody> 63 suspend fun fetchAllInvBody(inven:Int): List<InvBody>
64
65 @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo")
66 suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody
64 } 67 }
65 @Dao 68 @Dao
66 interface ServeInvDao { 69 interface ServeInvDao {
67 @Insert(onConflict = OnConflictStrategy.REPLACE) 70 @Insert(onConflict = OnConflictStrategy.REPLACE)
68 fun insertServer(servidor: ServeInv) 71 fun insertServer(servidor: ServeInv)
69 72
70 @Query("SELECT * FROM ServeInv") 73 @Query("SELECT * FROM ServeInv")
71 suspend fun fetchAllServers(): List<ServeInv> 74 suspend fun fetchAllServers(): List<ServeInv>
72 75
73 @Query("DELETE FROM ServeInv WHERE SER_NUM = :number") 76 @Query("DELETE FROM ServeInv WHERE SER_NUM = :number")
74 suspend fun deleteServer(number: Long) 77 suspend fun deleteServer(number: Long)
75 78
76 @Query("SELECT SER_NUM FROM ServeInv ORDER BY SER_NUM DESC") 79 @Query("SELECT SER_NUM FROM ServeInv ORDER BY SER_NUM DESC")
77 suspend fun findLastSer(): Long 80 suspend fun findLastSer(): Long
78 } 81 }
app/src/main/java/com/focasoftware/deboinventariov20/ui/SplashActivity.kt
1 package com.focasoftware.deboinventariov20.ui 1 package com.focasoftware.deboinventariov20.ui
2 2
3 import android.app.Activity 3 import android.app.Activity
4 import android.content.Intent 4 import android.content.Intent
5 import android.os.Bundle 5 import android.os.Bundle
6 import com.focasoftware.deboinventariov20.R 6 import com.focasoftware.deboinventariov20.R
7 7
8 class SplashActivity : Activity() { 8 class SplashActivity : Activity() {
9 9
10 override fun onCreate(savedInstanceState: Bundle?) { 10 override fun onCreate(savedInstanceState: Bundle?) {
11 super.onCreate(savedInstanceState) 11 super.onCreate(savedInstanceState)
12 setContentView(R.layout.activity_splash) 12 setContentView(R.layout.activity_splash)
13 //window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY 13 //window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
14 14
15 val bac = object : Thread(){ 15 val bac = object : Thread(){
16 override fun run(){ 16 override fun run(){
17 try { 17 try {
18 Thread.sleep(500) 18 Thread.sleep(5)
19 val intent = Intent(baseContext, MainActivity:: class.java) 19 val intent = Intent(baseContext, MainActivity:: class.java)
20 startActivity(intent) 20 startActivity(intent)
21 finish() 21 finish()
22 } catch (e : Exception){ 22 } catch (e : Exception){
23 e.printStackTrace() 23 e.printStackTrace()
24 } 24 }
25 } 25 }
26 } 26 }
27 bac.start() 27 bac.start()
28 } 28 }
29 } 29 }
30 30
app/src/main/java/com/focasoftware/deboinventariov20/ui/descripcionFragment/DescripcionFragment.kt
1 package com.focasoftware.deboinventariov20.ui.descripcionFragment 1 package com.focasoftware.deboinventariov20.ui.descripcionFragment
2 2
3 import android.app.AlertDialog
3 import android.content.Context 4 import android.content.Context
4 import android.content.SharedPreferences 5 import android.content.SharedPreferences
5 import android.graphics.Canvas 6 import android.graphics.Canvas
6 import android.graphics.Color 7 import android.graphics.Color
7 import android.graphics.drawable.ColorDrawable 8 import android.graphics.drawable.ColorDrawable
8 import android.os.Bundle 9 import android.os.Bundle
9 import android.text.InputType 10 import android.text.InputType
10 import android.view.LayoutInflater 11 import android.view.LayoutInflater
11 import android.view.View 12 import android.view.View
12 import android.view.ViewGroup 13 import android.view.ViewGroup
13 import android.widget.Button 14 import android.widget.Button
14 import androidx.fragment.app.Fragment 15 import androidx.fragment.app.Fragment
15 import androidx.lifecycle.lifecycleScope 16 import androidx.lifecycle.lifecycleScope
16 import androidx.navigation.NavController 17 import androidx.navigation.NavController
17 import androidx.navigation.Navigation 18 import androidx.navigation.Navigation
18 import androidx.recyclerview.widget.ItemTouchHelper 19 import androidx.recyclerview.widget.ItemTouchHelper
19 import androidx.recyclerview.widget.LinearLayoutManager 20 import androidx.recyclerview.widget.LinearLayoutManager
20 import androidx.recyclerview.widget.RecyclerView 21 import androidx.recyclerview.widget.RecyclerView
21 import com.afollestad.materialdialogs.MaterialDialog 22 import com.afollestad.materialdialogs.MaterialDialog
22 import com.afollestad.materialdialogs.input.input 23 import com.afollestad.materialdialogs.input.input
23 import com.focasoftware.deboinventariov20.DB.DataBase.AppDb 24 import com.focasoftware.deboinventariov20.DB.DataBase.AppDb
24 import com.focasoftware.deboinventariov20.Model.Articles 25 import com.focasoftware.deboinventariov20.Model.Articles
25 import com.focasoftware.deboinventariov20.Model.InvBody 26 import com.focasoftware.deboinventariov20.Model.InvBody
26 import com.focasoftware.deboinventariov20.R 27 import com.focasoftware.deboinventariov20.R
27 import com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment 28 import com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment
28 import kotlinx.coroutines.Dispatchers 29 import kotlinx.android.synthetic.main.login_dialog.view.*
29 import kotlinx.coroutines.launch 30 import kotlinx.coroutines.*
30 import kotlinx.coroutines.withContext
31 31
32 class DescripcionFragment : Fragment() { 32 class DescripcionFragment : Fragment() {
33 private var artAcargar2: List<Articles>? = null 33 private var artAcargar2: List<Articles>? = null
34 private var listArticulos2: List<Articles>? = null 34 private var listArticulos2: List<Articles>? = null
35 lateinit var viewAdapter2: RecyclerView.Adapter<*> 35 lateinit var viewAdapter2: RecyclerView.Adapter<*>
36 private lateinit var viewManager2: RecyclerView.LayoutManager 36 private lateinit var viewManager2: RecyclerView.LayoutManager
37 private lateinit var rcDescripcion: RecyclerView 37 private lateinit var rcDescripcion: RecyclerView
38 private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) 38 private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW)
39 private var cantidad = 0F 39 private var cantidad = 0F
40 private var numeroInventario = 0 40 private var numeroInventario = 0
41 lateinit var navController: NavController 41 lateinit var navController: NavController
42 lateinit var sharedPreferences: SharedPreferences 42 lateinit var sharedPreferences: SharedPreferences
43 private var indice=0 43 private var indice = 0
44 44 private var artCargadoEnBD: InvBody? = null
45 override fun onCreate(savedInstanceState: Bundle?) { 45 override fun onCreate(savedInstanceState: Bundle?) {
46 super.onCreate(savedInstanceState) 46 super.onCreate(savedInstanceState)
47 sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) 47 sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE)
48 arguments.apply { 48 arguments.apply {
49 artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> 49 artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles>
50 numeroInventario = requireArguments().getInt("numeroInv") 50 numeroInventario = requireArguments().getInt("numeroInv")
51 } 51 }
52 } 52 }
53 53
54 override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 54 override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
55 super.onViewCreated(view, savedInstanceState) 55 super.onViewCreated(view, savedInstanceState)
56 navController = Navigation.findNavController(view) 56 navController = Navigation.findNavController(view)
57 } 57 }
58 58
59 override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 59 override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
60 val v = inflater.inflate(R.layout.fragment_descripcion, container, false) 60 val v = inflater.inflate(R.layout.fragment_descripcion, container, false)
61 rcDescripcion = v.findViewById(R.id.rcDescripcion) 61 rcDescripcion = v.findViewById(R.id.rcDescripcion)
62 val btnSalir = v.findViewById<Button>(R.id.btnSalir) 62 val btnSalir = v.findViewById<Button>(R.id.btnSalir)
63 63
64 IngresarRecicler(artAcargar2) 64 IngresarRecicler(artAcargar2)
65 65
66 btnSalir.setOnClickListener { 66 btnSalir.setOnClickListener {
67 VolverAinventario() 67 VolverAinventario()
68 } 68 }
69 return v 69 return v
70 } 70 }
71 71
72 fun IngresarRecicler(articulos: List<Articles>?) { 72 fun IngresarRecicler(articulos: List<Articles>?) {
73 73
74 viewAdapter2 = DescripcionListAdapter(articulos) 74 viewAdapter2 = DescripcionListAdapter(articulos)
75 viewManager2 = LinearLayoutManager(requireContext()) 75 viewManager2 = LinearLayoutManager(requireContext())
76 76
77 rcDescripcion.apply { 77 rcDescripcion.apply {
78 adapter = viewAdapter2 78 adapter = viewAdapter2
79 layoutManager = viewManager2 79 layoutManager = viewManager2
80 } 80 }
81 val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) { 81 val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) {
82 override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { 82 override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean {
83 return false 83 return false
84 } 84 }
85 85
86 override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { 86 override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) {
87 val type = InputType.TYPE_CLASS_NUMBER 87
88 MaterialDialog(requireContext()).show { 88 var indice = 0
89 title(text = "Producto: ${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}") 89 indice = viewHolder.layoutPosition
90 message(R.string.sMensajeEncontrado) 90 GlobalScope.launch(Dispatchers.Main) {
91 input (waitForPositiveButton = false ,hint = "99.99", inputType = type){ materialDialog, charSequence -> 91 //TODO BUSCO EN BASE DE DATOS
92 cantidad = 0F 92 artCargadoEnBD = buscarCodigoDeboEnBD((viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.sector.toString(),
93 cantidad = charSequence.toString().toFloat() 93 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)?.codigo.toString(),
94 } 94 numeroInventario.toString())
95 // .input("Cantidad",1,,1,0,InputType.TYPE_CLASS_NUMBER,0,waitForPositiveButton = true,false,positiveButton ()) 95 if (artCargadoEnBD == null) {
96 positiveButton(R.string.btnOk) { 96 val type = InputType.TYPE_CLASS_NUMBER
97 dismiss() 97 MaterialDialog(requireContext()).show {
98 var indice = 0 98 title(text = "Producto: ${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}")
99 indice=viewHolder.layoutPosition 99 message(R.string.sMensajeEncontrado)
100 input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence ->
101 cantidad = 0F
102 cantidad = charSequence.toString().toFloat()
103 }
104 positiveButton(R.string.btnOk) {
105 dismiss()
106 }
107 }.cancelOnTouchOutside(false).cornerRadius(10F)
100 108
101 val body = InvBody(numeroInventario, 109 val body = InvBody(numeroInventario,
102 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, 110 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector,
103 // TODO PREPARO PARA MANDAR A CARGAR EN LA BD 111 // TODO: PREPARO PARA MANDAR A CARGAR EN LA BD
104 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, 112 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo,
105 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, 113 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion,
106 cantidad.toString(), 114 cantidad.toString(),
107 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, 115 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar,
108 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, 116 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen,
109 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, 117 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio,
110 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, 118 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio,
111 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, 119 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza,
112 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, 120 (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn,
113 InventarioFragment().ObtenerFechaActual(), 121 InventarioFragment().ObtenerFechaActual(),
114 InventarioFragment().ObtenerFechaActual()) 122 InventarioFragment().ObtenerFechaActual())
115 InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS 123 InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS
116 VolverAinventario() 124 VolverAinventario()
125 } else if (artCargadoEnBD != null) {
126
127 val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
128 val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${artCargadoEnBD!!.descripcion}', se encuentra cargado.").setCancelable(false)
129 mDialogView.tvCantInicial.text = artCargadoEnBD!!.cantTomada
130
131 val mAlertDialog = mBuilder.show()
132 mDialogView.rbSumar.setOnClickListener {
133 if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0")
134 mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
135 }
136 mDialogView.rbRestar.setOnClickListener {
137 if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0")
138 if (mDialogView.tvCantInicial.text.toString().toFloat() <= mDialogView.tvNuevaCantidad.text.toString().toFloat()) {
139 mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
140 }
141 }
142 mDialogView.rbMdodificar.setOnClickListener {
143 mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
144 }
145 mDialogView.btnAceptar.setOnClickListener {
146 mAlertDialog.dismiss()
147 val name = mDialogView.tvgenerico4.text.toString().toFloat()
148 //updateCantidad(artCargadoEnBD.sector.toString(),artCargadoEnBD.codigo.toString(), name)
149 }
150 mDialogView.dialogCancelBtn.setOnClickListener {
151 mAlertDialog.dismiss()
152 }
153
154 VolverAinventario()
117 } 155 }
118 }.cancelOnTouchOutside(false).cornerRadius(10F) 156 }
157
119 } 158 }
120 159
121 override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { 160 override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) {
122 super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) 161 super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
123 val itemView = viewHolder.itemView 162 val itemView = viewHolder.itemView
124 163
125 c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) 164 c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat())
126 165
127 if (dX > 0) { 166 if (dX > 0) {
128 167
129 c.drawColor(Color.RED) 168 c.drawColor(Color.RED)
130 } else if (dX < 0) { 169 } else if (dX < 0) {
131 // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) 170 // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom)
132 c.drawColor(Color.YELLOW) 171 c.drawColor(Color.YELLOW)
133 } 172 }
134 swipeBackground.draw(c) 173 swipeBackground.draw(c)
135 super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) 174 super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
136 } 175 }
137 } 176 }
138 val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) 177 val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback)
139 itemTouchHelper2.attachToRecyclerView(rcDescripcion) 178 itemTouchHelper2.attachToRecyclerView(rcDescripcion)
140 179
141 } 180 }
142 181
143 fun InsertarArtEnDB(cuarpoInventario: InvBody) { 182 fun InsertarArtEnDB(cuarpoInventario: InvBody) {
144 lifecycleScope.launch { 183 lifecycleScope.launch {
145 withContext(Dispatchers.IO) { 184 withContext(Dispatchers.IO) {
146 AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) 185 AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario)
147 } 186 }
148 } 187 }
149 } 188 }
150 fun VolverAinventario(){ 189
190 fun VolverAinventario() {
151 191
152 val editor = sharedPreferences.edit() 192 val editor = sharedPreferences.edit()
153 editor?.putString("Inventario", numeroInventario.toString()) 193 editor?.putString("Inventario", numeroInventario.toString())
154 editor?.apply() 194 editor?.apply()
155 editor.commit() 195 editor.commit()
156 navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) 196 navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment)
157 } 197 }
198
199 suspend fun buscarCodigoDeboEnBD(sector: String, codigo: String, numInventario: String): InvBody? {
200 //TODO BUSQUEDA POR CODIGO DE BARRAS
201 var busqueda: InvBody? = null
202 return GlobalScope.async(Dispatchers.IO) {
203 busqueda = AppDb.getAppDb(requireContext())!!.InvBodyDAO()!!.fetchArtInInvBody(sector, codigo, numInventario)
204 return@async busqueda
205 }.await()
206 }
207
208 fun updateCantidad(sector: String, codigo: String, cantidad: Float) {
209 lifecycleScope.launch {
210 withContext(Dispatchers.IO) {
211 AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo)
212 }
213 }
214 }
158 } 215 }
159 216
app/src/main/java/com/focasoftware/deboinventariov20/ui/dialogos/DialogNoEncontrado.kt
1 package com.focasoftware.deboinventariov20.ui.dialogos 1 package com.focasoftware.deboinventariov20.ui.dialogos
2 2
3 import android.app.AlertDialog 3 import android.app.AlertDialog
4 import android.app.Dialog 4 import android.app.Dialog
5 import android.content.DialogInterface 5 import android.content.DialogInterface
6 import android.os.Bundle 6 import android.os.Bundle
7 import android.view.LayoutInflater 7 import android.view.LayoutInflater
8 import androidx.fragment.app.DialogFragment 8 import androidx.fragment.app.DialogFragment
9 import com.focasoftware.deboinventariov20.R 9 import com.focasoftware.deboinventariov20.R
10 import kotlinx.android.synthetic.main.ingresar_cantidad.* 10 import kotlinx.android.synthetic.main.ingresar_cantidad.*
11 import kotlinx.android.synthetic.main.ingresar_cantidad.view.* 11 import kotlinx.android.synthetic.main.ingresar_cantidad.view.*
12 12
13 class DialogNoEncontrado : DialogFragment() { 13 class DialogNoEncontrado : DialogFragment() {
14 14
15 fun newInstance(title: String, s: String): DialogNoEncontrado? { 15 fun newInstance(title: String, s: String): DialogNoEncontrado? {
16 val dialog = DialogNoEncontrado() 16 val dialog = DialogNoEncontrado()
17 17
18 val args = Bundle() 18 val args = Bundle()
19 args.putString("title", title) 19 args.putString("title", title)
20 args.putString("s", s) 20 args.putString("s", s)
21 dialog.arguments = args 21 dialog.arguments = args
22 return dialog 22 return dialog
23 } 23 }
24 override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { 24 override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
25 return activity?.let { 25 return activity?.let {
26 val args = requireArguments() 26 val args = requireArguments()
27 val title = args.getString("title") 27
28 val s = args.getString("s")
29 28
30 val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) 29 val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity())
31 val inflater = requireActivity().layoutInflater; 30 val inflater = requireActivity().layoutInflater;
32 31
33 builder.setView(inflater.inflate(R.layout.ingresar_cantidad, null)) 32 builder.setView(inflater.inflate(R.layout.ingresar_cantidad, null))
34 .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, id ->}) 33 .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, id ->})
35 34
36 35
37 builder.create() 36 builder.create()
38 } ?: throw IllegalStateException("Activity cannot be null") 37 } ?: throw IllegalStateException("Activity cannot be null")
39 } 38 }
40 39
41 } 40 }
42 41
43 42
app/src/main/java/com/focasoftware/deboinventariov20/ui/dialogos/InsertCant.kt
File was created 1 package com.focasoftware.deboinventariov20.ui.dialogos
2
3 import android.app.Dialog
4 import android.content.Context
5 import android.view.View
6 import android.widget.EditText
7 import com.focasoftware.deboinventariov20.R
8
9 class InsertCant(ctxt: Context) : Dialog(ctxt) {
10
11 private val editT: EditText
12 fun get_text(): String {
13 return editT.text.toString()
14 }
15 init {
16 super.setContentView(R.layout.ingresar_cantidad)
17 editT = super.findViewById<View>(R.id.etCantidad) as EditText
18 }
19 }
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/InsertCant.kt
1 package com.focasoftware.deboinventariov20.ui.inventario File was deleted
2
3 import android.app.Dialog
4 import android.content.Context
5 import android.view.View
6 import android.widget.EditText
7 import com.focasoftware.deboinventariov20.R
8
9 class InsertCant(ctxt: Context) : Dialog(ctxt) {
10
11 private val editT: EditText
12 fun get_text(): String {
13 return editT.text.toString()
14 }
15 init {
16 super.setContentView(R.layout.ingresar_cantidad)
17 editT = super.findViewById<View>(R.id.etCantidad) as EditText
18 }
19 }
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/InventarioFragment.kt
1 package com.focasoftware.deboinventariov20.ui.inventario 1 package com.focasoftware.deboinventariov20.ui.inventario
2 2
3 import android.app.AlertDialog
3 import android.content.Context 4 import android.content.Context
4 import android.content.SharedPreferences 5 import android.content.SharedPreferences
5 import android.graphics.Canvas 6 import android.graphics.Canvas
6 import android.graphics.Color 7 import android.graphics.Color
7 import android.graphics.drawable.Drawable 8 import android.graphics.drawable.Drawable
8 import android.os.Bundle 9 import android.os.Bundle
9 import android.text.InputType 10 import android.text.InputType
10 import android.view.KeyEvent 11 import android.view.KeyEvent
11 import android.view.LayoutInflater 12 import android.view.LayoutInflater
12 import android.view.View 13 import android.view.View
13 import android.view.ViewGroup 14 import android.view.ViewGroup
14 import android.widget.EditText 15 import android.widget.EditText
15 import android.widget.TextView 16 import android.widget.TextView
16 import android.widget.Toast 17 import android.widget.Toast
17 import androidx.core.content.ContextCompat 18 import androidx.core.content.ContextCompat
18 import androidx.core.os.bundleOf 19 import androidx.core.os.bundleOf
19 import androidx.fragment.app.Fragment 20 import androidx.fragment.app.Fragment
20 import androidx.lifecycle.lifecycleScope 21 import androidx.lifecycle.lifecycleScope
21 import androidx.navigation.NavController 22 import androidx.navigation.NavController
22 import androidx.navigation.Navigation 23 import androidx.navigation.Navigation
23 import androidx.recyclerview.widget.ItemTouchHelper 24 import androidx.recyclerview.widget.ItemTouchHelper
24 import androidx.recyclerview.widget.LinearLayoutManager 25 import androidx.recyclerview.widget.LinearLayoutManager
25 import androidx.recyclerview.widget.RecyclerView 26 import androidx.recyclerview.widget.RecyclerView
26 import com.afollestad.materialdialogs.MaterialDialog 27 import com.afollestad.materialdialogs.MaterialDialog
27 import com.afollestad.materialdialogs.input.input 28 import com.afollestad.materialdialogs.input.input
28 import com.focasoftware.deboinventariov20.DB.DataBase.AppDb 29 import com.focasoftware.deboinventariov20.DB.DataBase.AppDb
29 import com.focasoftware.deboinventariov20.Model.Articles 30 import com.focasoftware.deboinventariov20.Model.Articles
30 import com.focasoftware.deboinventariov20.Model.InvBody 31 import com.focasoftware.deboinventariov20.Model.InvBody
31 import com.focasoftware.deboinventariov20.Model.InvHead 32 import com.focasoftware.deboinventariov20.Model.InvHead
32 import com.focasoftware.deboinventariov20.R 33 import com.focasoftware.deboinventariov20.R
33 import kotlinx.android.synthetic.main.fragment_inventario.* 34 import kotlinx.android.synthetic.main.fragment_inventario.*
35 import kotlinx.android.synthetic.main.login_dialog.view.*
34 import kotlinx.coroutines.* 36 import kotlinx.coroutines.*
35 import java.time.LocalDateTime 37 import java.time.LocalDateTime
36 import java.time.format.DateTimeFormatter 38 import java.time.format.DateTimeFormatter
37 import java.util.* 39 import java.util.*
38 40
39 41
40 class InventarioFragment : Fragment() { 42 class InventarioFragment : Fragment() {
41 43
42 private lateinit var sharedPreferences: SharedPreferences 44 private lateinit var sharedPreferences: SharedPreferences
43 private var iArea: Int = 0 45 private var iArea: Int = 0
44 private lateinit var invHead: InvHead 46 private lateinit var invHead: InvHead
45 private lateinit var rcInventarios: RecyclerView 47 private lateinit var rcInventarios: RecyclerView
46 private lateinit var viewAdapter: RecyclerView.Adapter<*> 48 private lateinit var viewAdapter: RecyclerView.Adapter<*>
47 private lateinit var viewManager: RecyclerView.LayoutManager 49 private lateinit var viewManager: RecyclerView.LayoutManager
48 private lateinit var sChangeUpper: String 50 private lateinit var sChangeUpper: String
49 private var listArticulos = ArrayList<ItemsRecycler>() 51 private var listArticulos = ArrayList<ItemsRecycler>()
50 private lateinit var navController: NavController 52 private lateinit var navController: NavController
51 private var InventarioNuevo: Int = 0 53 private var InventarioNuevo: Int = 0
52 private var iEstado = 0 54 private var iEstado = 0
53 private var iBusquedaPor=0 55 private var iBusquedaPor = 0
54 private var fCant = 0F 56 private var fCant = 0F
55 private var bFirst = false 57 private var bFirst = false
56 private lateinit var deleteIcon: Drawable 58 private lateinit var deleteIcon: Drawable
57 // private var editTT: EditText? = null 59 // private var editTT: EditText? = null
58 // private var dialogoModificacion: DialogPersoComplexCantidadModificacion? = null 60 // private var dialogoModificacion: DialogPersoComplexCantidadModificacion? = null
59 61
60 override fun onCreate(savedInstanceState: Bundle?) { 62 override fun onCreate(savedInstanceState: Bundle?) {
61 super.onCreate(savedInstanceState) 63 super.onCreate(savedInstanceState)
62 64
63 sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) 65 sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE)
64 if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { 66 if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") {
65 InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() 67 InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt()
66 val editor = sharedPreferences.edit() 68 val editor = sharedPreferences.edit()
67 editor?.putString("Inventario", "-1") 69 editor?.putString("Inventario", "-1")
68 editor?.apply() 70 editor?.apply()
69 editor.commit() 71 editor.commit()
70 } 72 }
71 } 73 }
72 74
73 override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 75 override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
74 val v = inflater.inflate(R.layout.fragment_inventario, container, false) 76 val v = inflater.inflate(R.layout.fragment_inventario, container, false)
75 sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) 77 sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE)
76 val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) 78 val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras)
77 rcInventarios = v.findViewById(R.id.rcInventarios) 79 rcInventarios = v.findViewById(R.id.rcInventarios)
78 val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) 80 val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo)
79 81
80
81 if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO 82 if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO
82 GlobalScope.launch(Dispatchers.Main) { 83 GlobalScope.launch(Dispatchers.Main) {
83 //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO 84 //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO
84 InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 85 InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1
85 SerchArea() 86 SerchArea()
86 val descripInv: String = if (iArea == 0) "Ventas" else "Deposito" 87 val descripInv: String = if (iArea == 0) "Ventas" else "Deposito"
87 //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO 88 //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO
88 invHead = InvHead(InventarioNuevo, descripInv, 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, iArea, AjusteProductos(), ProdNoCont()) 89 invHead = InvHead(InventarioNuevo, descripInv, 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, iArea, AjusteProductos(), ProdNoCont())
89 AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) 90 AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead)
90 tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" 91 tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo"
91 } 92 }
92 } else {// TODO: SI VENGO DE FRAGMENT DESCRIPCION 93 } else {// TODO: SI VENGO DE FRAGMENT DESCRIPCION
93 CargarDeBdInventario(InventarioNuevo) 94 CargarDeBdInventario(InventarioNuevo)
94 tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" 95 tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo"
95 } 96 }
96 97
97 tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> 98 tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent ->
98 if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { 99 if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) {
99 sChangeUpper = tCodigoBarras.text.toString() 100 sChangeUpper = tCodigoBarras.text.toString()
100 101
101 var indiceDelArtEncontrado = 0 102 var indiceDelArtEncontrado = 0
102 103
103 //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS 104 //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS
104 when (iBusquedaPor) { 105 when (iBusquedaPor) {
105 0 -> { 106 0 -> {
106 indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice 107 indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice
107 //TODO Si no lo encuentra devuelve -1 108 //TODO Si no lo encuentra devuelve -1
108 if (indiceDelArtEncontrado != -1) { 109 if (indiceDelArtEncontrado != -1) {
109 if (swSumaUno!!.isChecked) { 110 if (swSumaUno!!.isChecked) {
110 fCant = 0F 111 fCant = 0F
111 fCant = listArticulos[indiceDelArtEncontrado].cantTomada 112 fCant = listArticulos[indiceDelArtEncontrado].cantTomada
112 fCant += 1F 113 fCant += 1F
113 //TODO ACTUALIZO LA CANTIDAD EN LA BD 114 //TODO ACTUALIZO LA CANTIDAD EN LA BD
114 updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) 115 updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant)
115 //TODO ACTUALIZO LA CANTIDAD EN EL RV 116 //TODO ACTUALIZO LA CANTIDAD EN EL RV
116 listArticulos[indiceDelArtEncontrado].cantTomada = fCant 117 listArticulos[indiceDelArtEncontrado].cantTomada = fCant
117 viewAdapter.notifyDataSetChanged() 118 viewAdapter.notifyDataSetChanged()
118 } else { 119 } else {
119 // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) 120 val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
120 // val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Login Form").setCancelable(false) 121 val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.")
121 // val mAlertDialog = mBuilder.show() 122 .setCancelable(false)
122 // mDialogView.dialogLoginBtn.setOnClickListener { 123 mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString()
123 // mAlertDialog.dismiss() 124 val mAlertDialog = mBuilder.show()
124 // //get text from EditTexts of custom layout 125 mDialogView.rbSumar.setOnClickListener {
125 // val name = mDialogView.dialogNameEt.text.toString() 126 if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0")
126 // val email = mDialogView.dialogEmailEt.text.toString() 127 mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
127 // val password = mDialogView.dialogPasswEt.text.toString() 128 }
128 // fCant = 0F 129 mDialogView.rbRestar.setOnClickListener {
129 // fCant = name.toFloat() 130 if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0")
130 // } 131 if (mDialogView.tvCantInicial.text.toString().toFloat() <= mDialogView.tvNuevaCantidad.text.toString().toFloat()) {
131 // mDialogView.dialogCancelBtn.setOnClickListener { 132 mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
132 // mAlertDialog.dismiss()
133 // }
134 fCant = listArticulos[indiceDelArtEncontrado].cantTomada
135
136 val type = InputType.TYPE_CLASS_NUMBER
137 MaterialDialog(requireContext()).show {
138
139 title(text = "Producto '$sChangeUpper', se encuentra cargado.")
140 message(R.string.sMensajeEncontrado)
141 input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence ->
142 // val inputField = materialDialog.getInputField()
143 // val isValid = charSequence.isEmpty()
144 //
145 // inputField.error = if (isValid) null else "El campo no puede quedar vacio"
146 // materialDialog.setActionButtonEnabled(WhichButton.POSITIVE, isValid)
147 fCant = 0F
148 fCant = charSequence.toString().toFloat()
149 } 133 }
150 positiveButton(R.string.btnOk) { 134 }
151 //TODO ACTUALIZO CANTIADAD EN BD 135 mDialogView.rbMdodificar.setOnClickListener {
152 updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) 136 mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
153 //TODO ACTUALIZO CANTIDAD EN RV 137 }
154 listArticulos[indiceDelArtEncontrado].cantTomada = fCant 138 mDialogView.btnAceptar.setOnClickListener {
155 viewAdapter.notifyDataSetChanged() 139 mAlertDialog.dismiss()
156 dismiss() 140 val name = mDialogView.tvgenerico4.text.toString().toFloat()
157 } 141 fCant = 0F
158 }.cancelOnTouchOutside(false).cornerRadius(10F) 142 fCant = name
143 listArticulos[indiceDelArtEncontrado].cantTomada = fCant
144 updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant)
145 viewAdapter.notifyDataSetChanged()
146 }
147 mDialogView.dialogCancelBtn.setOnClickListener {
148 mAlertDialog.dismiss()
149 }
159 } 150 }
160 151
161 } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD 152 } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD
162 153
163 GlobalScope.launch(Dispatchers.Main) { 154 GlobalScope.launch(Dispatchers.Main) {
164 //TODO BUSCO EN BASE DE DATOS 155 //TODO BUSCO EN BASE DE DATOS
165 val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) 156 val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT))
166 ContinuarCargaCB(artEncontrado) 157 ContinuarCargaCB(artEncontrado)//TODO SE MANDA CERO POR QUE ES UN ARTICULO ESCANEADO NUEVO PARA QUE SEA COMPATIBLE
167 } 158 }
168 } 159 }
169 160
170 tCodigoBarras.focusable = View.FOCUSABLE 161 tCodigoBarras.focusable = View.FOCUSABLE
171 tCodigoBarras.setText("") 162 tCodigoBarras.setText("")
172 tCodigoBarras.selectAll() 163 tCodigoBarras.selectAll()
173 return@setOnKeyListener true 164 return@setOnKeyListener true
174 165
175 166
176 } 167 }
177 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** 168 1 -> {//TODO: BUSQUEDA POR DESCRIPCION**************************************************************************
178 // 169 //
179 // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice 170 // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice
180 // //TODO Si no lo encuentra devuelve -1 171 // //TODO Si no lo encuentra devuelve -1
181 // if (indiceDelArtEncontrado != -1) { 172 // if (indiceDelArtEncontrado != -1) {
182 //// if (swSumaUno!!.isChecked) { 173 //// if (swSumaUno!!.isChecked) {
183 //// fCant = 0F 174 //// fCant = 0F
184 //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada 175 //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada
185 //// fCant += 1F 176 //// fCant += 1F
186 //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant 177 //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant
187 //// viewAdapter.notifyDataSetChanged() 178 //// viewAdapter.notifyDataSetChanged()
188 //// } else { 179 //// } else {
189 // fCant = listArticulos[indiceDelArtEncontrado].cantTomada 180 // fCant = listArticulos[indiceDelArtEncontrado].cantTomada
190 // MaterialDialog(requireContext()).show { 181 // MaterialDialog(requireContext()).show {
191 // title(R.string.sTituloNueva) 182 // title(R.string.sTituloNueva)
192 // message(R.string.sCantidadNueva) 183 // message(R.string.sCantidadNueva)
193 // input { materialDialog, charSequence -> 184 // input { materialDialog, charSequence ->
194 // fCant = 0F 185 // fCant = 0F
195 // fCant = charSequence.toString().toFloat() 186 // fCant = charSequence.toString().toFloat()
196 // } 187 // }
197 // positiveButton(R.string.btnOk) { 188 // positiveButton(R.string.btnOk) {
198 // listArticulos[indiceDelArtEncontrado].cantTomada = fCant 189 // listArticulos[indiceDelArtEncontrado].cantTomada = fCant
199 // viewAdapter.notifyDataSetChanged() 190 // viewAdapter.notifyDataSetChanged()
200 // dismiss() 191 // dismiss()
201 // } 192 // }
202 // }.cancelOnTouchOutside(false).cornerRadius(10F) 193 // }.cancelOnTouchOutside(false).cornerRadius(10F)
203 //// } 194 //// }
204 // 195 //
205 // } else if 196 // } else if
206 // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD 197 // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD
207 GlobalScope.launch(Dispatchers.Main) { 198 GlobalScope.launch(Dispatchers.Main) {
208 val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) 199 val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT))
209 ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) 200 ContinuarCargaDesc(artEncontrado as ArrayList<Articles>)
210 } 201 }
211 // } 202 // }
212 tCodigoBarras.focusable = View.FOCUSABLE 203 tCodigoBarras.focusable = View.FOCUSABLE
213 tCodigoBarras.setText("") 204 tCodigoBarras.setText("")
214 tCodigoBarras.selectAll() 205 tCodigoBarras.selectAll()
215 return@setOnKeyListener true 206 return@setOnKeyListener true
216 } 207 }
217 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** 208 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN**************************************************************************
218 indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice 209 indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice
219 //TODO Si no lo encuentra devuelve -1 210 //TODO Si no lo encuentra devuelve -1
220 if (indiceDelArtEncontrado != -1) { 211 if (indiceDelArtEncontrado != -1) {
221 if (swSumaUno!!.isChecked) { 212 if (swSumaUno!!.isChecked) {
222 fCant = 0F 213 fCant = 0F
223 fCant = listArticulos[indiceDelArtEncontrado].cantTomada 214 fCant = listArticulos[indiceDelArtEncontrado].cantTomada
224 fCant += 1F 215 fCant += 1F
225 //TODO ACTUALIZO LA CANTIDAD EN LA BD 216 //TODO ACTUALIZO LA CANTIDAD EN LA BD
226 updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) 217 updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant)
227 //TODO ACTUALIZO LA CANTIDAD EN EL RV 218 //TODO ACTUALIZO LA CANTIDAD EN EL RV
228 listArticulos[indiceDelArtEncontrado].cantTomada = fCant 219 listArticulos[indiceDelArtEncontrado].cantTomada = fCant
229 viewAdapter.notifyDataSetChanged() 220 viewAdapter.notifyDataSetChanged()
230 } else { 221 } else {
231 fCant = listArticulos[indiceDelArtEncontrado].cantTomada 222 val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null)
232 val type = InputType.TYPE_CLASS_NUMBER 223 val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Producto '${listArticulos[indiceDelArtEncontrado].descripcion}', se encuentra cargado.")
233 MaterialDialog(requireContext()).show { 224 .setCancelable(false)
234 225 mDialogView.tvCantInicial.text = listArticulos[indiceDelArtEncontrado].cantTomada.toString()
235 title(text = "Producto '$sChangeUpper', se encuentra cargado.") 226 val mAlertDialog = mBuilder.show()
236 message(R.string.sCantidadNueva) 227 mDialogView.rbSumar.setOnClickListener {
237 input (waitForPositiveButton = false ,hint = "99.99", inputType = type){ materialDialog, charSequence -> 228 if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0")
238 fCant = 0F 229 mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() + mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
239 fCant = charSequence.toString().toFloat() 230 }
240 } 231 mDialogView.rbRestar.setOnClickListener {
241 positiveButton(R.string.btnOk) { 232 if (mDialogView.tvNuevaCantidad.text.isNullOrEmpty()) mDialogView.tvNuevaCantidad.setText("0")
242 //TODO ACTUALIZO CANTIADAD EN BD 233 if (mDialogView.tvCantInicial.text.toString().toFloat() <= mDialogView.tvNuevaCantidad.text.toString().toFloat()) {
243 updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) 234 mDialogView.tvgenerico4.text = (mDialogView.tvCantInicial.text.toString().toFloat() - mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
244 //TODO ACTUALIZO CANTIDAD EN RV
245 listArticulos[indiceDelArtEncontrado].cantTomada = fCant
246 viewAdapter.notifyDataSetChanged()
247 dismiss()
248 } 235 }
249 }.cancelOnTouchOutside(false).cornerRadius(10F) 236 }
237 mDialogView.rbMdodificar.setOnClickListener {
238 mDialogView.tvgenerico4.text = (mDialogView.tvNuevaCantidad.text.toString().toFloat()).toString()
239 }
240 mDialogView.btnAceptar.setOnClickListener {
241 mAlertDialog.dismiss()
242 val name = mDialogView.tvgenerico4.text.toString().toFloat()
243 fCant = 0F
244 fCant = name
245 listArticulos[indiceDelArtEncontrado].cantTomada = fCant
246 updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant)
247 viewAdapter.notifyDataSetChanged()
248 }
249 mDialogView.dialogCancelBtn.setOnClickListener {
250 mAlertDialog.dismiss()
251 }
252 // fCant = listArticulos[indiceDelArtEncontrado].cantTomada
253 // val type = InputType.TYPE_CLASS_NUMBER
254 // MaterialDialog(requireContext()).show {
255 //
256 // title(text = "Producto '$sChangeUpper', se encuentra cargado.")
257 // message(R.string.sCantidadNueva)
258 // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence ->
259 // fCant = 0F
260 // fCant = charSequence.toString().toFloat()
261 // }
262 // positiveButton(R.string.btnOk) {
263 // //TODO ACTUALIZO CANTIADAD EN BD
264 // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant)
265 // //TODO ACTUALIZO CANTIDAD EN RV
266 // listArticulos[indiceDelArtEncontrado].cantTomada = fCant
267 // viewAdapter.notifyDataSetChanged()
268 // dismiss()
269 // }
270 // }.cancelOnTouchOutside(false).cornerRadius(10F)
250 } 271 }
251 272
252 } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD 273 } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD
253 274
254 GlobalScope.launch(Dispatchers.Main) { 275 GlobalScope.launch(Dispatchers.Main) {
255 //TODO BUSCO EN BASE DE DATOS 276 //TODO BUSCO EN BASE DE DATOS
277 listArticulos[indiceDelArtEncontrado].cantTomada
256 val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) 278 val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT))
257 ContinuarCargaCB(artEncontrado) 279 ContinuarCargaCB(artEncontrado)
258 } 280 }
259 } 281 }
260 282
261 tCodigoBarras.focusable = View.FOCUSABLE 283 tCodigoBarras.focusable = View.FOCUSABLE
262 tCodigoBarras.setText("") 284 tCodigoBarras.setText("")
263 tCodigoBarras.selectAll() 285 tCodigoBarras.selectAll()
264 return@setOnKeyListener true 286 return@setOnKeyListener true
265 287
266 288
267 } 289 }
268 } 290 }
269 } 291 }
270 return@setOnKeyListener false 292 return@setOnKeyListener false
271 } 293 }
272 return v 294 return v
273 } 295 }
274 296
275 override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 297 override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
276 super.onViewCreated(view, savedInstanceState) 298 super.onViewCreated(view, savedInstanceState)
277 navController = Navigation.findNavController(view) 299 navController = Navigation.findNavController(view)
278 etCodigoBarras.requestFocus() 300 etCodigoBarras.requestFocus()
279 301
280 btnBorrarInv.setOnClickListener { 302 btnBorrarInv.setOnClickListener {
281 MaterialDialog(requireContext()).show { 303 MaterialDialog(requireContext()).show {
282 title(R.string.sTituloBorrarInv) 304 title(R.string.sTituloBorrarInv)
283 message(R.string.sMensajeBorrarInv) 305 message(R.string.sMensajeBorrarInv)
284 positiveButton(R.string.btnOk) { 306 positiveButton(R.string.btnOk) {
285 BorrarInvActual() 307 BorrarInvActual()
286 Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() 308 Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show()
287 navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) 309 navController.navigate(R.id.action_inventarioFragment_to_mainFragment2)
288 InventarioNuevo = 0 310 InventarioNuevo = 0
289 dismiss() 311 dismiss()
290 } 312 }
291 negativeButton { 313 negativeButton {
292 dismiss() 314 dismiss()
293 } 315 }
294 }.cancelOnTouchOutside(false).cornerRadius(10F) 316 }.cancelOnTouchOutside(false).cornerRadius(10F)
295 } 317 }
296 318
297 btnExportarInv.setOnClickListener { 319 btnExportarInv.setOnClickListener {
298 MaterialDialog(requireContext()).show { 320 MaterialDialog(requireContext()).show {
299 title(R.string.sTituloExportar) 321 title(R.string.sTituloExportar)
300 message(R.string.sMensajeExportar) 322 message(R.string.sMensajeExportar)
301 positiveButton(R.string.btnOk) { 323 positiveButton(R.string.btnOk) {
302 BorrarInvActual() 324 BorrarInvActual()
303 Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() 325 Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show()
304 navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) 326 navController.navigate(R.id.action_inventarioFragment_to_mainFragment2)
305 InventarioNuevo = 0 327 InventarioNuevo = 0
306 dismiss() 328 dismiss()
307 } 329 }
308 negativeButton { 330 negativeButton {
309 dismiss() 331 dismiss()
310 } 332 }
311 }.cancelOnTouchOutside(false).cornerRadius(10F) 333 }.cancelOnTouchOutside(false).cornerRadius(10F)
312 } 334 }
313 ivCamara.setOnClickListener { 335 ivCamara.setOnClickListener {
314 if (!bFirst) { 336 if (!bFirst) {
315 iEstado = 1 337 iEstado = 1
316 bFirst = true 338 bFirst = true
317 } 339 }
318 340
319 when (iEstado) { 341 when (iEstado) {
320 0 -> { 342 0 -> {
321 ivCamara.setImageResource(R.drawable.codbar) 343 ivCamara.setImageResource(R.drawable.codbar)
322 etCodigoBarras.hint = "Busqueda por C. Barras" 344 etCodigoBarras.hint = "Busqueda por C. Barras"
323 swSumaUno.visibility = View.VISIBLE 345 swSumaUno.visibility = View.VISIBLE
324 iBusquedaPor=0 346 iBusquedaPor = 0
325 iEstado = 1 347 iEstado = 1
326 } 348 }
327 1 -> { 349 1 -> {
328 ivCamara.setImageResource(R.drawable.desc) 350 ivCamara.setImageResource(R.drawable.desc)
329 etCodigoBarras.hint = "Busqueda por Descripción" 351 etCodigoBarras.hint = "Busqueda por Descripción"
330 swSumaUno.visibility = View.GONE 352 swSumaUno.visibility = View.GONE
331 iBusquedaPor=1 353 iBusquedaPor = 1
332 iEstado = 2 354 iEstado = 2
333 } 355 }
334 2 -> { 356 2 -> {
335 ivCamara.setImageResource(R.drawable.cod_origen) 357 ivCamara.setImageResource(R.drawable.cod_origen)
336 etCodigoBarras.hint = "Busqueda por C. Origen" 358 etCodigoBarras.hint = "Busqueda por C. Origen"
337 swSumaUno.visibility = View.GONE 359 swSumaUno.visibility = View.GONE
338 iBusquedaPor=2 360 iBusquedaPor = 2
339 iEstado = 0 361 iEstado = 0
340 } 362 }
341 } 363 }
342 } 364 }
343 } 365 }
344 366
345 private fun BorrarInvActual() { 367 private fun BorrarInvActual() {
346 lifecycleScope.launch { 368 lifecycleScope.launch {
347 withContext(Dispatchers.IO) { 369 withContext(Dispatchers.IO) {
348 AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) 370 AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo)
349 AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) 371 AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo)
350 } 372 }
351 } 373 }
352 } 374 }
353 375
354 private fun CargarDeBdInventario(ultimoInv: Int) { 376 private fun CargarDeBdInventario(ultimoInv: Int) {
355 GlobalScope.launch(Dispatchers.Main) { 377 GlobalScope.launch(Dispatchers.Main) {
356 val invbody = cargarInventario(ultimoInv) 378 val invbody = cargarInventario(ultimoInv)
357 for ((i, item) in invbody!!.withIndex()) { 379 for ((i, item) in invbody!!.withIndex()) {
358 val art = Articles(invbody[i].sector, 380 val art = Articles(invbody[i].sector,
359 invbody[i].codigo, 381 invbody[i].codigo,
360 invbody[i].descripcion, 382 invbody[i].descripcion,
361 invbody[i].codBar, 383 invbody[i].codBar,
362 invbody[i].codOrigen, 384 invbody[i].codOrigen,
363 invbody[i].precio, 385 invbody[i].precio,
364 invbody[i].costo, 386 invbody[i].costo,
365 invbody[i].balanza, 387 invbody[i].balanza,
366 invbody[i].depSn, 388 invbody[i].depSn,
367 invbody[i].costo) 389 invbody[i].costo)
368 cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) 390 cargarRecicler(art, invbody[i].cantTomada!!.toFloat())
369 } 391 }
370 } 392 }
371 393
372 } 394 }
373 395
374 private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { 396 private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) {
375 //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS 397 //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS
376 //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV 398 //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV
377 399
378 if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD 400 if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD
379 // if (swSumaUno!!.isChecked) {// TODO: SI ESTA +1, PONE CANTIDAD 1 401 // if (swSumaUno!!.isChecked) {// TODO: SI ESTA +1, PONE CANTIDAD 1
380 if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV 402 if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV
381 fCant = 0F 403 fCant = 0F
382 fCant += 1F 404 fCant += 1F
383 // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV 405 // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV
384 val acargarPorDesc = Articles(artAcargar[0].sector, 406 val acargarPorDesc = Articles(artAcargar[0].sector,
385 artAcargar[0].codigo, 407 artAcargar[0].codigo,
386 artAcargar[0].descripcion, 408 artAcargar[0].descripcion,
387 artAcargar[0].codBar, 409 artAcargar[0].codBar,
388 artAcargar[0].codOrigen, 410 artAcargar[0].codOrigen,
389 artAcargar[0].precio, 411 artAcargar[0].precio,
390 artAcargar[0].costo, 412 artAcargar[0].costo,
391 artAcargar[0].balanza, 413 artAcargar[0].balanza,
392 artAcargar[0].depSn, 414 artAcargar[0].depSn,
393 "") 415 "")
394 // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD 416 // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD
395 cargarArtEnBd(acargarPorDesc, fCant) 417 cargarArtEnBd(acargarPorDesc, fCant)
396 cargarRecicler(acargarPorDesc, fCant) 418 cargarRecicler(acargarPorDesc, fCant)
397 } else { 419 } else {
398 var bundle = Bundle() 420 var bundle = Bundle()
399 bundle = bundleOf("ArrayDesc" to artAcargar) 421 bundle = bundleOf("ArrayDesc" to artAcargar)
400 bundle.putInt("numeroInv", InventarioNuevo) 422 bundle.putInt("numeroInv", InventarioNuevo)
401 navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) 423 navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle)
402 } 424 }
403 // } else {//SI NO ESTA +1 425 // } else {//SI NO ESTA +1
404 // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV 426 // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV
405 // fCant = listArticulos[0].cantTomada 427 // fCant = listArticulos[0].cantTomada
406 // MaterialDialog(requireContext()).show { 428 // MaterialDialog(requireContext()).show {
407 // title(R.string.sTituloNueva) 429 // title(R.string.sTituloNueva)
408 // message(R.string.sCantidadNueva) 430 // message(R.string.sCantidadNueva)
409 // input { materialDialog, charSequence -> 431 // input { materialDialog, charSequence ->
410 // fCant = 0F 432 // fCant = 0F
411 // fCant = charSequence.toString().toFloat() 433 // fCant = charSequence.toString().toFloat()
412 // } 434 // }
413 // positiveButton(R.string.btnOk) { 435 // positiveButton(R.string.btnOk) {
414 // listArticulos[0].cantTomada = fCant 436 // listArticulos[0].cantTomada = fCant
415 // viewAdapter.notifyDataSetChanged() 437 // viewAdapter.notifyDataSetChanged()
416 // dismiss() 438 // dismiss()
417 // } 439 // }
418 // }.cancelOnTouchOutside(false).cornerRadius(10F) 440 // }.cancelOnTouchOutside(false).cornerRadius(10F)
419 // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV 441 // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV
420 // val acargarPorDesc = Articles(artAcargar[0].sector, 442 // val acargarPorDesc = Articles(artAcargar[0].sector,
421 // artAcargar[0].codigo, 443 // artAcargar[0].codigo,
422 // artAcargar[0].descripcion, 444 // artAcargar[0].descripcion,
423 // artAcargar[0].codBar, 445 // artAcargar[0].codBar,
424 // artAcargar[0].cod_origen, 446 // artAcargar[0].cod_origen,
425 // artAcargar[0].precio, 447 // artAcargar[0].precio,
426 // artAcargar[0].costo, 448 // artAcargar[0].costo,
427 // artAcargar[0].balanza, 449 // artAcargar[0].balanza,
428 // artAcargar[0].depSn, 450 // artAcargar[0].depSn,
429 // "") 451 // "")
430 // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD 452 // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD
431 // cargarArtEnBd(acargarPorDesc, fCant) 453 // cargarArtEnBd(acargarPorDesc, fCant)
432 // cargarRecicler(acargarPorDesc, fCant) 454 // cargarRecicler(acargarPorDesc, fCant)
433 // } else { 455 // } else {
434 // var bundle = Bundle() 456 // var bundle = Bundle()
435 // bundle = bundleOf("ArrayDesc" to artAcargar) 457 // bundle = bundleOf("ArrayDesc" to artAcargar)
436 // bundle.putInt("numeroInv", InventarioNuevo) 458 // bundle.putInt("numeroInv", InventarioNuevo)
437 // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) 459 // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle)
438 // } 460 // }
439 // } 461 // }
440 } else {//TODO si no lo encuentra en la BD 462 } else {//TODO si no lo encuentra en la BD
441 MaterialDialog(requireContext()).show { 463 MaterialDialog(requireContext()).show {
442 title(text = "El articulo ${etCodigoBarras.text}") 464 title(text = "El articulo ${etCodigoBarras.text}")
443 message(R.string.sMensaje) 465 message(R.string.sMensaje)
444 positiveButton(R.string.btnOk) { 466 positiveButton(R.string.btnOk) {
445 dismiss() 467 dismiss()
446 } 468 }
447 }.cornerRadius(10F) 469 }.cornerRadius(10F)
448 } 470 }
449 } 471 }
450 472
451 private fun ContinuarCargaCB(artAcargar: Articles?) { 473 private fun ContinuarCargaCB(artAcargar: Articles?) {
452 474
453 if (artAcargar != null) {//Si lo encuentra en la BD 475 if (artAcargar != null) {// TODO: Si lo encuentra en la BD
454 if (swSumaUno!!.isChecked) {// SI ESTA +1, PONE CANTIDAD 1 476 if (swSumaUno!!.isChecked) {//TODO: SI ESTA +1, PONE CANTIDAD 1
455 fCant = 0F 477 fCant = 0F
456 fCant += 1F 478 fCant += 1F
457 cargarArtEnBd(artAcargar, fCant) 479 cargarArtEnBd(artAcargar, fCant)
458 cargarRecicler(artAcargar, fCant) 480 cargarRecicler(artAcargar, fCant)
459 } else {//SI NO ESTA +1 PREGUNTA CANTIDAD 481 } else {//SI NO ESTA +1 PREGUNTA CANTIDAD
482
460 val type = InputType.TYPE_CLASS_PHONE 483 val type = InputType.TYPE_CLASS_PHONE
461 MaterialDialog(requireContext()).show { 484 MaterialDialog(requireContext()).show {
462 485
463 title(text = "Producto: $sChangeUpper") 486 title(text = "Producto: $sChangeUpper")
464 message(R.string.sMensajeEncontrado) 487 message(text = "Ingrese la cantidad")
465 input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> 488 input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence ->
466 // val inputField = materialDialog.getInputField() 489 // val inputField = materialDialog.getInputField()
467 // val isValid = charSequence.isEmpty() 490 // val isValid = charSequence.isEmpty()
468 // 491 //
469 // inputField.error = if (isValid) null else "El campo no puede quedar vacio" 492 // inputField.error = if (isValid) null else "El campo no puede quedar vacio"
470 // materialDialog.setActionButtonEnabled(WhichButton.POSITIVE, isValid) 493 // materialDialog.setActionButtonEnabled(WhichButton.POSITIVE, isValid)
471 fCant = 0F 494 fCant = 0F
472 fCant = charSequence.toString().toFloat() 495 fCant = charSequence.toString().toFloat()
473 } 496 }
474 positiveButton(R.string.btnOk) { 497 positiveButton(R.string.btnOk) {
475 dismiss() 498 dismiss()
476 cargarArtEnBd(artAcargar, fCant) 499 cargarArtEnBd(artAcargar, fCant)
477 cargarRecicler(artAcargar, fCant) 500 cargarRecicler(artAcargar, fCant)
478 501
479 } 502 }
480 }.cancelOnTouchOutside(false).cornerRadius(10F) 503 }.cancelOnTouchOutside(false).cornerRadius(10F)
481 } 504 }
482 } else {// TODO si no lo encuentra en la BD 505 } else {// TODO si no lo encuentra en la BD
483 506
484 MaterialDialog(requireContext()).show { 507 MaterialDialog(requireContext()).show {
485 title(text = "El producto: $sChangeUpper") 508 title(text = "El producto: $sChangeUpper")
486 message(text = "¡No fue encontrado!") 509 message(text = "¡No fue encontrado!")
487 positiveButton(R.string.btnOk) {} 510 positiveButton(R.string.btnOk) {}
488 dismiss() 511 dismiss()
489 } 512 }
490 } 513 }
491 } 514 }
492 515
493 suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { 516 suspend fun buscarCBEnBD(CodigoBarras: String): Articles? {
494 //TODO BUSQUEDA POR CODIGO DE BARRAS 517 //TODO BUSQUEDA POR CODIGO DE BARRAS
495 var busqueda: Articles? = null 518 var busqueda: Articles? = null
496 return GlobalScope.async(Dispatchers.IO) { 519 return GlobalScope.async(Dispatchers.IO) {
497 busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, iArea) 520 busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, iArea)
498 return@async busqueda 521 return@async busqueda
499 }.await() 522 }.await()
500 } 523 }
501 524
502 suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { 525 suspend fun buscarDescEnBD(descripcion: String): List<Articles>? {
503 //TODO BUSQUEDA POR DESCRIPCION 526 //TODO BUSQUEDA POR DESCRIPCION
504 var busqueda: List<Articles>? = null 527 var busqueda: List<Articles>? = null
505 return GlobalScope.async(Dispatchers.IO) { 528 return GlobalScope.async(Dispatchers.IO) {
506 busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, iArea) 529 busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, iArea)
507 return@async busqueda 530 return@async busqueda
508 }.await() 531 }.await()
509 } 532 }
510 533
511 private fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { 534 private fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int {
512 var indice = 0 535 var indice = 0
513 var bEncontrado = false 536 var bEncontrado = false
514 if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS 537 if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS
515 for (item in listArticulos) { 538 for (item in listArticulos) {
516 if (item.codigoBarras!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { 539 if (item.codigoBarras!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) {
517 bEncontrado = true 540 bEncontrado = true
518 break 541 break
519 } 542 }
520 indice += 1 543 indice += 1
521 } 544 }
522 } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION 545 } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION
523 for (item in listArticulos) { 546 for (item in listArticulos) {
524 if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { 547 if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) {
525 bEncontrado = true 548 bEncontrado = true
526 break 549 break
527 } 550 }
528 indice += 1 551 indice += 1
529 } 552 }
530 } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN 553 } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN
531 for (item in listArticulos) { 554 for (item in listArticulos) {
532 if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { 555 if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) {
533 bEncontrado = true 556 bEncontrado = true
534 break 557 break
535 } 558 }
536 indice += 1 559 indice += 1
537 } 560 }
538 } 561 }
539 return if (bEncontrado) indice 562 return if (bEncontrado) indice
540 else -1 563 else -1
541 } 564 }
542 565
543 private fun cargarArtEnBd(articulos: Articles, cant: Float) { 566 private fun cargarArtEnBd(articulos: Articles, cant: Float) {
544 val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD 567 val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD
545 articulos.sector, 568 articulos.sector,
546 articulos.codigo, 569 articulos.codigo,
547 articulos.descripcion, 570 articulos.descripcion,
548 cant.toString(), 571 cant.toString(),
549 articulos.codBar, 572 articulos.codBar,
550 articulos.codOrigen, 573 articulos.codOrigen,
551 articulos.precio, 574 articulos.precio,
552 articulos.precio, 575 articulos.precio,
553 articulos.balanza, 576 articulos.balanza,
554 articulos.depSn, 577 articulos.depSn,
555 ObtenerFechaActual(), 578 ObtenerFechaActual(),
556 ObtenerFechaActual()) 579 ObtenerFechaActual())
557 InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS 580 InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS
558 } 581 }
559 582
560 fun cargarRecicler(articulos: Articles, cant: Float) { 583 fun cargarRecicler(articulos: Articles, cant: Float) {
561 584
562 //TODO CARGO EN LE RV 585 //TODO CARGO EN LE RV
563 val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen) 586 val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen)
564 listArticulos.add(item) 587 listArticulos.add(item)
565 588
566 viewAdapter = ProductosListAdapter(listArticulos) 589 viewAdapter = ProductosListAdapter(listArticulos)
567 viewManager = LinearLayoutManager(requireContext()) 590 viewManager = LinearLayoutManager(requireContext())
568 deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! 591 deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!!
569 rcInventarios.apply { 592 rcInventarios.apply {
570 adapter = viewAdapter 593 adapter = viewAdapter
571 layoutManager = viewManager 594 layoutManager = viewManager
572 } 595 }
573 val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { 596 val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) {
574 override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { 597 override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean {
575 return false 598 return false
576 } 599 }
577 600
578 override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { 601 override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
579 (viewAdapter as ProductosListAdapter).removeItem(viewHolder) 602 (viewAdapter as ProductosListAdapter).removeItem(viewHolder)
580 viewAdapter.notifyDataSetChanged() 603 viewAdapter.notifyDataSetChanged()
581 } 604 }
582 605
583 override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { 606 override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) {
584 val itemView = viewHolder.itemView 607 val itemView = viewHolder.itemView
585 val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 608 val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2
586 c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) 609 c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat())
587 610
588 if (dX > 0) { 611 if (dX > 0) {
589 612
590 if (dX < c.width / 2) c.drawColor(Color.GREEN) 613 if (dX < c.width / 2) c.drawColor(Color.GREEN)
591 else c.drawColor(Color.RED) 614 else c.drawColor(Color.RED)
592 deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) 615 deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin)
593 } else { 616 } else {
594 617
595 } 618 }
596 619
597 super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) 620 super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
598 deleteIcon.draw(c) 621 deleteIcon.draw(c)
599 } 622 }
600 } 623 }
601 624
602 val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) 625 val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback)
603 itemTouchHelper.attachToRecyclerView(rcInventarios) 626 itemTouchHelper.attachToRecyclerView(rcInventarios)
604 } 627 }
605 628
606 private fun ProdNoCont(): Int? { 629 private fun ProdNoCont(): Int? {
607 var mostrarStock = 0 630 var mostrarStock = 0
608 if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 631 if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1
609 return mostrarStock 632 return mostrarStock
610 } 633 }
611 634
612 private fun AjusteProductos(): Int? { 635 private fun AjusteProductos(): Int? {
613 var prodInclu = 0 636 var prodInclu = 0
614 if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 637 if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1
615 638
616 if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 639 if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0
617 return prodInclu 640 return prodInclu
618 } 641 }
619 642
620 private fun SerchArea() { 643 private fun SerchArea() {
621 644
622 if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 645 if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0
623 if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 646 if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1
624 } 647 }
625 648
626 fun ObtenerFechaActual(): String? { 649 fun ObtenerFechaActual(): String? {
627 //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD 650 //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD
628 val current = LocalDateTime.now() 651 val current = LocalDateTime.now()
629 val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") 652 val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss")
630 val dFechaHora = current.format(formatter) 653 val dFechaHora = current.format(formatter)
631 return dFechaHora.toString() 654 return dFechaHora.toString()
632 } 655 }
633 656
634 fun InsertarArtEnDB(cuarpoInventario: InvBody) { 657 fun InsertarArtEnDB(cuarpoInventario: InvBody) {
635 lifecycleScope.launch { 658 lifecycleScope.launch {
636 withContext(Dispatchers.IO) { 659 withContext(Dispatchers.IO) {
637 AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) 660 AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario)
638 } 661 }
639 } 662 }
640 } 663 }
641 664
642 fun updateCantidad(sector: String, codigo: String, cantidad: Float) { 665 fun updateCantidad(sector: String, codigo: String, cantidad: Float) {
643 lifecycleScope.launch { 666 lifecycleScope.launch {
644 withContext(Dispatchers.IO) { 667 withContext(Dispatchers.IO) {
645 AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) 668 AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo)
646 } 669 }
647 } 670 }
app/src/main/res/drawable-v24/icono_inventario_big.png

13.3 KB

app/src/main/res/layout-land/fragment_configuracion.xml
File was created 1 <?xml version="1.0" encoding="UTF-8"?>
2 <ScrollView
3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools"
5 tools:context=".ui.configuracion.ConfiguracionFragment"
6 xmlns:android="http://schemas.android.com/apk/res/android"
7 android:layout_width="match_parent"
8 android:layout_height="wrap_content">
9
10 <androidx.constraintlayout.widget.ConstraintLayout
11 android:layout_width="match_parent"
12 android:layout_height="wrap_content">
13
14 <androidx.appcompat.widget.AppCompatTextView
15 android:id="@+id/textView2"
16 android:layout_width="match_parent"
17 android:layout_height="wrap_content"
18 android:layout_marginTop="@dimen/MarginTopTitulos"
19 android:gravity="center"
20 android:lines="1"
21 android:text="@string/tvTituloConf"
22 android:textColor="@color/colorAccent"
23 android:textSize="@dimen/Titulos"
24 app:fontFamily="sans-serif-condensed"
25 app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor"
26 app:layout_constraintEnd_toEndOf="parent"
27 app:layout_constraintStart_toStartOf="parent"
28 app:layout_constraintTop_toTopOf="parent" />
29
30 <TextView
31 android:id="@+id/tvSeleccioneServidor"
32 android:layout_width="0dp"
33 android:layout_height="wrap_content"
34
35 android:layout_marginStart="@dimen/MarginBotAgreSer"
36 android:layout_marginTop="@dimen/MarginTopSubTitulos"
37 android:gravity="start"
38 android:lines="1"
39 android:text="@string/tvSeleccioneServidor"
40 android:textColor="@android:color/black"
41 android:textSize="@dimen/SubTitulos"
42 app:fontFamily="sans-serif-condensed"
43 app:layout_constraintBottom_toTopOf="@+id/spServidor"
44 app:layout_constraintEnd_toEndOf="parent"
45 app:layout_constraintStart_toStartOf="parent"
46 app:layout_constraintTop_toBottomOf="@+id/textView2" />
47
48 <Spinner
49 android:id="@+id/spServidor"
50 android:layout_width="0dp"
51 android:layout_height="wrap_content"
52 android:backgroundTint="@color/LightGray"
53 android:elevation="5dp"
54 android:fadeScrollbars="true"
55 android:foregroundTint="@android:color/holo_orange_dark"
56 android:soundEffectsEnabled="true"
57 android:spinnerMode="dialog"
58 android:splitMotionEvents="false"
59 android:textAlignment="center"
60 android:textSize="@dimen/NormalText"
61 app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor"
62 app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor"
63 app:layout_constraintHorizontal_chainStyle="packed"
64 app:layout_constraintStart_toStartOf="parent"
65 app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor"
66 android:entries="@array/spinnerServidor"
67 android:prompt="@string/leyendaSpinner"/>
68
69 <Button
70 android:id="@+id/btnValidarServidor"
71 android:layout_width="wrap_content"
72 android:layout_height="wrap_content"
73 android:textColor="@android:color/white"
74 android:padding="10dp"
75 android:background="@drawable/boton_borde_redondeado"
76 android:text="@string/btnValidarServidor"
77 android:textSize="@dimen/NormalText"
78 app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor"
79 app:layout_constraintEnd_toEndOf="parent"
80 app:layout_constraintHorizontal_chainStyle="packed"
81 app:layout_constraintStart_toEndOf="@id/spServidor"
82 app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" />
83
84 <Button
85 android:id="@+id/btnAgregarServidor"
86 android:layout_width="0dp"
87 android:layout_height="wrap_content"
88 android:layout_marginStart="@dimen/MarginBotAgreSer"
89 android:layout_marginEnd="@dimen/MarginBotAgreSer"
90 android:text="@string/btnAgregarServidor"
91 android:textSize="@dimen/NormalText"
92 android:textColor="@android:color/white"
93 android:padding="10dp"
94 android:background="@drawable/boton_borde_redondeado"
95 app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas"
96 app:layout_constraintEnd_toEndOf="parent"
97 app:layout_constraintStart_toStartOf="parent"
98 app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" />
99
100
101 <TextView
102 android:id="@+id/tvUbicacionCarpetas"
103 android:layout_width="0dp"
104 android:layout_height="wrap_content"
105
106 android:layout_marginStart="@dimen/MarginBotAgreSer"
107 android:layout_marginTop="@dimen/MarginTopSubTitulos"
108 android:gravity="start"
109 android:lines="1"
110 android:text="@string/tvUbicacionCarpetas"
111 android:textColor="@android:color/black"
112 android:textSize="@dimen/SubTitulos"
113 app:fontFamily="sans-serif-condensed"
114 app:layout_constraintBottom_toTopOf="@+id/ibSearch"
115 app:layout_constraintEnd_toEndOf="parent"
116 app:layout_constraintStart_toStartOf="parent"
117 app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" />
118
119 <ImageButton
120 android:id="@+id/ibSearch"
121 android:layout_width="36dp"
122 android:layout_height="37dp"
123 android:layout_margin="10dp"
124 android:src="@drawable/search"
125 android:textColor="@android:color/white"
126 android:padding="10dp"
127 android:background="@drawable/boton_borde_redondeado"
128 app:layout_constraintEnd_toStartOf="@+id/etRuta"
129 app:layout_constraintStart_toStartOf="parent"
130 app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" />
131
132 <EditText
133 android:id="@+id/etRuta"
134 android:layout_width="0dp"
135 android:layout_height="wrap_content"
136 android:layout_marginTop="10dp"
137 android:layout_marginEnd="10dp"
138 android:clickable="true"
139 android:ems="10"
140 android:focusable="true"
141 android:inputType="textPersonName"
142 android:lines="1"
143 android:text=""
144 android:textSize="@dimen/NormalText"
145 app:layout_constraintEnd_toEndOf="parent"
146 app:layout_constraintStart_toEndOf="@id/ibSearch"
147 app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" />
148
149 <TextView
150 android:id="@+id/tvActuFecha"
151 android:layout_width="0dp"
152 android:layout_height="wrap_content"
153 android:layout_marginStart="@dimen/MarginBotAgreSer"
154 android:layout_marginTop="@dimen/MarginTopSubTitulos"
155 android:gravity="start"
156 android:lines="1"
157 android:text="@string/tvTituloArea"
158 android:textColor="@android:color/black"
159 android:textSize="@dimen/SubTitulos"
160 app:fontFamily="sans-serif-condensed"
161 app:layout_constraintEnd_toEndOf="parent"
162 app:layout_constraintStart_toStartOf="parent"
163 app:layout_constraintTop_toBottomOf="@+id/etRuta" />
164
165 <RadioGroup
166 android:id="@+id/rgFechaHora"
167 android:layout_width="0dp"
168 android:layout_height="wrap_content"
169
170 android:gravity="center"
171 android:orientation="horizontal"
172 app:layout_constraintEnd_toEndOf="parent"
173 app:layout_constraintStart_toStartOf="parent"
174 app:layout_constraintTop_toBottomOf="@+id/tvActuFecha">
175
176 <RadioButton
177 android:id="@+id/rbVentas"
178 android:layout_width="wrap_content"
179 android:layout_height="wrap_content"
180 android:layout_margin="5dp"
181 android:checked="true"
182 android:padding="5dp"
183 android:text="@string/rbVentas"
184 android:textSize="@dimen/NormalText" />
185
186 <RadioButton
187 android:id="@+id/rbDeposito"
188 android:layout_width="wrap_content"
189 android:layout_height="wrap_content"
190 android:layout_margin="5dp"
191 android:checked="false"
192 android:padding="5dp"
193 android:text="@string/rbDeposito"
194 android:textSize="@dimen/NormalText" />
195
196 </RadioGroup>
197
198 <TextView
199 android:id="@+id/tvLosProductos"
200 android:layout_width="0dp"
201 android:layout_height="wrap_content"
202
203 android:layout_marginStart="@dimen/MarginBotAgreSer"
204 android:layout_marginEnd="@dimen/MarginTopSubTitulos"
205 android:gravity="start"
206 android:lines="1"
207 android:text="@string/tvLosProductos"
208 android:textColor="@android:color/black"
209 android:textSize="@dimen/SubTitulos"
210 app:fontFamily="sans-serif-condensed"
211 app:layout_constraintEnd_toEndOf="parent"
212 app:layout_constraintStart_toStartOf="parent"
213 app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" />
214
215 <RadioGroup
216 android:id="@+id/rgLosProductos"
217 android:layout_width="0dp"
218 android:layout_height="wrap_content"
219
220 android:gravity="center"
221 android:orientation="vertical"
222 app:layout_constraintEnd_toEndOf="parent"
223 app:layout_constraintStart_toStartOf="parent"
224 app:layout_constraintTop_toBottomOf="@+id/tvLosProductos">
225
226 <RadioButton
227 android:id="@+id/rbProInclu"
228 android:layout_width="match_parent"
229 android:layout_height="wrap_content"
230
231 android:layout_margin="@dimen/PadingCbyRb"
232 android:checked="true"
233 android:padding="@dimen/PadingCbyRb"
234 android:text="@string/rbProInclu"
235 android:textSize="@dimen/NormalText" />
236
237 <RadioButton
238 android:id="@+id/rbProNoInclu"
239 android:layout_width="match_parent"
240 android:layout_height="wrap_content"
241 android:layout_margin="@dimen/PadingCbyRb"
242 android:checked="false"
243 android:padding="@dimen/PadingCbyRb"
244 android:text="@string/rbProNoInclu"
245 android:textSize="@dimen/NormalText" />
246
247 </RadioGroup>
248
249 <CheckBox
250 android:id="@+id/cbHabiLectura"
251 android:layout_width="0dp"
252 android:layout_height="wrap_content"
253 android:layout_margin="@dimen/PadingCbyRb"
254 android:padding="@dimen/PadingCbyRb"
255 android:text="@string/cbHabiLectura"
256 android:textSize="@dimen/NormalText"
257 app:layout_constraintEnd_toEndOf="parent"
258 app:layout_constraintStart_toStartOf="parent"
259 app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" />
260
261 <CheckBox
262 android:id="@+id/cbMostrarStock"
263 android:layout_width="0dp"
264 android:layout_height="wrap_content"
265 android:layout_margin="@dimen/PadingCbyRb"
266 android:padding="@dimen/PadingCbyRb"
267 android:text="@string/cbMostrarStock"
268 android:textSize="@dimen/NormalText"
269 app:layout_constraintEnd_toEndOf="parent"
270 app:layout_constraintStart_toStartOf="parent"
271 app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" />
272
273 <TextView
274 android:id="@+id/tvColumMostrar"
275 android:layout_width="0dp"
276 android:layout_height="wrap_content"
277
278 android:layout_marginStart="@dimen/MarginBotAgreSer"
279 android:layout_marginEnd="@dimen/MarginTopSubTitulos"
280 android:gravity="start"
281 android:lines="1"
282 android:text="@string/tvColumMostrar"
283 android:textColor="@android:color/black"
284 android:textSize="@dimen/SubTitulos"
285 app:fontFamily="sans-serif-condensed"
286 app:layout_constraintEnd_toEndOf="parent"
287 app:layout_constraintStart_toStartOf="parent"
288 app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" />
289
290 <RadioGroup
291 android:id="@+id/rgCodigosMostrar"
292 android:layout_width="0dp"
293 android:layout_height="wrap_content"
294
295 android:gravity="center"
296 android:orientation="horizontal"
297 app:layout_constraintEnd_toEndOf="parent"
298 app:layout_constraintStart_toStartOf="parent"
299 app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar">
300
301 <RadioButton
302 android:id="@+id/rbCodigoDebo"
303 android:layout_width="wrap_content"
304 android:layout_height="wrap_content"
305 android:layout_margin="5dp"
306 android:checked="true"
307 android:padding="5dp"
308 android:text="@string/rbCodigoDebo"
309 android:textSize="@dimen/NormalText" />
310
311 <RadioButton
312 android:id="@+id/rbCodigoOrigen"
313 android:layout_width="wrap_content"
314 android:layout_height="wrap_content"
315 android:layout_margin="5dp"
316 android:checked="false"
317 android:padding="5dp"
318 android:text="@string/rbCodigoOrigen"
319 android:textSize="@dimen/NormalText" />
320
321 <RadioButton
322 android:id="@+id/rbCodigoBarras"
323 android:layout_width="wrap_content"
324 android:layout_height="wrap_content"
325 android:layout_margin="5dp"
326 android:padding="5dp"
327 android:text="@string/rbCodigoBarras"
328 android:textSize="@dimen/NormalText" />
329 </RadioGroup>
330
331 <CheckBox
332 android:id="@+id/cbMostrarExistencia"
333 android:layout_width="wrap_content"
334 android:layout_height="wrap_content"
335 android:layout_margin="@dimen/PadingCbyRb"
336 android:padding="@dimen/PadingCbyRb"
337 android:text="@string/cbMostrarExistencia"
338 android:textSize="@dimen/NormalText"
339 android:checked="false"
340 app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio"
341 app:layout_constraintStart_toStartOf="parent"
342 app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" />
343
344 <CheckBox
345 android:id="@+id/cbMostrarPrecio"
346 android:layout_width="wrap_content"
347 android:layout_height="wrap_content"
348 android:layout_margin="@dimen/PadingCbyRb"
349 android:padding="@dimen/PadingCbyRb"
350 android:text="@string/cbMostrarPrecio"
351 android:textSize="@dimen/NormalText"
352 android:checked="false"
353 app:layout_constraintEnd_toEndOf="parent"
354 app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia"
355 app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" />
356
357 <Button
358 android:id="@+id/btnGuardar"
359 android:layout_width="wrap_content"
360 android:layout_height="wrap_content"
361 android:text="@string/btnGuardar"
362 android:textSize="@dimen/NormalText"
363 app:layout_constraintEnd_toEndOf="parent"
364 android:textColor="@android:color/white"
365 android:padding="10dp"
366 android:background="@drawable/boton_borde_redondeado"
367 app:layout_constraintStart_toStartOf="parent"
368 app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" />
369 </androidx.constraintlayout.widget.ConstraintLayout>
370
371 </ScrollView>
app/src/main/res/layout-land/fragment_descripcion.xml
File was created 1 <?xml version="1.0" encoding="utf-8"?>
2
3
4 <androidx.constraintlayout.widget.ConstraintLayout
5 xmlns:android="http://schemas.android.com/apk/res/android"
6 xmlns:app="http://schemas.android.com/apk/res-auto"
7 xmlns:tools="http://schemas.android.com/tools"
8 android:layout_width="match_parent"
9 android:layout_height="match_parent"
10 tools:context=".ui.descripcionFragment.DescripcionFragment">
11
12
13 <androidx.recyclerview.widget.RecyclerView
14 android:id="@+id/rcDescripcion"
15 android:layout_width="match_parent"
16 android:layout_height="0dp"
17 android:background="@android:color/darker_gray"
18 android:scrollbars="vertical"
19 app:layout_constraintTop_toBottomOf="@id/guideline4"
20 app:layout_constraintBottom_toTopOf="@+id/guideline5"
21 app:layout_constraintEnd_toEndOf="parent"
22 app:layout_constraintStart_toStartOf="parent"
23 tools:listitem="@layout/item" />
24
25 <Button
26 android:id="@+id/btnSalir"
27 android:layout_width="0dp"
28 android:layout_height="wrap_content"
29 android:text="@string/btnCancelar"
30 android:textColor="@android:color/white"
31 android:padding="10dp"
32 android:background="@drawable/boton_borde_redondeado"
33 app:layout_constraintBottom_toBottomOf="@+id/guideline6"
34 app:layout_constraintEnd_toEndOf="parent"
35 app:layout_constraintHorizontal_chainStyle="spread"
36 app:layout_constraintStart_toStartOf="parent"
37 app:layout_constraintTop_toBottomOf="@+id/rcInventarios" />
38
39 <androidx.constraintlayout.widget.Guideline
40 android:id="@+id/guideline4"
41 android:layout_width="wrap_content"
42 android:layout_height="wrap_content"
43 android:orientation="horizontal"
44 app:layout_constraintGuide_percent="0.04" />
45
46 <androidx.constraintlayout.widget.Guideline
47 android:id="@+id/guideline5"
48 android:layout_width="wrap_content"
49 android:layout_height="wrap_content"
50 android:orientation="horizontal"
51 app:layout_constraintGuide_percent="0.82" />
52
53 <androidx.constraintlayout.widget.Guideline
54 android:id="@+id/guideline6"
55 android:layout_width="wrap_content"
56 android:layout_height="wrap_content"
57 android:orientation="horizontal"
58 app:layout_constraintGuide_percent="0.97" />
59 </androidx.constraintlayout.widget.ConstraintLayout>
60
app/src/main/res/layout-land/fragment_inventario.xml
File was created 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools"
5 android:id="@+id/frameLayout"
6 android:layout_width="match_parent"
7 android:layout_height="match_parent"
8 tools:context=".ui.inventario.InventarioFragment">
9
10
11 <androidx.appcompat.widget.AppCompatTextView
12 android:id="@+id/tvTitulo"
13 android:layout_width="match_parent"
14 android:layout_height="60dp"
15 android:layout_marginStart="8dp"
16 android:layout_marginTop="15dp"
17 android:layout_marginEnd="8dp"
18 android:autoSizeMaxTextSize="100sp"
19 android:autoSizeMinTextSize="20sp"
20 android:autoSizeStepGranularity="5sp"
21 android:autoSizeTextType="uniform"
22 android:gravity="center"
23 android:lines="1"
24 android:text="@string/invTitulo"
25 android:textColor="@color/colorAccent"
26 app:fontFamily="sans-serif-condensed"
27 app:layout_constraintBottom_toTopOf="@id/guideline2"
28 app:layout_constraintEnd_toEndOf="parent"
29 app:layout_constraintStart_toStartOf="parent"
30 app:layout_constraintTop_toTopOf="@id/guideline" />
31
32
33 <ImageButton
34 android:id="@+id/ivCamara"
35 android:layout_width="60dp"
36 android:layout_height="60dp"
37 android:layout_marginTop="15dp"
38 android:clickable="true"
39 android:contentDescription="@string/ibBusCB"
40 android:elevation="5dp"
41 android:background="@drawable/boton_redondo"
42 android:layout_margin="10dp"
43 android:focusable="false"
44 android:scaleType="fitEnd"
45 app:layout_constraintCircleRadius="40dp"
46 android:src="@drawable/codbar"
47 app:layout_constraintBottom_toTopOf="@id/guideline3"
48 app:layout_constraintEnd_toStartOf="@+id/etCodigoBarras"
49 app:layout_constraintHorizontal_bias="0.0"
50 app:layout_constraintStart_toStartOf="parent"
51 app:layout_constraintTop_toBottomOf="@+id/guideline2" />
52
53 <EditText
54 android:id="@+id/etCodigoBarras"
55 android:layout_width="0dp"
56 android:layout_height="wrap_content"
57 android:autofillHints=""
58 android:clickable="true"
59 android:ems="10"
60 android:focusable="true"
61 android:hint="@string/ibBusCB"
62 android:inputType="textPersonName"
63 android:lines="1"
64 android:textAllCaps="true"
65 android:textSize="20sp"
66 app:layout_constraintBottom_toTopOf="@+id/guideline3"
67 app:layout_constraintEnd_toStartOf="@+id/swSumaUno"
68 app:layout_constraintHorizontal_bias="0.49"
69 app:layout_constraintHorizontal_chainStyle="packed"
70 app:layout_constraintStart_toEndOf="@+id/ivCamara"
71 app:layout_constraintTop_toBottomOf="@+id/guideline2" />
72
73
74 <Switch
75 android:id="@+id/swSumaUno"
76 android:layout_width="wrap_content"
77 android:layout_height="wrap_content"
78 android:text="@string/switch_1"
79 app:layout_constraintBaseline_toBaselineOf="@+id/etCodigoBarras"
80 app:layout_constraintEnd_toEndOf="parent"
81 app:layout_constraintStart_toEndOf="@id/etCodigoBarras"
82 tools:ignore="UseSwitchCompatOrMaterialXml" />
83
84 <androidx.recyclerview.widget.RecyclerView
85 android:id="@+id/rcInventarios"
86 android:layout_width="match_parent"
87 android:layout_height="0dp"
88 android:background="@android:color/darker_gray"
89 app:layout_constraintBottom_toBottomOf="@+id/guideline5"
90 app:layout_constraintEnd_toEndOf="parent"
91 app:layout_constraintStart_toStartOf="parent"
92 app:layout_constraintTop_toBottomOf="@+id/guideline4"
93 tools:listitem="@layout/item" />
94
95
96 <Button
97 android:id="@+id/btnExportarInv"
98 android:layout_width="wrap_content"
99 android:layout_height="wrap_content"
100 android:text="@string/btnExportarInv"
101 android:textColor="@android:color/white"
102 android:padding="10dp"
103 android:background="@drawable/boton_borde_redondeado"
104 app:layout_constraintBottom_toBottomOf="@+id/guideline6"
105 app:layout_constraintEnd_toEndOf="parent"
106 app:layout_constraintHorizontal_chainStyle="spread"
107 app:layout_constraintStart_toEndOf="@+id/btnBorrarInv"
108 app:layout_constraintTop_toBottomOf="@+id/guideline5" />
109
110 <Button
111 android:id="@+id/btnBorrarInv"
112 android:layout_width="wrap_content"
113 android:layout_height="wrap_content"
114 android:text="@string/btnBorrarInv"
115 app:layout_constraintBottom_toBottomOf="@+id/guideline6"
116 app:layout_constraintEnd_toStartOf="@id/btnExportarInv"
117 app:layout_constraintHorizontal_chainStyle="spread"
118 app:layout_constraintStart_toStartOf="parent"
119 android:textColor="@android:color/white"
120 android:padding="10dp"
121 android:background="@drawable/boton_borde_redondeado"
122 app:layout_constraintTop_toBottomOf="@+id/guideline5" />
123
124 <androidx.constraintlayout.widget.Guideline
125 android:id="@+id/guideline"
126 android:layout_width="wrap_content"
127 android:layout_height="wrap_content"
128 android:orientation="horizontal"
129 app:layout_constraintGuide_percent="0.02" />
130
131 <androidx.constraintlayout.widget.Guideline
132 android:id="@+id/guideline2"
133 android:layout_width="wrap_content"
134 android:layout_height="wrap_content"
135 android:orientation="horizontal"
136 app:layout_constraintGuide_percent="0.2" />
137
138 <androidx.constraintlayout.widget.Guideline
139 android:id="@+id/guideline3"
140 android:layout_width="wrap_content"
141 android:layout_height="wrap_content"
142 android:orientation="horizontal"
143 app:layout_constraintGuide_percent="0.29" />
144
145 <androidx.constraintlayout.widget.Guideline
146 android:id="@+id/guideline4"
147 android:layout_width="wrap_content"
148 android:layout_height="wrap_content"
149 android:orientation="horizontal"
150 app:layout_constraintGuide_percent="0.35" />
151
152 <androidx.constraintlayout.widget.Guideline
153 android:id="@+id/guideline5"
154 android:layout_width="wrap_content"
155 android:layout_height="wrap_content"
156 android:orientation="horizontal"
157 app:layout_constraintGuide_percent="0.83" />
158
159 <androidx.constraintlayout.widget.Guideline
160 android:id="@+id/guideline6"
161 android:layout_width="wrap_content"
162 android:layout_height="wrap_content"
163 android:orientation="horizontal"
164 app:layout_constraintGuide_percent="0.97" />
165
166
167 </androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout-land/fragment_servidores.xml
File was created 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout
3 xmlns:android="http://schemas.android.com/apk/res/android"
4 xmlns:app="http://schemas.android.com/apk/res-auto"
5 xmlns:tools="http://schemas.android.com/tools"
6 android:layout_width="match_parent"
7 android:layout_height="match_parent"
8 tools:context=".ui.servidores.ServidoresFragment">
9
10 <androidx.appcompat.widget.AppCompatTextView
11 android:id="@+id/tvTitutloServer"
12 android:layout_width="match_parent"
13 android:layout_height="60dp"
14 android:layout_marginStart="8dp"
15 android:layout_marginTop="15dp"
16 android:layout_marginEnd="8dp"
17 android:autoSizeMaxTextSize="100sp"
18 android:autoSizeMinTextSize="20sp"
19 android:autoSizeStepGranularity="5sp"
20 android:autoSizeTextType="uniform"
21 android:gravity="center"
22 android:lines="1"
23 android:text="@string/tvTitutloServer"
24 android:textColor="@color/colorAccent"
25 app:fontFamily="sans-serif-condensed"
26 app:layout_constraintEnd_toEndOf="parent"
27 app:layout_constraintStart_toStartOf="parent"
28 app:layout_constraintTop_toTopOf="parent" />
29
30 <TextView
31 android:id="@+id/tvDirServer"
32 android:layout_width="match_parent"
33 android:layout_height="wrap_content"
34 android:layout_margin="10dp"
35 android:gravity="start"
36 android:lines="1"
37 android:text="@string/tvDirServer"
38 android:textColor="@android:color/black"
39 android:textSize="@dimen/SubTitulos"
40 android:textStyle="bold|italic"
41 app:fontFamily="sans-serif-condensed"
42 app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor"
43 app:layout_constraintEnd_toEndOf="parent"
44 app:layout_constraintStart_toStartOf="parent"
45 app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" />
46
47 <EditText
48 android:id="@+id/etDireccionServidor"
49 android:layout_width="0dp"
50 android:layout_height="wrap_content"
51 android:layout_margin="10dp"
52 android:clickable="true"
53 android:ems="10"
54 android:focusable="true"
55 android:hint="192.168.10.1:9090"
56 android:inputType="text"
57 android:lines="1"
58 android:textSize="10sp"
59 app:layout_constraintEnd_toEndOf="parent"
60 app:layout_constraintStart_toStartOf="parent"
61 app:layout_constraintTop_toBottomOf="@id/tvDirServer" />
62
63 <TextView
64 android:id="@+id/tvNomServer"
65 android:layout_width="match_parent"
66 android:layout_height="wrap_content"
67 android:layout_margin="10dp"
68 android:gravity="start"
69 android:lines="1"
70 android:text="@string/tvNomServer"
71 android:textColor="@android:color/black"
72 android:textSize="@dimen/SubTitulos"
73 android:textStyle="bold|italic"
74 app:fontFamily="sans-serif-condensed"
75 app:layout_constraintEnd_toEndOf="parent"
76 app:layout_constraintStart_toStartOf="parent"
77 app:layout_constraintTop_toBottomOf="@id/etDireccionServidor" />
78
79 <EditText
80 android:id="@+id/etNombreServidor"
81 android:layout_width="match_parent"
82 android:layout_height="wrap_content"
83 android:layout_margin="10dp"
84 android:autofillHints=""
85 android:clickable="true"
86 android:ems="10"
87 android:focusable="true"
88 android:inputType="text"
89 android:lines="1"
90 android:hint="Servidor Local"
91 android:textSize="10sp"
92 app:layout_constraintEnd_toEndOf="parent"
93 app:layout_constraintStart_toStartOf="parent"
94 app:layout_constraintTop_toBottomOf="@+id/tvNomServer" />
95
96
97 <androidx.recyclerview.widget.RecyclerView
98 android:id="@+id/rvServidores"
99 android:layout_width="0dp"
100 android:layout_height="0dp"
101 android:layout_marginTop="10dp"
102 android:background="@android:color/darker_gray"
103 app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores"
104 app:layout_constraintEnd_toEndOf="parent"
105 app:layout_constraintHorizontal_bias="0.0"
106 app:layout_constraintStart_toStartOf="parent"
107 app:layout_constraintTop_toBottomOf="@+id/etNombreServidor"
108 app:layout_goneMarginEnd="10dp"
109 tools:listitem="@layout/item_servidores" />
110
111 <Button
112 android:id="@+id/btnGuardarServidores"
113 android:layout_width="0dp"
114 android:layout_height="wrap_content"
115 android:layout_marginTop="10dp"
116 android:layout_marginEnd="10dp"
117 android:text="@string/btnGuardarServidores"
118 android:textColor="@android:color/white"
119 android:padding="5dp"
120 android:background="@drawable/boton_borde_redondeado"
121 app:layout_constraintTop_toBottomOf="@+id/rvServidores"
122 app:layout_constraintEnd_toEndOf="parent"
123 app:layout_constraintStart_toStartOf="parent"
124 app:layout_constraintBottom_toBottomOf="parent"/>
125
126 </androidx.constraintlayout.widget.ConstraintLayout>
127
app/src/main/res/layout/fragment_servidores.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout 2 <androidx.constraintlayout.widget.ConstraintLayout
3 xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:android="http://schemas.android.com/apk/res/android"
4 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:app="http://schemas.android.com/apk/res-auto"
5 xmlns:tools="http://schemas.android.com/tools" 5 xmlns:tools="http://schemas.android.com/tools"
6 android:layout_width="match_parent" 6 android:layout_width="match_parent"
7 android:layout_height="match_parent" 7 android:layout_height="match_parent"
8 tools:context=".ui.servidores.ServidoresFragment"> 8 tools:context=".ui.servidores.ServidoresFragment">
9 9
10 <androidx.appcompat.widget.AppCompatTextView 10 <androidx.appcompat.widget.AppCompatTextView
11 android:id="@+id/tvTitutloServer" 11 android:id="@+id/tvTitutloServer"
12 android:layout_width="match_parent" 12 android:layout_width="match_parent"
13 android:layout_height="90dp" 13 android:layout_height="90dp"
14 android:layout_marginStart="8dp" 14 android:layout_marginStart="8dp"
15 android:layout_marginTop="15dp" 15 android:layout_marginTop="15dp"
16 android:layout_marginEnd="8dp" 16 android:layout_marginEnd="8dp"
17 android:autoSizeMaxTextSize="100sp" 17 android:autoSizeMaxTextSize="100sp"
18 android:autoSizeMinTextSize="20sp" 18 android:autoSizeMinTextSize="20sp"
19 android:autoSizeStepGranularity="5sp" 19 android:autoSizeStepGranularity="5sp"
20 android:autoSizeTextType="uniform" 20 android:autoSizeTextType="uniform"
21 android:gravity="center" 21 android:gravity="center"
22 android:lines="1" 22 android:lines="1"
23 android:text="@string/tvTitutloServer" 23 android:text="@string/tvTitutloServer"
24 android:textColor="@color/colorAccent" 24 android:textColor="@color/colorAccent"
25 app:fontFamily="sans-serif-condensed" 25 app:fontFamily="sans-serif-condensed"
26 app:layout_constraintEnd_toEndOf="parent" 26 app:layout_constraintEnd_toEndOf="parent"
27 app:layout_constraintStart_toStartOf="parent" 27 app:layout_constraintStart_toStartOf="parent"
28 app:layout_constraintTop_toTopOf="parent" /> 28 app:layout_constraintTop_toTopOf="parent" />
29 29
30 <TextView 30 <TextView
31 android:id="@+id/tvDirServer" 31 android:id="@+id/tvDirServer"
32 android:layout_width="match_parent" 32 android:layout_width="match_parent"
33 android:layout_height="wrap_content" 33 android:layout_height="wrap_content"
34 android:layout_margin="10dp" 34 android:layout_margin="10dp"
35 android:gravity="start" 35 android:gravity="start"
36 android:lines="1" 36 android:lines="1"
37 android:text="@string/tvDirServer" 37 android:text="@string/tvDirServer"
38 android:textColor="@android:color/black" 38 android:textColor="@android:color/black"
39 android:textSize="@dimen/TitulosMedios" 39 android:textSize="@dimen/TitulosMedios"
40 android:textStyle="bold|italic" 40 android:textStyle="bold|italic"
41 app:fontFamily="sans-serif-condensed" 41 app:fontFamily="sans-serif-condensed"
42 app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor" 42 app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor"
43 app:layout_constraintEnd_toEndOf="parent" 43 app:layout_constraintEnd_toEndOf="parent"
44 app:layout_constraintStart_toStartOf="parent" 44 app:layout_constraintStart_toStartOf="parent"
45 app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> 45 app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" />
46 46
47 <EditText 47 <EditText
48 android:id="@+id/etDireccionServidor" 48 android:id="@+id/etDireccionServidor"
49 android:layout_width="0dp" 49 android:layout_width="0dp"
50 android:layout_height="wrap_content" 50 android:layout_height="wrap_content"
51 android:layout_margin="10dp" 51 android:layout_margin="10dp"
52 android:clickable="true" 52 android:clickable="true"
53 android:ems="10" 53 android:ems="10"
54 android:focusable="true" 54 android:focusable="true"
55 android:hint="192.168.10.1:9090" 55 android:hint="192.168.10.1:9090"
56 android:inputType="text" 56 android:inputType="text"
57 android:lines="1" 57 android:lines="1"
58 android:textSize="15sp" 58 android:textSize="15sp"
59 app:layout_constraintEnd_toEndOf="parent" 59 app:layout_constraintEnd_toEndOf="parent"
60 app:layout_constraintStart_toStartOf="parent" 60 app:layout_constraintStart_toStartOf="parent"
61 app:layout_constraintTop_toBottomOf="@id/tvDirServer" /> 61 app:layout_constraintTop_toBottomOf="@id/tvDirServer" />
62 62
63 <TextView 63 <TextView
64 android:id="@+id/tvNomServer" 64 android:id="@+id/tvNomServer"
65 android:layout_width="match_parent" 65 android:layout_width="match_parent"
66 android:layout_height="wrap_content" 66 android:layout_height="wrap_content"
67 android:layout_margin="10dp" 67 android:layout_margin="10dp"
68 android:gravity="center" 68 android:gravity="start"
69 android:lines="1" 69 android:lines="1"
70 android:text="@string/tvNomServer" 70 android:text="@string/tvNomServer"
71 android:textColor="@android:color/black" 71 android:textColor="@android:color/black"
72 android:textSize="@dimen/TitulosMedios" 72 android:textSize="@dimen/TitulosMedios"
73 android:textStyle="bold|italic" 73 android:textStyle="bold|italic"
74 app:fontFamily="sans-serif-condensed" 74 app:fontFamily="sans-serif-condensed"
75 app:layout_constraintEnd_toEndOf="parent" 75 app:layout_constraintEnd_toEndOf="parent"
76 app:layout_constraintStart_toStartOf="parent" 76 app:layout_constraintStart_toStartOf="parent"
77 app:layout_constraintTop_toBottomOf="@id/etDireccionServidor" /> 77 app:layout_constraintTop_toBottomOf="@id/etDireccionServidor" />
78 78
79 <EditText 79 <EditText
80 android:id="@+id/etNombreServidor" 80 android:id="@+id/etNombreServidor"
81 android:layout_width="match_parent" 81 android:layout_width="match_parent"
82 android:layout_height="wrap_content" 82 android:layout_height="wrap_content"
83 android:layout_margin="10dp" 83 android:layout_margin="10dp"
84 android:autofillHints="" 84 android:autofillHints=""
85 android:clickable="true" 85 android:clickable="true"
86 android:ems="10" 86 android:ems="10"
87 android:focusable="true" 87 android:focusable="true"
88 android:inputType="text" 88 android:inputType="text"
89 android:lines="1" 89 android:lines="1"
90 android:hint="Servidor Local" 90 android:hint="Servidor Local"
91 android:textSize="15sp" 91 android:textSize="15sp"
92 app:layout_constraintEnd_toEndOf="parent" 92 app:layout_constraintEnd_toEndOf="parent"
93 app:layout_constraintStart_toStartOf="parent" 93 app:layout_constraintStart_toStartOf="parent"
94 app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> 94 app:layout_constraintTop_toBottomOf="@+id/tvNomServer" />
95 95
96 96
97 <androidx.recyclerview.widget.RecyclerView 97 <androidx.recyclerview.widget.RecyclerView
98 android:id="@+id/rvServidores" 98 android:id="@+id/rvServidores"
99 android:layout_width="0dp" 99 android:layout_width="0dp"
100 android:layout_height="0dp" 100 android:layout_height="0dp"
101 android:layout_marginTop="10dp" 101 android:layout_marginTop="10dp"
102 app:layout_goneMarginEnd="10dp" 102 app:layout_goneMarginEnd="10dp"
103 android:background="@android:color/darker_gray" 103 android:background="@android:color/darker_gray"
104 app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" 104 app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores"
105 app:layout_constraintEnd_toEndOf="parent" 105 app:layout_constraintEnd_toEndOf="parent"
106 app:layout_constraintStart_toStartOf="parent" 106 app:layout_constraintStart_toStartOf="parent"
107 app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" 107 app:layout_constraintTop_toBottomOf="@+id/etNombreServidor"
108 tools:listitem="@layout/item_servidores" /> 108 tools:listitem="@layout/item_servidores" />
109 109
110 <Button 110 <Button
111 android:id="@+id/btnGuardarServidores" 111 android:id="@+id/btnGuardarServidores"
112 android:layout_width="0dp" 112 android:layout_width="0dp"
113 android:layout_height="wrap_content" 113 android:layout_height="wrap_content"
114 android:layout_marginTop="10dp" 114 android:layout_marginTop="10dp"
115 android:layout_marginEnd="10dp" 115 android:layout_marginEnd="10dp"
116 android:text="@string/btnGuardarServidores" 116 android:text="@string/btnGuardarServidores"
117 android:textColor="@android:color/white" 117 android:textColor="@android:color/white"
118 android:padding="10dp" 118 android:padding="10dp"
119 android:background="@drawable/boton_borde_redondeado" 119 android:background="@drawable/boton_borde_redondeado"
120 app:layout_constraintTop_toBottomOf="@+id/rvServidores" 120 app:layout_constraintTop_toBottomOf="@+id/rvServidores"
121 app:layout_constraintEnd_toEndOf="parent" 121 app:layout_constraintEnd_toEndOf="parent"
122 app:layout_constraintStart_toStartOf="parent" 122 app:layout_constraintStart_toStartOf="parent"
123 app:layout_constraintBottom_toBottomOf="parent"/> 123 app:layout_constraintBottom_toBottomOf="parent"/>
124 124
125 </androidx.constraintlayout.widget.ConstraintLayout> 125 </androidx.constraintlayout.widget.ConstraintLayout>
126 126
app/src/main/res/layout/login_dialog.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 android:layout_width="match_parent" 4 android:layout_width="match_parent"
5 android:layout_height="wrap_content" 5 android:layout_height="wrap_content"
6 android:orientation="vertical" 6 android:orientation="vertical"
7 android:padding="10dp"> 7 android:padding="10dp">
8 8
9 <TextView 9 <TextView
10 android:id="@+id/dialogNameEt" 10 android:id="@+id/dialogNameEt"
11 android:layout_width="wrap_content" 11 android:layout_width="wrap_content"
12 android:layout_height="wrap_content" 12 android:layout_height="wrap_content"
13 android:layout_margin="5dp" 13 android:layout_margin="5dp"
14 android:text="La cantidad actual es:" 14 android:text="Cantidad actual:"
15 android:textSize="20sp" 15 android:textSize="20sp"
16 app:layout_constraintEnd_toStartOf="@id/tvCantInicial" 16 app:layout_constraintEnd_toStartOf="@id/tvCantInicial"
17 app:layout_constraintHorizontal_bias="0.0" 17 app:layout_constraintHorizontal_bias="0.0"
18 app:layout_constraintHorizontal_chainStyle="packed" 18 app:layout_constraintHorizontal_chainStyle="packed"
19 app:layout_constraintStart_toStartOf="parent" 19 app:layout_constraintStart_toStartOf="parent"
20 app:layout_constraintTop_toTopOf="parent" /> 20 app:layout_constraintTop_toTopOf="parent" />
21 21
22 <TextView 22 <TextView
23 android:id="@+id/tvCantInicial" 23 android:id="@+id/tvCantInicial"
24 android:layout_width="wrap_content" 24 android:layout_width="wrap_content"
25 android:layout_height="wrap_content" 25 android:layout_height="wrap_content"
26 android:layout_margin="5dp" 26 android:layout_margin="5dp"
27 android:text="20" 27 android:text=""
28 android:textSize="20sp" 28 android:textSize="20sp"
29 app:layout_constraintBaseline_toBaselineOf="@+id/dialogNameEt" 29 app:layout_constraintBaseline_toBaselineOf="@+id/dialogNameEt"
30 app:layout_constraintEnd_toEndOf="parent" 30 app:layout_constraintEnd_toEndOf="parent"
31 app:layout_constraintHorizontal_chainStyle="packed" 31 app:layout_constraintHorizontal_chainStyle="packed"
32 app:layout_constraintStart_toEndOf="@id/dialogNameEt" /> 32 app:layout_constraintStart_toEndOf="@id/dialogNameEt" />
33 33
34 <TextView 34 <TextView
35 android:id="@+id/tvgenerico" 35 android:id="@+id/tvgenerico"
36 android:layout_width="wrap_content" 36 android:layout_width="wrap_content"
37 android:layout_height="wrap_content" 37 android:layout_height="wrap_content"
38 android:layout_margin="5dp" 38 android:layout_margin="5dp"
39 android:text="Ingrese la nueva cantidad:" 39 android:text="Nueva cantidad:"
40 android:textSize="20sp" 40 android:textSize="20sp"
41 app:layout_constraintStart_toStartOf="parent" 41 app:layout_constraintStart_toStartOf="parent"
42 app:layout_constraintTop_toBottomOf="@+id/tvCantInicial" /> 42 app:layout_constraintTop_toBottomOf="@+id/tvCantInicial" />
43 43
44 <EditText 44 <EditText
45 android:id="@+id/tvNuevaCantidad" 45 android:id="@+id/tvNuevaCantidad"
46 android:layout_width="0dp" 46 android:layout_width="0dp"
47 android:layout_height="wrap_content" 47 android:layout_height="wrap_content"
48 android:hint="Nueva Cacntidad" 48 android:hint=""
49 android:inputType="numberDecimal" 49 android:inputType="numberDecimal"
50 app:layout_constraintBaseline_toBaselineOf="@+id/tvgenerico" 50 app:layout_constraintBaseline_toBaselineOf="@+id/tvgenerico"
51 app:layout_constraintEnd_toEndOf="parent" 51 app:layout_constraintEnd_toEndOf="parent"
52 app:layout_constraintStart_toEndOf="@id/tvgenerico" /> 52 app:layout_constraintStart_toEndOf="@id/tvgenerico"
53 android:autofillHints="" />
53 54
54 <TextView 55 <TextView
55 android:id="@+id/tvgenerico2" 56 android:id="@+id/tvgenerico2"
56 android:layout_width="wrap_content" 57 android:layout_width="wrap_content"
57 android:layout_height="wrap_content" 58 android:layout_height="wrap_content"
58 android:layout_margin="5dp" 59 android:layout_margin="5dp"
59 android:visibility="gone" 60 android:visibility="gone"
60 android:gravity="center" 61 android:gravity="center"
61 android:text="@string/tvSeleccion" 62 android:text="@string/tvSeleccion"
62 android:textSize="20sp" 63 android:textSize="20sp"
63 app:layout_constraintStart_toStartOf="parent" 64 app:layout_constraintStart_toStartOf="parent"
64 app:layout_constraintTop_toBottomOf="@+id/tvgenerico" /> 65 app:layout_constraintTop_toBottomOf="@+id/tvgenerico" />
65 66
66 <RadioGroup 67 <RadioGroup
67 android:id="@+id/rgFechaHora" 68 android:id="@+id/rgFechaHora"
68 android:layout_width="wrap_content" 69 android:layout_width="wrap_content"
69 android:layout_height="wrap_content" 70 android:layout_height="wrap_content"
70 android:layout_margin="5dp" 71 android:layout_margin="5dp"
71 android:gravity="start" 72 android:gravity="start"
72 android:orientation="horizontal" 73 android:orientation="horizontal"
73 app:layout_constraintEnd_toEndOf="parent" 74 app:layout_constraintEnd_toEndOf="parent"
74 app:layout_constraintHorizontal_bias="0.0" 75 app:layout_constraintHorizontal_bias="0.0"
75 app:layout_constraintStart_toStartOf="parent" 76 app:layout_constraintStart_toStartOf="parent"
76 app:layout_constraintTop_toBottomOf="@+id/tvgenerico2"> 77 app:layout_constraintTop_toBottomOf="@+id/tvgenerico2">
77 78
78 <RadioButton 79 <RadioButton
79 android:id="@+id/rbSumar" 80 android:id="@+id/rbSumar"
80 android:layout_width="wrap_content" 81 android:layout_width="wrap_content"
81 android:layout_height="wrap_content" 82 android:layout_height="wrap_content"
82 android:layout_margin="5dp" 83 android:layout_margin="5dp"
83 android:checked="true" 84 android:checked="false"
84 android:padding="5dp" 85 android:padding="5dp"
85 android:text="@string/rbSumar" 86 android:text="@string/rbSumar"
86 android:textSize="@dimen/text_size2" /> 87 android:textSize="@dimen/text_size2" />
87 88
88 <RadioButton 89 <RadioButton
89 android:id="@+id/rbRestar" 90 android:id="@+id/rbRestar"
90 android:layout_width="wrap_content" 91 android:layout_width="wrap_content"
91 android:layout_height="wrap_content" 92 android:layout_height="wrap_content"
92 android:layout_margin="5dp" 93 android:layout_margin="5dp"
93 android:checked="false" 94 android:checked="false"
94 android:padding="5dp" 95 android:padding="5dp"
95 android:text="@string/rbRestar" 96 android:text="@string/rbRestar"
96 android:textSize="@dimen/text_size2" /> 97 android:textSize="@dimen/text_size2" />
97 98
98 <RadioButton 99 <RadioButton
99 android:id="@+id/rbMdodificar" 100 android:id="@+id/rbMdodificar"
100 android:layout_width="wrap_content" 101 android:layout_width="wrap_content"
101 android:layout_height="wrap_content" 102 android:layout_height="wrap_content"
102 android:layout_margin="5dp" 103 android:layout_margin="5dp"
103 android:checked="false" 104 android:checked="false"
104 android:padding="5dp" 105 android:padding="5dp"
105 android:text="@string/rbModificar" 106 android:text="@string/rbModificar"
106 android:textSize="@dimen/text_size2" /> 107 android:textSize="@dimen/text_size2" />
107 </RadioGroup> 108 </RadioGroup>
108 109
109 <TextView 110 <TextView
110 android:id="@+id/tvgenerico3" 111 android:id="@+id/tvgenerico3"
111 android:layout_width="wrap_content" 112 android:layout_width="wrap_content"
112 android:layout_height="wrap_content" 113 android:layout_height="wrap_content"
113 android:layout_margin="5dp" 114 android:layout_margin="5dp"
114 android:gravity="center" 115 android:gravity="center"
115 android:text="@string/tvResultado" 116 android:text="@string/tvResultado"
116 android:textSize="20sp" 117 android:textSize="20sp"
117 app:layout_constraintEnd_toEndOf="parent" 118 app:layout_constraintEnd_toEndOf="parent"
118 app:layout_constraintHorizontal_bias="0.0" 119 app:layout_constraintHorizontal_bias="0.0"
119 app:layout_constraintStart_toStartOf="parent" 120 app:layout_constraintStart_toStartOf="parent"
120 app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> 121 app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" />
121 122
122 <TextView 123 <TextView
123 android:id="@+id/tvgenerico4" 124 android:id="@+id/tvgenerico4"
124 android:layout_width="wrap_content" 125 android:layout_width="wrap_content"
125 android:layout_height="wrap_content" 126 android:layout_height="wrap_content"
126 android:layout_margin="5dp" 127 android:layout_margin="5dp"
127 android:gravity="center" 128 android:gravity="center"
128 android:text="50" 129 android:text=""
129 android:textSize="20sp" 130 android:textSize="20sp"
130 app:layout_constraintEnd_toEndOf="parent" 131 app:layout_constraintEnd_toEndOf="parent"
131 app:layout_constraintHorizontal_bias="0.0" 132 app:layout_constraintHorizontal_bias="0.0"
132 app:layout_constraintStart_toEndOf="@+id/tvgenerico3" 133 app:layout_constraintStart_toEndOf="@+id/tvgenerico3"
133 app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> 134 app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" />
134 135
135 <LinearLayout 136 <LinearLayout
136 android:layout_width="match_parent" 137 android:layout_width="match_parent"
137 android:layout_height="wrap_content" 138 android:layout_height="wrap_content"
138 android:orientation="horizontal" 139 android:orientation="horizontal"
139 android:gravity="center" 140 android:gravity="center"
140 app:layout_constraintStart_toStartOf="parent" 141 app:layout_constraintStart_toStartOf="parent"
141 app:layout_constraintEnd_toEndOf="parent" 142 app:layout_constraintEnd_toEndOf="parent"
142 app:layout_constraintTop_toBottomOf="@+id/tvgenerico4"> 143 app:layout_constraintTop_toBottomOf="@+id/tvgenerico4">
143 144
144 <Button 145 <Button
145 android:id="@+id/dialogLoginBtn" 146 android:id="@+id/btnAceptar"
146 style="@style/Base.Widget.AppCompat.Button.Colored" 147 style="@style/Base.Widget.AppCompat.Button.Colored"
147 android:layout_width="wrap_content" 148 android:layout_width="wrap_content"
148 android:textColor="@android:color/white" 149 android:textColor="@android:color/white"
149 android:padding="20dp" 150 android:padding="20dp"
150 android:background="@drawable/boton_borde_redondeado" 151 android:background="@drawable/boton_borde_redondeado"
151 android:layout_margin="5dp" 152 android:layout_margin="5dp"
152 android:layout_height="wrap_content" 153 android:layout_height="wrap_content"
153 android:text="@string/btnOk" /> 154 android:text="@string/btnOk" />
154 155
155 <Button 156 <Button
156 android:id="@+id/dialogCancelBtn" 157 android:id="@+id/dialogCancelBtn"
157 style="@style/Base.Widget.AppCompat.Button.Colored" 158 style="@style/Base.Widget.AppCompat.Button.Colored"
158 android:textColor="@android:color/white" 159 android:textColor="@android:color/white"
159 android:padding="20dp" 160 android:padding="20dp"
160 android:background="@drawable/boton_borde_redondeado" 161 android:background="@drawable/boton_borde_redondeado"
161 android:layout_margin="5dp" 162 android:layout_margin="5dp"
162 android:layout_width="wrap_content" 163 android:layout_width="wrap_content"
163 android:layout_height="wrap_content" 164 android:layout_height="wrap_content"
164 android:text="@string/btnCancelar" /> 165 android:text="@string/btnCancelar" />
165 </LinearLayout> 166 </LinearLayout>
166 167
167 </androidx.constraintlayout.widget.ConstraintLayout> 168 </androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/values/strings.xml
1 <resources> 1 <resources>
2 2
3 <string name="nav_header_title">Android Studio</string> 3 <string name="action_settings">Ayuda</string>
4 <string name="nav_header_subtitle">android.studio@android.com</string> 4 <string name="app_name">DEBO Inventarios</string>
5 <string name="nav_header_desc">Navigation header</string>
6 <string name="action_settings">Settings</string>
7
8 <string name="menu_home">Home</string>
9 <string name="menu_gallery">Gallery</string>
10 <string name="menu_slideshow">Slideshow</string>
11
12 <string name="app_name">Inventario Dinamicos</string>
13 5
14 <!-- menu--> 6 <!-- menu-->
15 <string name="menuInicio">Inicio</string> 7 <string name="menuInicio">Inicio</string>
16 <string name="menuNueInv">Nuevo Inventario</string> 8 <string name="menuNueInv">Nuevo Inventario</string>
17 <string name="menuActMae">Actualizar Maestros</string> 9 <string name="menuActMae">Actualizar Maestros</string>
18 <string name="menuConf">Configuraciones</string> 10 <string name="menuConf">Configuraciones</string>
19 <string name="menuSal">Salir</string> 11 <string name="menuSal">Salir</string>
20 12
21 <!-- Menu header--> 13 <!-- Menu header-->
22 <string name="menuLeyenda">Debo Inventario</string> 14 <string name="menuLeyenda">Debo Inventario</string>
23 15
24 <string name="navigation_drawer_open">Open navigation drawer</string> 16 <string name="navigation_drawer_open">Open navigation drawer</string>
25 <string name="navigation_drawer_close">Close navigation drawer</string> 17 <string name="navigation_drawer_close">Close navigation drawer</string>
26 18
27 <!-- Pantalla de inicio--> 19 <!-- Pantalla de inicio-->
28 <string name="bien">Bienvenido</string> 20 <string name="bien">Bienvenido</string>
29 <string name="debo">DEBO®</string> 21 <string name="debo">DEBO®</string>
30 <string name="inventario">Inventario</string> 22 <string name="inventario">Inventario</string>
31 <string name="todo">TODO</string> 23 <string name="todo">TODO</string>
32 <string name="hello_blank_fragment">Hello blank fragment</string> 24 <string name="hello_blank_fragment">Hello blank fragment</string>
33 25
34 <!-- inventarios dinamicos--> 26 <!-- inventarios dinamicos-->
35 <string name="invDinamicoVenta">Inventarios Dinamicos</string> 27 <string name="invDinamicoVenta">Inventarios Dinamicos</string>
36 <string name="invDinamicoCompra">Inventarios Sectorizados</string> 28 <string name="invDinamicoCompra">Inventarios Sectorizados</string>
37 29
38 <!-- ventana emergente--> 30 <!-- ventana emergente-->
39 <string name="adv">Ingrese la cantidad contada</string> 31 <string name="adv">Ingrese la cantidad contada</string>
40 <string name="invVentas">Inventarios Dinamicos de Ventas</string> 32 <string name="invVentas">Inventarios Dinamicos de Ventas</string>
41 <string name="btnConfirmar">Confirmar</string> 33 <string name="btnConfirmar">Confirmar</string>
42 <string name="btnCancela">Cancelar</string> 34 <string name="btnCancela">Cancelar</string>
43 35
44 36
45 <!-- Fragment Inventario--> 37 <!-- Fragment Inventario-->
46 <string name="invTitulo">Inventarios Dinámicos</string> 38 <string name="invTitulo">Inventarios Dinámicos</string>
47 <string name="invTituloV">Inventarios de Ventas</string> 39 <string name="invTituloV">Inventarios de Ventas</string>
48 <string name="invTituloD">Inventarios de Depositos</string> 40 <string name="invTituloD">Inventarios de Depositos</string>
49 <string name="invCodigoBarras">Código Barras:</string> 41 <string name="invCodigoBarras">Código Barras:</string>
50 <string name="btnExportarInv">Exportar Inventario</string> 42 <string name="btnExportarInv">Exportar Inventario</string>
51 <string name="btnBorrarInv">Borrar Inventario</string> 43 <string name="btnBorrarInv">Borrar Inventario</string>
52 <string name="ibBusDesc">Busqueda por Descripción</string> 44 <string name="ibBusDesc">Busqueda por Descripción</string>
53 <string name="ibBusCB">Busqueda por C. Barras</string> 45 <string name="ibBusCB">Busqueda por C. Barras</string>
54 <string name="ibBusCO">Busqueda por Código de Origen</string> 46 <string name="ibBusCO">Busqueda por Código de Origen</string>
55 <string name="switch_1">+ 1</string> 47 <string name="switch_1">+ 1</string>
56 48
57 <!-- Fragmento Configuraciones--> 49 <!-- Fragmento Configuraciones-->
58 <string name="tvTituloConf">Configuraciones</string> 50 <string name="tvTituloConf">Configuraciones</string>
59 <string name="tvSeleccioneServidor">Seleccione un Servidor</string> 51 <string name="tvSeleccioneServidor">Seleccione un Servidor</string>
60 <string name="btnValidarServidor">Validar</string> 52 <string name="btnValidarServidor">Validar</string>
61 <string name="btnAgregarServidor">Agregar un nuevo servidor</string> 53 <string name="btnAgregarServidor">Agregar un nuevo servidor</string>
62 <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> 54 <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string>
63 <string name="tvTituloArea">Area de Invetnario</string> 55 <string name="tvTituloArea">Area de Invetnario</string>
64 <string name="rbVentas">Inventarios de Ventas</string> 56 <string name="rbVentas">Inventarios de Ventas</string>
65 <string name="rbDeposito">Inventarios de Depositos</string> 57 <string name="rbDeposito">Inventarios de Depositos</string>
66 <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> 58 <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string>
67 <string name="tvColumnas">Columnas a Visualizar</string> 59 <string name="tvColumnas">Columnas a Visualizar</string>
68 60
69 <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> 61 <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string>
70 <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> 62 <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string>
71 63
72 <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> 64 <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string>
73 <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> 65 <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string>
74 66
75 <string name="tvColumMostrar">Columnas a mostrar en inventario</string> 67 <string name="tvColumMostrar">Columnas a mostrar en inventario</string>
76 68
77 <string name="rbCodigoDebo">Código DEBO</string> 69 <string name="rbCodigoDebo">Código DEBO</string>
78 <string name="rbCodigoOrigen">Código Origen</string> 70 <string name="rbCodigoOrigen">Código Origen</string>
79 <string name="rbCodigoBarras">Código de Barras</string> 71 <string name="rbCodigoBarras">Código de Barras</string>
80 72
81 73
82 <!-- Spinner servidor--> 74 <!-- Spinner servidor-->
83 <string-array name="spinnerServidor"> 75 <string-array name="spinnerServidor">
84 <item>Servidor Laboratorio 1</item> 76 <item>Servidor Laboratorio 1</item>
85 <item>Servidor Laboratorio 2</item> 77 <item>Servidor Laboratorio 2</item>
86 <item>Servidor Laboratorio 3</item> 78 <item>Servidor Laboratorio 3</item>
87 </string-array> 79 </string-array>
88 <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> 80 <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string>
89 81
90 <string name="cbMostrarExistencia">Existencia</string> 82 <string name="cbMostrarExistencia">Existencia</string>
91 <string name="cbMostrarPrecio">Precio</string> 83 <string name="cbMostrarPrecio">Precio</string>
92 84
93 <string name="btnGuardar">Guardar Cambios</string> 85 <string name="btnGuardar">Guardar Cambios</string>
94 86
95 <!-- fragment Actualizacion de Maestros--> 87 <!-- fragment Actualizacion de Maestros-->
96 <string name="tvActMaestros">Actualización de Maestros</string> 88 <string name="tvActMaestros">Actualización de Maestros</string>
97 <string name="tvMedio">Seleccione el medio por el cual desea realizar la importación de maestros</string> 89 <string name="tvMedio">Seleccione el medio por el cual desea realizar la importación de maestros</string>
98 <string name="obPorWifi">Via Wifi</string> 90 <string name="obPorWifi">Via Wifi</string>
99 <string name="obViaArchivo">Via Archivos MaeTable</string> 91 <string name="obViaArchivo">Via Archivos MaeTable</string>
100 92
101 <string name="btnConfirmarAct">Confirmar Actualización</string> 93 <string name="btnConfirmarAct">Confirmar Actualización</string>
102 94
103 <!-- Fragment Save--> 95 <!-- Fragment Save-->
104 <string name="tvConfServi">Configuración de Servidores</string> 96 <string name="tvConfServi">Configuración de Servidores</string>
105 <string name="server">Ingrese la direccion del servidor</string> 97 <string name="server">Ingrese la direccion del servidor</string>
106 <string name="etNomServer">Ingrese una descripción para la conexión</string> 98 <string name="etNomServer">Ingrese una descripción para la conexión</string>
107 <string name="btnGuardarConfServ">Guardar Conexión</string> 99 <string name="btnGuardarConfServ">Guardar Conexión</string>
108 100
109 <!-- Dialog--> 101 <!-- Dialog-->
110 <string name="sTitulo">Producto Buscado</string> 102 <string name="sTitulo">Producto Buscado</string>
111 <string name="btnOk">Aceptar</string> 103 <string name="btnOk">Aceptar</string>
112 <string name="btnCancelar">Cancelar</string> 104 <string name="btnCancelar">Cancelar</string>
113 <string name="sMensaje">¡No se encontro el producto ingresado!</string> 105 <string name="sMensaje">¡No se encontro el producto ingresado!</string>
114 <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> 106 <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string>
115 <string name="sTituloNueva">Producto ingresado esta cargado</string> 107 <string name="sTituloNueva">Producto ingresado esta cargado</string>
116 <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> 108 <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string>
117 <string name="sMensajeBorrarInv">¡Seguro que desea Borrar el inventario!</string> 109 <string name="sMensajeBorrarInv">¡Seguro que desea Borrar el inventario!</string>
118 <string name="sTituloBorrarInv">Borrar Inventario</string> 110 <string name="sTituloBorrarInv">Borrar Inventario</string>
119 111
120 <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> 112 <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string>
121 <string name="sTituloExportar">Exportación de Inventarios</string> 113 <string name="sTituloExportar">Exportación de Inventarios</string>
122 114
123 <!-- FRAGMENT SERVIDOR--> 115 <!-- FRAGMENT SERVIDOR-->
124 <string name="tvTitutloServer">Alta de Servidores</string> 116 <string name="tvTitutloServer">Alta de Servidores</string>
125 <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> 117 <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string>
126 <string name="tvDirServer">Ingrese la dirección del servidor</string> 118 <string name="tvDirServer">Ingrese la dirección del servidor</string>
127 <string name="btnGuardarServidores">Guardar Servidor</string> 119 <string name="btnGuardarServidores">Guardar Servidor</string>
128 120
129 <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> 121 <string name="tvSeleccion">Toque sobre la operación que desea realizar</string>
130 <string name="rbSumar">Sumar</string> 122 <string name="rbSumar">Sumar</string>
131 <string name="rbRestar">Restar</string> 123 <string name="rbRestar">Restar</string>
132 <string name="rbModificar">Reemplazar</string> 124 <string name="rbModificar">Reemplazar</string>
133 <string name="tvTotal">Cantidad Final</string>tvTotal 125 <string name="tvTotal">Cantidad Final</string>tvTotal
134 <string name="tvResultado">La cantidad final es:</string>tvTotal 126 <string name="tvResultado">Cantidad final:</string>tvTotal
135 127
136 <string name="large_text"> 128 <string name="large_text">
137 "Material is the metaphor.\n\n" 129 "Material is the metaphor.\n\n"
138 130
139 "A material metaphor is the unifying theory of a rationalized space and a system of motion." 131 "A material metaphor is the unifying theory of a rationalized space and a system of motion."
140 "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " 132 "The material is grounded in tactile reality, inspired by the study of paper and ink, yet "
141 "technologically advanced and open to imagination and magic.\n" 133 "technologically advanced and open to imagination and magic.\n"
142 "Surfaces and edges of the material provide visual cues that are grounded in reality. The " 134 "Surfaces and edges of the material provide visual cues that are grounded in reality. The "
143 "use of familiar tactile attributes helps users quickly understand affordances. Yet the " 135 "use of familiar tactile attributes helps users quickly understand affordances. Yet the "
144 "flexibility of the material creates new affordances that supercede those in the physical " 136 "flexibility of the material creates new affordances that supercede those in the physical "
145 "world, without breaking the rules of physics.\n" 137 "world, without breaking the rules of physics.\n"
146 "The fundamentals of light, surface, and movement are key to conveying how objects move, " 138 "The fundamentals of light, surface, and movement are key to conveying how objects move, "
147 "interact, and exist in space and in relation to each other. Realistic lighting shows " 139 "interact, and exist in space and in relation to each other. Realistic lighting shows "
148 "seams, divides space, and indicates moving parts.\n\n" 140 "seams, divides space, and indicates moving parts.\n\n"
149 141
150 "Bold, graphic, intentional.\n\n" 142 "Bold, graphic, intentional.\n\n"
151 143
152 "The foundational elements of print based design typography, grids, space, scale, color, " 144 "The foundational elements of print based design typography, grids, space, scale, color, "
153 "and use of imagery guide visual treatments. These elements do far more than please the " 145 "and use of imagery guide visual treatments. These elements do far more than please the "
154 "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " 146 "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge "
155 "imagery, large scale typography, and intentional white space create a bold and graphic " 147 "imagery, large scale typography, and intentional white space create a bold and graphic "
156 "interface that immerse the user in the experience.\n" 148 "interface that immerse the user in the experience.\n"
157 "An emphasis on user actions makes core functionality immediately apparent and provides " 149 "An emphasis on user actions makes core functionality immediately apparent and provides "
158 "waypoints for the user.\n\n" 150 "waypoints for the user.\n\n"
159 151
160 "Motion provides meaning.\n\n" 152 "Motion provides meaning.\n\n"
161 153
162 "Motion respects and reinforces the user as the prime mover. Primary user actions are " 154 "Motion respects and reinforces the user as the prime mover. Primary user actions are "
163 "inflection points that initiate motion, transforming the whole design.\n" 155 "inflection points that initiate motion, transforming the whole design.\n"
164 "All action takes place in a single environment. Objects are presented to the user without " 156 "All action takes place in a single environment. Objects are presented to the user without "
165 "breaking the continuity of experience even as they transform and reorganize.\n" 157 "breaking the continuity of experience even as they transform and reorganize.\n"
166 "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " 158 "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. "
167 "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" 159 "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n"
168 160
169 "3D world.\n\n" 161 "3D world.\n\n"
170 162
171 "The material environment is a 3D space, which means all objects have x, y, and z " 163 "The material environment is a 3D space, which means all objects have x, y, and z "
172 "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " 164 "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the "
173 "positive z-axis extending towards the viewer. Every sheet of material occupies a single " 165 "positive z-axis extending towards the viewer. Every sheet of material occupies a single "
174 "position along the z-axis and has a standard 1dp thickness.\n" 166 "position along the z-axis and has a standard 1dp thickness.\n"
175 "On the web, the z-axis is used for layering and not for perspective. The 3D world is " 167 "On the web, the z-axis is used for layering and not for perspective. The 3D world is "
176 "emulated by manipulating the y-axis.\n\n" 168 "emulated by manipulating the y-axis.\n\n"
177 169
178 "Light and shadow.\n\n" 170 "Light and shadow.\n\n"
179 171
180 "Within the material environment, virtual lights illuminate the scene. Key lights create " 172 "Within the material environment, virtual lights illuminate the scene. Key lights create "
181 "directional shadows, while ambient light creates soft shadows from all angles.\n" 173 "directional shadows, while ambient light creates soft shadows from all angles.\n"
182 "Shadows in the material environment are cast by these two light sources. In Android " 174 "Shadows in the material environment are cast by these two light sources. In Android "
183 "development, shadows occur when light sources are blocked by sheets of material at " 175 "development, shadows occur when light sources are blocked by sheets of material at "
184 "various positions along the z-axis. On the web, shadows are depicted by manipulating the " 176 "various positions along the z-axis. On the web, shadows are depicted by manipulating the "
185 "y-axis only. The following example shows the card with a height of 6dp.\n\n" 177 "y-axis only. The following example shows the card with a height of 6dp.\n\n"
186 178
187 "Resting elevation.\n\n" 179 "Resting elevation.\n\n"
188 180
189 "All material objects, regardless of size, have a resting elevation, or default elevation " 181 "All material objects, regardless of size, have a resting elevation, or default elevation "
190 "that does not change. If an object changes elevation, it should return to its resting " 182 "that does not change. If an object changes elevation, it should return to its resting "
191 "elevation as soon as possible.\n\n" 183 "elevation as soon as possible.\n\n"
192 184
193 "Component elevations.\n\n" 185 "Component elevations.\n\n"
194 186
195 "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " 187 "The resting elevation for a component type is consistent across apps (e.g., FAB elevation "
196 "does not vary from 6dp in one app to 16dp in another app).\n" 188 "does not vary from 6dp in one app to 16dp in another app).\n"
197 "Components may have different resting elevations across platforms, depending on the depth " 189 "Components may have different resting elevations across platforms, depending on the depth "
198 "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" 190 "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n"
199 191
200 "Responsive elevation and dynamic elevation offsets.\n\n" 192 "Responsive elevation and dynamic elevation offsets.\n\n"
201 193
202 "Some component types have responsive elevation, meaning they change elevation in response " 194 "Some component types have responsive elevation, meaning they change elevation in response "
203 "to user input (e.g., normal, focused, and pressed) or system events. These elevation " 195 "to user input (e.g., normal, focused, and pressed) or system events. These elevation "
204 "changes are consistently implemented using dynamic elevation offsets.\n" 196 "changes are consistently implemented using dynamic elevation offsets.\n"
205 "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " 197 "Dynamic elevation offsets are the goal elevation that a component moves towards, relative "
206 "to the component’s resting state. They ensure that elevation changes are consistent " 198 "to the component’s resting state. They ensure that elevation changes are consistent "
207 "across actions and component types. For example, all components that lift on press have " 199 "across actions and component types. For example, all components that lift on press have "
208 "the same elevation change relative to their resting elevation.\n" 200 "the same elevation change relative to their resting elevation.\n"
209 "Once the input event is completed or cancelled, the component will return to its resting " 201 "Once the input event is completed or cancelled, the component will return to its resting "
210 "elevation.\n\n" 202 "elevation.\n\n"
211 203
212 "Avoiding elevation interference.\n\n" 204 "Avoiding elevation interference.\n\n"
213 205
214 "Components with responsive elevations may encounter other components as they move between " 206 "Components with responsive elevations may encounter other components as they move between "
215 "their resting elevations and dynamic elevation offsets. Because material cannot pass " 207 "their resting elevations and dynamic elevation offsets. Because material cannot pass "
216 "through other material, components avoid interfering with one another any number of ways, " 208 "through other material, components avoid interfering with one another any number of ways, "
217 "whether on a per component basis or using the entire app layout.\n" 209 "whether on a per component basis or using the entire app layout.\n"
218 "On a component level, components can move or be removed before they cause interference. " 210 "On a component level, components can move or be removed before they cause interference. "
219 "For example, a floating action button (FAB) can disappear or move off screen before a " 211 "For example, a floating action button (FAB) can disappear or move off screen before a "
220 "user picks up a card, or it can move if a snackbar appears.\n" 212 "user picks up a card, or it can move if a snackbar appears.\n"
221 "On the layout level, design your app layout to minimize opportunities for interference. " 213 "On the layout level, design your app layout to minimize opportunities for interference. "
222 "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " 214 "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere "
223 "when a user tries to pick up one of cards.\n\n" 215 "when a user tries to pick up one of cards.\n\n"
224 </string> 216 </string>
225 </resources> 217 </resources>