BearND has uploaded a new change for review.
https://gerrit.wikimedia.org/r/147367
Change subject: Codestyle: Category Coding (some Utils)
......................................................................
Codestyle: Category Coding (some Utils)
Change-Id: Ie97e173f374d7a173e485adfb5e92b904ee1ab44
---
M wikipedia/src/main/java/org/wikipedia/Utils.java
1 file changed, 7 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia
refs/changes/67/147367/1
diff --git a/wikipedia/src/main/java/org/wikipedia/Utils.java
b/wikipedia/src/main/java/org/wikipedia/Utils.java
index 0ffa8fd..65b5425 100644
--- a/wikipedia/src/main/java/org/wikipedia/Utils.java
+++ b/wikipedia/src/main/java/org/wikipedia/Utils.java
@@ -57,6 +57,10 @@
* Contains utility methods that Java doesn't have because we can't make code
look too good, can we?
*/
public final class Utils {
+
+ private static final int MCC_LENGTH = 3;
+ private static final int KB16 = 16 * 1024;
+
/**
* Private constructor, so nobody can construct Utils.
*
@@ -279,7 +283,7 @@
if (t != null && t.getPhoneType() >= 0) {
mccMncNetwork = t.getNetworkOperator();
if (mccMncNetwork != null) {
- mccMncNetwork = mccMncNetwork.substring(0, 3) + "-" +
mccMncNetwork.substring(3);
+ mccMncNetwork = mccMncNetwork.substring(0, MCC_LENGTH)
+ "-" + mccMncNetwork.substring(MCC_LENGTH);
} else {
mccMncNetwork = "000-00";
}
@@ -289,7 +293,7 @@
// so let's check the SIM, too. Let's not worry if it's
CDMA, as the def of CDMA is complex.
mccMncSim = t.getSimOperator();
if (mccMncSim != null) {
- mccMncSim = mccMncSim.substring(0, 3) + "-" +
mccMncSim.substring(3);
+ mccMncSim = mccMncSim.substring(0, MCC_LENGTH) + "-" +
mccMncSim.substring(MCC_LENGTH);
} else {
mccMncSim = "000-00";
}
@@ -474,7 +478,7 @@
* @throws IOException
*/
public static void copyStreams(InputStream in, OutputStream out) throws
IOException {
- byte[] buffer = new byte[16 * 1024]; // 16kb buffer
+ byte[] buffer = new byte[KB16]; // 16kb buffer
int len;
while ((len = in.read(buffer)) != -1) {
out.write(buffer, 0, len);
--
To view, visit https://gerrit.wikimedia.org/r/147367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie97e173f374d7a173e485adfb5e92b904ee1ab44
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits