Home | History | Annotate | Download | only in layout
      1 <?xml version="1.0" encoding="utf-8"?>
      2 <!--
      3   ~ Copyright (C) 2015 The Android Open Source Project
      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   ~      http://www.apache.org/licenses/LICENSE-2.0
      8   ~ Unless required by applicable law or agreed to in writing, software
      9   ~ distributed under the License is distributed on an "AS IS" BASIS,
     10   ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     11   ~ See the License for the specific language governing permissions and
     12   ~ limitations under the License.
     13   -->
     14 
     15 <layout xmlns:android="http://schemas.android.com/apk/res/android"
     16         xmlns:app="http://schemas.android.com/apk/res-auto">
     17     <data>
     18         <import type="android.databinding.testapp.vo.NotBindableVo"/>
     19         <variable name="otherObj" type="android.databinding.testapp.vo.NotBindableVo"/>
     20         <variable name="obj" type="android.databinding.testapp.vo.CallbackBindingObject"/>
     21         <variable name="obj2" type="android.databinding.testapp.vo.CallbackBindingObject"/>
     22         <variable name="objArr" type="android.databinding.testapp.vo.CallbackBindingObject[]"/>
     23     </data>
     24     <LinearLayout
     25             android:orientation="vertical"
     26             android:layout_width="match_parent"
     27             android:layout_height="match_parent">
     28         <View
     29                 android:id="@+id/view1"
     30                 android:layout_width="wrap_content"
     31                 android:layout_height="wrap_content"
     32                 android:onClick="@{() -> obj.onClick()}"
     33                 android:onLongClick="@{() -> obj.onLongClick()}"
     34                 />
     35         <View
     36                 android:id="@+id/view2"
     37                 android:layout_width="wrap_content"
     38                 android:layout_height="wrap_content"
     39                 android:onClick="@{(v) -> obj.onClick(v)}"
     40                 android:onLongClick="@{(view) -> obj.onLongClick(view)}"
     41         />
     42 
     43         <View
     44                 android:id="@+id/view3"
     45                 android:layout_width="wrap_content"
     46                 android:layout_height="wrap_content"
     47                 android:onClick="@{(v) -> obj.onClickWithParam(otherObj)}"
     48                 android:onLongClick="@{(view) -> obj.onLongClickWithParam(otherObj)}"
     49         />
     50 
     51         <View
     52                 android:id="@+id/view4"
     53                 android:layout_width="wrap_content"
     54                 android:layout_height="wrap_content"
     55                 android:onClick="@{(v) -> obj.onClickWithParam(v, otherObj)}"
     56                 android:onLongClick="@{(view) -> obj.onLongClickWithParam(view, otherObj)}"
     57         />
     58 
     59         <!-- via adapter and also multiple params -->
     60         <ListView
     61                 android:id="@+id/listView"
     62                 android:layout_width="wrap_content"
     63                 android:layout_height="wrap_content"
     64                 android:onScroll="@{() -> obj2.onScrolled()}"/>
     65 
     66         <SeekBar
     67                  android:id="@+id/seekBar"
     68                  android:layout_width="wrap_content"
     69                  android:layout_height="wrap_content"
     70                  android:onProgressChanged="@{(seekBar, progress, fromUser) -> obj.onProgressChanged(seekBar, progress, fromUser)}"
     71         />
     72         <View
     73                 android:id="@+id/view5"
     74                 android:layout_width="wrap_content"
     75                 android:layout_height="wrap_content"
     76                 android:onClick="@{(v) -> NotBindableVo.incStaticCounter()}"
     77                 android:onLongClick="@{(v) -> NotBindableVo.incStaticCounter()}"
     78         />
     79         <View
     80                 android:id="@+id/view6"
     81                 android:layout_width="wrap_content"
     82                 android:layout_height="wrap_content"
     83                 android:onClick="@{(v) -> otherObj.incStaticCounter()}"
     84                 android:onLongClick="@{(v) -> otherObj.incStaticCounter()}"
     85         />
     86         <View android:layout_width="wrap_content" android:layout_height="wrap_content"
     87               android:id="@+id/view7"
     88               android:onClick="@{(v) -> objArr[1].onClick(v)}"
     89               android:onLongClick="@{(view) -> objArr[2].onLongClick(view)}"/>
     90 
     91         <!--variable override-->
     92         <View android:layout_width="wrap_content" android:layout_height="match_parent"
     93               android:id="@+id/view8"
     94               android:onClick="@{(objArr) -> obj.onClick(objArr)}"/>
     95 
     96         <View android:layout_width="wrap_content" android:layout_height="match_parent"
     97               android:id="@+id/view9"
     98               android:onClick="@{(v) -> obj.setVisible(android.view.View.VISIBLE)}"/>
     99 
    100         <View android:layout_width="wrap_content" android:layout_height="match_parent"
    101               android:id="@+id/view10"
    102               android:onClick="@{(v) -> obj.setVisible(NotBindableVo.STATIC_VAL)}"/>
    103 
    104         <View android:layout_width="wrap_content" android:layout_height="match_parent"
    105               android:id="@+id/view11"
    106               android:onClick="@{(v) -> v.focusable ? obj.onFocusable() : obj.onNotFocusable()}"
    107               android:onLongClick="@{(v) -> v.focusable ? obj.onFocusable() : obj.onNotFocusable()}"/>
    108     </LinearLayout>
    109 </layout>