-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
supplement
- Loading branch information
Showing
4 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
module-work/src/main/java/com/goldze/work/ui/viewmodel/WorkItemViewModel.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.goldze.work.ui.viewmodel; | ||
|
||
import android.databinding.ObservableField; | ||
import android.support.annotation.NonNull; | ||
|
||
import me.goldze.mvvmhabit.base.BaseViewModel; | ||
import me.goldze.mvvmhabit.base.ItemViewModel; | ||
|
||
/** | ||
* Created by goldze on 2017/7/17. | ||
*/ | ||
|
||
public class WorkItemViewModel extends ItemViewModel { | ||
public ObservableField<String> text = new ObservableField<>(); | ||
|
||
public WorkItemViewModel(@NonNull BaseViewModel viewModel, String text) { | ||
super(viewModel); | ||
this.text.set(text); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:binding="http://schemas.android.com/apk/res-auto"> | ||
|
||
<data> | ||
|
||
<variable | ||
name="viewModel" | ||
type="com.goldze.work.ui.viewmodel.WorkItemViewModel" /> | ||
|
||
</data> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@color/appBackColor" | ||
android:gravity="center" | ||
android:orientation="vertical"> | ||
<ImageView | ||
android:src="@mipmap/ic_launcher" | ||
android:layout_width="50dp" | ||
android:layout_height="50dp" /> | ||
<TextView | ||
android:text="@{viewModel.text}" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" /> | ||
</LinearLayout> | ||
</layout> |