]> git.ktnx.net Git - mobile-ledger.git/commitdiff
drop unused/unneeded variables
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 15 Aug 2020 12:05:37 +0000 (12:05 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 15 Aug 2020 12:48:13 +0000 (12:48 +0000)
app/src/main/java/net/ktnx/mobileledger/ui/MobileLedgerListFragment.java
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java
app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java

index da1ea1e642bb54c7e2a59cf8f6da0d6937372dca..74247189649883fbb1be0c7012cf0f5980b8c804 100644 (file)
@@ -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();
                         }
index 9f69644436b000eb316afebad568bc554ba2b795..05b272e8a6d4f27a9577dac5b526c1ce27f83e6d 100644 (file)
@@ -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));
 
index c274c455cef6845d5af8601f1c776ea92064d24c..64161a5cc1964e922d30ca83d9ce5da679efe588 100644 (file)
@@ -94,7 +94,6 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
     private Observer<Boolean> 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 -> {
index ee01017e792eac8fc26d3fdbaf24a7797c34b347..46a0ea6e6abbe7dcd3c9dca6e24e81f5db89f4a9 100644 (file)
@@ -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);