Skip to content

Commit c4c4c7c

Browse files
committed
Reformat code
1 parent 0c4be95 commit c4c4c7c

3 files changed

Lines changed: 36 additions & 39 deletions

File tree

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/api/sharedpreferences/FloatPrefField.java‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,19 @@ public float get() {
3131
}
3232

3333
public float getOr(float defaultValue) {
34-
try{
34+
try {
3535
return sharedPreferences.getFloat(key, defaultValue);
36-
}catch( ClassCastException e ){
37-
// The pref could be a String, if that is the case try this
38-
// recovery bit
39-
try{
40-
String value = sharedPreferences.getString(key, ""+defaultValue);
41-
float result = Float.parseFloat(value);
42-
return result ;
43-
}catch( Exception e2){
44-
// our recovery bit failed. The problem is elsewhere. Send the original error
45-
throw e ;
46-
}
47-
}
36+
} catch (ClassCastException e) {
37+
// The pref could be a String, if that is the case try this
38+
// recovery bit
39+
try {
40+
String value = sharedPreferences.getString(key, "" + defaultValue);
41+
return Float.parseFloat(value);
42+
} catch (Exception e2) {
43+
// our recovery bit failed. The problem is elsewhere. Send the original error
44+
throw e;
45+
}
46+
}
4847

4948
}
5049

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/api/sharedpreferences/IntPrefField.java‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,19 @@ public int get() {
3131
}
3232

3333
public int getOr(int defaultValue) {
34-
try{
34+
try {
3535
return sharedPreferences.getInt(key, defaultValue);
36-
}catch( ClassCastException e ){
37-
// The pref could be a String, if that is the case try this
38-
// recovery bit
39-
try{
40-
String value = sharedPreferences.getString(key, ""+defaultValue);
41-
int result = Integer.parseInt(value);
42-
return result ;
43-
}catch( Exception e2){
44-
// our recovery bit failed. The problem is elsewhere. Send the original error
45-
throw e ;
46-
}
47-
}
36+
} catch (ClassCastException e) {
37+
// The pref could be a String, if that is the case try this
38+
// recovery bit
39+
try {
40+
String value = sharedPreferences.getString(key, "" + defaultValue);
41+
return Integer.parseInt(value);
42+
} catch (Exception e2) {
43+
// our recovery bit failed. The problem is elsewhere. Send the original error
44+
throw e;
45+
}
46+
}
4847

4948
}
5049

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/api/sharedpreferences/LongPrefField.java‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,19 @@ public long get() {
3131
}
3232

3333
public long getOr(long defaultValue) {
34-
try{
34+
try {
3535
return sharedPreferences.getLong(key, defaultValue);
36-
}catch( ClassCastException e ){
37-
// The pref could be a String, if that is the case try this
38-
// recovery bit
39-
try{
40-
String value = sharedPreferences.getString(key, ""+defaultValue);
41-
long result = Long.parseLong(value);
42-
return result ;
43-
}catch( Exception e2){
44-
// our recovery bit failed. The problem is elsewhere. Send the original error
45-
throw e ;
46-
}
47-
}
36+
} catch (ClassCastException e) {
37+
// The pref could be a String, if that is the case try this
38+
// recovery bit
39+
try {
40+
String value = sharedPreferences.getString(key, "" + defaultValue);
41+
return Long.parseLong(value);
42+
} catch (Exception e2) {
43+
// our recovery bit failed. The problem is elsewhere. Send the original error
44+
throw e;
45+
}
46+
}
4847
}
4948

5049
public void put(long value) {

0 commit comments

Comments
 (0)