PublicFinalWithObservableTestVo.java revision a6e4583962e19e8e93b4ca3f9fe3d34560b6d96c
198e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount/* 298e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount * Copyright (C) 2015 The Android Open Source Project 398e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount * Licensed under the Apache License, Version 2.0 (the "License"); 498e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount * you may not use this file except in compliance with the License. 598e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount * You may obtain a copy of the License at 698e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount * http://www.apache.org/licenses/LICENSE-2.0 798e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount * Unless required by applicable law or agreed to in writing, software 898e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount * distributed under the License is distributed on an "AS IS" BASIS, 998e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1098e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount * See the License for the specific language governing permissions and 1198e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount * limitations under the License. 1298e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount */ 1398e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount 1498e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mountpackage com.android.databinding.testapp.vo; 1598e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount 1698e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mountimport com.android.databinding.library.BaseObservable; 1798e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mountimport com.android.databinding.testapp.R; 1898e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount 1998e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mountimport android.binding.Bindable; 20a6e4583962e19e8e93b4ca3f9fe3d34560b6d96cYigit Boyarimport com.android.databinding.testapp.BR; 2198e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount 2298e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mountpublic class PublicFinalWithObservableTestVo { 2398e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount public final int myField; 2498e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount public final MyVo myFinalVo = new MyVo(); 2598e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount 2698e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount public PublicFinalWithObservableTestVo(int field) { 2798e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount myField = field; 2898e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount } 2998e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount 3098e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount public static class MyVo extends BaseObservable { 3198e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount @Bindable 3298e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount private int val = R.string.app_name; 3398e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount 3498e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount public int getVal() { 3598e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount return val; 3698e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount } 3798e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount 3898e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount public void setVal(int val) { 3998e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount this.val = val; 40a6e4583962e19e8e93b4ca3f9fe3d34560b6d96cYigit Boyar notifyPropertyChanged(BR.val); 4198e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount } 4298e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount } 4398e4b7a419c91797a7ef66158fa0ce9aaacc8817George Mount} 44