Skip to content

Commit

Permalink
0.0.41.beta4
Browse files Browse the repository at this point in the history
  • Loading branch information
kongzue committed Jul 28, 2021
1 parent 39f5fcb commit 323837c
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class FullScreenDialog extends BaseDialog {

protected OnBindView<FullScreenDialog> onBindView;
protected BOOLEAN privateCancelable;
protected boolean hideZoomBackground;

protected DialogLifecycleCallback<FullScreenDialog> dialogLifecycleCallback;

Expand Down Expand Up @@ -114,6 +115,14 @@ public DialogImpl(View convertView) {
boxBkg = convertView.findViewById(R.id.box_bkg);
bkg = convertView.findViewById(R.id.bkg);
boxCustom = convertView.findViewById(R.id.box_custom);

if (hideZoomBackground) {
dialogView.setBackgroundResource(R.color.black20);
imgZoomActivity.setVisibility(View.GONE);
} else {
dialogView.setBackgroundResource(R.color.black);
imgZoomActivity.setVisibility(View.VISIBLE);
}
init();
dialogImpl = this;
refreshView();
Expand Down Expand Up @@ -164,15 +173,22 @@ public boolean onBackPressed() {
enterAnimDurationTemp = enterAnimDuration;
}

bkg.setY(boxRoot.getHeight());
boxRoot.post(new Runnable() {
@Override
public void run() {
bkgEnterAimY = boxRoot.getSafeHeight() - boxCustom.getHeight();
if (bkgEnterAimY < 0) bkgEnterAimY = 0;
boxRoot.animate()
.setDuration(enterAnimDurationTemp)
.alpha(1f)
.setInterpolator(new DecelerateInterpolator())
.setListener(null);

ObjectAnimator exitAnim = ObjectAnimator.ofFloat(bkg, "y", boxRoot.getHeight(), bkgEnterAimY);
exitAnim.setDuration(enterAnimDurationTemp);
exitAnim.start();
bkg.setVisibility(View.VISIBLE);
}
});

Expand All @@ -181,10 +197,12 @@ public void run() {
public void y(float y) {
float zoomScale = 1 - (boxRoot.getHeight() - y) * 0.00002f;
if (zoomScale > 1) zoomScale = 1;
imgZoomActivity.setScaleX(zoomScale);
imgZoomActivity.setScaleY(zoomScale);

imgZoomActivity.setRadius(dip2px(15) * ((boxRoot.getHeight() - y) / boxRoot.getHeight()));
if (!hideZoomBackground) {
imgZoomActivity.setScaleX(zoomScale);
imgZoomActivity.setScaleY(zoomScale);

imgZoomActivity.setRadius(dip2px(15) * ((boxRoot.getHeight() - y) / boxRoot.getHeight()));
}
}
});

Expand Down Expand Up @@ -226,6 +244,14 @@ public void run() {
});
}

if (hideZoomBackground) {
dialogView.setBackgroundResource(R.color.black20);
imgZoomActivity.setVisibility(View.GONE);
} else {
dialogView.setBackgroundResource(R.color.black);
imgZoomActivity.setVisibility(View.VISIBLE);
}

fullScreenDialogTouchEventInterceptor.refresh(me, this);
}

Expand Down Expand Up @@ -394,6 +420,16 @@ public FullScreenDialog setExitAnimDuration(long exitAnimDuration) {
return this;
}

public boolean isHideZoomBackground() {
return hideZoomBackground;
}

public FullScreenDialog setHideZoomBackground(boolean hideZoomBackground) {
this.hideZoomBackground = hideZoomBackground;
refreshUI();
return this;
}

@Override
public void onUIModeChange(Configuration newConfig) {
if (dialogView != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import com.kongzue.dialogx.R;
import com.kongzue.dialogx.dialogs.BottomDialog;
import com.kongzue.dialogx.dialogs.FullScreenDialog;
import com.kongzue.dialogx.dialogs.PopTip;
import com.kongzue.dialogx.interfaces.BaseDialog;

Expand Down Expand Up @@ -65,7 +68,7 @@ public void onStart() {
Window dialogWindow = getDialog().getWindow();
if (dialogWindow == null) return;
dialogWindow.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);

dialogWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

WindowManager.LayoutParams lp = dialogWindow.getAttributes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ protected void onDetachedFromWindow() {
if (onLifecycleCallBack != null) {
onLifecycleCallBack.onDismiss();
}
onSafeInsetsChangeListener = null;
super.onDetachedFromWindow();
}

Expand Down Expand Up @@ -246,4 +247,6 @@ protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getParentDialog().onUIModeChange(newConfig);
}


}
1 change: 1 addition & 0 deletions DialogX/src/main/res/layout/layout_dialogx_fullscreen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

<com.kongzue.dialogx.util.views.MaxRelativeLayout
android:id="@+id/bkg"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

