|
24 | 24 | import android.content.DialogInterface; |
25 | 25 | import android.content.Intent; |
26 | 26 | import android.database.Cursor; |
| 27 | +import android.graphics.Rect; |
27 | 28 | import android.os.AsyncTask; |
28 | 29 | import android.os.Bundle; |
29 | 30 | import android.support.v4.app.DialogFragment; |
|
36 | 37 | import android.text.TextUtils; |
37 | 38 | import android.util.Log; |
38 | 39 | import android.view.LayoutInflater; |
| 40 | +import android.view.TouchDelegate; |
39 | 41 | import android.view.View; |
40 | 42 | import android.view.ViewGroup; |
41 | 43 | import android.widget.*; |
@@ -666,9 +668,9 @@ public void bindView(View v, Context context, Cursor cursor) { |
666 | 668 | subAccountTextView.setVisibility(View.GONE); |
667 | 669 |
|
668 | 670 | // add a summary of transactions to the account view |
669 | | - TextView summary = (TextView) v |
| 671 | + TextView accountBalanceTextView = (TextView) v |
670 | 672 | .findViewById(R.id.transactions_summary); |
671 | | - new AccountBalanceTask(summary, getActivity()).execute(accountId); |
| 673 | + new AccountBalanceTask(accountBalanceTextView, getActivity()).execute(accountId); |
672 | 674 |
|
673 | 675 | boolean isPlaceholderAccount = mAccountsDbAdapter.isPlaceholderAccount(accountId); |
674 | 676 |
|
@@ -705,6 +707,25 @@ public View getView(int position, View convertView, ViewGroup parent) { |
705 | 707 | secondaryText.setTextColor(getResources().getColor(android.R.color.secondary_text_light_nodisable)); |
706 | 708 | } |
707 | 709 |
|
| 710 | + |
| 711 | + //increase the touch target area for the add new transaction button |
| 712 | + |
| 713 | + final View addTransactionButton = convertView.findViewById(R.id.btn_new_transaction); |
| 714 | + final View parentView = convertView; |
| 715 | + parentView.post(new Runnable() { |
| 716 | + @Override |
| 717 | + public void run() { |
| 718 | + final android.graphics.Rect hitRect = new Rect(); |
| 719 | + float extraPadding = getResources().getDimension(R.dimen.edge_padding); |
| 720 | + addTransactionButton.getHitRect(hitRect); |
| 721 | + hitRect.right += extraPadding; |
| 722 | + hitRect.bottom += extraPadding; |
| 723 | + hitRect.top -= extraPadding; |
| 724 | + hitRect.left -= extraPadding; |
| 725 | + parentView.setTouchDelegate(new TouchDelegate(hitRect, addTransactionButton)); |
| 726 | + } |
| 727 | + }); |
| 728 | + |
708 | 729 | return convertView; |
709 | 730 | } |
710 | 731 | } |
|
0 commit comments