-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(0.9.6): 添加状态页辅助类,添加空白和错误状态页demo
Signed-off-by: free46000 <[email protected]>
- Loading branch information
Showing
10 changed files
with
222 additions
and
108 deletions.
There are no files selected for viewing
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
45 changes: 45 additions & 0 deletions
45
demo/src/main/java/com/freelib/multiitem/demo/state/ItemEmptyAndError.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,45 @@ | ||
package com.freelib.multiitem.demo.state; | ||
|
||
import android.databinding.ViewDataBinding; | ||
|
||
import com.freelib.multiitem.demo.BR; | ||
import com.freelib.multiitem.demo.R; | ||
import com.freelib.multiitem.item.BaseItemState; | ||
|
||
/** | ||
* Created by free46000 on 2017/4/23. | ||
*/ | ||
public class ItemEmptyAndError extends BaseItemState<ItemEmptyAndError> { | ||
private String message; | ||
private String btnText = "点击重试"; | ||
|
||
public ItemEmptyAndError(String message) { | ||
this.message = message; | ||
} | ||
|
||
@Override | ||
protected void onBindViewHolder(ViewDataBinding dataBinding, ItemEmptyAndError data) { | ||
dataBinding.setVariable(BR.itemData, data); | ||
} | ||
|
||
@Override | ||
protected int getItemLayoutId() { | ||
return R.layout.layout_empty_error; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
public String getBtnText() { | ||
return btnText; | ||
} | ||
|
||
public void setBtnText(String btnText) { | ||
this.btnText = btnText; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,34 +1,46 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.ConstraintLayout | ||
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" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
> | ||
<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"> | ||
|
||
<TextView | ||
android:id="@+id/tip_txt" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintBottom_toTopOf="@+id/handler_btn" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintVertical_chainStyle="packed" | ||
tools:text="xin xi" | ||
/> | ||
<data> | ||
|
||
<Button | ||
android:id="@+id/handler_btn" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/tip_txt" | ||
tools:text="xin xi" | ||
/> | ||
</android.support.constraint.ConstraintLayout> | ||
<variable | ||
name="itemData" | ||
type="com.freelib.multiitem.demo.state.ItemEmptyAndError"/> | ||
</data> | ||
|
||
<android.support.constraint.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
> | ||
|
||
<TextView | ||
android:id="@+id/tip_txt" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@{itemData.message}" | ||
app:layout_constraintBottom_toTopOf="@+id/handler_btn" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintVertical_chainStyle="packed" | ||
tools:text="xin xi" | ||
/> | ||
|
||
<Button | ||
android:id="@+id/handler_btn" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:onClick="@{() -> itemData.onStateClickListener.onStateClick()}" | ||
android:text="@{itemData.btnText}" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/tip_txt" | ||
tools:text="xin xi" | ||
/> | ||
</android.support.constraint.ConstraintLayout> | ||
|
||
|
||
</layout> |
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
31 changes: 0 additions & 31 deletions
31
library/src/main/java/com/freelib/multiitem/adapter/holder/BaseItemState.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.