santalu / empty-view Goto Github PK
View Code? Open in Web Editor NEWA view that displays state of screen like loading, error, empty
License: Apache License 2.0
A view that displays state of screen like loading, error, empty
License: Apache License 2.0
In recyclerviews with EmptyView I get a lot of visual glitches like List DivisorItem don't appear well and text from a list item disappears and only appears when I make a scroll gesture.
If I rollback to previous version all works normally.
Version that works well- 1.0.5
I love the new animations btw! Congrats!
Codebase needs a blog/wiki on how to use with complete code examples for different scenarios.
How to set text style to bold in ErrorTitle
thanks!!!
Thank you very much
As the title says, would be great if you could add an example for this as I've been trying to do it for a while and haven't had a lot of luck as it gets pretty messy once you use ViewHolder pattern. Thank you!
How can I stop animation
Just have to setVisibility of emptyView to GONE?
I receive this error when trying to use the swipe refresh after I added the emptyview.
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
<?xml version="1.0" encoding="utf-8"?>
<com.santalu.emptyview.EmptyView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/empty_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:emptyButtonText="@string/try_again"
app:emptyButtonTextColor="@color/colorPrimaryDark"
app:emptyDrawable="@drawable/ic_sentiment_dissatisfied"
app:emptyDrawableTint="@color/colorPrimary"
app:emptyGravity="center"
app:emptyText="@string/empty"
app:errorBackgroundColor="@color/red"
app:errorButtonBackgroundColor="@color/white"
app:errorButtonText="@string/try_again"
app:errorButtonTextColor="@color/black"
app:errorDrawable="@drawable/ic_sentiment_very_dissatisfied"
app:errorDrawableTint="@color/white"
app:errorText="@string/emptyview_error_unknown"
app:errorTextColor="@color/white"
app:loadingDrawable="@drawable/ic_sentiment_satisfied"
app:loadingStyle="circular"
app:loadingText="@string/emptyview_loading"
app:loadingTint="@color/colorPrimary">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="15dp"
android:background="#98FB98"
android:visibility="visible">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="#9ACD32"
android:orientation="vertical">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="#9A32CD"
android:lineSpacingExtra="1dp"
android:lineSpacingMultiplier="1.2"
android:padding="16dp"
android:text="@string/lorem" />
<com.santalu.emptyview.EmptyView
android:id="@+id/empty_view1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:emptyDrawable="@drawable/ic_sentiment_dissatisfied"
app:emptyDrawableTint="@color/colorPrimary"
app:emptyGravity="center"
app:emptyText="@string/empty"
app:errorBackgroundColor="@color/red"
app:errorButtonBackgroundColor="@color/white"
app:errorButtonText="@string/try_again"
app:errorButtonTextColor="@color/black"
app:errorDrawable="@drawable/ic_sentiment_very_dissatisfied"
app:errorDrawableTint="@color/white"
app:errorText="@string/emptyview_error_unknown"
app:errorTextColor="@color/white"
app:loadingDrawable="@drawable/ic_sentiment_satisfied"
app:loadingStyle="circular"
app:loadingText="@string/emptyview_loading"
app:loadingTint="@color/colorPrimary">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="15dp"
android:background="#A4D3EE">
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="#A0522D"
android:lineSpacingExtra="1dp"
android:lineSpacingMultiplier="1.2"
android:padding="16dp"
android:text="@string/lorem" />
</LinearLayout>
</com.santalu.emptyview.EmptyView>
</LinearLayout>
</ScrollView>
</com.santalu.emptyview.EmptyView>
Please add method to set button text programmatically.
For instance, if empty button text depends on some condition.
Thanks a lot!
There is an vector drawables issue on old Android devices. You should use AppCompatResources.getDrawable to support old Android versions.
...
mLoadingDrawableRes = a.getResourceId(R.styleable.EmptyView_loadingDrawable, -1);
...
mEmptyDrawableRes = a.getResourceId(R.styleable.EmptyView_emptyDrawable, -1);
...
mErrorDrawableRes = a.getResourceId(R.styleable.EmptyView_errorDrawable, -1);`
private void setIcon(@DrawableRes int emptyDrawableRes, @ColorInt int tint) {
if (emptyDrawableRes == -1) {
mImageView.setVisibility(GONE);
} else {
mImageView.setVisibility(VISIBLE);
mImageView.setImageDrawable(AppCompatResources.getDrawable(getContext(), emptyDrawableRes));
...
}
}
Thanks!
We should add custom font support asap.
Please add the "ev_" prefix in your resources.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.