From cc3ab6c9be7d434108521409121a11bdf5670ce2 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 2 Jan 2021 18:16:43 +0200 Subject: [PATCH] convert switch on resource IDs with a series of if/else resource IDs are going to be non-final in the future --- .../ui/activity/NewTransactionItemHolder.java | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java index b2dd24da..f8d6002b 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java @@ -144,22 +144,20 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder try { final int pos = getAdapterPosition(); adapter.updateFocusedItem(pos); - switch (id) { - case R.id.account_row_acc_name: - adapter.noteFocusIsOnAccount(pos); - break; - case R.id.account_row_acc_amounts: - adapter.noteFocusIsOnAmount(pos); - break; - case R.id.comment: - adapter.noteFocusIsOnComment(pos); - break; - case R.id.transaction_comment: - adapter.noteFocusIsOnTransactionComment(pos); - break; - case R.id.new_transaction_description: - adapter.noteFocusIsOnDescription(pos); - break; + if (id == R.id.account_row_acc_name) { + adapter.noteFocusIsOnAccount(pos); + } + else if (id == R.id.account_row_acc_amounts) { + adapter.noteFocusIsOnAmount(pos); + } + else if (id == R.id.comment) { + adapter.noteFocusIsOnComment(pos); + } + else if (id == R.id.transaction_comment) { + adapter.noteFocusIsOnTransactionComment(pos); + } + else if (id == R.id.new_transaction_description) { + adapter.noteFocusIsOnDescription(pos); } } finally { -- 2.39.5