This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
private final String firstName; | |
private final String lastName; | |
private final boolean loggedIn; | |
public User(String firstName, String lastName, boolean loggedIn) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
this.loggedIn = loggedIn; | |
} | |
public String getFirstName() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ImageButton | |
android:id="@+id/btn_login" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:text="@{user.loggedIn? @string/logout : @string/login}"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ListItemUserBinding binding = DataBindingUtil.inflate(layoutInflater, R.layout.list_item_user, viewGroup, false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
View view = inflater.inflate(R.layout.fragment_user, container, false); | |
FragmentUserBinding bind = DataBindingUtil.bind(view); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
ActivityUserBinding binding = DataBindingUtil.setContentView(this, R.layout.user_activity); | |
User user = new User("firstName", "lastName"); | |
binding.setUser(user); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
ActivityUserBinding binding = DataBindingUtil.setContentView(this, R.layout.user_activity); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
private final String firstName; | |
private final String lastName; | |
public User(String firstName, String lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
public String getFirstName() { | |
return firstName; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
public final String firstName; | |
public final String lastName; | |
public User(String firstName, String lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<data> | |
<variable name="user" type="com.example.User"/> | |
</data> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TextView android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="@{@string/userFullNameLbl + ' ' + user.firstName + ' ' + user.lastName}"/> |
NewerOlder