1 /* 2 * Copyright (C) 2018 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.car.settings.common; 18 19 import android.content.Context; 20 import android.util.AttributeSet; 21 22 import androidx.preference.PreferenceGroup; 23 import androidx.preference.PreferenceViewHolder; 24 25 import com.android.car.settings.R; 26 27 /** 28 * {@link PreferenceGroup} which does not display a title, icon, or summary. This allows for 29 * logical grouping of preferences without indications in the UI. 30 */ 31 public class LogicalPreferenceGroup extends PreferenceGroup { 32 LogicalPreferenceGroup(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)33 public LogicalPreferenceGroup(Context context, AttributeSet attrs, int defStyleAttr, 34 int defStyleRes) { 35 super(context, attrs, defStyleAttr, defStyleRes); 36 setLayoutResource(R.layout.logical_preference_group); 37 } 38 LogicalPreferenceGroup(Context context, AttributeSet attrs, int defStyleAttr)39 public LogicalPreferenceGroup(Context context, AttributeSet attrs, int defStyleAttr) { 40 this(context, attrs, defStyleAttr, 0); 41 } 42 LogicalPreferenceGroup(Context context, AttributeSet attrs)43 public LogicalPreferenceGroup(Context context, AttributeSet attrs) { 44 this(context, attrs, 0); 45 } 46 LogicalPreferenceGroup(Context context)47 public LogicalPreferenceGroup(Context context) { 48 this(context, null); 49 } 50 51 @Override onBindViewHolder(PreferenceViewHolder holder)52 public void onBindViewHolder(PreferenceViewHolder holder) { 53 super.onBindViewHolder(holder); 54 holder.setDividerAllowedAbove(false); 55 } 56 } 57