Merge commit '377c7c9' into merge2
This commit is contained in:
@@ -67,30 +67,6 @@
|
|||||||
android:prompt="@string/wifi_security"
|
android:prompt="@string/wifi_security"
|
||||||
android:entries="@array/wifi_ap_security" />
|
android:entries="@array/wifi_ap_security" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/wifi_item_label"
|
|
||||||
android:layout_marginTop="8dip"
|
|
||||||
android:text="@string/wifi_ap_band_config" />
|
|
||||||
|
|
||||||
<RadioGroup android:id = "@+id/choose_channel"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<RadioButton android:id="@+id/ap_2G_band"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/wifi_ap_choose_2G"
|
|
||||||
android:layout_marginTop="8dip"/>
|
|
||||||
|
|
||||||
<RadioButton android:id="@+id/ap_5G_band"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/wifi_ap_choose_5G"
|
|
||||||
android:layout_marginTop="8dip"/>
|
|
||||||
</RadioGroup>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/fields"
|
<LinearLayout android:id="@+id/fields"
|
||||||
@@ -130,5 +106,26 @@
|
|||||||
style="@style/wifi_item_content"
|
style="@style/wifi_item_content"
|
||||||
android:text="@string/wifi_show_password" />
|
android:text="@string/wifi_show_password" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/fields"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/wifi_item"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/wifi_item_label"
|
||||||
|
android:layout_marginTop="8dip"
|
||||||
|
android:text="@string/wifi_ap_band_config" />
|
||||||
|
|
||||||
|
<Spinner android:id="@+id/choose_channel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/wifi_item_content"
|
||||||
|
android:prompt="@string/wifi_ap_band_config" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@@ -324,6 +324,17 @@
|
|||||||
<item>AKA\'</item>
|
<item>AKA\'</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Wi-Fi AP band settings. Either 2.4GHz or 5GHz. -->
|
||||||
|
<!-- Note that adding/removing/moving the items will need wifi settings code change. -->
|
||||||
|
<string-array name="wifi_ap_band_config_full">
|
||||||
|
<item>@string/wifi_ap_choose_2G</item>
|
||||||
|
<item>@string/wifi_ap_choose_5G</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="wifi_ap_band_config_2G_only">
|
||||||
|
<item>@string/wifi_ap_choose_2G</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<!-- Wi-Fi WPS setup for p2p connections. -->
|
<!-- Wi-Fi WPS setup for p2p connections. -->
|
||||||
<!-- Note that adding/removing/moving the items will need wifi settings code change. -->
|
<!-- Note that adding/removing/moving the items will need wifi settings code change. -->
|
||||||
<string-array name="wifi_p2p_wps_setup">
|
<string-array name="wifi_p2p_wps_setup">
|
||||||
|
@@ -178,10 +178,9 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
boolean wfcEnabled = ImsManager.isWfcEnabledByUser(context)
|
boolean wfcEnabled = ImsManager.isWfcEnabledByUser(context)
|
||||||
&& ImsManager.isNonTtyOrTtyOnVolteEnabled(context);
|
&& ImsManager.isNonTtyOrTtyOnVolteEnabled(context);
|
||||||
mSwitch.setChecked(wfcEnabled);
|
mSwitch.setChecked(wfcEnabled);
|
||||||
|
|
||||||
int wfcMode = ImsManager.getWfcMode(context);
|
int wfcMode = ImsManager.getWfcMode(context);
|
||||||
mButtonWfcMode.setValue(Integer.toString(wfcMode));
|
mButtonWfcMode.setValue(Integer.toString(wfcMode));
|
||||||
mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode));
|
updateButtonWfcMode(context, wfcEnabled, wfcMode);
|
||||||
|
|
||||||
context.registerReceiver(mIntentReceiver, mIntentFilter);
|
context.registerReceiver(mIntentReceiver, mIntentFilter);
|
||||||
|
|
||||||
@@ -217,11 +216,15 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
ImsManager.setWfcSetting(context, isChecked);
|
ImsManager.setWfcSetting(context, isChecked);
|
||||||
|
|
||||||
int wfcMode = ImsManager.getWfcMode(context);
|
int wfcMode = ImsManager.getWfcMode(context);
|
||||||
|
updateButtonWfcMode(context, isChecked, wfcMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateButtonWfcMode(Context context, boolean wfcEnabled, int wfcMode) {
|
||||||
mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode));
|
mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode));
|
||||||
mButtonWfcMode.setEnabled(isChecked);
|
mButtonWfcMode.setEnabled(wfcEnabled);
|
||||||
|
|
||||||
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
||||||
if (isChecked) {
|
if (wfcEnabled) {
|
||||||
preferenceScreen.addPreference(mButtonWfcMode);
|
preferenceScreen.addPreference(mButtonWfcMode);
|
||||||
} else {
|
} else {
|
||||||
preferenceScreen.removePreference(mButtonWfcMode);
|
preferenceScreen.removePreference(mButtonWfcMode);
|
||||||
|
@@ -29,12 +29,11 @@ import android.text.InputType;
|
|||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.RadioGroup;
|
|
||||||
import android.widget.RadioButton;
|
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
|
||||||
@@ -58,12 +57,11 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,
|
|||||||
private TextView mSsid;
|
private TextView mSsid;
|
||||||
private int mSecurityTypeIndex = OPEN_INDEX;
|
private int mSecurityTypeIndex = OPEN_INDEX;
|
||||||
private EditText mPassword;
|
private EditText mPassword;
|
||||||
private RadioGroup mChannel;
|
private int mBandIndex = OPEN_INDEX;
|
||||||
private RadioButton mChannel2G;
|
|
||||||
private RadioButton mChannel5G;
|
|
||||||
|
|
||||||
WifiConfiguration mWifiConfig;
|
WifiConfiguration mWifiConfig;
|
||||||
WifiManager mWifiManager;
|
WifiManager mWifiManager;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
private static final String TAG = "WifiApDialog";
|
private static final String TAG = "WifiApDialog";
|
||||||
|
|
||||||
@@ -76,6 +74,7 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,
|
|||||||
mSecurityTypeIndex = getSecurityTypeIndex(wifiConfig);
|
mSecurityTypeIndex = getSecurityTypeIndex(wifiConfig);
|
||||||
}
|
}
|
||||||
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||||
|
mContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSecurityTypeIndex(WifiConfiguration wifiConfig) {
|
public static int getSecurityTypeIndex(WifiConfiguration wifiConfig) {
|
||||||
@@ -97,15 +96,7 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,
|
|||||||
*/
|
*/
|
||||||
config.SSID = mSsid.getText().toString();
|
config.SSID = mSsid.getText().toString();
|
||||||
|
|
||||||
//obtain the band configure
|
config.apBand = mBandIndex;
|
||||||
if (mChannel2G.isChecked()) {
|
|
||||||
config.apBand = 0;
|
|
||||||
} else if(mChannel5G.isChecked()) {
|
|
||||||
config.apBand = 1;
|
|
||||||
} else {
|
|
||||||
Log.e("TAG", "AP band configure error!");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (mSecurityTypeIndex) {
|
switch (mSecurityTypeIndex) {
|
||||||
case OPEN_INDEX:
|
case OPEN_INDEX:
|
||||||
@@ -126,9 +117,10 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
boolean mInit = true;
|
||||||
mView = getLayoutInflater().inflate(R.layout.wifi_ap_dialog, null);
|
mView = getLayoutInflater().inflate(R.layout.wifi_ap_dialog, null);
|
||||||
Spinner mSecurity = ((Spinner) mView.findViewById(R.id.security));
|
Spinner mSecurity = ((Spinner) mView.findViewById(R.id.security));
|
||||||
|
final Spinner mChannel = (Spinner) mView.findViewById(R.id.choose_channel);
|
||||||
|
|
||||||
setView(mView);
|
setView(mView);
|
||||||
setInverseBackgroundForced(true);
|
setInverseBackgroundForced(true);
|
||||||
@@ -140,20 +132,20 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,
|
|||||||
mSsid = (TextView) mView.findViewById(R.id.ssid);
|
mSsid = (TextView) mView.findViewById(R.id.ssid);
|
||||||
mPassword = (EditText) mView.findViewById(R.id.password);
|
mPassword = (EditText) mView.findViewById(R.id.password);
|
||||||
|
|
||||||
mChannel = (RadioGroup) mView.findViewById(R.id.choose_channel);
|
ArrayAdapter <CharSequence> channelAdapter;
|
||||||
mChannel2G = (RadioButton) mView.findViewById(R.id.ap_2G_band);
|
|
||||||
mChannel5G = (RadioButton) mView.findViewById(R.id.ap_5G_band);
|
|
||||||
|
|
||||||
String countryCode = mWifiManager.getCountryCode();
|
String countryCode = mWifiManager.getCountryCode();
|
||||||
if (!mWifiManager.is5GHzBandSupported() || countryCode == null) {
|
if (!mWifiManager.is5GHzBandSupported() || countryCode == null) {
|
||||||
//If no country code, 5GHz AP is forbidden
|
//If no country code, 5GHz AP is forbidden
|
||||||
Log.e(TAG," NO country code, forbid 5GHz");
|
Log.i(TAG," NO country code, forbid 5GHz");
|
||||||
mChannel5G.setVisibility(View.INVISIBLE);
|
channelAdapter = ArrayAdapter.createFromResource(mContext,
|
||||||
|
R.array.wifi_ap_band_config_2G_only, android.R.layout.simple_spinner_item);
|
||||||
mWifiConfig.apBand = 0;
|
mWifiConfig.apBand = 0;
|
||||||
} else {
|
} else {
|
||||||
mChannel5G.setVisibility(View.VISIBLE);
|
channelAdapter = ArrayAdapter.createFromResource(mContext,
|
||||||
|
R.array.wifi_ap_band_config_full, android.R.layout.simple_spinner_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channelAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
|
||||||
setButton(BUTTON_SUBMIT, context.getString(R.string.wifi_save), mListener);
|
setButton(BUTTON_SUBMIT, context.getString(R.string.wifi_save), mListener);
|
||||||
setButton(DialogInterface.BUTTON_NEGATIVE,
|
setButton(DialogInterface.BUTTON_NEGATIVE,
|
||||||
@@ -162,9 +154,9 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,
|
|||||||
if (mWifiConfig != null) {
|
if (mWifiConfig != null) {
|
||||||
mSsid.setText(mWifiConfig.SSID);
|
mSsid.setText(mWifiConfig.SSID);
|
||||||
if (mWifiConfig.apBand == 0) {
|
if (mWifiConfig.apBand == 0) {
|
||||||
mChannel2G.setChecked(true);
|
mBandIndex = 0;
|
||||||
} else {
|
} else {
|
||||||
mChannel5G.setChecked(true);
|
mBandIndex = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mSecurity.setSelection(mSecurityTypeIndex);
|
mSecurity.setSelection(mSecurityTypeIndex);
|
||||||
@@ -173,6 +165,32 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mChannel.setAdapter(channelAdapter);
|
||||||
|
mChannel.setOnItemSelectedListener(
|
||||||
|
new AdapterView.OnItemSelectedListener() {
|
||||||
|
boolean mInit = true;
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position,
|
||||||
|
long id) {
|
||||||
|
if (!mInit) {
|
||||||
|
mBandIndex = position;
|
||||||
|
mWifiConfig.apBand = mBandIndex;
|
||||||
|
Log.i(TAG, "config on channelIndex : " + mBandIndex + " Band: " +
|
||||||
|
mWifiConfig.apBand);
|
||||||
|
} else {
|
||||||
|
mInit = false;
|
||||||
|
mChannel.setSelection(mBandIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
mSsid.addTextChangedListener(this);
|
mSsid.addTextChangedListener(this);
|
||||||
mPassword.addTextChangedListener(this);
|
mPassword.addTextChangedListener(this);
|
||||||
((CheckBox) mView.findViewById(R.id.show_password)).setOnClickListener(this);
|
((CheckBox) mView.findViewById(R.id.show_password)).setOnClickListener(this);
|
||||||
|
Reference in New Issue
Block a user