* @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
@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;
}
}
-package com.google.zxing.client.android.wifi;
+/*
+ * 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.
+ */
-import com.google.zxing.client.android.R;
+package com.google.zxing.client.android.wifi;
import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
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;