Skip to content
This repository has been archived by the owner on Feb 14, 2019. It is now read-only.

Commit

Permalink
Merge pull request #32 from spark/lint_fix
Browse files Browse the repository at this point in the history
fixing lint issues
  • Loading branch information
jensck authored Feb 9, 2017
2 parents b73933e + 623c4b2 commit 1511b86
Show file tree
Hide file tree
Showing 17 changed files with 114 additions and 59 deletions.
6 changes: 3 additions & 3 deletions devicesetup/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ dependencies {
compile 'com.squareup.phrase:phrase:1.0.3'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'

compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:support-annotations:25.1.0'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:recyclerview-v7:25.1.1'
compile 'com.android.support:support-annotations:25.1.1'

retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:2.3.0'

Expand Down
41 changes: 22 additions & 19 deletions devicesetup/devicesetup.iml
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
Expand All @@ -83,6 +75,15 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/docs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
Expand All @@ -96,29 +97,31 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="okio-1.9.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.7.5" level="project" />
<orderEntry type="library" exported="" name="support-annotations-25.1.0" level="project" />
<orderEntry type="library" exported="" name="jsr305-3.0.1" level="project" />
<orderEntry type="library" exported="" name="cloudsdk-0.4.0" level="project" />
<orderEntry type="library" exported="" name="gson-2.7" level="project" />
<orderEntry type="library" exported="" name="retrofit-1.9.0" level="project" />
<orderEntry type="library" exported="" name="support-fragment-25.1.0" level="project" />
<orderEntry type="library" exported="" name="support-compat-25.1.0" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-25.1.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-25.1.0" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-25.1.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-25.1.1" level="project" />
<orderEntry type="library" exported="" name="support-compat-25.1.1" level="project" />
<orderEntry type="library" exported="" name="phrase-1.0.3" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-25.1.1" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-25.1.1" level="project" />
<orderEntry type="library" exported="" name="calligraphy-2.2.0" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-25.1.0" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-25.1.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-25.1.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-25.1.0" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-25.1.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-25.1.1" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-25.1.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-25.1.1" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-25.1.1" level="project" />
<orderEntry type="library" exported="" name="support-fragment-25.1.1" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-25.1.1" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-25.1.1" level="project" />
</component>
</module>
9 changes: 9 additions & 0 deletions devicesetup/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="IconMissingDensityFolder" severity="ignore"/>
<issue id="UnusedResources" severity="ignore"/>
<issue id="IconLocation" severity="ignore"/>
<issue id="IconDensities" severity="ignore"/>
<issue id="InvalidPackage" severity="ignore"/>
<issue id="RtlEnabled" severity="ignore"/>
</lint>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.net.wifi.WifiManager;

import java.util.List;
import java.util.Locale;
import java.util.Set;

import io.particle.android.sdk.devicesetup.R;
Expand Down Expand Up @@ -93,8 +94,8 @@ public Set<ScanResultNetwork> loadInBackground() {
if (input == null || !truthy(input.SSID)) {
return false;
}
String softApPrefix = (getContext().getString(R.string.network_name_prefix) + "-").toLowerCase();
return input.SSID.toLowerCase().startsWith(softApPrefix);
String softApPrefix = (getContext().getString(R.string.network_name_prefix) + "-").toLowerCase(Locale.ROOT);
return input.SSID.toLowerCase(Locale.ROOT).startsWith(softApPrefix);
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.io.IOException;
import java.security.PublicKey;
import java.util.Locale;
import java.util.Set;

import io.particle.android.sdk.accountsetup.LoginActivity;
Expand Down Expand Up @@ -397,7 +398,7 @@ public void doTheThing() throws SetupStepException {
try {
DeviceIdCommand.Response response = client.sendCommand(
new DeviceIdCommand(), DeviceIdCommand.Response.class);
detectedDeviceID = response.deviceIdHex.toLowerCase();
detectedDeviceID = response.deviceIdHex.toLowerCase(Locale.ROOT);
DeviceSetupState.deviceToBeSetUpId = detectedDeviceID;
isDetectedDeviceClaimed = truthy(response.isClaimed);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.security.PublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
import java.util.Locale;

import javax.annotation.ParametersAreNonnullByDefault;
import javax.crypto.BadPaddingException;
Expand Down Expand Up @@ -48,13 +49,14 @@ public static String encryptAndEncodeToHex(String inputString, PublicKey publicK
String hex = ByteString.of(encryptedBytes).hex();
// forcing lowercase here because of a bug in the early firmware that didn't accept
// hex encoding in uppercase
return hex.toLowerCase();
return hex.toLowerCase(Locale.ROOT);
}

@SuppressLint("TrulyRandom")
static byte[] encryptWithKey(byte[] inputData, PublicKey publicKey) throws CryptoException {
try {
@SuppressLint("GetInstance") // the warning doesn't apply to how we're using this
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
return cipher.doFinal(inputData);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.os.Parcelable;
import android.support.annotation.NonNull;

import java.util.Locale;


/**
* Simple value wrapper for SSID strings. Eliminates case comparison issues and the quoting
Expand Down Expand Up @@ -59,7 +61,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return ssidString.toLowerCase().hashCode();
return ssidString.toLowerCase(Locale.ROOT).hashCode();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ private void saveWithKey(String key, Set<SSID> ssids) {
Set<String> asStrings = transformSet(ssids, SSID::toString);
prefs.edit()
.putStringSet(key, asStrings)
.commit();
.apply();
}
}
5 changes: 5 additions & 0 deletions devicesetup/src/main/res/layout/activity_connecting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="left|center_vertical"
android:contentDescription="@null"
android:src="@drawable/checkmark"
android:visibility="gone"/>

Expand Down Expand Up @@ -136,6 +137,7 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="left|center_vertical"
android:contentDescription="@null"
android:src="@drawable/checkmark"
android:visibility="gone"
tools:ignore="DuplicateIds"/>
Expand Down Expand Up @@ -174,6 +176,7 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="left|center_vertical"
android:contentDescription="@null"
android:src="@drawable/checkmark"
android:visibility="gone"
tools:ignore="DuplicateIds"/>
Expand Down Expand Up @@ -212,6 +215,7 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="left|center_vertical"
android:contentDescription="@null"
android:src="@drawable/checkmark"
android:visibility="gone"
tools:ignore="DuplicateIds"/>
Expand Down Expand Up @@ -250,6 +254,7 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="left|center_vertical"
android:contentDescription="@null"
android:src="@drawable/checkmark"
android:visibility="gone"
tools:ignore="DuplicateIds"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
android:layout_height="96dp"
android:layout_marginBottom="4dp"
android:layout_marginTop="8dp"
android:contentDescription="@null"
android:src="@drawable/device_image_small"/>

<TextView
Expand Down
8 changes: 4 additions & 4 deletions devicesetup/src/main/res/layout/activity_password_entry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@
android:id="@+id/ssid"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_gravity="start"
android:layout_weight="1"
android:ellipsize="middle"
android:singleLine="true"
android:text="(ssid)"
android:textSize="@dimen/text_size_small"
tools:ignore="HardcodedText"/>
tools:ignore="HardcodedText,Deprecated"/>

<TextView
android:id="@+id/security_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:gravity="end"
android:singleLine="true"
android:text="Unsecured network"
android:textSize="@dimen/text_size_small"
tools:ignore="HardcodedText,MissingPrefix"/>
tools:ignore="HardcodedText,MissingPrefix,Deprecated"/>

</LinearLayout>

Expand Down
7 changes: 5 additions & 2 deletions devicesetup/src/main/res/layout/brand_image_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
<ImageView
android:id="@+id/brand_image_header"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="left|top"
android:layout_gravity="start|top"
android:background="@color/shaded_background"
android:contentDescription="@null"
android:padding="12dp"
android:scaleType="fitStart"
android:src="@drawable/brand_image_horizontal"/>
android:src="@drawable/brand_image_horizontal"
tools:ignore="Overdraw"/>
13 changes: 11 additions & 2 deletions devicesetup/src/main/res/layout/row_wifi_scan_result.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingEnd="0dp"
android:paddingLeft="8dp"
android:paddingRight="0dp"
android:paddingStart="8dp"
android:text="[SSID will go here]"
android:textSize="@dimen/text_size_medium"
tools:ignore="HardcodedText"/>
Expand All @@ -22,17 +25,23 @@
android:id="@+id/wifi_security_indicator_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="right|center_vertical"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="1dp"
android:contentDescription="@null"
android:src="@drawable/lock"/>

<ImageView
android:id="@+id/the_wifi"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="right|center_vertical"
android:layout_gravity="end|center_vertical"
android:contentDescription="@null"
android:paddingEnd="8dp"
android:paddingLeft="0dp"
android:paddingRight="8dp"
android:paddingStart="0dp"
android:src="@drawable/the_wifi"/>

</LinearLayout>
10 changes: 8 additions & 2 deletions devicesetup/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@
<item name="android:textAppearanceSmallPopupMenu">@style/PopupMenuText</item>
</style>

<style name="PopupMenu" parent="Widget.AppCompat.Light.PopupMenu.Overflow">
<style name="PopupMenuParent">
<item name="overlapAnchor">true</item>
<item name="android:dropDownHorizontalOffset">-4dip</item>
</style>

<style name="PopupMenu" parent="PopupMenuParent">
<item name="android:dropDownSelector">@drawable/abc_list_selector_holo_dark</item>
<!--<item name="android:popupBackground">@drawable/abc_popup_background_mtrl_mult</item>-->
<item name="android:popupBackground">@android:color/white</item>
Expand All @@ -45,7 +50,8 @@
<!-- only applies to API 19 + 21, but we still need this here as a placeholder. -->
</style>

<style name="ParticleSetupTheme_DialogNoDimBackground" parent="@android:style/Theme.Holo.Dialog">
<style name="ParticleSetupTheme_DialogNoDimBackground"
parent="@android:style/Theme.Holo.Dialog">
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFrame">@null</item>
Expand Down
2 changes: 1 addition & 1 deletion exampleapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies {
// UNCOMMENT THE FOLLOWING TO USE A PUBLISHED VERSION OF THE SDK:
// compile 'io.particle:devicesetup:0.2.0'

compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:appcompat-v7:25.1.1'
retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:2.3.0'
}

Expand Down
Loading

0 comments on commit 1511b86

Please sign in to comment.