package com.deathsnacks.wardroid.utils.preferences;

import android.content.Context;
import android.preference.EditTextPreference;
import android.util.AttributeSet;

/**
 * Created by Admin on 05/02/14.
 */
public class IntEditTextPreference extends EditTextPreference {

    public IntEditTextPreference(Context context) {
        super(context);
    }

    public IntEditTextPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public IntEditTextPreference(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    protected String getPersistedString(String defaultReturnValue) {
        return String.valueOf(getPersistedInt(-1));
    }

    @Override
    protected boolean persistString(String value) {
        return persistInt(Integer.valueOf(value));
    }
}
@@ -792,32 +792,50 @@
 String value) %7B%0A
+        try %7B%0A    
         return p
@@ -865,19 +865,107 @@
 Of(value));%0A
+        %7D catch (NumberFormatException e) %7B%0A            return persistInt(0);%0A        %7D%0A
     %7D%0A%7D

Fix #6