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
| <ImageView | |
| android:layout_width="@dimen/logo_size" | |
| android:layout_height="@dimen/logo_size" | |
| android:contentDescription="@null" | |
| bind:src="@{logoURL}" | |
| bind:blur="@{20}" | |
| bind:cropCircle="@{true}" | |
| bind:error="@{@drawable/ic_error_black_24dp}" | |
| bind:placeholder="@{@drawable/ic_rowing_black_24dp}" | |
| /> |
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
| /** | |
| * Bind Glide with an ImageView. | |
| * | |
| * @param view the ImageView to bind to Glide. | |
| * @param src The URL of the image to load. | |
| * @param placeholder The placeholder icon. | |
| * @param error The error icon. | |
| * @param blurValue The blur radius value between 1 and 25. | |
| * @param cropCircle Crop the image in a circle of not. | |
| */ |
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
| <ProgressBar | |
| style="?android:attr/progressBarStyleLarge" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:indeterminate="true" | |
| bind:progressColor="@{@android:color/holo_green_dark}" | |
| /> |
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
| @BindingAdapter("progressColor") | |
| public static void setProgressBarColor(ProgressBar loader, int color) { | |
| if (loader != null) { | |
| loader.getIndeterminateDrawable() | |
| .setColorFilter(color, android.graphics.PorterDuff.Mode.SRC_IN); | |
| } | |
| } |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| xmlns:tools="http://schemas.android.com/tools"> | |
| <data> | |
| <variable | |
| name="presenter" | |
| type="com.example.MyPresenter"/> | |
| <variable |
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 MainActivity extends AppCompatActivity { | |
| ActivityMainBinding binding; | |
| MainViewModel viewModel; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| viewModel = new MainViewModel(); | |
| binding = DataBindingUtil.setContentView(this, R.layout.activity_main); | |
| binding.setModel(viewModel); |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| xmlns:tools="http://schemas.android.com/tools"> | |
| <data> | |
| <variable | |
| name="model" | |
| type="com.example.MyModel"/> | |
| </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
| public class TwoWayViewModel extends BaseObservable { | |
| private String username; | |
| @Bindable | |
| public String getUsername() { | |
| return username; | |
| } | |
| public void setUsername(String username) { | |
| this.username = username; |
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
| @OnClick(R.id.my_button) | |
| public void sendToServer(){ | |
| MyData data = getDataFromEditText(); | |
| presenter.makeServerCall(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
| public class MainActivity extends AppCompatActivity { | |
| ActivityMainBinding binding; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| binding = DataBindingUtil.setContentView(this, R.layout.activity_main); | |
| setSupportActionBar(binding.toolbar); | |
| } | |
| } |