<com.kongzue.dialogx.util.views.MaxRelativeLayout
android:id="@+id/bkg"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
Expand Down
5 changes: 5 additions & 0 deletions DialogX/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@
<item name="android:padding">0dp</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>

<style name="DialogXBottomMenuAnim">
<item name="android:windowEnterAnimation">@anim/anim_dialogx_bottom_enter</item>
<item name="android:windowExitAnimation">@anim/anim_dialogx_bottom_exit</item>
</style>
</resources>
91 changes: 49 additions & 42 deletions app/src/main/java/com/kongzue/dialogxdemo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,48 +423,55 @@ public void onClick(View v) {
public void onClick(View v) {
if (rdoMaterial.isChecked()) {
//Material 可滑动展开 BottomMenu 演示
BottomMenu.show(new String[]{"添加", "查看", "编辑", "删除", "分享", "评论", "下载", "收藏", "赞!", "不喜欢", "所属专辑", "复制链接", "类似推荐", "添加", "查看", "编辑", "删除", "分享", "评论", "下载", "收藏", "赞!", "不喜欢", "所属专辑", "复制链接", "类似推荐"})
.setOnIconChangeCallBack(new OnIconChangeCallBack(true) {
@Override
public int getIcon(BottomMenu bottomMenu, int index, String menuText) {
switch (menuText) {
case "添加":
return R.mipmap.img_dialogx_demo_add;
case "查看":
return R.mipmap.img_dialogx_demo_view;
case "编辑":
return R.mipmap.img_dialogx_demo_edit;
case "删除":
return R.mipmap.img_dialogx_demo_delete;
case "分享":
return R.mipmap.img_dialogx_demo_share;
case "评论":
return R.mipmap.img_dialogx_demo_comment;
case "下载":
return R.mipmap.img_dialogx_demo_download;
case "收藏":
return R.mipmap.img_dialogx_demo_favorite;
case "赞!":
return R.mipmap.img_dialogx_demo_good;
case "不喜欢":
return R.mipmap.img_dialogx_demo_dislike;
case "所属专辑":
return R.mipmap.img_dialogx_demo_album;
case "复制链接":
return R.mipmap.img_dialogx_demo_link;
case "类似推荐":
return R.mipmap.img_dialogx_demo_recommend;
}
return 0;
}
})
.setOnMenuItemClickListener(new OnMenuItemClickListener<BottomMenu>() {
@Override
public boolean onClick(BottomMenu dialog, CharSequence text, int index) {
PopTip.show(text);
return false;
}
});
//因数据量大,尝试异步线程启动
new Thread(){
@Override
public void run() {
super.run();
BottomMenu.show(new String[]{"添加", "查看", "编辑", "删除", "分享", "评论", "下载", "收藏", "赞!", "不喜欢", "所属专辑", "复制链接", "类似推荐", "添加", "查看", "编辑", "删除", "分享", "评论", "下载", "收藏", "赞!", "不喜欢", "所属专辑", "复制链接", "类似推荐"})
.setOnIconChangeCallBack(new OnIconChangeCallBack(true) {
@Override
public int getIcon(BottomMenu bottomMenu, int index, String menuText) {
switch (menuText) {
case "添加":
return R.mipmap.img_dialogx_demo_add;
case "查看":
return R.mipmap.img_dialogx_demo_view;
case "编辑":
return R.mipmap.img_dialogx_demo_edit;
case "删除":
return R.mipmap.img_dialogx_demo_delete;
case "分享":
return R.mipmap.img_dialogx_demo_share;
case "评论":
return R.mipmap.img_dialogx_demo_comment;
case "下载":
return R.mipmap.img_dialogx_demo_download;
case "收藏":
return R.mipmap.img_dialogx_demo_favorite;
case "赞!":
return R.mipmap.img_dialogx_demo_good;
case "不喜欢":
return R.mipmap.img_dialogx_demo_dislike;
case "所属专辑":
return R.mipmap.img_dialogx_demo_album;
case "复制链接":
return R.mipmap.img_dialogx_demo_link;
case "类似推荐":
return R.mipmap.img_dialogx_demo_recommend;
}
return 0;
}
})
.setOnMenuItemClickListener(new OnMenuItemClickListener<BottomMenu>() {
@Override
public boolean onClick(BottomMenu dialog, CharSequence text, int index) {
PopTip.show(text);
return false;
}
});
}
}.start();
} else {
BottomMenu.show(new String[]{"新标签页中打开", "稍后阅读", "复制链接网址"})
.setMessage("http://www.kongzue.com/DialogX")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

BUILD_VERSION=0.0.41.beta3
BUILD_VERSION=0.0.41.beta4
BUILD_VERSION_INT=40

0 comments on commit 323837c

Please sign in to comment.