Home | History | Annotate | Download | only in vo
      1 /*
      2  * Copyright (C) 2015 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 package android.databinding.testapp.vo;
     17 
     18 import android.databinding.Bindable;
     19 import android.databinding.adapters.ViewBindingAdapter;
     20 import android.databinding.testapp.R;
     21 import android.view.View;
     22 
     23 public class ViewBindingObject extends BindingAdapterBindingObject {
     24     @Bindable
     25     private int mBackgroundTint = 0xFF00FF00;
     26     @Bindable
     27     private boolean mFadeScrollbars = true;
     28     @Bindable
     29     private int mNextFocusForward = R.id.padding;
     30     @Bindable
     31     private int mNextFocusLeft = R.id.paddingStartEnd;
     32     @Bindable
     33     private int mNextFocusRight = R.id.paddingTopBottom;
     34     @Bindable
     35     private int mNextFocusUp = R.id.backgroundTint;
     36     @Bindable
     37     private int mNextFocusDown = R.id.fadeScrollbars;
     38     @Bindable
     39     private int mRequiresFadingEdge = ViewBindingAdapter.FADING_EDGE_VERTICAL;
     40     @Bindable
     41     private int mScrollbarDefaultDelayBeforeFade = 300;
     42     @Bindable
     43     private int mScrollbarFadeDuration = 400;
     44     @Bindable
     45     private int mScrollbarSize = 10;
     46     @Bindable
     47     private int mScrollbarStyle = View.SCROLLBARS_INSIDE_OVERLAY;
     48     @Bindable
     49     private float mTransformPivotX = 9;
     50     @Bindable
     51     private float mTransformPivotY = 8;
     52     @Bindable
     53     private int mPadding = 11;
     54     @Bindable
     55     private int mPaddingBottom = 12;
     56     @Bindable
     57     private int mPaddingTop = 13;
     58     @Bindable
     59     private int mPaddingLeft = 14;
     60     @Bindable
     61     private int mPaddingRight = 15;
     62     @Bindable
     63     private int mPaddingStart = 16;
     64     @Bindable
     65     private int mPaddingEnd = 17;
     66     @Bindable
     67     private boolean mClickable = true;
     68 
     69     public int getBackgroundTint() {
     70         return mBackgroundTint;
     71     }
     72 
     73     public int getScrollbarFadeDuration() {
     74         return mScrollbarFadeDuration;
     75     }
     76 
     77     public boolean getFadeScrollbars() {
     78         return mFadeScrollbars;
     79     }
     80 
     81     public int getNextFocusDown() {
     82         return mNextFocusDown;
     83     }
     84 
     85     public int getNextFocusForward() {
     86         return mNextFocusForward;
     87     }
     88 
     89     public int getNextFocusLeft() {
     90         return mNextFocusLeft;
     91     }
     92 
     93     public int getNextFocusRight() {
     94         return mNextFocusRight;
     95     }
     96 
     97     public int getNextFocusUp() {
     98         return mNextFocusUp;
     99     }
    100 
    101     public int getRequiresFadingEdge() {
    102         return mRequiresFadingEdge;
    103     }
    104 
    105     public int getScrollbarDefaultDelayBeforeFade() {
    106         return mScrollbarDefaultDelayBeforeFade;
    107     }
    108 
    109     public int getScrollbarSize() {
    110         return mScrollbarSize;
    111     }
    112 
    113     public int getScrollbarStyle() {
    114         return mScrollbarStyle;
    115     }
    116 
    117     public float getTransformPivotX() {
    118         return mTransformPivotX;
    119     }
    120 
    121     public float getTransformPivotY() {
    122         return mTransformPivotY;
    123     }
    124 
    125     public int getPadding() {
    126         return mPadding;
    127     }
    128 
    129     public int getPaddingBottom() {
    130         return mPaddingBottom;
    131     }
    132 
    133     public int getPaddingEnd() {
    134         return mPaddingEnd;
    135     }
    136 
    137     public int getPaddingLeft() {
    138         return mPaddingLeft;
    139     }
    140 
    141     public int getPaddingRight() {
    142         return mPaddingRight;
    143     }
    144 
    145     public int getPaddingStart() {
    146         return mPaddingStart;
    147     }
    148 
    149     public int getPaddingTop() {
    150         return mPaddingTop;
    151     }
    152 
    153     public boolean getClickable() { return mClickable; }
    154 
    155     public void changeValues() {
    156         mBackgroundTint = 0xFFFF0000;
    157         mFadeScrollbars = false;
    158         mNextFocusForward = R.id.paddingStartEnd;
    159         mNextFocusLeft = R.id.paddingTopBottom;
    160         mNextFocusRight = R.id.backgroundTint;
    161         mNextFocusUp = R.id.fadeScrollbars;
    162         mNextFocusDown = R.id.padding;
    163         mRequiresFadingEdge = ViewBindingAdapter.FADING_EDGE_HORIZONTAL;
    164         mScrollbarDefaultDelayBeforeFade = 400;
    165         mScrollbarFadeDuration = 500;
    166         mScrollbarSize = 11;
    167         mScrollbarStyle = View.SCROLLBARS_INSIDE_INSET;
    168         mTransformPivotX = 7;
    169         mTransformPivotY = 6;
    170         mPadding = 110;
    171         mPaddingBottom = 120;
    172         mPaddingTop = 130;
    173         mPaddingLeft = 140;
    174         mPaddingRight = 150;
    175         mPaddingStart = 160;
    176         mPaddingEnd = 170;
    177         mClickable = false;
    178         notifyChange();
    179     }
    180 }
    181