• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  */
16 
17 package com.android.settings.notification;
18 
19 import android.content.Context;
20 import android.support.v4.content.res.TypedArrayUtils;
21 import android.support.v7.preference.Preference;
22 import android.support.v7.preference.PreferenceViewHolder;
23 import android.text.method.LinkMovementMethod;
24 import android.util.AttributeSet;
25 import android.widget.TextView;
26 
27 import com.android.settingslib.R;
28 
29 /**
30  * FooterPreference that can have any key or ordering.
31  */
32 public class NotificationFooterPreference extends Preference {
33 
NotificationFooterPreference(Context context, AttributeSet attrs)34     public NotificationFooterPreference(Context context, AttributeSet attrs) {
35         super(context, attrs, TypedArrayUtils.getAttr(
36                 context, R.attr.footerPreferenceStyle, android.R.attr.preferenceStyle));
37         init();
38     }
39 
NotificationFooterPreference(Context context)40     public NotificationFooterPreference(Context context) {
41         this(context, null);
42     }
43 
44     @Override
onBindViewHolder(PreferenceViewHolder holder)45     public void onBindViewHolder(PreferenceViewHolder holder) {
46         super.onBindViewHolder(holder);
47         TextView title = holder.itemView.findViewById(android.R.id.title);
48         title.setMovementMethod(new LinkMovementMethod());
49         title.setClickable(false);
50         title.setLongClickable(false);
51     }
52 
init()53     private void init() {
54         setIcon(R.drawable.ic_info_outline_24dp);
55         setSelectable(false);
56     }
57 }
58