Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple click crash handled #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
240 changes: 141 additions & 99 deletions app/src/main/java/com/dvm/appd/oasis/dbg/MainActivity.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,12 @@ class EventsAdapter(private val listener: OnMarkFavouriteClicked): RecyclerView.
// }

RxView.clicks(holder.directions).debounce(200, TimeUnit.MILLISECONDS).observeOn(
AndroidSchedulers.mainThread()).subscribe {
AndroidSchedulers.mainThread()).subscribe ({
listener.getDirections(events[position].venue)
}

RxView.clicks(holder.view).debounce(200, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe {
listener.showAboutRules(events[position].details, events[position].name, events[position].contact)
}
},{})

RxView.clicks(holder.view).debounce(200, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe({
listener.showAboutRules(events[position].details, events[position].name, events[position].contact)},{})
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,18 @@ class CartChildAdapter(private val listener: OnButtonClicked): RecyclerView.Adap
holder.isVeg.setImageResource(R.drawable.ic_non_veg)
}

RxView.clicks(holder.plus).debounce(200, TimeUnit.MILLISECONDS).subscribe {
RxView.clicks(holder.plus).debounce(200, TimeUnit.MILLISECONDS).subscribe ({
listener.plusButtonClicked(cartChildItems[position], cartChildItems[position].quantity + 1)
}
},{})

RxView.clicks(holder.minus).debounce(200, TimeUnit.MILLISECONDS).subscribe {
RxView.clicks(holder.minus).debounce(200, TimeUnit.MILLISECONDS).subscribe ({
if (cartChildItems[position].quantity > 1) {

listener.plusButtonClicked(cartChildItems[position], cartChildItems[position].quantity - 1)
} else {

listener.deleteCartItemClicked(cartChildItems[position].itemId)
}
}
},{})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ class OrdersAdapter(private val listener:OrderCardClick): RecyclerView.Adapter<O
}
else{
RxView.clicks(holder.otp).debounce(200, TimeUnit.MILLISECONDS).observeOn(
AndroidSchedulers.mainThread()).subscribe {
AndroidSchedulers.mainThread()).subscribe ({
if (orderItems[position].status == 2){
listener.updateOtpSeen(orderItems[position].orderId)
Log.d("OTP", "Called")
}
else{
Log.d("OTP", "Status not yet ready ${orderItems[position].status}")
}
}
},{})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a space after the comma, and one between the empty braces

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ class StallItemsChildAdapter(private val listener:OnAddClickedListener) : Recycl
holder.quantity.text = stallItems[position].quantity.toString()

RxView.clicks(holder.plus).debounce(200, TimeUnit.MILLISECONDS).observeOn(
AndroidSchedulers.mainThread()).subscribe {
AndroidSchedulers.mainThread()).subscribe ({
listener.addButtonClicked(stallItems[position], stallItems[position].quantity + 1)
}
},{})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


RxView.clicks(holder.minus).debounce(200, TimeUnit.MILLISECONDS).subscribe {
RxView.clicks(holder.minus).debounce(200, TimeUnit.MILLISECONDS).subscribe({
if (stallItems[position].quantity > 1){

listener.addButtonClicked(stallItems[position], stallItems[position].quantity - 1)
Expand All @@ -89,7 +89,7 @@ class StallItemsChildAdapter(private val listener:OnAddClickedListener) : Recycl

listener.deleteCartItemClicked(stallItems[position].itemId)
}
}
},{})

}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class StallsAdapter (private val listener:OnStallSelectedListener): RecyclerView

Glide.with(holder.itemView.context!!).load(stalls[position].imageUrl).circleCrop().placeholder(R.color.zxing_transparent).circleCrop().into(holder.stallImg)

RxView.clicks(holder.parent).debounce(200, TimeUnit.MILLISECONDS).subscribe {
RxView.clicks(holder.parent).debounce(200, TimeUnit.MILLISECONDS).subscribe ({
listener.stallSelected(stalls[position])
}
},{})
}
inner class StallsViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val stallName = view.quantity
Expand Down