Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db91007f authored by Hui Feng's avatar Hui Feng Committed by Josh Guilfoyle
Browse files

Add ToggleButtonPreference.

parent ab8e1350
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
package com.tmobile.preferences;


import android.content.Context;

import android.preference.CheckBoxPreference;
import android.util.AttributeSet;
import com.android.internal.R;

/**
 * Essentially the same as CheckBoxPreference except for using a toggle button in place of a check box
 *
 * @hide
 */
public class ToggleButtonPreference extends CheckBoxPreference {
    public ToggleButtonPreference(Context context) {
        super(context, null);
        
        setWidgetLayoutResource(R.layout.tmobile_preference_widget_toggle);        
    }
    
    // This is the constructor called by the inflater
    public ToggleButtonPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
        
        setWidgetLayoutResource(R.layout.tmobile_preference_widget_toggle);        
    }
    
    public ToggleButtonPreference(Context context, AttributeSet attrs, int defStyle){
        super(context, attrs, defStyle);
        setWidgetLayoutResource(R.layout.tmobile_preference_widget_toggle);   
    }
}
+12 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!-- Layout used by CheckBoxPreference for the toggle style. This is inflated
     inside android.R.layout.preference. -->
<com.tmobile.widget.ToggleButton xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+android:id/checkbox" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginRight="4dip"
    android:layout_gravity="center_vertical"
    android:focusable="false"
    android:clickable="false" />