@@ -87,7 +87,7 @@ public class AccountFormFragment extends Fragment {
8787 /**
8888 * Tag for the color picker dialog fragment
8989 */
90- public static final String COLOR_PICKER_DIALOG_TAG = "color_picker_dialog" ;
90+ private static final String COLOR_PICKER_DIALOG_TAG = "color_picker_dialog" ;
9191
9292 /**
9393 * EditText for the name of the account to be created/edited
@@ -176,7 +176,7 @@ public class AccountFormFragment extends Fragment {
176176 /**
177177 * Spinner for selecting the default transfer account
178178 */
179- @ Bind (R .id .input_default_transfer_account ) Spinner mDefaulTransferAccountSpinner ;
179+ @ Bind (R .id .input_default_transfer_account ) Spinner mDefaultTransferAccountSpinner ;
180180
181181 /**
182182 * Account description input text view
@@ -205,13 +205,14 @@ public class AccountFormFragment extends Fragment {
205205 */
206206 @ Bind (R .id .input_color_picker ) ColorSquare mColorSquare ;
207207
208- private ColorPickerSwatch .OnColorSelectedListener mColorSelectedListener = new ColorPickerSwatch .OnColorSelectedListener () {
209- @ Override
210- public void onColorSelected (int color ) {
211- mColorSquare .setBackgroundColor (color );
212- mSelectedColor = color ;
213- }
214- };
208+ private final ColorPickerSwatch .OnColorSelectedListener mColorSelectedListener =
209+ new ColorPickerSwatch .OnColorSelectedListener () {
210+ @ Override
211+ public void onColorSelected (int color ) {
212+ mColorSquare .setBackgroundColor (color );
213+ mSelectedColor = color ;
214+ }
215+ };
215216
216217
217218 /**
@@ -294,11 +295,11 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
294295 }
295296 });
296297
297- mDefaulTransferAccountSpinner .setEnabled (false );
298+ mDefaultTransferAccountSpinner .setEnabled (false );
298299 mDefaultTransferAccountCheckBox .setOnCheckedChangeListener (new OnCheckedChangeListener () {
299300 @ Override
300301 public void onCheckedChanged (CompoundButton compoundButton , boolean isChecked ) {
301- mDefaulTransferAccountSpinner .setEnabled (isChecked );
302+ mDefaultTransferAccountSpinner .setEnabled (isChecked );
302303 }
303304 });
304305
@@ -496,13 +497,13 @@ private void setParentAccountSelection(long parentAccountId){
496497 private void setDefaultTransferAccountSelection (long defaultTransferAccountId , boolean enableTransferAccount ) {
497498 if (defaultTransferAccountId > 0 ) {
498499 mDefaultTransferAccountCheckBox .setChecked (enableTransferAccount );
499- mDefaulTransferAccountSpinner .setEnabled (enableTransferAccount );
500+ mDefaultTransferAccountSpinner .setEnabled (enableTransferAccount );
500501 } else
501502 return ;
502503
503504 for (int pos = 0 ; pos < mDefaultTransferAccountCursorAdapter .getCount (); pos ++) {
504505 if (mDefaultTransferAccountCursorAdapter .getItemId (pos ) == defaultTransferAccountId ) {
505- mDefaulTransferAccountSpinner .setSelection (pos );
506+ mDefaultTransferAccountSpinner .setSelection (pos );
506507 break ;
507508 }
508509 }
@@ -521,6 +522,7 @@ private int[] getAccountColorOptions(){
521522 int color = colorTypedArray .getColor (i , getResources ().getColor (R .color .title_green ));
522523 colorOptions [i ] = color ;
523524 }
525+ colorTypedArray .recycle ();
524526 return colorOptions ;
525527 }
526528 /**
@@ -574,13 +576,13 @@ private void loadDefaultTransferAccountList(){
574576 Cursor defaultTransferAccountCursor = mAccountsDbAdapter .fetchAccountsOrderedByFullName (condition ,
575577 new String []{AccountType .ROOT .name ()});
576578
577- if (mDefaulTransferAccountSpinner .getCount () <= 0 ) {
579+ if (mDefaultTransferAccountSpinner .getCount () <= 0 ) {
578580 setDefaultTransferAccountInputsVisible (false );
579581 }
580582
581583 mDefaultTransferAccountCursorAdapter = new QualifiedAccountNameCursorAdapter (getActivity (),
582584 defaultTransferAccountCursor );
583- mDefaulTransferAccountSpinner .setAdapter (mDefaultTransferAccountCursorAdapter );
585+ mDefaultTransferAccountSpinner .setAdapter (mDefaultTransferAccountCursorAdapter );
584586 }
585587
586588 /**
@@ -733,7 +735,7 @@ private void saveAccount() {
733735 boolean nameChanged = false ;
734736 if (mAccount == null ){
735737 String name = getEnteredName ();
736- if (name == null || name .length () == 0 ){
738+ if (name .length () == 0 ){
737739 mTextInputLayout .setErrorEnabled (true );
738740 mTextInputLayout .setError (getString (R .string .toast_no_account_name_entered ));
739741 return ;
@@ -771,8 +773,8 @@ private void saveAccount() {
771773 mAccount .setParentUID (newParentAccountUID );
772774
773775 if (mDefaultTransferAccountCheckBox .isChecked ()
774- && mDefaulTransferAccountSpinner .getSelectedItemId () != Spinner .INVALID_ROW_ID ){
775- long id = mDefaulTransferAccountSpinner .getSelectedItemId ();
776+ && mDefaultTransferAccountSpinner .getSelectedItemId () != Spinner .INVALID_ROW_ID ){
777+ long id = mDefaultTransferAccountSpinner .getSelectedItemId ();
776778 mAccount .setDefaultTransferAccountUID (mAccountsDbAdapter .getUID (id ));
777779 } else {
778780 //explicitly set in case of removal of default account
@@ -842,7 +844,7 @@ private AccountType getSelectedAccountType() {
842844 * Retrieves the name of the account which has been entered in the EditText
843845 * @return Name of the account which has been entered in the EditText
844846 */
845- public String getEnteredName (){
847+ private String getEnteredName (){
846848 return mNameEditText .getText ().toString ().trim ();
847849 }
848850
0 commit comments