Skip to content

Commit

Permalink
fixed #2: Bug corregido
Browse files Browse the repository at this point in the history
  • Loading branch information
hall9zeha committed Mar 1, 2022
1 parent 15d24a7 commit 6a64e86
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 32 deletions.
17 changes: 0 additions & 17 deletions NiloPartner/.idea/deploymentTargetDropDown.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

}
}
}

Expand Down

0 comments on commit 6a64e86

Please sign in to comment.