From 77e2ae96d231714c2f8bd0750a01640f71491a3a Mon Sep 17 00:00:00 2001 From: Shobhit Agarwal Date: Thu, 13 Apr 2017 23:14:43 +0530 Subject: [PATCH] Adds checkstyle FileTabCharacter (#882) * Adds checkstyle FileTabCharacter * Fixes AndroidManifest * Fixes AppListActivity * Fixes OSMWidget * Fixes instance_uploader_list * Fixes geopoint_layout * Fixes checkstyle * Fixes form_entry_end * Fixes arrays.xml * Fixes untranslated.xml * Fixes splash_screen * Fixes start_arrow.xml * Fixes push_right_out * Fixes push_right_in * Fixes two_item_multiple_choice * Fixes two_item_image * Fixes theme.xml * Fixes string.xml * Fixes two_item * Fixes thumb.xml * Fixes push_out_left * Fixes chooser_list_layout * Fixes EncryptionUtils * Fixes GeopointMapActivity * Fixes GeoTraceOsmMapActivity * Fixes ExStringWidget * Fixes GeoPointOsmMapActivity * Fixes MainMenuActivity * Fixes WebUtils * Fixes fade_in and fade_out * Fixes geopoint_osm_layout * Fixes google_preferences * Fixes heirarchy_layout * Fixes main_menu * Fixes preferences.xml * Fixes push_left_in * Fixes list_view_filled --- collect_app/config/checkstyle/checkstyle.xml | 33 ++- collect_app/src/main/AndroidManifest.xml | 135 ++++++----- .../android/activities/AppListActivity.java | 2 +- .../activities/GeoPointMapActivity.java | 9 +- .../activities/GeoPointOsmMapActivity.java | 27 +-- .../activities/GeoTraceGoogleMapActivity.java | 4 +- .../activities/GeoTraceOsmMapActivity.java | 8 +- .../android/activities/MainMenuActivity.java | 2 +- .../android/utilities/EncryptionUtils.java | 10 +- .../collect/android/utilities/WebUtils.java | 12 +- .../android/widgets/ExStringWidget.java | 20 +- .../collect/android/widgets/OSMWidget.java | 3 +- collect_app/src/main/res/anim/fade_in.xml | 8 +- collect_app/src/main/res/anim/fade_out.xml | 8 +- .../src/main/res/anim/push_left_in.xml | 13 +- .../src/main/res/anim/push_left_out.xml | 10 +- .../src/main/res/anim/push_right_in.xml | 10 +- .../src/main/res/anim/push_right_out.xml | 10 +- collect_app/src/main/res/anim/start_arrow.xml | 16 +- collect_app/src/main/res/drawable/thumb.xml | 11 +- .../main/res/layout/chooser_list_layout.xml | 93 ++++---- .../src/main/res/layout/form_entry_end.xml | 18 +- .../src/main/res/layout/geopoint_layout.xml | 200 ++++++++-------- .../main/res/layout/geopoint_osm_layout.xml | 186 +++++++-------- .../src/main/res/layout/hierarchy_layout.xml | 136 ++++++----- .../res/layout/instance_uploader_list.xml | 143 ++++++----- .../src/main/res/layout/list_view_filled.xml | 30 +-- collect_app/src/main/res/layout/main_menu.xml | 21 +- .../src/main/res/layout/splash_screen.xml | 129 +++++----- collect_app/src/main/res/layout/two_item.xml | 114 ++++----- .../src/main/res/layout/two_item_image.xml | 95 ++++---- .../res/layout/two_item_multiple_choice.xml | 25 +- collect_app/src/main/res/values-v11/theme.xml | 15 +- collect_app/src/main/res/values/arrays.xml | 222 +++++++++--------- collect_app/src/main/res/values/strings.xml | 18 +- collect_app/src/main/res/values/theme.xml | 15 +- .../src/main/res/values/untranslated.xml | 30 +-- .../src/main/res/xml/google_preferences.xml | 12 +- collect_app/src/main/res/xml/preferences.xml | 37 +-- 39 files changed, 972 insertions(+), 918 deletions(-) diff --git a/collect_app/config/checkstyle/checkstyle.xml b/collect_app/config/checkstyle/checkstyle.xml index 08344b28709..c8eaeb53225 100644 --- a/collect_app/config/checkstyle/checkstyle.xml +++ b/collect_app/config/checkstyle/checkstyle.xml @@ -1,7 +1,6 @@ - - + - - + + - + - + + + - + - - + + @@ -44,14 +43,14 @@ --> - + - + @@ -74,8 +73,8 @@ --> - - + + diff --git a/collect_app/src/main/AndroidManifest.xml b/collect_app/src/main/AndroidManifest.xml index 8451efe2941..62ef860d17d 100644 --- a/collect_app/src/main/AndroidManifest.xml +++ b/collect_app/src/main/AndroidManifest.xml @@ -1,25 +1,32 @@ - - + package="org.odk.collect.android"> - - - - - - + + + + + @@ -37,57 +44,56 @@ + android:required="true" /> + android:name="org.odk.collect.android.permission.MAPS_RECEIVE" + android:protectionLevel="signature" /> + + android:smallScreens="true" + android:xlargeScreens="true" /> + android:largeHeap="true" + android:supportsRtl="true" + android:theme="@style/Collect"> + android:authorities="org.odk.collect.android.provider.odk.forms" + android:exported="true" /> + android:authorities="org.odk.collect.android.provider.odk.instances" + android:exported="true" /> - + android:label="@string/app_name"> + android:windowSoftInputMode="adjustResize"> @@ -98,13 +104,12 @@ - + android:taskAffinity="" /> @@ -113,10 +118,9 @@ android:label="@string/all_open_source_licenses" /> + android:label="@string/app_name" + android:windowSoftInputMode="stateHidden" /> @@ -132,7 +136,7 @@ + android:label="@string/app_name"> @@ -158,12 +162,12 @@ android:name=".activities.InstanceUploaderList" android:configChanges="orientation|screenSize" android:label="@string/app_name"> - - - + + + - - + + - - - + + + android:theme="@android:style/Theme.Dialog"> @@ -240,7 +245,7 @@ + android:theme="@android:style/Theme.Translucent.NoTitleBar"> @@ -249,7 +254,7 @@ + android:enabled="true"> @@ -259,30 +264,32 @@ - - + android:exported="false" /> + android:name="com.google.android.geo.API_KEY" + android:value="AIzaSyBS-JQ-dnaZ_8qsbvSyr_I3rTPFd5fJsYI" /> + android:value="@integer/google_play_services_version" + tools:replace="android:value" /> - + diff --git a/collect_app/src/main/java/org/odk/collect/android/activities/AppListActivity.java b/collect_app/src/main/java/org/odk/collect/android/activities/AppListActivity.java index 2e4a8dcdfbe..6229b604219 100644 --- a/collect_app/src/main/java/org/odk/collect/android/activities/AppListActivity.java +++ b/collect_app/src/main/java/org/odk/collect/android/activities/AppListActivity.java @@ -322,7 +322,7 @@ public static void toggleButtonLabel(Button mToggleButton, ListView lv) { mToggleButton.setText(R.string.clear_all); } } - + @Override public void onBackPressed() { if (mDrawerLayout.isDrawerOpen(Gravity.END)) { diff --git a/collect_app/src/main/java/org/odk/collect/android/activities/GeoPointMapActivity.java b/collect_app/src/main/java/org/odk/collect/android/activities/GeoPointMapActivity.java index 823ff16c7b6..80f0c13cc47 100644 --- a/collect_app/src/main/java/org/odk/collect/android/activities/GeoPointMapActivity.java +++ b/collect_app/src/main/java/org/odk/collect/android/activities/GeoPointMapActivity.java @@ -88,7 +88,7 @@ public class GeoPointMapActivity extends FragmentActivity implements LocationLis private int mLocationCount = 0; private MapHelper mHelper; -// private KmlLayer kk; +//private KmlLayer kk; private AlertDialog zoomDialog; private View zoomDialogView; @@ -335,8 +335,7 @@ public void onClick(View v) { } } - - /*Zoom only if there's a previous location*/ + /*Zoom only if there's a previous location*/ if (mLatLng != null) { mlocationInfo.setVisibility(View.GONE); mLocationStatus.setVisibility(View.GONE); @@ -373,7 +372,7 @@ private void upMyLocationOverlayLayers() { this); } } -// mShowLocation.setClickable(mMarker != null); +//mShowLocation.setClickable(mMarker != null); if (!mGPSOn && !mNetworkOn) { showGPSDisabledAlertToUser(); } else { @@ -410,7 +409,7 @@ public void onLocationChanged(Location location) { mReloadLocation.setEnabled(true); } if (!foundFirstLocation) { -// zoomToPoint(); + //zoomToPoint(); showZoomDialog(); foundFirstLocation = true; } diff --git a/collect_app/src/main/java/org/odk/collect/android/activities/GeoPointOsmMapActivity.java b/collect_app/src/main/java/org/odk/collect/android/activities/GeoPointOsmMapActivity.java index 4857924fe91..a2e27142c49 100644 --- a/collect_app/src/main/java/org/odk/collect/android/activities/GeoPointOsmMapActivity.java +++ b/collect_app/src/main/java/org/odk/collect/android/activities/GeoPointOsmMapActivity.java @@ -56,8 +56,7 @@ */ public class GeoPointOsmMapActivity extends FragmentActivity implements LocationListener, Marker.OnMarkerDragListener, MapEventsReceiver, IRegisterReceiver { - - private static final String LOCATION_COUNT = "locationCount"; + private static final String LOCATION_COUNT = "locationCount"; //private GoogleMap mMap; private MapView mMap; @@ -232,7 +231,7 @@ public void onClick(View v) { mMarker.remove(mMap); if (mLocation != null) { mReloadLocationButton.setEnabled(true); -// mLocationStatus.setVisibility(View.VISIBLE); + //mLocationStatus.setVisibility(View.VISIBLE); } mLocationStatus.setVisibility(View.VISIBLE); mMap.getOverlays().remove(mMarker); @@ -447,16 +446,16 @@ public void onLocationChanged(Location location) { } -// if (mLocation.getLatitude() != mMarker.getPosition().getLatitude() & mLocation -// .getLongitude() != mMarker.getPosition().getLongitude()) { -// mReloadLocationButton.setEnabled(true); -// } -// -// //If location is accurate enough, stop updating position and make the marker -// draggable -// if (mLocation.getAccuracy() <= mLocationAccuracy) { -// stopGeolocating(); -// } + //if (mLocation.getLatitude() != mMarker.getPosition().getLatitude() & mLocation + // .getLongitude() != mMarker.getPosition().getLongitude()) { + //mReloadLocationButton.setEnabled(true); + //} + // + //If location is accurate enough, stop updating position and make the marker + // draggable + //if (mLocation.getAccuracy() <= mLocationAccuracy) { + //stopGeolocating(); + //} } else { InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis() + @@ -487,7 +486,7 @@ public void onMarkerDragEnd(Marker marker) { @Override public void onMarkerDragStart(Marker arg0) { -// stopGeolocating(); + //stopGeolocating(); } diff --git a/collect_app/src/main/java/org/odk/collect/android/activities/GeoTraceGoogleMapActivity.java b/collect_app/src/main/java/org/odk/collect/android/activities/GeoTraceGoogleMapActivity.java index a102061e3dd..9dc25722e47 100644 --- a/collect_app/src/main/java/org/odk/collect/android/activities/GeoTraceGoogleMapActivity.java +++ b/collect_app/src/main/java/org/odk/collect/android/activities/GeoTraceGoogleMapActivity.java @@ -581,9 +581,9 @@ private void createPolygon() { update_polyline(); } - /* +/* This functions handels the delay and the Runable for - */ +*/ public void setGeoTraceScheuler(long delay, TimeUnit units) { schedulerHandler = scheduler.scheduleAtFixedRate(new Runnable() { diff --git a/collect_app/src/main/java/org/odk/collect/android/activities/GeoTraceOsmMapActivity.java b/collect_app/src/main/java/org/odk/collect/android/activities/GeoTraceOsmMapActivity.java index 5b9d65828f2..3e995f0a7e6 100644 --- a/collect_app/src/main/java/org/odk/collect/android/activities/GeoTraceOsmMapActivity.java +++ b/collect_app/src/main/java/org/odk/collect/android/activities/GeoTraceOsmMapActivity.java @@ -448,10 +448,10 @@ private void overlayMapLayerListner() { } private void overlayMyLocationLayers() { -// mMyLocationOverlay.runOnFirstFix(centerAroundFix); -// if(mMyLocationOverlay.getMyLocation()!= null){ -// mMyLocationOverlay.runOnFirstFix(centerAroundFix); -// } + //mMyLocationOverlay.runOnFirstFix(centerAroundFix); + //if(mMyLocationOverlay.getMyLocation()!= null){ + //mMyLocationOverlay.runOnFirstFix(centerAroundFix); + //} mapView.getOverlays().add(mMyLocationOverlay); mMyLocationOverlay.setEnabled(true); mMyLocationOverlay.enableMyLocation(); diff --git a/collect_app/src/main/java/org/odk/collect/android/activities/MainMenuActivity.java b/collect_app/src/main/java/org/odk/collect/android/activities/MainMenuActivity.java index 1312f1678d6..fba4c2c7c66 100644 --- a/collect_app/src/main/java/org/odk/collect/android/activities/MainMenuActivity.java +++ b/collect_app/src/main/java/org/odk/collect/android/activities/MainMenuActivity.java @@ -261,7 +261,7 @@ public void onClick(View v) { mCompletedCount = mFinalizedCursor != null ? mFinalizedCursor.getCount() : 0; getContentResolver().registerContentObserver(InstanceColumns.CONTENT_URI, true, mContentObserver); -// mFinalizedCursor.registerContentObserver(mContentObserver); +// mFinalizedCursor.registerContentObserver(mContentObserver); // count for saved instances try { diff --git a/collect_app/src/main/java/org/odk/collect/android/utilities/EncryptionUtils.java b/collect_app/src/main/java/org/odk/collect/android/utilities/EncryptionUtils.java index d58a6a60ede..e6c378d5cab 100644 --- a/collect_app/src/main/java/org/odk/collect/android/utilities/EncryptionUtils.java +++ b/collect_app/src/main/java/org/odk/collect/android/utilities/EncryptionUtils.java @@ -184,16 +184,16 @@ public void appendFileSignatureSource(File file) { public String getBase64EncryptedElementSignature() { // Step 0: construct the text of the elements in elementSignatureSource (done) - // Where... + // Where... // * Elements are separated by newline characters. // * Filename is the unencrypted filename (no .enc suffix). // * Md5 hashes of the unencrypted files' contents are converted // to zero-padded 32-character strings before concatenation. // Assumes this is in the order: - // formId - // version (omitted if null) - // base64RsaEncryptedSymmetricKey - // instanceId + // formId + // version (omitted if null) + // base64RsaEncryptedSymmetricKey + // instanceId // for each media file { filename "::" md5Hash } // submission.xml "::" md5Hash diff --git a/collect_app/src/main/java/org/odk/collect/android/utilities/WebUtils.java b/collect_app/src/main/java/org/odk/collect/android/utilities/WebUtils.java index fed3d638b0c..ea291f46c56 100644 --- a/collect_app/src/main/java/org/odk/collect/android/utilities/WebUtils.java +++ b/collect_app/src/main/java/org/odk/collect/android/utilities/WebUtils.java @@ -224,12 +224,12 @@ public static final void setGoogleHeaders(HttpRequest req) { Collect.getInstance().getString(R.string.protocol_odk_default)); // TODO: this doesn't exist.... -// if ( protocol.equals(PreferencesActivity.PROTOCOL_GOOGLE) ) { -// String auth = settings.getString(PreferencesActivity.KEY_AUTH, ""); -// if ((auth != null) && (auth.length() > 0)) { -// req.setHeader("Authorization", "GoogleLogin auth=" + auth); -// } -// } + //if ( protocol.equals(PreferencesActivity.PROTOCOL_GOOGLE) ) { + //String auth = settings.getString(PreferencesActivity.KEY_AUTH, ""); + //if ((auth != null) && (auth.length() > 0)) { + //req.setHeader("Authorization", "GoogleLogin auth=" + auth); + //} + //} } public static final HttpPost createOpenRosaHttpPost(Uri u) { diff --git a/collect_app/src/main/java/org/odk/collect/android/widgets/ExStringWidget.java b/collect_app/src/main/java/org/odk/collect/android/widgets/ExStringWidget.java index 5caa8b07011..3a9e218eb44 100644 --- a/collect_app/src/main/java/org/odk/collect/android/widgets/ExStringWidget.java +++ b/collect_app/src/main/java/org/odk/collect/android/widgets/ExStringWidget.java @@ -244,16 +244,16 @@ public void setFocus(Context context) { if (!mPrompt.isReadOnly()) { mAnswer.requestFocus(); inputManager.showSoftInput(mAnswer, 0); - /* - * If you do a multi-question screen after a "add another group" dialog, this won't - * automatically pop up. It's an Android issue. - * - * That is, if I have an edit text in an activity, and pop a dialog, and in that - * dialog's button's OnClick() I call edittext.requestFocus() and - * showSoftInput(edittext, 0), showSoftinput() returns false. However, if the - * edittext - * is focused before the dialog pops up, everything works fine. great. - */ + /* + * If you do a multi-question screen after a "add another group" dialog, this won't + * automatically pop up. It's an Android issue. + * + * That is, if I have an edit text in an activity, and pop a dialog, and in that + * dialog's button's OnClick() I call edittext.requestFocus() and + * showSoftInput(edittext, 0), showSoftinput() returns false. However, if the + * edittext + * is focused before the dialog pops up, everything works fine. great. + */ } else { inputManager.hideSoftInputFromWindow(mAnswer.getWindowToken(), 0); } diff --git a/collect_app/src/main/java/org/odk/collect/android/widgets/OSMWidget.java b/collect_app/src/main/java/org/odk/collect/android/widgets/OSMWidget.java index 7f75198f391..915673907ea 100644 --- a/collect_app/src/main/java/org/odk/collect/android/widgets/OSMWidget.java +++ b/collect_app/src/main/java/org/odk/collect/android/widgets/OSMWidget.java @@ -206,10 +206,9 @@ private void launchOpenMapKit() { builder.setTitle(R.string.alert); builder.setMessage(R.string.install_openmapkit); DialogInterface.OnClickListener okClickListener = new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { + public void onClick(DialogInterface dialog, int id) { //TODO: launch to app store? } - }; builder.setPositiveButton("Ok", okClickListener); diff --git a/collect_app/src/main/res/anim/fade_in.xml b/collect_app/src/main/res/anim/fade_in.xml index f07a3c8070f..5a8bfc1439c 100644 --- a/collect_app/src/main/res/anim/fade_in.xml +++ b/collect_app/src/main/res/anim/fade_in.xml @@ -1,5 +1,4 @@ - - - + diff --git a/collect_app/src/main/res/anim/fade_out.xml b/collect_app/src/main/res/anim/fade_out.xml index 96c176abeb7..c078c1e2b85 100644 --- a/collect_app/src/main/res/anim/fade_out.xml +++ b/collect_app/src/main/res/anim/fade_out.xml @@ -1,5 +1,4 @@ - - - + diff --git a/collect_app/src/main/res/anim/push_left_in.xml b/collect_app/src/main/res/anim/push_left_in.xml index 41232782ab3..135d26d69d4 100644 --- a/collect_app/src/main/res/anim/push_left_in.xml +++ b/collect_app/src/main/res/anim/push_left_in.xml @@ -1,5 +1,4 @@ - - - - + + diff --git a/collect_app/src/main/res/anim/push_left_out.xml b/collect_app/src/main/res/anim/push_left_out.xml index d004486b2b0..2f7f013a195 100644 --- a/collect_app/src/main/res/anim/push_left_out.xml +++ b/collect_app/src/main/res/anim/push_left_out.xml @@ -14,6 +14,12 @@ License for the specific language governing permissions and limitations under the License. --> - - + + diff --git a/collect_app/src/main/res/anim/push_right_in.xml b/collect_app/src/main/res/anim/push_right_in.xml index 5aa21f6cad8..5340e24b4f9 100644 --- a/collect_app/src/main/res/anim/push_right_in.xml +++ b/collect_app/src/main/res/anim/push_right_in.xml @@ -14,6 +14,12 @@ License for the specific language governing permissions and limitations under the License. --> - - + + diff --git a/collect_app/src/main/res/anim/push_right_out.xml b/collect_app/src/main/res/anim/push_right_out.xml index b1823563196..189ee8159ac 100644 --- a/collect_app/src/main/res/anim/push_right_out.xml +++ b/collect_app/src/main/res/anim/push_right_out.xml @@ -14,6 +14,12 @@ License for the specific language governing permissions and limitations under the License. --> - - + + diff --git a/collect_app/src/main/res/anim/start_arrow.xml b/collect_app/src/main/res/anim/start_arrow.xml index 89eeca02528..d7fbc08b46a 100644 --- a/collect_app/src/main/res/anim/start_arrow.xml +++ b/collect_app/src/main/res/anim/start_arrow.xml @@ -1,5 +1,4 @@ - - - - + + diff --git a/collect_app/src/main/res/drawable/thumb.xml b/collect_app/src/main/res/drawable/thumb.xml index 1662c15bd44..d348a1ddc68 100644 --- a/collect_app/src/main/res/drawable/thumb.xml +++ b/collect_app/src/main/res/drawable/thumb.xml @@ -1,5 +1,8 @@ - - - - + + + + \ No newline at end of file diff --git a/collect_app/src/main/res/layout/chooser_list_layout.xml b/collect_app/src/main/res/layout/chooser_list_layout.xml index c08318df158..00cab3e8fc5 100644 --- a/collect_app/src/main/res/layout/chooser_list_layout.xml +++ b/collect_app/src/main/res/layout/chooser_list_layout.xml @@ -14,58 +14,57 @@ License for the specific language governing permissions and limitations under the License. --> - + - + - + - + - + - - + + - - + + \ No newline at end of file diff --git a/collect_app/src/main/res/layout/form_entry_end.xml b/collect_app/src/main/res/layout/form_entry_end.xml index 4359ed1749b..8b8cdd7d13c 100644 --- a/collect_app/src/main/res/layout/form_entry_end.xml +++ b/collect_app/src/main/res/layout/form_entry_end.xml @@ -1,25 +1,25 @@ + android:orientation="vertical"> + android:padding="10dp"> - - + - - - - + - - - - - - - - - - + -