调整弹窗显示
This commit is contained in:
parent
d0b7b065b2
commit
cdf3c4e411
@ -1,6 +1,7 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -21,6 +22,10 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
||||
private OpenAdModel model;
|
||||
private OnItemClickListener<OpenAdModel> mListener;
|
||||
|
||||
public OpenAdCenterDialogPopup(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public OpenAdCenterDialogPopup(@NonNull Context context, OpenAdModel model) {
|
||||
super(context);
|
||||
this.model = model;
|
||||
@ -33,6 +38,7 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
builder.hasShadowBg(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -53,6 +59,7 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
Log.e("-----弹窗-----", "onCreate: 创建弹窗" );
|
||||
mImageView = findViewById(R.id.img);
|
||||
mClose = findViewById(R.id.close);
|
||||
findViewById(R.id.layout).setOnClickListener(v -> dismiss());
|
||||
|
@ -83,12 +83,16 @@ public class OpenAdManager {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static long showTime=0;
|
||||
public synchronized void show(int type, boolean isGuard) {
|
||||
if (list == null) {
|
||||
init(true);
|
||||
return;
|
||||
}
|
||||
if(System.currentTimeMillis()-showTime<100){
|
||||
return;
|
||||
}
|
||||
showTime=System.currentTimeMillis();
|
||||
showType = type;
|
||||
for (OpenAdModel model : list) {
|
||||
if (model.getType() == type) {
|
||||
@ -179,6 +183,10 @@ public class OpenAdManager {
|
||||
if (model.getType() != showType) {
|
||||
return;
|
||||
}
|
||||
if(isShow(model)){
|
||||
Log.i(TAG,"展示过:"+model);
|
||||
return;
|
||||
}
|
||||
showMap.put(model.getId(), true);
|
||||
if (model.getShowModel() == OpenAdModel.SHOW_DIY) {
|
||||
String nextTime= String.valueOf(System.currentTimeMillis() + (Long.parseLong(model.getSection()) * 60 * 1000));
|
||||
|
@ -1,9 +1,12 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
/**
|
||||
@ -15,12 +18,13 @@ public class AndroidBug5497Workaround {
|
||||
// For more information, see https://issuetracker.google.com/issues/36911528
|
||||
// To use this class, simply invoke assistActivity() on an Activity that already has its content view set.
|
||||
|
||||
public static void assistActivity (Activity activity) {
|
||||
public static void assistActivity(Activity activity) {
|
||||
new AndroidBug5497Workaround(activity);
|
||||
}
|
||||
|
||||
private View mChildOfContent;
|
||||
private int usableHeightPrevious;
|
||||
private int defHeight = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
private FrameLayout.LayoutParams frameLayoutParams;
|
||||
|
||||
private AndroidBug5497Workaround(Activity activity) {
|
||||
@ -29,8 +33,14 @@ public class AndroidBug5497Workaround {
|
||||
mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
public void onGlobalLayout() {
|
||||
possiblyResizeChildOfContent();
|
||||
int heightDiff = mChildOfContent.getRootView().getHeight() - mChildOfContent.getHeight();
|
||||
if (heightDiff < 100) {
|
||||
frameLayoutParams.height = defHeight;
|
||||
mChildOfContent.requestLayout();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams();
|
||||
}
|
||||
|
||||
@ -39,7 +49,7 @@ public class AndroidBug5497Workaround {
|
||||
if (usableHeightNow != usableHeightPrevious) {
|
||||
int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight();
|
||||
int heightDifference = usableHeightSansKeyboard - usableHeightNow;
|
||||
if (heightDifference > (usableHeightSansKeyboard/4)) {
|
||||
if (heightDifference > (usableHeightSansKeyboard / 4)) {
|
||||
// keyboard probably just became visible
|
||||
frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
|
||||
} else {
|
||||
|
@ -13,7 +13,7 @@
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:scaleType="fitEnd"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintBottom_toTopOf="@+id/close"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
@ -511,7 +511,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
findViewById(R.id.banner_click).setVisibility(View.GONE);
|
||||
isfloatBannernet = false;
|
||||
}
|
||||
mViewHolders[index].onResume();
|
||||
});
|
||||
//获取指导员账号
|
||||
ConversationIMListManager.get(this).getUserInstructor(this);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yunbao.main.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
@ -107,7 +108,6 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mViewHolders[mViewPager.getCurrentItem()].onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user