vlonjat-gashi / progress-activity Goto Github PK
View Code? Open in Web Editor NEWEasily add loading, empty and error states in your app.
Easily add loading, empty and error states in your app.
When using vector image resources for reverse compatible devices (API level 17) we get
android.content.res.Resources$NotFoundException: File res/drawable/ic_no_wifi.xml from drawable resource ID #0x7f02009b. If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.
implementation 'com.github.vlonjatg:progress-activity:v2.0.3'
not work please release it in jitpack! http://www.methodscount.com/?lib=com.github.vlonjatg%3Aprogress-activity%3Av2.0.4
I'm sorry to ask this, but after doing progressActivity.showLoading() - I don't find any method like progressActivity.StopLoading; can you please point me to the right method to hide loading? Thanks!
If I want to show empty or error layout ,and want to show a part of widget ,And The layout is a child in other widget . and it take no effect. i think the contentViews is incomplete, it must be include the all child view
using or with out using this https://github.com/jineshfrancs/LazyLoadingViews logic we want that effect in this lib
it's in my todo list 💯
This would be a greatly needed customization attribute for this library! Nice work!
I observed your source code and found that there is no shape manipulation of the button, so it is strange how the rounded corners of this button are implemented.
Is this the line?
https://github.com/vlonjatg/progress-activity/blob/25b9ec063df3d0c752e6eb0aa15062be4714178a/library/src/main/java/com/vlonjatg/progressactivity/ProgressConstraintLayout.java#L419
On doing showContent()
, all static views are rendered correctly. However, recycler doesn't show at all.
I have implemented this library in my project, it is very useful library to reduce code and showing good user interface.
It works fine for loading, showing content but when I used skip id in empty content, it is not working, it is taking whole page to show empty content.
` List skipIds = new ArrayList<>();
skipIds.add(R.id.aml_rlUser);
loadingLayout.showEmpty(imgResource, title, message,skipIds);`
how can i replace image when data is empty
it will be awesome if we get GIF drawable support, We can do it by simply adding Glide!!
in your sourcecode you use this code
`
public void addView(@NonNull View child, int index, ViewGroup.LayoutParams params) {
super.addView(child, index, params);
if (child.getTag() == null || (!child.getTag().equals(TAG_LOADING) &&
!child.getTag().equals(TAG_EMPTY) && !child.getTag().equals(TAG_ERROR))) {
contentViews.add(child);
}
}
`
and process the visibility every time we change to different state.
`
private void setContentVisibility(boolean visible, List<Integer> skipIds) {
for (View v : contentViews) {
if (!skipIds.contains(v.getId())) {
v.setVisibility(visible ? View.VISIBLE : View.GONE);
}
}
}
`
which means you will only process the view component in
List<View> contentViews = new ArrayList<>();
but the addView method will not add the child views of a child viewgroup .which means a ImageView is inside a RelativeLayout,and the RelativeLayout is a child of ProgressActivity . In this context ,the ImageView will not be add to the contentViews instance .
so I made some changes
`
public void addView(@NonNull View child, int index, ViewGroup.LayoutParams params) {
super.addView(child, index, params);
if (child.getTag() == null || (!child.getTag().equals(TAG_LOADING) &&
!child.getTag().equals(TAG_EMPTY) && !child.getTag().equals(TAG_ERROR))) {
// contentViews.add(child);
contentViews.addAll(getAllChildren(child));
Log.i("ProgressActivity", "sub children count of ProgressActivity is" + contentViews.size());
}
}
/**
* save all of the direct and indirect children views
*
* @param
*/
private List<View> getAllChildren(View v) {
if (!(v instanceof ViewGroup)) {
List<View> viewArrayList = new ArrayList<>();
viewArrayList.add(v);
return viewArrayList;
} else {
if (((ViewGroup) v).getChildCount() == 0) {
List<View> viewArrayList = new ArrayList<>();
viewArrayList.add(v);
return viewArrayList;
} else {
List<View> result = new ArrayList<>();
ViewGroup vg = (ViewGroup) v;
for (int i = 0; i < vg.getChildCount(); i++) {
View child = vg.getChildAt(i);
List<View> viewArrayList = new ArrayList<>();
viewArrayList.add(v);
viewArrayList.addAll(getAllChildren(child));
result.addAll(viewArrayList);
}
return result;
}
}
}`
now the instance of contentViews includes all of the chilrend and grandson ....component.
one more changes is needed:
`
/**
* set children visibility of StatusLayout
*
* @param visible
* @param skipIds
*/
private void setContentVisibility(boolean visible, List<Integer> skipIds) {
for (View v : contentViews) {
if (!skipIds.contains(v.getId())) {
v.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
}
// when visible is true,which means set content Layout, the skipIds compoent need to be hide
if (visible) {
if (skipIds.contains(v.getId())) {
v.setVisibility(View.INVISIBLE);
}
}
//set parent to be visible when child want to be visible
if (v.getVisibility() == View.VISIBLE) {
setParentToVisible(v);
}
}
}
`
`
public void setParentToVisible(View v) {
ViewParent mParent = v.getParent();
if (mParent != null && mParent instanceof ViewGroup) {
((ViewGroup) mParent).setVisibility(View.VISIBLE);
if (mParent.getParent() != null) {
setParentToVisible((View) mParent);
}
}
}
`
the part of code which I add .means the example ImageView I told in this issue before if i skip to hide it .I needed to set it to visible .but at the same time ,we need to set its parent to be visible ,which is the RelativeLayout -the child of ProgressActivity.
For anyone who meet with this problem's recommendation.
<com.vlonjatg.progressactivity.ProgressActivity xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/progressActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/box_background"
android:padding="12dp"
style="@style/ProgressActivity">
<ExpandableListView
android:id="@+id/exp_lv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:childDivider="@color/box_background"
android:divider="@color/box_background"
android:dividerHeight="12dp" />
</com.vlonjatg.progressactivity.ProgressActivity>
I am using above code but I can't see any loading progress bar after calling progressActivity.showLoading();
smart design.
it will be better if empty view have a retry button
Thank u for your library,while i use it in fragment ,sometimes it does not show the correct view in different state,sometimes the view shows insanity.It troubles me for a long time. @vlonjatg
Firstly, its good library thanks for this!. I am using this library to show network error, in the layout the set these: app:loadingBackgroundColor="#FFFFFF" app:emptyBackgroundColor="#fbc02d" app:errorBackgroundColor="@color/disabled_grey" app:errorButtonTextColor="@color/white" app:errorContentTextColor="@color/Red"
So when I showErr its background must be grey, and yes it works for the first time. Then I have a retry button and again I check the network stat, if not good I call the same showErr method it shows the layout having the drawable I supplied and also the retry button. And the point is it shows me the content of my xml file wic is editable and Ui interactive but it was supposed to be was, it must have shown a grey background (as per this : app:errorBackgroundColor="@color/disabled_grey")
how to handle error on click of Try again for ex. in the case of no connection available..
we have to manually hide or show progress Activity then what’s the meaning of using of this lib..we can achieve this is manually also
I would love the ability to change stroke width of the loading circle. This is useful when changing with width and height.
Attributes are not resolved. There is a mismatch between application package and library.
package="com.vlonjatg.progressactivity"
compile 'com.vlonjatg.android:progress-activity:1.1.1'
When showError is called on progressActivity then app crashes.
Attempt to invoke virtual method 'android.content.res.Resources android.support.v4.app.r.getResources()' on a null object reference
I have also checked if progessActivity is not null
I'd like to add More stylish button to the view,
still following it's callback pattern...
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.