app/src/main/java/org/andstatus/app/util/SharedPreferencesUtil.java
/**
     * Returns true not only for boolean true or String "true", but for "1" also
     */
Returns true not only for boolean true or String "true", but for "1" also
Returns true not only for boolean true or String " true " but for " 1 " also
public static boolean isTrue(Object o) {
        boolean is = false;
        try {
            if (o != null) {
                if (o instanceof Boolean) {
                    is = (Boolean) o;
                } else {
                    String string = o.toString();
                    if (!isEmpty(string)) {
                        is = Boolean.parseBoolean(string);
                        if (!is && string.compareTo("1") == 0) {
                            is = true;
                        }
                    }
                }
            }
        } catch (Exception e) {
            MyLog.v(TAG, o.toString(), e);
        }
        return is;
    }
public static boolean isTrue ( Object o ) { boolean is = false ; try { if ( o != null ) { if ( o instanceof Boolean ) { is = ( Boolean ) o ; } else { String string = o . toString ( ) ; if ( ! isEmpty ( string ) ) { is = Boolean . parseBoolean ( string ) ; if ( ! is && string . compareTo ( "1" ) == 0 ) { is = true ; } } } } } catch ( Exception e ) { MyLog . v ( TAG , o . toString ( ) , e ) ; } return is ; }
Returns true not only for boolean true or String "true", but for "1" also
Returns true not only for boolean true or String " true " but for " 1 " also