aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLara Scheidegger <lararennie@google.com>2014-10-22 21:13:33 +0200
committerLara Scheidegger <lararennie@google.com>2014-10-22 21:13:33 +0200
commitb6bf3a8c83b1ceb0bd11fcd89833ecbc18580ed2 (patch)
treecf43eb4c48540fcc93cdb1fde1536438b0ece281
parent29761c802c0df839dfbfae7dd9c77f66278bab48 (diff)
downloadsrc-b6bf3a8c83b1ceb0bd11fcd89833ecbc18580ed2.tar.gz
More whitespace/line-break changes, fixed tests by using this where appropriate.
-rw-r--r--java/src/com/android/i18n/addressinput/AddressUiComponent.java20
-rw-r--r--java/src/com/android/i18n/addressinput/AddressWidget.java31
-rw-r--r--java/src/com/android/i18n/addressinput/AddressWidgetUiComponentProvider.java4
-rw-r--r--java/src/com/android/i18n/addressinput/FieldVerifier.java2
-rw-r--r--java/src/com/android/i18n/addressinput/FormController.java6
-rw-r--r--java/src/com/android/i18n/addressinput/FormOptions.java2
-rw-r--r--java/src/com/android/i18n/addressinput/JsonpRequestBuilder.java4
-rw-r--r--java/src/com/android/i18n/addressinput/NotifyingListener.java4
-rw-r--r--java/src/com/android/i18n/addressinput/StandardAddressVerifier.java17
-rw-r--r--java/test/com/android/i18n/addressinput/AsyncTestCaseTest.java20
10 files changed, 52 insertions, 58 deletions
diff --git a/java/src/com/android/i18n/addressinput/AddressUiComponent.java b/java/src/com/android/i18n/addressinput/AddressUiComponent.java
index d0aa4c8..5e07799 100644
--- a/java/src/com/android/i18n/addressinput/AddressUiComponent.java
+++ b/java/src/com/android/i18n/addressinput/AddressUiComponent.java
@@ -55,10 +55,10 @@ class AddressUiComponent {
}
AddressUiComponent(AddressField id) {
- id = id;
+ this.id = id;
// By default, an AddressUiComponent doesn't depend on anything else.
- parentId = null;
- uiType = UiComponent.EDIT;
+ this.parentId = null;
+ this.uiType = UiComponent.EDIT;
}
/**
@@ -66,7 +66,7 @@ class AddressUiComponent {
* @param candidatesList
*/
void initializeCandidatesList(List<RegionData> candidatesList) {
- candidatesList = candidatesList;
+ this.candidatesList = candidatesList;
if (candidatesList.size() > 1) {
uiType = UiComponent.SPINNER;
switch (id) {
@@ -111,7 +111,7 @@ class AddressUiComponent {
}
void setFieldName(String fieldName) {
- fieldName = fieldName;
+ this.fieldName = fieldName;
}
UiComponent getUiType() {
@@ -119,7 +119,7 @@ class AddressUiComponent {
}
void setUiType(UiComponent uiType) {
- uiType = uiType;
+ this.uiType = uiType;
}
List<RegionData> getCandidatesList() {
@@ -127,7 +127,7 @@ class AddressUiComponent {
}
void setCandidatesList(List<RegionData> candidatesList) {
- candidatesList = candidatesList;
+ this.candidatesList = candidatesList;
}
AddressField getId() {
@@ -135,7 +135,7 @@ class AddressUiComponent {
}
void setId(AddressField id) {
- id = id;
+ this.id = id;
}
AddressField getParentId() {
@@ -143,11 +143,11 @@ class AddressUiComponent {
}
void setParentId(AddressField parentId) {
- parentId = parentId;
+ this.parentId = parentId;
}
void setView(View view) {
- view = view;
+ this.view = view;
}
View getView() {
diff --git a/java/src/com/android/i18n/addressinput/AddressWidget.java b/java/src/com/android/i18n/addressinput/AddressWidget.java
index 8c6b7d4..3a7267b 100644
--- a/java/src/com/android/i18n/addressinput/AddressWidget.java
+++ b/java/src/com/android/i18n/addressinput/AddressWidget.java
@@ -167,10 +167,10 @@ public class AddressWidget implements AdapterView.OnItemSelectedListener {
@SuppressWarnings("unchecked")
public AddressSpinnerInfo(Spinner view, AddressField id, AddressField parentId) {
- view = view;
- id = id;
- parentId = parentId;
- adapter = (ArrayAdapter<String>) view.getAdapter();
+ this.view = view;
+ this.id = id;
+ this.parentId = parentId;
+ this.adapter = (ArrayAdapter<String>) view.getAdapter();
}
public void setSpinnerList(List<RegionData> list, String defaultKey) {
@@ -599,8 +599,7 @@ public class AddressWidget implements AdapterView.OnItemSelectedListener {
}
private void initializeFieldsWithAddress(AddressData savedAddress) {
- for (AddressField field : formatInterpreter.getAddressFieldOrder(script,
- currentRegion)) {
+ for (AddressField field : formatInterpreter.getAddressFieldOrder(script, currentRegion)) {
String value = savedAddress.getFieldValue(field);
if (value == null) {
value = "";
@@ -615,17 +614,15 @@ public class AddressWidget implements AdapterView.OnItemSelectedListener {
private void init(Context context, ViewGroup rootView, FormOptions formOptions,
ClientCacheManager cacheManager) {
- context = context;
- rootView = rootView;
- formOptions = formOptions;
- cacheData = new CacheData(cacheManager);
- inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- formController =
- new FormController(new ClientData(cacheData),
- widgetLocale, currentRegion);
- formatInterpreter = new FormatInterpreter(formOptions);
- verifier = new StandardAddressVerifier(
- new FieldVerifier(new ClientData(cacheData)));
+ this.context = context;
+ this.rootView = rootView;
+ this.formOptions = formOptions;
+ this.cacheData = new CacheData(cacheManager);
+ this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ this.formController =
+ new FormController(new ClientData(cacheData), widgetLocale, currentRegion);
+ this.formatInterpreter = new FormatInterpreter(formOptions);
+ this.verifier = new StandardAddressVerifier(new FieldVerifier(new ClientData(cacheData)));
if (!formOptions.isHidden(AddressField.COUNTRY)) {
buildCountryListBox();
createView(rootView, inputWidgets.get(AddressField.COUNTRY),
diff --git a/java/src/com/android/i18n/addressinput/AddressWidgetUiComponentProvider.java b/java/src/com/android/i18n/addressinput/AddressWidgetUiComponentProvider.java
index 670c6c6..31160b9 100644
--- a/java/src/com/android/i18n/addressinput/AddressWidgetUiComponentProvider.java
+++ b/java/src/com/android/i18n/addressinput/AddressWidgetUiComponentProvider.java
@@ -41,8 +41,8 @@ public class AddressWidgetUiComponentProvider {
protected LayoutInflater inflater;
public AddressWidgetUiComponentProvider(Context context) {
- context = context;
- inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ this.context = context;
+ this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
/**
diff --git a/java/src/com/android/i18n/addressinput/FieldVerifier.java b/java/src/com/android/i18n/addressinput/FieldVerifier.java
index 17a71e0..9dee8de 100644
--- a/java/src/com/android/i18n/addressinput/FieldVerifier.java
+++ b/java/src/com/android/i18n/addressinput/FieldVerifier.java
@@ -70,7 +70,7 @@ public class FieldVerifier {
* Creates the root field verifier for a particular data source.
*/
public FieldVerifier(DataSource dataSource) {
- dataSource = dataSource;
+ this.dataSource = dataSource;
populateRootVerifier();
}
diff --git a/java/src/com/android/i18n/addressinput/FormController.java b/java/src/com/android/i18n/addressinput/FormController.java
index 68deed7..63c69ab 100644
--- a/java/src/com/android/i18n/addressinput/FormController.java
+++ b/java/src/com/android/i18n/addressinput/FormController.java
@@ -56,7 +56,7 @@ class FormController {
*/
FormController(ClientData integratedData, String languageCode, String currentCountry) {
Util.checkNotNull(integratedData, "null data not allowed");
- languageCode = languageCode;
+ this.languageCode = languageCode;
this.currentCountry = currentCountry;
AddressData address = new AddressData.Builder().setCountry(DEFAULT_REGION_CODE).build();
@@ -70,11 +70,11 @@ class FormController {
}
void setLanguageCode(String languageCode) {
- languageCode = languageCode;
+ this.languageCode = languageCode;
}
void setCurrentCountry(String currentCountry) {
- currentCountry = currentCountry;
+ this.currentCountry = currentCountry;
}
private ScriptType getScriptType() {
diff --git a/java/src/com/android/i18n/addressinput/FormOptions.java b/java/src/com/android/i18n/addressinput/FormOptions.java
index 2b9bee6..ffa8c10 100644
--- a/java/src/com/android/i18n/addressinput/FormOptions.java
+++ b/java/src/com/android/i18n/addressinput/FormOptions.java
@@ -154,7 +154,7 @@ public class FormOptions {
if (baseId == null) {
throw new RuntimeException("baseId cannot be null.");
}
- baseId = baseId;
+ this.baseId = baseId;
return this;
}
diff --git a/java/src/com/android/i18n/addressinput/JsonpRequestBuilder.java b/java/src/com/android/i18n/addressinput/JsonpRequestBuilder.java
index b21fded..d5bc608 100644
--- a/java/src/com/android/i18n/addressinput/JsonpRequestBuilder.java
+++ b/java/src/com/android/i18n/addressinput/JsonpRequestBuilder.java
@@ -72,8 +72,8 @@ class JsonpRequestBuilder {
private AsyncCallback<JsoMap> callback;
protected AsyncHttp(HttpUriRequest request, AsyncCallback<JsoMap> callback) {
- request = request;
- callback = callback;
+ this.request = request;
+ this.callback = callback;
}
@Override
diff --git a/java/src/com/android/i18n/addressinput/NotifyingListener.java b/java/src/com/android/i18n/addressinput/NotifyingListener.java
index 4e64d2d..038a069 100644
--- a/java/src/com/android/i18n/addressinput/NotifyingListener.java
+++ b/java/src/com/android/i18n/addressinput/NotifyingListener.java
@@ -24,8 +24,8 @@ public class NotifyingListener implements DataLoadListener {
private boolean done;
NotifyingListener(Object sleeper) {
- sleeper = sleeper;
- done = false;
+ this.sleeper = sleeper;
+ this.done = false;
}
@Override
diff --git a/java/src/com/android/i18n/addressinput/StandardAddressVerifier.java b/java/src/com/android/i18n/addressinput/StandardAddressVerifier.java
index 1b547c1..96cf684 100644
--- a/java/src/com/android/i18n/addressinput/StandardAddressVerifier.java
+++ b/java/src/com/android/i18n/addressinput/StandardAddressVerifier.java
@@ -105,9 +105,9 @@ public class StandardAddressVerifier {
private DataLoadListener listener;
Verifier(AddressData address, AddressProblems problems, DataLoadListener listener) {
- address = address;
- problems = problems;
- listener = listener;
+ this.address = address;
+ this.problems = problems;
+ this.listener = listener;
}
@Override
@@ -165,17 +165,15 @@ public class StandardAddressVerifier {
* Hook to perform any final processing using the final verifier. Default does no additional
* verification.
*/
- protected void postVerify(FieldVerifier verifier, AddressData address,
- AddressProblems problems) {
+ protected void postVerify(FieldVerifier verifier, AddressData address, AddressProblems problems) {
}
/**
* Hook called by verify with each verifiable field, in order. Override to provide pre- or
* post-checks for all fields.
*/
- protected boolean verifyField(LookupKey.ScriptType script,
- FieldVerifier verifier, AddressField field, String value,
- AddressProblems problems) {
+ protected boolean verifyField(LookupKey.ScriptType script, FieldVerifier verifier,
+ AddressField field, String value, AddressProblems problems) {
Iterator<AddressProblemType> iter = getProblemIterator(field);
while (iter.hasNext()) {
AddressProblemType prob = iter.next();
@@ -220,8 +218,7 @@ public class StandardAddressVerifier {
/**
* Refines the verifier. This delegates to the verifier to perform the refinement.
*/
- public FieldVerifier refineVerifier(FieldVerifier v, AddressField field,
- String subkey) {
+ public FieldVerifier refineVerifier(FieldVerifier v, AddressField field, String subkey) {
return v.refineVerifier(subkey);
}
diff --git a/java/test/com/android/i18n/addressinput/AsyncTestCaseTest.java b/java/test/com/android/i18n/addressinput/AsyncTestCaseTest.java
index 495f937..36833b8 100644
--- a/java/test/com/android/i18n/addressinput/AsyncTestCaseTest.java
+++ b/java/test/com/android/i18n/addressinput/AsyncTestCaseTest.java
@@ -68,6 +68,14 @@ public class AsyncTestCaseTest extends AsyncTestCase {
* Helper class to perform an asynchronous callback after a specified delay.
*/
private static class AsyncCallback extends Thread {
+ private long waitMillis;
+ private Runnable callback;
+
+ private AsyncCallback(long waitMillis, Runnable callback) {
+ this.waitMillis = waitMillis;
+ this.callback = callback;
+ }
+
public static void execute(long waitMillis, Runnable callback) {
(new AsyncCallback(waitMillis, callback)).start();
}
@@ -76,20 +84,12 @@ public class AsyncTestCaseTest extends AsyncTestCase {
public void run() {
try {
synchronized (this) {
- wait(waitMillis);
+ wait(this.waitMillis);
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
- callback.run();
+ this.callback.run();
}
-
- private AsyncCallback(long waitMillis, Runnable callback) {
- this.waitMillis = waitMillis;
- this.callback = callback;
- }
-
- private long waitMillis;
- private Runnable callback;
}
}