-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
Add support for select multiple request. #1130
base: main
Are you sure you want to change the base?
Conversation
Add support for share selected Transaction as text and har file type. Add support for delete selected transaction only.
Fix Adapter parameters.
@cortinico what should i do next? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
library/src/main/kotlin/com/chuckerteam/chucker/internal/ui/MainActivity.kt
Outdated
Show resolved
Hide resolved
@@ -148,15 +168,16 @@ internal class MainActivity : | |||
showDialog( | |||
getClearDialogData(), | |||
onPositiveClick = { | |||
viewModel.clearTransactions() | |||
if (selectedTransactions.isNotEmpty()) viewModel.clearSelectedTransactions(selectedTransactions) else viewModel.clearTransactions() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this logic inside hte ViewModel? Let's just have a viewModel.clearTransactions(selectedTransactions)
that behaves differently wether the selectedTransactions
is empty or not
Co-authored-by: Nicola Corti <[email protected]>
Co-authored-by: Nicola Corti <[email protected]>
Co-authored-by: Nicola Corti <[email protected]>
Thanks @cortinico for review, i will try to fix that ASAP. |
@rohitjakhar Just to set expectations, I'll be able to take a look at this only next week. |
…are_multiple_request # Conflicts: # library/src/main/kotlin/com/chuckerteam/chucker/internal/ui/MainActivity.kt # library/src/main/kotlin/com/chuckerteam/chucker/internal/ui/transaction/TransactionAdapter.kt
@cortinico I resolve conflicts, test all corner cases. |
@rohitjakhar sorry I've been off for XMas vacation and haven't had time to look at this again. I can look into it this week so we can merge it. Could you fix the detekt/ktlint failures in the meanwhile? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for sending this over @rohitjakhar
Please reformat the code with ./gradlew ktlintFormat
as formatting is odd in a couple of places.
Also there is a problem with rotation of the device: the highlights is lost, but the selection still remains. Also clicking delete is deleting the wrong transaction. See the video I'm attaching.
) : ListAdapter< | ||
HttpTransactionTuple, | ||
TransactionAdapter.TransactionViewHolder>( | ||
TransactionDiffCallback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatting here is odd and is causing ktlint
to fail
} | ||
|
||
@SuppressLint("SetTextI18n") | ||
fun bind(transaction: HttpTransactionTuple) { | ||
transactionId = transaction.id | ||
|
||
if (selectedPos.find { it == adapterPosition } != null) { | ||
itemView.setBackgroundColor(color400) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not used this.
Let's create a new color resource as:
<color name="chucker_status_highlighted">#FF9800</color>
} | ||
notifyItemChanged(adapterPosition) | ||
true | ||
} ?: kotlin.run { false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} ?: kotlin.run { false } | |
} ?: false |
context.theme.resolveAttribute( | ||
android.R.attr.selectableItemBackground, | ||
outValue, | ||
true, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting is odd also here
We're getting close to a mergeabble state :) |
Review Changes.
@cortinico I fix above issues. |
@cortinico can you give me next step to merge it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make sure the CI is green 👍 You also need to run ./gradlew ktlintFormat
before resubmitting
getExportDialogData( | ||
if (viewModel.isItemSelected.value == true) { | ||
R.string.chucker_export_text_selected_http_confirmation | ||
} else { | ||
R.string.chucker_export_text_http_confirmation | ||
}, | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of this, the function is now getting too long and letting detekt fail:
> Task :library:detekt
/home/runner/work/chucker/chucker/library/src/main/kotlin/com/chuckerteam/chucker/internal/ui/MainActivity.kt:161:18: The function onOptionsItemSelected is too long (60). The maximum length is 60. [LongMethod]
You can see it in the CI signal.
Can you export this + lines 193/199 to separate functions
…into share_multiple_request
@cortinico I just update code and run ktlintformat. |
@cortinico should i supress TooManyFunctions ? |
Yes please do, it's reasonable to do so in |
@cortinico All are green |
@rohitjakhar thanks for following up. Sadly there are still a couple of bugs:
video-1718923534.mp4Can I ask you to look into those 2 problems and then we can merge it 👍 |
📷 Screenshots
📄 Context
Issue link: Share Multiple Request at One Time
📝 Changes
Made change in TransactionAdapter to show color on Selected. Transaction, list of selected position, lambda for longClick on itemView.
Also Add query for get selected transaction data, delete transaction data.
🛠️ How to test
Long press at any transaction to select transaction, after that click other transaction to select them too.