+
+ showCommentsObserver = show -> {
+ final View amountLayout = itemView.findViewById(R.id.amount_layout);
+ ConstraintLayout.LayoutParams amountLayoutParams =
+ (ConstraintLayout.LayoutParams) amountLayout.getLayoutParams();
+ ConstraintLayout.LayoutParams accountParams =
+ (ConstraintLayout.LayoutParams) tvAccount.getLayoutParams();
+ if (show) {
+ commentLayout.setVisibility(View.VISIBLE);
+
+ accountParams.endToStart = ConstraintLayout.LayoutParams.UNSET;
+ accountParams.endToEnd = ConstraintLayout.LayoutParams.PARENT_ID;
+
+ amountLayoutParams.topToTop = ConstraintLayout.LayoutParams.UNSET;
+ amountLayoutParams.topToBottom = tvAccount.getId();
+ }
+ else {
+ commentLayout.setVisibility(View.GONE);
+
+ accountParams.endToStart = amountLayout.getId();
+ accountParams.endToEnd = ConstraintLayout.LayoutParams.UNSET;
+
+ amountLayoutParams.topToBottom = ConstraintLayout.LayoutParams.UNSET;
+ amountLayoutParams.topToTop = ConstraintLayout.LayoutParams.PARENT_ID;
+
+ }
+
+ tvAccount.setLayoutParams(accountParams);
+ amountLayout.setLayoutParams(amountLayoutParams);
+
+ transactionCommentLayout.setVisibility(show ? View.VISIBLE : View.GONE);
+ };
+ }
+ private void commentFocusChanged(View layout, TextView textView, boolean hasFocus) {
+ layout.setAlpha(hasFocus ? 1f : 0.5f);
+ textView.setTypeface(null, hasFocus ? Typeface.NORMAL : Typeface.ITALIC);
+ if (hasFocus)
+ textView.setHint(R.string.transaction_account_comment_hint);
+ else
+ textView.setHint("");
+
+ if (!hasFocus && Misc.isEmptyOrNull(textView.getText()))
+ textView.setVisibility(View.INVISIBLE);