Skip to content

Commit c93152a

Browse files
committed
Merge pull request YiuChoi#15 from DevFactory/release/naming-conventions-should-be-followed-fix-1
General code quality fix-1
2 parents b49ac2f + 9d60ac7 commit c93152a

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

app/src/main/java/name/caiyao/microreader/utils/CacheUtil.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ public static CacheUtil get(File cacheDir) {
5858
return get(cacheDir, MAX_SIZE, MAX_COUNT);
5959
}
6060

61-
public static CacheUtil get(Context ctx, long max_zise, int max_count) {
61+
public static CacheUtil get(Context ctx, long maxSise, int maxCount) {
6262
File f = new File(ctx.getCacheDir(), "ACache");
63-
return get(f, max_zise, max_count);
63+
return get(f, maxSise, maxCount);
6464
}
6565

66-
public static CacheUtil get(File cacheDir, long max_zise, int max_count) {
66+
public static CacheUtil get(File cacheDir, long maxZise, int maxCount) {
6767
CacheUtil manager = mInstanceMap.get(cacheDir.getAbsoluteFile() + myPid());
6868
if (manager == null) {
69-
manager = new CacheUtil(cacheDir, max_zise, max_count);
69+
manager = new CacheUtil(cacheDir, maxZise, maxCount);
7070
mInstanceMap.put(cacheDir.getAbsolutePath() + myPid(), manager);
7171
}
7272
return manager;
@@ -144,11 +144,11 @@ private static String myPid() {
144144
return "_" + android.os.Process.myPid();
145145
}
146146

147-
private CacheUtil(File cacheDir, long max_size, int max_count) {
147+
private CacheUtil(File cacheDir, long maxSize, int maxCount) {
148148
if (!cacheDir.exists() && !cacheDir.mkdirs()) {
149149
throw new RuntimeException("can't make dirs in " + cacheDir.getAbsolutePath());
150150
}
151-
mCache = new ACacheManager(cacheDir, max_size, max_count);
151+
mCache = new ACacheManager(cacheDir, maxSize, maxCount);
152152
}
153153

154154
/**
@@ -290,9 +290,9 @@ public void put(String key, JSONObject value, int saveTime) {
290290
* @return JSONObject数据
291291
*/
292292
public JSONObject getAsJSONObject(String key) {
293-
String JSONString = getAsString(key);
293+
String jsonString = getAsString(key);
294294
try {
295-
JSONObject obj = new JSONObject(JSONString);
295+
JSONObject obj = new JSONObject(jsonString);
296296
return obj;
297297
} catch (Exception e) {
298298
return null;
@@ -331,9 +331,9 @@ public void put(String key, JSONArray value, int saveTime) {
331331
* @return JSONArray数据
332332
*/
333333
public JSONArray getAsJSONArray(String key) {
334-
String JSONString = getAsString(key);
334+
String jsonstring = getAsString(key);
335335
try {
336-
JSONArray obj = new JSONArray(JSONString);
336+
JSONArray obj = new JSONArray(jsonstring);
337337
return obj;
338338
} catch (Exception e) {
339339
//e.printStackTrace();
@@ -413,15 +413,15 @@ public void put(String key, byte[] value, int saveTime) {
413413
* @return byte 数据
414414
*/
415415
public byte[] getAsBinary(String key) {
416-
RandomAccessFile RAFile = null;
416+
RandomAccessFile raFile = null;
417417
boolean removeFile = false;
418418
try {
419419
File file = mCache.get(key);
420420
if (!file.exists())
421421
return null;
422-
RAFile = new RandomAccessFile(file, "r");
423-
byte[] byteArray = new byte[(int) RAFile.length()];
424-
RAFile.read(byteArray);
422+
raFile = new RandomAccessFile(file, "r");
423+
byte[] byteArray = new byte[(int) raFile.length()];
424+
raFile.read(byteArray);
425425
if (!Utils.isDue(byteArray)) {
426426
return Utils.clearDateInfo(byteArray);
427427
} else {
@@ -432,9 +432,9 @@ public byte[] getAsBinary(String key) {
432432
e.printStackTrace();
433433
return null;
434434
} finally {
435-
if (RAFile != null) {
435+
if (raFile != null) {
436436
try {
437-
RAFile.close();
437+
raFile.close();
438438
} catch (IOException e) {
439439
e.printStackTrace();
440440
}
@@ -539,7 +539,7 @@ public Object getAsObject(String key) {
539539
* @param value 保存的bitmap数据
540540
*/
541541
public void put(String key, Bitmap value) {
542-
put(key, Utils.Bitmap2Bytes(value));
542+
put(key, Utils.bitmap2Bytes(value));
543543
}
544544

545545
/**
@@ -550,7 +550,7 @@ public void put(String key, Bitmap value) {
550550
* @param saveTime 保存的时间,单位:秒
551551
*/
552552
public void put(String key, Bitmap value, int saveTime) {
553-
put(key, Utils.Bitmap2Bytes(value), saveTime);
553+
put(key, Utils.bitmap2Bytes(value), saveTime);
554554
}
555555

556556
/**
@@ -563,7 +563,7 @@ public Bitmap getAsBitmap(String key) {
563563
if (getAsBinary(key) == null) {
564564
return null;
565565
}
566-
return Utils.Bytes2Bimap(getAsBinary(key));
566+
return Utils.bytes2Bimap(getAsBinary(key));
567567
}
568568

569569
// =======================================
@@ -601,7 +601,7 @@ public Drawable getAsDrawable(String key) {
601601
if (getAsBinary(key) == null) {
602602
return null;
603603
}
604-
return Utils.bitmap2Drawable(Utils.Bytes2Bimap(getAsBinary(key)));
604+
return Utils.bitmap2Drawable(Utils.bytes2Bimap(getAsBinary(key)));
605605
}
606606

607607
/**
@@ -881,7 +881,7 @@ private static String createDateInfo(int second) {
881881
/*
882882
* Bitmap → byte[]
883883
*/
884-
private static byte[] Bitmap2Bytes(Bitmap bm) {
884+
private static byte[] bitmap2Bytes(Bitmap bm) {
885885
if (bm == null) {
886886
return null;
887887
}
@@ -893,7 +893,7 @@ private static byte[] Bitmap2Bytes(Bitmap bm) {
893893
/*
894894
* byte[] → Bitmap
895895
*/
896-
private static Bitmap Bytes2Bimap(byte[] b) {
896+
private static Bitmap bytes2Bimap(byte[] b) {
897897
if (b.length == 0) {
898898
return null;
899899
}

app/src/main/java/name/caiyao/microreader/utils/WebUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class WebUtil {
1616
private static final String DIV_IMAGE_PLACE_HOLDER = "class=\"img-place-holder\"";
1717
private static final String DIV_IMAGE_PLACE_HOLDER_IGNORED = "class=\"img-place-holder-ignored\"";
1818

19-
public static String BuildHtmlWithCss(String html, String[] cssUrls, boolean isNightMode) {
19+
public static String buildHtmlWithCss(String html, String[] cssUrls, boolean isNightMode) {
2020
StringBuilder result = new StringBuilder();
2121
for (String cssUrl : cssUrls) {
2222
result.append(String.format(CSS_LINK_PATTERN, cssUrl));

0 commit comments

Comments
 (0)