Remove grey Wi-Fi icon from Setup Wizard
This removes the grey Wi-Fi icon from the empty-view in the Wi-Fi list of Setup Wizard. Also updated the style so it looks like the description text in other setup screens. Also fixed the view recycling by not calling getRootAdapter in onActivityCreated, since that will cause the Preference framework to not cache the AccessPoint preference. Bug: 17575719 Bug: 16518752 Change-Id: I06cbc88db1c04b29a9ce8221596265effc39b90b
This commit is contained in:
24
res/layout/setup_wifi_empty.xml
Normal file
24
res/layout/setup_wifi_empty.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/setup_wizard_margin_top"
|
||||
android:paddingStart="@dimen/setup_wizard_margin_sides"
|
||||
android:paddingEnd="@dimen/setup_wizard_margin_sides"
|
||||
android:textAppearance="@style/TextAppearance.SetupWizardDescription" />
|
@@ -58,6 +58,7 @@
|
||||
<dimen name="setup_wizard_card_port_margin_sides">56dp</dimen>
|
||||
<dimen name="setup_wizard_card_land_margin_top">128dp</dimen>
|
||||
<dimen name="setup_wizard_margin_sides">40dp</dimen>
|
||||
<dimen name="setup_wizard_margin_top">24dp</dimen>
|
||||
<dimen name="setup_wizard_title_area_elevation">3dp</dimen>
|
||||
|
||||
<dimen name="divider_height">3dip</dimen>
|
||||
|
@@ -187,6 +187,9 @@
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.SetupWizardDescription" parent="@android:style/TextAppearance.Material.Subhead">
|
||||
</style>
|
||||
|
||||
<style name="SetupAddWifiNetwork">
|
||||
<item name="android:fontFamily">sans-serif-medium</item>
|
||||
<item name="android:gravity">start|center_vertical</item>
|
||||
|
@@ -652,7 +652,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
||||
* Shows the latest access points available with supplemental information like
|
||||
* the strength of network and the security for it.
|
||||
*/
|
||||
private void updateAccessPoints() {
|
||||
protected void updateAccessPoints() {
|
||||
// Safeguard from some delayed event handling
|
||||
if (getActivity() == null) return;
|
||||
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.wifi;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.DataSetObserver;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
@@ -29,7 +28,6 @@ import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView.LayoutParams;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -49,7 +47,6 @@ public class WifiSettingsForSetupWizard extends WifiSettings {
|
||||
protected static final String EXTRA_SHOW_WIFI_REQUIRED_INFO = "wifi_show_wifi_required_info";
|
||||
|
||||
private View mAddOtherNetworkItem;
|
||||
private ListAdapter mAdapter;
|
||||
private TextView mEmptyFooter;
|
||||
private boolean mListLastEmpty = false;
|
||||
|
||||
@@ -98,15 +95,12 @@ public class WifiSettingsForSetupWizard extends WifiSettings {
|
||||
if (hasNextButton()) {
|
||||
getNextButton().setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mAdapter = getPreferenceScreen().getRootAdapter();
|
||||
mAdapter.registerDataSetObserver(new DataSetObserver() {
|
||||
@Override
|
||||
public void onChanged() {
|
||||
super.onChanged();
|
||||
updateFooter();
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
protected void updateAccessPoints() {
|
||||
super.updateAccessPoints();
|
||||
updateFooter(getPreferenceScreen().getPreferenceCount() == 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,17 +145,12 @@ public class WifiSettingsForSetupWizard extends WifiSettings {
|
||||
|
||||
@Override
|
||||
protected TextView initEmptyView() {
|
||||
mEmptyFooter = new TextView(getActivity());
|
||||
mEmptyFooter.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.MATCH_PARENT));
|
||||
mEmptyFooter.setGravity(Gravity.CENTER);
|
||||
mEmptyFooter.setCompoundDrawablesWithIntrinsicBounds(0,
|
||||
R.drawable.ic_wifi_emptystate, 0,0);
|
||||
final LayoutInflater inflater = LayoutInflater.from(getActivity());
|
||||
mEmptyFooter = (TextView) inflater.inflate(R.layout.setup_wifi_empty, getListView(), false);
|
||||
return mEmptyFooter;
|
||||
}
|
||||
|
||||
protected void updateFooter() {
|
||||
final boolean isEmpty = mAdapter.isEmpty();
|
||||
protected void updateFooter(boolean isEmpty) {
|
||||
if (isEmpty != mListLastEmpty) {
|
||||
final ListView list = getListView();
|
||||
if (isEmpty) {
|
||||
|
Reference in New Issue
Block a user