Skip to content

Commit

Permalink
#update refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
wumeng1 authored and wumeng1 committed Aug 20, 2021
1 parent 613ffc1 commit 653a9c4
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/com/mirkowu/mvm/mvvm/MVVMActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public boolean onItemChildLongClick(View view, Object item, int position) {
}
});

binding.stateview.setLoadingState(R.mipmap.ic_launcher, getString(R.string.widget_loading));
binding.stateview.setLoadingState(getString(R.string.widget_loading));
//binding.stateview.setLoadingState(R.mipmap.ic_launcher, getString(R.string.widget_loading));
binding.stateview.setOnRefreshListener(() -> refreshHelper.autoRefresh());

refreshHelper.refresh();
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/res/drawable/anim_loading.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/widget_ic_loading"
android:duration="200" />
<item
android:drawable="@drawable/ivp_camera"
android:duration="200" />
<item
android:drawable="@drawable/ivp_addimage"
android:duration="200" />
<item
android:drawable="@drawable/ivp_delete"
android:duration="200" />
<item
android:drawable="@drawable/ivp_save"
android:duration="200" />
</animation-list>
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_m_v_v_m.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
<com.mirkowu.lib_widget.stateview.StateView
android:id="@+id/stateview"
android:layout_width="match_parent"
app:sv_loadingIcon="@drawable/anim_loading"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public void setLoadData(BaseRVAdapter adapter, List<?> list) {
mRefreshLayout.finishRefresh();
}
adapter.setData(list);

if (mOnRefreshListener != null) {
mOnRefreshListener.onEmptyChange(list == null || list.isEmpty());
}
}

/**
Expand Down
Binary file modified lib_photo/src/main/res/drawable-xxhdpi/ivp_delete.webp
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
android:id="@+id/flDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:layout_gravity="top|end"
android:paddingLeft="8dp"
android:paddingTop="4dp"
android:paddingRight="4dp"
Expand All @@ -33,7 +33,6 @@
android:layout_height="26dp"
android:layout_marginTop="2dp"
android:layout_marginRight="2dp"
android:padding="2dp"
android:src="@drawable/ivp_delete" />
</FrameLayout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ public int getState() {
return mState;
}

public ImageView getLoadingView() {
return ivLoading;
}

public Button getRefreshButton() {
return btnRefresh;
}


private void setState(int state) {
mState = state;
setVisibility(VISIBLE);
Expand Down
9 changes: 5 additions & 4 deletions lib_widget/src/main/res/layout/widget_layout_state_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
android:id="@+id/mRootView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:gravity="center"
android:orientation="vertical">

<ImageView
android:id="@+id/ivLoading"
android:layout_width="100dp"
android:layout_height="80dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="30dp"
android:scaleType="center"
android:adjustViewBounds="true"
android:maxWidth="100dp"
android:scaleType="fitCenter"
android:visibility="gone" />


Expand Down

0 comments on commit 653a9c4

Please sign in to comment.