SwitchCompatBindingAdapter.java revision c619d8f69127c1200103d8119101c5f0675661d0
1974a07824642fabd896930f20c7b176fd2333e31George Mount/* 2974a07824642fabd896930f20c7b176fd2333e31George Mount * Copyright (C) 2015 The Android Open Source Project 3974a07824642fabd896930f20c7b176fd2333e31George Mount * 4974a07824642fabd896930f20c7b176fd2333e31George Mount * Licensed under the Apache License, Version 2.0 (the "License"); 5974a07824642fabd896930f20c7b176fd2333e31George Mount * you may not use this file except in compliance with the License. 6974a07824642fabd896930f20c7b176fd2333e31George Mount * You may obtain a copy of the License at 7974a07824642fabd896930f20c7b176fd2333e31George Mount * 8974a07824642fabd896930f20c7b176fd2333e31George Mount * http://www.apache.org/licenses/LICENSE-2.0 9974a07824642fabd896930f20c7b176fd2333e31George Mount * 10974a07824642fabd896930f20c7b176fd2333e31George Mount * Unless required by applicable law or agreed to in writing, software 11974a07824642fabd896930f20c7b176fd2333e31George Mount * distributed under the License is distributed on an "AS IS" BASIS, 12974a07824642fabd896930f20c7b176fd2333e31George Mount * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13974a07824642fabd896930f20c7b176fd2333e31George Mount * See the License for the specific language governing permissions and 14974a07824642fabd896930f20c7b176fd2333e31George Mount * limitations under the License. 15974a07824642fabd896930f20c7b176fd2333e31George Mount */ 16fead9ca09b117136b35bc5bf137340a754f9edddGeorge Mountpackage android.databinding.adapters; 17974a07824642fabd896930f20c7b176fd2333e31George Mount 18fead9ca09b117136b35bc5bf137340a754f9edddGeorge Mountimport android.databinding.BindingAdapter; 19fead9ca09b117136b35bc5bf137340a754f9edddGeorge Mountimport android.databinding.BindingMethod; 20fead9ca09b117136b35bc5bf137340a754f9edddGeorge Mountimport android.databinding.BindingMethods; 21974a07824642fabd896930f20c7b176fd2333e31George Mountimport android.support.v7.widget.SwitchCompat; 22974a07824642fabd896930f20c7b176fd2333e31George Mount 23974a07824642fabd896930f20c7b176fd2333e31George Mount@BindingMethods({ 24c619d8f69127c1200103d8119101c5f0675661d0George Mount @BindingMethod(type = android.support.v7.widget.SwitchCompat.class, attribute = "android:thumb", method = "setThumbDrawable"), 25c619d8f69127c1200103d8119101c5f0675661d0George Mount @BindingMethod(type = android.support.v7.widget.SwitchCompat.class, attribute = "android:track", method = "setTrackDrawable"), 26974a07824642fabd896930f20c7b176fd2333e31George Mount}) 27974a07824642fabd896930f20c7b176fd2333e31George Mountpublic class SwitchCompatBindingAdapter { 28974a07824642fabd896930f20c7b176fd2333e31George Mount 29974a07824642fabd896930f20c7b176fd2333e31George Mount @BindingAdapter("android:switchTextAppearance") 30974a07824642fabd896930f20c7b176fd2333e31George Mount public static void setSwitchTextAppearance(SwitchCompat view, int value) { 31974a07824642fabd896930f20c7b176fd2333e31George Mount view.setSwitchTextAppearance(null, value); 32974a07824642fabd896930f20c7b176fd2333e31George Mount } 33974a07824642fabd896930f20c7b176fd2333e31George Mount} 34