From: Damyan Ivanov Date: Sat, 15 Aug 2020 12:05:37 +0000 (+0000) Subject: drop unused/unneeded variables X-Git-Tag: v0.15.0~60 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=90a2528c5da0a524701fade91d1a2a45e0fccdc5;p=mobile-ledger.git drop unused/unneeded variables --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/MobileLedgerListFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/MobileLedgerListFragment.java index da1ea1e6..74247189 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/MobileLedgerListFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/MobileLedgerListFragment.java @@ -52,13 +52,12 @@ public class MobileLedgerListFragment extends Fragment { int triggerPixels = DimensionUtils.dp2px(mainActivity, 30f); root.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() { private float upAnchor = -1; - private float downAnchor = -1; private float lastY; @Override public boolean onInterceptTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) { switch (e.getActionMasked()) { case MotionEvent.ACTION_DOWN: - lastY = upAnchor = downAnchor = e.getAxisValue(MotionEvent.AXIS_Y); + lastY = upAnchor = e.getAxisValue(MotionEvent.AXIS_Y); break; case MotionEvent.ACTION_MOVE: final float currentY = e.getAxisValue(MotionEvent.AXIS_Y); @@ -70,8 +69,6 @@ public class MobileLedgerListFragment extends Fragment { } else { // swipe up - downAnchor = lastY; - if (currentY < upAnchor - triggerPixels) mainActivity.fabHide(); } diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java index 9f696444..05b272e8 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java @@ -63,7 +63,6 @@ import org.jetbrains.annotations.NotNull; public class NewTransactionFragment extends Fragment { private NewTransactionItemsAdapter listAdapter; private NewTransactionModel viewModel; - private RecyclerView list; private FloatingActionButton fab; private OnNewTransactionFragmentInteractionListener mListener; private MobileLedgerProfile mProfile; @@ -118,6 +117,8 @@ public class NewTransactionFragment extends Fragment { viewModel.observeDataProfile(this); mProfile = Data.getProfile(); listAdapter = new NewTransactionItemsAdapter(viewModel, mProfile); + + RecyclerView list = activity.findViewById(R.id.new_transaction_accounts); list.setAdapter(listAdapter); list.setLayoutManager(new LinearLayoutManager(activity)); 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 c274c455..64161a5c 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 @@ -94,7 +94,6 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder private Observer amountValidityObserver; private boolean inUpdate = false; private boolean syncingData = false; - private View commentButton; //TODO multiple amounts with different currencies per posting NewTransactionItemHolder(@NonNull View itemView, NewTransactionItemsAdapter adapter) { super(itemView); @@ -103,7 +102,6 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder tvComment = lAccount.findViewById(R.id.comment); tvTransactionComment = itemView.findViewById(R.id.transaction_comment); new TextViewClearHelper().attachToTextView((EditText) tvComment); - commentButton = lAccount.findViewById(R.id.comment_button); tvAmount = itemView.findViewById(R.id.account_row_acc_amounts); tvCurrency = itemView.findViewById(R.id.currency); tvDate = itemView.findViewById(R.id.new_transaction_date); @@ -121,10 +119,11 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder tvDate.setOnClickListener(v -> pickTransactionDate()); - commentButton.setOnClickListener(v -> { - tvComment.setVisibility(View.VISIBLE); - tvComment.requestFocus(); - }); + lAccount.findViewById(R.id.comment_button) + .setOnClickListener(v -> { + tvComment.setVisibility(View.VISIBLE); + tvComment.requestFocus(); + }); transactionCommentLayout.findViewById(R.id.comment_button) .setOnClickListener(v -> { diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java index ee01017e..46a0ea6e 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java @@ -82,7 +82,6 @@ public class ProfileDetailFragment extends Fragment { private MobileLedgerProfile mProfile; private TextView url; private TextView defaultCommodity; - private View defaultCommodityLayout; private boolean defaultCommoditySet; private TextInputLayout urlLayout; private LinearLayout authParams; @@ -94,11 +93,9 @@ public class ProfileDetailFragment extends Fragment { private TextView profileName; private TextInputLayout profileNameLayout; private TextView preferredAccountsFilter; - private TextInputLayout preferredAccountsFilterLayout; private View huePickerView; private View insecureWarningText; private TextView futureDatesText; - private View futureDatesLayout; private TextView apiVersionText; private boolean syncingModelFromUI = false; /** @@ -238,14 +235,14 @@ public class ProfileDetailFragment extends Fragment { urlLayout = context.findViewById(R.id.url_layout); - defaultCommodityLayout = context.findViewById(R.id.default_commodity_layout); - defaultCommodityLayout.setOnClickListener(v -> { - CurrencySelectorFragment cpf = CurrencySelectorFragment.newInstance( - CurrencySelectorFragment.DEFAULT_COLUMN_COUNT, false); - cpf.setOnCurrencySelectedListener(model::setDefaultCommodity); - final AppCompatActivity activity = (AppCompatActivity) v.getContext(); - cpf.show(activity.getSupportFragmentManager(), "currency-selector"); - }); + context.findViewById(R.id.default_commodity_layout) + .setOnClickListener(v -> { + CurrencySelectorFragment cpf = CurrencySelectorFragment.newInstance( + CurrencySelectorFragment.DEFAULT_COLUMN_COUNT, false); + cpf.setOnCurrencySelectedListener(model::setDefaultCommodity); + final AppCompatActivity activity = (AppCompatActivity) v.getContext(); + cpf.show(activity.getSupportFragmentManager(), "currency-selector"); + }); Switch showCommodityByDefault = context.findViewById(R.id.profile_show_commodity); showCommodityByDefault.setOnCheckedChangeListener( @@ -269,7 +266,6 @@ public class ProfileDetailFragment extends Fragment { defaultCommodity = context.findViewById(R.id.default_commodity_text); - futureDatesLayout = context.findViewById(R.id.future_dates_layout); futureDatesText = context.findViewById(R.id.future_dates_text); context.findViewById(R.id.future_dates_layout) .setOnClickListener(v -> { @@ -359,8 +355,6 @@ public class ProfileDetailFragment extends Fragment { preferredAccountsFilter.setText(text); }); hookTextChangeSyncRoutine(preferredAccountsFilter, model::setPreferredAccountsFilter); - preferredAccountsFilterLayout = - context.findViewById(R.id.preferred_accounts_accounts_filter_layout); insecureWarningText = context.findViewById(R.id.insecure_scheme_text);