Merge "Change header of wifi detail page to "Network info"."
This commit is contained in:
committed by
Android (Google) Code Review
commit
4fefb21547
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2017 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.
|
||||
*/
|
||||
package com.android.settings.wifi.details;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
import com.android.settingslib.core.lifecycle.events.OnCreate;
|
||||
|
||||
/**
|
||||
* ActionBar lifecycle observer for {@link WifiNetworkDetailsFragment}.
|
||||
*/
|
||||
public class WifiDetailActionBarObserver implements LifecycleObserver, OnCreate {
|
||||
|
||||
private final Fragment mFragment;
|
||||
private final Context mContext;
|
||||
|
||||
public WifiDetailActionBarObserver(Context context, Fragment fragment) {
|
||||
mContext = context;
|
||||
mFragment = fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
if (mFragment.getActivity() != null) {
|
||||
mFragment.getActivity().getActionBar()
|
||||
.setTitle(mContext.getString(R.string.wifi_details_title));
|
||||
}
|
||||
}
|
||||
}
|
@@ -21,15 +21,14 @@ import android.net.wifi.WifiManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.vpn2.ConnectivityManagerWrapperImpl;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.wifi.AccessPoint;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -39,13 +38,18 @@ import java.util.List;
|
||||
* {@link AccessPoint#saveWifiState(Bundle)} in order to properly render this page.
|
||||
*/
|
||||
public class WifiNetworkDetailsFragment extends DashboardFragment {
|
||||
|
||||
private static final String TAG = "WifiNetworkDetailsFrg";
|
||||
|
||||
private AccessPoint mAccessPoint;
|
||||
private WifiDetailPreferenceController mWifiDetailPreferenceController;
|
||||
private WifiDetailActionBarObserver mWifiDetailActionBarObserver;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
mWifiDetailActionBarObserver = new WifiDetailActionBarObserver(context, this);
|
||||
getLifecycle().addObserver(mWifiDetailActionBarObserver);
|
||||
|
||||
mAccessPoint = new AccessPoint(context, getArguments());
|
||||
super.onAttach(context);
|
||||
}
|
||||
@@ -78,8 +82,6 @@ public class WifiNetworkDetailsFragment extends DashboardFragment {
|
||||
context.getSystemService(WifiManager.class),
|
||||
mMetricsFeatureProvider);
|
||||
|
||||
ArrayList<AbstractPreferenceController> controllers = new ArrayList(1);
|
||||
controllers.add(mWifiDetailPreferenceController);
|
||||
return controllers;
|
||||
return new ArrayList<>(Collections.singletonList(mWifiDetailPreferenceController));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user