diff --git a/android/src/com/google/zxing/client/android/result/WifiResultHandler.java b/android/src/com/google/zxing/client/android/result/WifiResultHandler.java index 1cc2b5d51..2ef26c26f 100644 --- a/android/src/com/google/zxing/client/android/result/WifiResultHandler.java +++ b/android/src/com/google/zxing/client/android/result/WifiResultHandler.java @@ -28,10 +28,9 @@ import com.google.zxing.client.result.WifiParsedResult; * @author viki@google.com (Vikram Aggarwal) */ public final class WifiResultHandler extends ResultHandler { - Activity parentActivity = null; + public WifiResultHandler(Activity activity, ParsedResult result) { super(activity, result); - parentActivity = activity; } @Override @@ -42,24 +41,18 @@ public final class WifiResultHandler extends ResultHandler { @Override public int getButtonText(int index) { - switch (index) { - case 0: + if (index == 0) { return R.string.button_wifi; - default: - throw new ArrayIndexOutOfBoundsException(); } + throw new ArrayIndexOutOfBoundsException(); } @Override public void handleButtonPress(int index) { // Get the underlying wifi config WifiParsedResult wifiResult = (WifiParsedResult) getResult(); - switch (index) { - case 0: + if (index == 0) { wifiConnect(wifiResult); - break; - default: - break; } } diff --git a/android/src/com/google/zxing/client/android/wifi/ConnectedReceiver.java b/android/src/com/google/zxing/client/android/wifi/ConnectedReceiver.java index 40ce99c3b..c42852b9b 100644 --- a/android/src/com/google/zxing/client/android/wifi/ConnectedReceiver.java +++ b/android/src/com/google/zxing/client/android/wifi/ConnectedReceiver.java @@ -1,10 +1,22 @@ +/* + * Copyright (C) 2010 ZXing authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.google.zxing.client.android.wifi; -import com.google.zxing.client.android.R; - import android.app.Activity; -import android.app.AlertDialog; -import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; diff --git a/android/src/com/google/zxing/client/android/wifi/WifiActivity.java b/android/src/com/google/zxing/client/android/wifi/WifiActivity.java index b86fed0a9..948aa4579 100644 --- a/android/src/com/google/zxing/client/android/wifi/WifiActivity.java +++ b/android/src/com/google/zxing/client/android/wifi/WifiActivity.java @@ -19,12 +19,9 @@ package com.google.zxing.client.android.wifi; import java.util.List; import android.app.Activity; -import android.app.AlertDialog; -import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.IntentFilter; import android.net.ConnectivityManager; -import android.net.Uri; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; import android.os.Bundle;