From 6a64e861ce963f203a3758cfe6c4cda669a82600 Mon Sep 17 00:00:00 2001 From: hall9zeha Date: Tue, 1 Mar 2022 14:34:44 -0500 Subject: [PATCH] fixed #2: Bug corregido --- .../.idea/deploymentTargetDropDown.xml | 17 ---------- .../com/barryzea/niloclient/MainActivity.kt | 5 ++- .../barryzea/niloclient/commons/Constants.kt | 1 + .../niloclient/order/OrderActivity.kt | 31 ++++++++++--------- 4 files changed, 22 insertions(+), 32 deletions(-) delete mode 100644 NiloPartner/.idea/deploymentTargetDropDown.xml diff --git a/NiloPartner/.idea/deploymentTargetDropDown.xml b/NiloPartner/.idea/deploymentTargetDropDown.xml deleted file mode 100644 index 0ca1718..0000000 --- a/NiloPartner/.idea/deploymentTargetDropDown.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NiloPartner/app/src/main/java/com/barryzea/niloclient/MainActivity.kt b/NiloPartner/app/src/main/java/com/barryzea/niloclient/MainActivity.kt index b0a1080..875da13 100644 --- a/NiloPartner/app/src/main/java/com/barryzea/niloclient/MainActivity.kt +++ b/NiloPartner/app/src/main/java/com/barryzea/niloclient/MainActivity.kt @@ -299,7 +299,10 @@ class MainActivity : AppCompatActivity(), OnProductListener, MainAux { } } } - R.id.itemOrder->{startActivity(Intent(this, OrderActivity::class.java))} + R.id.itemOrder->{ + + startActivity(Intent(this, OrderActivity::class.java) + .putExtra(Constants.ACTION_INTENT,Constants.ORIGIN_INTENT))} R.id.itemProfile->{ val fragment=ProfileFragment() supportFragmentManager.beginTransaction() diff --git a/NiloPartner/app/src/main/java/com/barryzea/niloclient/commons/Constants.kt b/NiloPartner/app/src/main/java/com/barryzea/niloclient/commons/Constants.kt index 188c93b..b005dfb 100644 --- a/NiloPartner/app/src/main/java/com/barryzea/niloclient/commons/Constants.kt +++ b/NiloPartner/app/src/main/java/com/barryzea/niloclient/commons/Constants.kt @@ -17,4 +17,5 @@ object Constants { const val MY_PHOTO="my_photo" const val ACTION_INTENT="action_intent" const val PROP_ID="id" + const val ORIGIN_INTENT="locale" } \ No newline at end of file diff --git a/NiloPartner/app/src/main/java/com/barryzea/niloclient/order/OrderActivity.kt b/NiloPartner/app/src/main/java/com/barryzea/niloclient/order/OrderActivity.kt index 5b1b4e1..17bad6a 100644 --- a/NiloPartner/app/src/main/java/com/barryzea/niloclient/order/OrderActivity.kt +++ b/NiloPartner/app/src/main/java/com/barryzea/niloclient/order/OrderActivity.kt @@ -35,25 +35,28 @@ class OrderActivity : AppCompatActivity(), OnOrderListener, OrderAux { setupRecyclerView() setupFirestore() + checkIntent(intent) } private fun checkIntent(intent: Intent?) { - intent?.let{ - val actionIntent=it.getIntExtra(Constants.ACTION_INTENT,0) - actionIntent?.let{ - val id=intent.getStringExtra(Constants.PROP_ID)?:"" - val status=intent.getIntExtra(Constants.STATUS, 0) - orderSelected= Order(id=id, status=status) - val fragment=TrackFragment() - - supportFragmentManager - .beginTransaction() - .add(R.id.containerMainOrder, fragment) - .addToBackStack(null) - .commit() - } + intent?.let { + if (it.getStringExtra(Constants.ACTION_INTENT).isNullOrEmpty()) { + val actionIntent = it.getIntExtra(Constants.ACTION_INTENT, 0) + actionIntent?.let { + val id = intent.getStringExtra(Constants.PROP_ID) ?: "" + val status = intent.getIntExtra(Constants.STATUS, 0) + orderSelected = Order(id = id, status = status) + val fragment = TrackFragment() + + supportFragmentManager + .beginTransaction() + .add(R.id.containerMainOrder, fragment) + .addToBackStack(null) + .commit() + } + } } }