Skip to content

Commit 557206c

Browse files
committed
Extract code to remove the favorite icon into a new method
1 parent a8dd6f7 commit 557206c

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

app/src/main/java/org/gnucash/android/ui/transaction/TransactionFormFragment.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
322322

323323
@Override
324324
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
325-
if (view != null) {
326-
// Remove the favorite star from the view to avoid visual clutter.
327-
TextView qualifiedAccountName = (TextView) view;
328-
qualifiedAccountName.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
329-
}
325+
removeFavoriteIconFromSelectedView((TextView) view);
330326

331327
if (mSplitsList.size() == 2) { //when handling simple transfer to one account
332328
for (Split split : mSplitsList) {
@@ -343,6 +339,13 @@ public void onItemSelected(AdapterView<?> adapterView, View view, int position,
343339
startTransferFunds();
344340
}
345341

342+
// Removes the icon from view to avoid visual clutter
343+
private void removeFavoriteIconFromSelectedView(TextView view) {
344+
if (view != null) {
345+
view.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
346+
}
347+
}
348+
346349
@Override
347350
public void onNothingSelected(AdapterView<?> adapterView) {
348351
//nothing to see here, move along

0 commit comments

Comments
 (0)