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.phone;
17
18import android.content.Context;
19import android.preference.Preference;
20import android.util.AttributeSet;
21import android.view.View;
22import android.widget.TextView;
23
24/**
25 * Customized preference class representing the "Advanced" button that expands to fields that
26 * are hidden by default.
27 */
28public class AdvancedOptionsPreference extends Preference {
29    public AdvancedOptionsPreference(Context context, AttributeSet attrs) {
30        super(context, attrs);
31    }
32
33    @Override
34    protected void onBindView(View view) {
35        super.onBindView(view);
36
37        setIcon(R.drawable.ic_expand_more);
38        setTitle(R.string.advanced_options_title);
39        TextView summary = view.findViewById(android.R.id.summary);
40        summary.setMaxLines(1);
41    }
42}
43