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);
}
else {
// swipe up
- downAnchor = lastY;
-
if (currentY < upAnchor - triggerPixels)
mainActivity.fabHide();
}
public class NewTransactionFragment extends Fragment {
private NewTransactionItemsAdapter listAdapter;
private NewTransactionModel viewModel;
- private RecyclerView list;
private FloatingActionButton fab;
private OnNewTransactionFragmentInteractionListener mListener;
private MobileLedgerProfile mProfile;
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));
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);
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);
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 -> {
private MobileLedgerProfile mProfile;
private TextView url;
private TextView defaultCommodity;
- private View defaultCommodityLayout;
private boolean defaultCommoditySet;
private TextInputLayout urlLayout;
private LinearLayout authParams;
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;
/**
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(
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 -> {
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);