1/* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16package com.android.settings.wifi.details; 17 18import android.app.Fragment; 19import android.content.Context; 20import android.os.Bundle; 21import com.android.settings.R; 22import com.android.settingslib.core.lifecycle.LifecycleObserver; 23import com.android.settingslib.core.lifecycle.events.OnCreate; 24 25/** 26 * ActionBar lifecycle observer for {@link WifiNetworkDetailsFragment}. 27 */ 28public class WifiDetailActionBarObserver implements LifecycleObserver, OnCreate { 29 30 private final Fragment mFragment; 31 private final Context mContext; 32 33 public WifiDetailActionBarObserver(Context context, Fragment fragment) { 34 mContext = context; 35 mFragment = fragment; 36 } 37 38 @Override 39 public void onCreate(Bundle savedInstanceState) { 40 if (mFragment.getActivity() != null) { 41 mFragment.getActivity().getActionBar() 42 .setTitle(mContext.getString(R.string.wifi_details_title)); 43 } 44 } 45} 46