Skip to content

Commit

Permalink
优化Loading弹窗
Browse files Browse the repository at this point in the history
  • Loading branch information
junixapp committed Dec 11, 2023
1 parent f2e53c1 commit 3ed711b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
5 changes: 0 additions & 5 deletions library/src/main/java/com/lxj/xpopup/core/BasePopupView.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
Expand All @@ -21,7 +18,6 @@
import android.view.Window;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.animation.LayoutAnimationController;
import android.widget.EditText;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
Expand All @@ -48,7 +44,6 @@
import com.lxj.xpopup.impl.PartShadowPopupView;
import com.lxj.xpopup.util.KeyboardUtils;
import com.lxj.xpopup.util.XPopupUtils;

import java.util.ArrayList;
import java.util.List;

Expand Down
15 changes: 10 additions & 5 deletions library/src/main/java/com/lxj/xpopup/impl/LoadingPopupView.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ protected void setup() {
@Override
public void run() {
if(!firstShow) {
TransitionSet set = new TransitionSet()
.setDuration(getAnimationDuration())
.addTransition(new MaterialFade())
.addTransition(new ChangeBounds());
TransitionManager.beginDelayedTransition(centerPopupContainer, set);
}
TransitionSet set = new TransitionSet()
.setDuration(getAnimationDuration())
.addTransition(new MaterialFade())
.addTransition(new ChangeBounds());
TransitionManager.beginDelayedTransition(centerPopupContainer, set);
if (title == null || title.length() == 0) {
XPopupUtils.setVisible(tv_title, false);
} else {
Expand Down Expand Up @@ -113,4 +113,9 @@ public LoadingPopupView setStyle(Style style){
return this;
}

@Override
protected void onDismiss() {
super.onDismiss();
firstShow = true;
}
}
15 changes: 5 additions & 10 deletions library/src/main/res/layout/_xpopup_center_impl_loading.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,25 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="30dp"
android:paddingBottom="30dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:padding="22dp"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<ProgressBar
android:id="@+id/loadProgress"
android:visibility="gone"
android:layout_width="35dp"
android:layout_height="35dp"/>
android:layout_width="28dp"
android:layout_height="28dp"/>

<com.lxj.xpopup.widget.LoadingView
android:id="@+id/loadview"
android:layout_width="35dp"
android:layout_height="35dp" />
android:layout_width="28dp"
android:layout_height="28dp" />
<TextView
android:id="@+id/tv_title"
android:maxLines="1"
android:text=" "
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:visibility="gone"
android:ellipsize="end"
android:textSize="14sp"
Expand Down

0 comments on commit 3ed711b

Please sign in to comment.