{"id":259345,"date":"2015-06-15T15:55:02","date_gmt":"2015-06-15T11:55:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=259345"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=259345","title":{"rendered":"\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442 Data Binding \u0432 Android"},"content":{"rendered":"<br \/>\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0430\u043d\u0434\u0440\u043e\u0438\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0433\u043e\u0434\u0430, \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u043f\u043e Windows Phone \u0438 \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0432\u044c\u044e \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u0441\u0430\u043c\u0438\u043c View \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 Bindings. \u0410 \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f RX, \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0442\u0430\u043b\u0438 \u0440\u0435\u0448\u0430\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0441\u0442\u043e, \u0432\u044c\u044e-\u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u0434\u0435\u043b\u0438\u043b\u0430\u0441\u044c \u043e\u0442 View. \u041e\u043d\u0430 \u0441\u0442\u0430\u043b\u0430 \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0437\u0430\u0431\u043e\u0442\u044f\u0441\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f. <\/p>\n<p>  \u0412 Android \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u043e\u0433\u043e\u0441\u0442\u0438 \u044f \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b, Activity \u0438\u043b\u0438 Fragment \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u043c\u0435\u044e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u0430\u043a \u043a\u043e View, \u0442\u0430\u043a \u0438 \u043a \u043c\u043e\u0434\u0435\u043b\u0438, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044f \u0440\u0435\u0448\u0430\u044f, \u043a\u0430\u043a\u043e\u0439 View \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0438\u043c, \u0440\u0435\u0448\u0430\u044f \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0447\u0438\u0441\u0442\u043e \u0432\u044c\u044e\u0448\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0434\u043e\u0441\u0442\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u044f\u043b \u043d\u043e\u0432\u043e\u0441\u0442\u044c \u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 Data Binding \u0432 Android \u043d\u0430 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0435\u043c Google IO.<\/p>\n<p>  <iframe loading=\"lazy\" width=\"560\" height=\"349\" src=\"\/\/www.youtube.com\/embed\/f7ihSQ44WO0?wmode=opaque&#038;start=1735\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>  \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0435\u0442\u0430 \u0440\u0435\u043b\u0438\u0437, \u043d\u043e \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0434\u0432\u0438\u0433\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0438\u0437 Google.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041d\u0430\u0447\u0430\u043b\u043e<\/h4>\n<p>  \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e Android Studio 1.3.<\/p>\n<p>  \u0414\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 android \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f Gradle (\u043d\u0443\u0436\u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044f 1.3.0-beta1 \u0438 \u0441\u0442\u0430\u0440\u0448\u0435). \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u0432\u044f\u0437\u0438 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u043b\u0430\u0433\u0438\u043d \u043a Gradle &#8216;com.android.databinding:dataBinder:1.0-rc0&#8217;. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0442\u043e\u0433\u043e \u0436\u0435 Windows Phone \u0433\u0434\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0440\u0438\u0432\u044f\u0437\u043e\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043f\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c DependencyProperty \u0438 \u0432 RealTime, \u0432 Android \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0431\u044b \u043f\u043e\u0432\u0435\u0440\u0445 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u0431\u0443\u0434\u044c\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u0444\u0430\u0439\u043b build.gradle, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (\u0432 \u043d\u0451\u043c \u0438\u0434\u0443\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Gradle \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430). \u0412 \u0431\u043b\u043e\u043a\u0435 dependencies \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c:<\/p>\n<pre><code>dependencies {     classpath 'com.android.tools.build:gradle:1.3.0-beta2'     classpath 'com.android.databinding:dataBinder:1.0-rc0' } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u043f\u043b\u0430\u0433\u0438\u043d \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u043c\u043e\u0434\u0443\u043b\u044e, \u043e\u0442\u043a\u0440\u043e\u0435\u043c build.gradle \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0436\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0434\u0443\u043b\u044f. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e app\/build.gradle \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0443:<\/p>\n<pre><code>apply plugin: 'com.android.databinding' <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Layout<\/h4>\n<p>  \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430\u0448 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 View \u0432 \u0442\u0435\u0433 <code>&lt;layout&gt;<\/code>. C\u0442\u0443\u0434\u0438\u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u043a\u0440\u0430\u0441\u043d\u044b\u043c \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0435\u043c\u0443 \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0432\u044b\u0441\u043e\u0442\u044b \u0438 \u0448\u0438\u0440\u0438\u043d\u044b; \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c \u0435\u0451, \u0438\u043d\u0430\u0447\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u042d\u0442\u0438\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u0432\u044b \u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0443 \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u044f. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u043c\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438. \u0414\u043b\u044f main_activity \u2014 MainActivityBinding, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430, \u0434\u043b\u044f \u043c\u0435\u043d\u044f com.georgeci.bindingssample.databinding.ActivityMainBinding<\/p>\n<p>  \u0412\u0430\u0436\u043d\u043e: \u0435\u0441\u043b\u0438 \u0432 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 View \u0441 Id \u0438\u043b\u0438 \u0442\u0435\u0433\u0430 <code>&lt;data&gt;<\/code> \u043a\u043b\u0430\u0441\u0441 \u0431\u0438\u043d\u0434\u0438\u043d\u0433 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0441\u0442\u0441\u044f.<\/p>\n<pre><code class=\"xml\">&lt;layout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;&gt;    &lt;data&gt;        &lt;variable name=&quot;user&quot; type=&quot;com.georgeci.bindingssample.User&quot;\/&gt;    &lt;\/data&gt;    &lt;LinearLayout                    xmlns:tools=&quot;http:\/\/schemas.android.com\/tools&quot;                    android:layout_width=&quot;match_parent&quot;                    android:layout_height=&quot;match_parent&quot;                    android:paddingLeft=&quot;@dimen\/activity_horizontal_margin&quot;                    android:paddingRight=&quot;@dimen\/activity_horizontal_margin&quot;                    android:paddingTop=&quot;@dimen\/activity_vertical_margin&quot;                    android:paddingBottom=&quot;@dimen\/activity_vertical_margin&quot;                    tools:context=&quot;.MainActivity&quot;&gt;        &lt;TextView            android:id=&quot;@+id\/bindTv&quot;            android:layout_width=&quot;wrap_content&quot;            android:layout_height=&quot;wrap_content&quot;\/&gt;    &lt;\/RelativeLayout&gt; &lt;\/layout&gt; <\/code><\/pre>\n<p>  \u0423\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 Binding \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f findViewById. \u0412 MainActivity \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u043b\u0435 \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u043c\u0435\u0442\u043e\u0434 onCreate:<\/p>\n<pre><code class=\"java\">ActivityMainBinding binder;    @Override protected void onCreate(Bundle savedInstanceState) {  super.onCreate(savedInstanceState);  binding = DataBindingUtil.setContentView(this, R.layout.activity_main);  binding.bindTv.setText(&quot;Some text&quot;); } <\/code><\/pre>\n<p>  \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0438\u0437 Id View, \u0431\u0435\u0437 Id \u0432 \u0431\u0438\u043d\u0434\u0435\u0440\u0435 \u043f\u043e\u043b\u0435 \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c Id View, \u0442\u043e \u043f\u043e\u043b\u0435 \u0432 \u0431\u0438\u043d\u0434\u0435\u0440\u0435 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0442\u043d\u0443\u0442\u044c\u0441\u044f. \u0415\u0441\u043b\u0438 \u0441 \u0437\u0430\u0436\u0430\u0442\u044b\u043c CTRL \u043d\u0430\u0436\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f View, \u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0448\u044c \u043a \u043d\u0435\u043c\u0443 \u0432 \u0444\u0430\u0439\u043b\u0435 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438. \u041a\u0430\u043a \u043f\u043e \u043c\u043d\u0435 \u0442\u0430\u043a \u0443\u0436\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0438.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041c\u043e\u0438 \u043f\u0440\u0435\u0434\u0432\u043a\u0443\u0448\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\u041d\u043e \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u043d\u0430\u0447\u0430\u043b\u043e \u0438 \u0438\u0434\u0451\u0442 \u043a\u0430\u043a \u0431\u043e\u043d\u0443\u0441, \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0433\u043e Layout \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0442\u043e\u0433\u043e \u043a\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0443\u0434\u0430 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0438 \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 MVVM \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0421# \u0432 Windows \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u0410 \u0435\u0441\u043b\u0438 \u0435\u0449\u0451 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0438\u0442\u044c \u043c\u043e\u0449\u044c Java RX, \u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u0432\u043b\u0435\u043a\u0430\u0442\u044c\u0441\u044f.  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043c\u044f \u0438 \u0432\u043e\u0437\u0440\u0430\u0441\u0442.<\/p>\n<pre><code class=\"java\">public class User {    public String name;    public int age;     public User(String name, int age) {        this.nam = name;        this.age = age;    } } <\/code><\/pre>\n<p>  \u0418\u0437\u043c\u0435\u043d\u0438\u043c Layout, \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 LinearLayout \u043d\u0430:<\/p>\n<pre><code class=\"xml\">&lt;TextView    android:layout_width=&quot;wrap_content&quot;    android:layout_height=&quot;wrap_content&quot;    android:text=&quot;@{user.name}&quot;\/&gt;  &lt;TextView    android:layout_width=&quot;wrap_content&quot;    android:layout_height=&quot;wrap_content&quot;    android:text=&quot;@{Integer.toString(user.age)}&quot;\/&gt;  <\/code><\/pre>\n<p>  \u0418 \u0432 onCreate \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430:<\/p>\n<pre><code class=\"java\">   binding.setUser(new User(&quot;Some name&quot;, 27)); <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c. \u0412\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<br \/>  \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0443 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0432 \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438 \u0438\u043b\u0438 \u0432 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u0445 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:<\/p>\n<pre><code class=\"java\">   someView.setVisibility(isVisible : View.VISIBLE : View.GONE); <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0442\u043e \u043c\u044b \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c: <\/p>\n<pre><code class=\"java\">public class User {    public String name;    public int age;     public User(String name, int age, boolean isAdult) {        this.name = name;        this.age = age;        this.isAdult = isAdult;    }    public boolean isAdult;  } <\/code><\/pre>\n<p>  \u0418 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 Layout:<\/p>\n<pre><code class=\"xml\">&lt;TextView    android:id=&quot;@+id\/adult_content&quot;    android:layout_width=&quot;wrap_content&quot;    android:layout_height=&quot;wrap_content&quot;    android:visibility=&quot;@{user.isAdult ?View.VISIBLE :View.GONE}&quot;    android:text=&quot;Some content only for adult&quot;\/&gt; <\/code><\/pre>\n<p>  \u041d\u0430 \u043a\u0440\u0430\u0441\u043d\u044b\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0443\u0434\u0438\u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c.<br \/>  \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441 View, \u0442\u043e \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u043e\u0434\u0443 <code>&lt;data&gt;<\/code>:<\/p>\n<pre><code class=\"xml\">   &lt;import type=&quot;android.view.View&quot;\/&gt;  <\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0430\u043a\u0435\u0442\u0430:<\/p>\n<pre><code class=\"xml\">   android:visibility=&quot;@{user.isAdult ? android.view.View.VISIBLE : android.view.View.GONE}&quot; <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432 \u043d\u043e\u0434\u0435 <code>&lt;import&gt;<\/code> \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"xml\">&lt;import type=&quot;android.view.View&quot; alias=&quot;SomeAlias&quot;\/&gt; ... android:visibility=&quot;@{user.isAdult ? SomeAlias.VISIBLE : SomeAlias.GONE}&quot; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u044b<\/h4>\n<p>  \u0418\u043c\u043f\u043e\u0440\u0442 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u0430\u0451\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u044b. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u043b\u0435 \u0441 \u0434\u0430\u0442\u043e\u0439 \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0438 \u0443\u0434\u0430\u043b\u0438\u043c \u0432\u043e\u0437\u0440\u0430\u0441\u0442:<\/p>\n<pre><code class=\"java\">public class User {    public String name;    public long birthday;    public boolean isAdult;    public User(String name, long birthday, boolean isAdult) {        this.name = name;        this.birthday = birthday;        this.isAdult = isAdult;    } } <\/code><\/pre>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440:<\/p>\n<pre><code class=\"java\">public class UnixDateConverter {    public static String convert(long timestamp) {        Calendar mydate = Calendar.getInstance();        mydate.setTimeInMillis(timestamp * 1000);        SimpleDateFormat sdf = new SimpleDateFormat(&quot;MM\/dd\/yyyy&quot;);        return sdf.format(mydate.getTime());    } }  <\/code><\/pre>\n<p>  \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443:<\/p>\n<pre><code class=\"xml\">&lt;import type=&quot;com.georgeci.bindingssample.UnixDateConverter&quot;\/&gt; ... &lt;TextView    android:id=&quot;@+id\/birthday&quot;    android:layout_width=&quot;wrap_content&quot;    android:layout_height=&quot;wrap_content&quot;    android:text=&quot;@{UnixDateConverter.convert(user.birthday)}&quot;\/&gt;  <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c \u0438 Binding<\/h4>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 Layout:<\/p>\n<pre><code class=\"xml\">&lt;variable             name=&quot;clicker&quot;             type=&quot;android.view.View.OnClickListener&quot;\/&gt; ... &lt;Button             android:text=&quot;Some button&quot;             app:onClickListener=&quot;@{clicker}&quot;             android:layout_width=&quot;match_parent&quot;             android:layout_height=&quot;wrap_content&quot;\/&gt; <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c onCreate:<\/p>\n<pre><code class=\"java\">protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         binding = DataBindingUtil.setContentView(this, R.layout.activity_main);         final User user = new User(&quot;Some name&quot;, 668714400L, false);         binding.setUser(user);         binding.setClicker(new View.OnClickListener() {             @Override             public void onClick(View v) {                 Toast.makeText(MainActivity.this, &quot;ckick!&quot;, Toast.LENGTH_SHORT).show();                 user.name=&quot;from btn&quot;;             }         });     } <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438 \u043a\u043b\u0438\u043a\u0430\u0435\u043c, \u0442\u043e\u0441\u0442 \u0432\u0441\u043f\u043b\u044b\u043b, \u043d\u043e \u0438\u043c\u044f \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c. \u042d\u0442\u043e \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0438 \u043a\u0430\u043a \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u0438\u043b\u0430 binder \u043e \u0441\u0432\u043e\u0451\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0451, \u043d\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u044d\u0442\u043e \u0440\u0430\u0441\u0442\u043e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e:<\/p>\n<pre><code class=\"java\">   binding.setUser(new User(&quot;New model&quot;, 668714400L, false)); <\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u0443\u044e, \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u043f\u044f\u0442\u044c:<\/p>\n<pre><code class=\"java\">User user1 = binding.getUser(); user1.name = &quot;old model&quot;; binding.setUser(user1); <\/code><\/pre>\n<p>  \u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u043e\u0431\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0432\u0441\u0435 View, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e. \u041b\u0443\u0447\u0448\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0441 binder, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043c\u043e\u0433\u043b\u0430 \u0435\u0433\u043e \u043e\u043f\u043e\u0432\u0435\u0441\u0442\u0438\u0442\u044c \u043e \u0441\u0432\u043e\u0451\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0434\u0435\u043b\u0438, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b, <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0427\u0442\u043e \u0432 Android Studio \u0434\u0435\u043b\u043e \u043f\u0430\u0440\u044b \u043a\u043b\u0438\u043a\u043e\u0432<\/b><\/p>\n<div class=\"spoiler_text\">Alt-Insert -&gt; Getter and Setter -&gt; Ctrl-A -&gt; Enter  <\/div>\n<\/div>\n<p> \u043f\u043e\u043c\u0435\u0447\u0430\u044f \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c  @Bindable, \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0432\u044b\u0437\u043e\u0432 notifyPropertyChanged(BR.lastName);<\/p>\n<pre><code class=\"java\">public class User extends BaseObservable {     private String name;     private long birthday;     private boolean adult;     public User(String name, long birthday, boolean isAdult) {         this.name = name;         this.birthday = birthday;         this.adult = isAdult;     }     @Bindable     public String getName() {         return name;     }     public void setName(String name) {         this.name = name;         notifyPropertyChanged(com.georgeci.bindingssample.BR.name);     }     @Bindable     public long getBirthday() {         return birthday;     }     public void setBirthday(long birthday) {         this.birthday = birthday;         notifyPropertyChanged(com.georgeci.bindingssample.BR.birthday);     }     @Bindable     public boolean isAdult() {         return adult;     }     public void setAdult(boolean adult) {         this.adult = adult;         notifyPropertyChanged(com.georgeci.bindingssample.BR.adult);     } } <\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 BR, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043f\u043e\u043b\u0435\u0439, \u0447\u044c\u0438 \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c <code>@Bindable<\/code>. \u0412 Layout \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c android:text=&quot;@{user.name}&quot;, \u043c\u0435\u043d\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e isAdult \u043d\u0430 adult, c &#8216;is&#8217; \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u043b\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h4>ObservableFields<\/h4>\n<p>  \u0412 \u043f\u0430\u043a\u0435\u0442\u0435 android.databinding \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e binder \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438:  <\/p>\n<ul>\n<li> \u041e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0430\u0434 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438<\/li>\n<li> ObservableField&lt;T&gt;<\/li>\n<li> ObservableArrayMap&lt;K, V&gt;<\/li>\n<li> ObservableArrayList&lt;T&gt;<\/li>\n<\/ul>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c:<\/p>\n<pre><code class=\"java\">public class User extends BaseObservable {     @Bindable     public final ObservableField&lt;String&gt; name = new ObservableField&lt;&gt;();     @Bindable     public final ObservableLong birthday = new ObservableLong();     @Bindable     public final ObservableBoolean adult = new ObservableBoolean();      public User(String name, long birthday, boolean isAdult) {         this.name.set(name);         this.birthday.set(birthday);         this.adult.set(isAdult);     } } <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0435 \u043f\u043e\u043b\u0435? \u041d\u0435 \u0432 \u043c\u043e\u044e \u0441\u043c\u0435\u043d\u0443.<\/b><\/p>\n<div class=\"spoiler_text\">\u0422\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043b\u0435 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043e \u043a\u0430\u043a final, \u0438 \u043f\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043c\u043d\u043e\u0439 \u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439 \u043d\u0430\u0434 \u0442\u0438\u043f\u043e\u043c, \u0442\u043e \u043d\u0435 \u0432\u0438\u0436\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432 \u044d\u0442\u043e\u043c; \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.  <\/div>\n<\/div>\n<p>  \u041f\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a\u043e \u043a\u043b\u044e\u0447\u0443 \u043a Map:<\/p>\n<pre><code class=\"xml\">&lt;TextView    android:text='@{user[&quot;lastName&quot;]}'    android:layout_width=&quot;wrap_content&quot;    android:layout_height=&quot;wrap_content&quot;\/&gt; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0418\u0437 View \u0432 Model<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u0438\u043c\u044f \u0438\u0437 UI, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0432 EditText \u043a \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0432\u043d\u0443\u0442\u0440\u0438 EditText \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f Editable, \u0442\u043e \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043a <code>ObservableField&lt;Editable&gt;<\/code>. \u041d\u043e \u0433\u0434\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442? \u0412\u043e\u0442 \u0442\u0443\u0442 \u0438 \u043d\u0430\u0441\u0442\u0430\u0451\u0442 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f MVVM. \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u043b\u0430\u0441\u0441 SimpleViewMode:<\/p>\n<pre><code class=\"java\">public class Vm extends BaseObservable {     @Bindable     public final ObservableField&lt;Editable&gt; edit = new ObservableField&lt;&gt;();          public Vm() {         this.edit.set(Editable.Factory.getInstance().newEditable(&quot;&quot;));     } } <\/code><\/pre>\n<p>  \u0418\u0437\u043c\u0435\u043d\u044e MainActivity:<\/p>\n<pre><code class=\"java\">public class MainActivity extends AppCompatActivity {      User user;     ActivityMainBinding binding;     Vm vm = new Vm();      @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         binding = DataBindingUtil.setContentView(this, R.layout.activity_main);         user = new User(&quot;Some name&quot;, 668714400L, false);         binding.setUser(user);         binding.setVm(vm);         binding.setClicker(new View.OnClickListener() {             @Override             public void onClick(View v) {                 Toast.makeText(getApplicationContext(), vm.edit.get().toString(), Toast.LENGTH_SHORT).show();             }         });     } } <\/code><\/pre>\n<p>  \u0410 \u0432 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044e:<\/p>\n<pre><code class=\"xml\">&lt;EditText             android:id=&quot;@+id\/edit_text&quot;             android:layout_width=&quot;match_parent&quot;             android:text=&quot;@{vm.edit}&quot;             android:layout_height=&quot;wrap_content&quot;\/&gt; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0442\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c <code>ObservableField&lt;Editable&gt;<\/code> \u043a EditText, \u0442\u043e \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 View. \u041a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Editable, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0436\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 ObservableField, \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0436\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 EditText. <\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u043a\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u0438 \u2014 \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c.<\/p>\n<h4>\u0418\u0442\u043e\u0433<\/h4>\n<p>  \u041e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e \u0431\u044b\u043b\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 Data Binding \u0432 Android \u043e\u0442 Google. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0442\u043e\u0436\u0435 \u043d\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u0440\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u044c \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043d\u0430 \u0441\u043a\u043e\u0440\u0443\u044e \u0435\u0451 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u041f\u043e\u0441\u043b\u0435 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0445\u043e\u0434\u0430 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0441 JavaRX.<\/p>\n<p>  [ <a href=\"https:\/\/developer.android.com\/tools\/data-binding\/guide.html\">\u041e\u0444\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> ]<br \/>  [ <a href=\"https:\/\/github.com\/georgeci\/AndroidBindings\/tree\/master\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043c\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/a> ]             <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/260317\/\"> http:\/\/habrahabr.ru\/post\/260317\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0430\u043d\u0434\u0440\u043e\u0438\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0433\u043e\u0434\u0430, \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u043f\u043e Windows Phone \u0438 \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0432\u044c\u044e \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u0441\u0430\u043c\u0438\u043c View \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 Bindings. \u0410 \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f RX, \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0442\u0430\u043b\u0438 \u0440\u0435\u0448\u0430\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0441\u0442\u043e, \u0432\u044c\u044e-\u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u0434\u0435\u043b\u0438\u043b\u0430\u0441\u044c \u043e\u0442 View. \u041e\u043d\u0430 \u0441\u0442\u0430\u043b\u0430 \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0437\u0430\u0431\u043e\u0442\u044f\u0441\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f. <\/p>\n<p>  \u0412 Android \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u043e\u0433\u043e\u0441\u0442\u0438 \u044f \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b, Activity \u0438\u043b\u0438 Fragment \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u043c\u0435\u044e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u0430\u043a \u043a\u043e View, \u0442\u0430\u043a \u0438 \u043a \u043c\u043e\u0434\u0435\u043b\u0438, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044f \u0440\u0435\u0448\u0430\u044f, \u043a\u0430\u043a\u043e\u0439 View \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0438\u043c, \u0440\u0435\u0448\u0430\u044f \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0447\u0438\u0441\u0442\u043e \u0432\u044c\u044e\u0448\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0434\u043e\u0441\u0442\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u044f\u043b \u043d\u043e\u0432\u043e\u0441\u0442\u044c \u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 Data Binding \u0432 Android \u043d\u0430 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0435\u043c Google IO.<\/p>\n<p>  <iframe loading=\"lazy\" width=\"560\" height=\"349\" src=\"\/\/www.youtube.com\/embed\/f7ihSQ44WO0?wmode=opaque&#038;start=1735\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>  \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0435\u0442\u0430 \u0440\u0435\u043b\u0438\u0437, \u043d\u043e \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0434\u0432\u0438\u0433\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0438\u0437 Google.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-259345","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/259345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=259345"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/259345\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=259345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=259345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=259345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}