> getActivityReenterLiveData() {
20 | if (activityReenterLiveData == null) {
21 | activityReenterLiveData = new DPLiveData<>();
22 | }
23 | return activityReenterLiveData;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/DemoCommonUsageInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.demo.base.baseadapter.MultiType;
6 | import razerdp.demo.popup.PopupSource;
7 |
8 | /**
9 | * Created by 大灯泡 on 2019/9/20
10 | *
11 | * Description:
12 | */
13 | public abstract class DemoCommonUsageInfo implements MultiType {
14 | public String title;
15 | public String desc;
16 | public String option;
17 | public boolean sourceVisible = true;
18 | protected PopupSource source;
19 |
20 | protected String name;
21 | protected String javaUrl;
22 | protected String resUrl;
23 |
24 | public DemoCommonUsageInfo() {
25 | }
26 |
27 |
28 | @Override
29 | public int getItemType() {
30 | return 1;
31 | }
32 |
33 | public abstract void toShow(View v);
34 |
35 | public abstract void toOption(View v);
36 |
37 | public void toSource(View v) {
38 | if (source == null) {
39 | source = new PopupSource(v.getContext(), name, javaUrl, resUrl);
40 | }
41 | source.showPopupWindow();
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/DemoCommonUsageTitle.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model;
2 |
3 | import razerdp.demo.base.baseadapter.MultiType;
4 |
5 | /**
6 | * Created by 大灯泡 on 2019/9/20
7 | *
8 | * Description:
9 | */
10 | public class DemoCommonUsageTitle implements MultiType {
11 | public String title;
12 |
13 | public DemoCommonUsageTitle(String title) {
14 | this.title = title;
15 | }
16 |
17 | @Override
18 | public int getItemType() {
19 | return 0;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/DemoMainItem.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model;
2 |
3 | import razerdp.demo.base.baseactivity.BaseActivity;
4 |
5 | /**
6 | * Created by 大灯泡 on 2019/9/20
7 | *
8 | * Description:
9 | */
10 | public class DemoMainItem {
11 |
12 | public Class extends BaseActivity> toClass;
13 | public String title;
14 | public String desc;
15 | public String tag;
16 |
17 | public DemoMainItem(Class extends BaseActivity> toClass, String title, String desc, String tag) {
18 | this.toClass = toClass;
19 | this.title = title;
20 | this.desc = desc;
21 | this.tag = tag;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/DependenceInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model;
2 |
3 | /**
4 | * Created by 大灯泡 on 2019/9/20
5 | *
6 | * Description:
7 | */
8 | public class DependenceInfo {
9 | public String versionIcon;
10 | public String desc;
11 | public String importText;
12 |
13 | public DependenceInfo(String versionIcon, String desc, String importText) {
14 | this.versionIcon = versionIcon;
15 | this.desc = desc;
16 | this.importText = importText;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/api/ApiInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.api;
2 |
3 | import java.io.Serializable;
4 |
5 | import razerdp.demo.ui.apidemo.ApiDemoFragment;
6 | import razerdp.demo.utils.StringUtil;
7 |
8 | /**
9 | * Created by 大灯泡 on 2020/4/4.
10 | */
11 | public class ApiInfo implements Serializable {
12 | private CharSequence api;
13 | private Class extends ApiDemoFragment> fragmentClass;
14 | private String titleText;
15 |
16 | public ApiInfo(CharSequence api, Class extends ApiDemoFragment> fragmentClass) {
17 | this(api, fragmentClass, null);
18 | }
19 |
20 | public ApiInfo(CharSequence api, Class extends ApiDemoFragment> fragmentClass, String titleText) {
21 | this.api = api;
22 | this.fragmentClass = fragmentClass;
23 | this.titleText = titleText;
24 | }
25 |
26 | public CharSequence getApi() {
27 | return api;
28 | }
29 |
30 | public Class extends ApiDemoFragment> getFragmentClass() {
31 | return fragmentClass;
32 | }
33 |
34 | public String getTitleText() {
35 | if (StringUtil.noEmpty(titleText)) {
36 | return titleText;
37 | }
38 | return String.valueOf(api);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/CommonAnimateInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.view.View;
4 | import android.view.animation.Animation;
5 |
6 | import razerdp.demo.model.DemoCommonUsageInfo;
7 | import razerdp.demo.popup.PopupAnimate;
8 | import razerdp.demo.popup.options.PopupAnimateOption;
9 |
10 | /**
11 | * Created by 大灯泡 on 2019/9/20
12 | *
13 | * Description:
14 | */
15 | public class CommonAnimateInfo extends DemoCommonUsageInfo {
16 |
17 | public Animation showAnimation;
18 | public Animation dismissAnimation;
19 | public boolean blur;
20 | public boolean clip;
21 |
22 | PopupAnimateOption popupAnimateOption;
23 | PopupAnimate popupAnimate;
24 |
25 | public CommonAnimateInfo() {
26 | title = "动画展示";
27 | name = "PopupAnimate";
28 | javaUrl = "https://github.com/razerdp/BasePopup/blob/master/app/src/main/java/razerdp/demo/popup/PopupAnimate.java";
29 | resUrl = "https://github.com/razerdp/BasePopup/blob/master/app/src/main/res/layout/popup_animate.xml";
30 | }
31 |
32 | @Override
33 | public void toShow(View v) {
34 | if (popupAnimate == null) {
35 | popupAnimate = new PopupAnimate(v.getContext());
36 | }
37 | popupAnimate.setShowAnimation(showAnimation)
38 | .setDismissAnimation(dismissAnimation)
39 | .setBlurBackgroundEnable(blur)
40 | .setClipChildren(clip);
41 | popupAnimate.showPopupWindow();
42 |
43 | }
44 |
45 | @Override
46 | public void toOption(View v) {
47 | if (popupAnimateOption == null) {
48 | popupAnimateOption = new PopupAnimateOption(v.getContext());
49 | popupAnimateOption.setInfo(this);
50 | }
51 | popupAnimateOption.showPopupWindow(v);
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/CommonArrowInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.view.Gravity;
4 | import android.view.View;
5 |
6 | import razerdp.basepopup.BasePopupWindow;
7 | import razerdp.demo.model.DemoCommonUsageInfo;
8 | import razerdp.demo.popup.PopupArrow;
9 | import razerdp.demo.popup.options.PopupArrowOption;
10 |
11 | /**
12 | * Created by 大灯泡 on 2020/5/6.
13 | */
14 | public class CommonArrowInfo extends DemoCommonUsageInfo {
15 | public int gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
16 | public boolean blur;
17 | public BasePopupWindow.GravityMode gravityMode = BasePopupWindow.GravityMode.RELATIVE_TO_ANCHOR;
18 |
19 | PopupArrow mPopupArrow;
20 | PopupArrowOption mPopupArrowOption;
21 |
22 | public CommonArrowInfo() {
23 | title = "带箭头的Popup";
24 | name="PopupArrow";
25 | javaUrl="https://github.com/razerdp/BasePopup/blob/master/app/src/main/java/razerdp/demo/popup/PopupArrow.java";
26 | resUrl="https://github.com/razerdp/BasePopup/blob/master/app/src/main/res/layout/popup_arrow.xml";
27 | }
28 |
29 | @Override
30 | public void toShow(View v) {
31 | if (mPopupArrow == null) {
32 | mPopupArrow = new PopupArrow(v.getContext());
33 | }
34 | mPopupArrow.setBlurBackgroundEnable(blur);
35 | mPopupArrow.setPopupGravity(gravityMode, gravity);
36 | mPopupArrow.showPopupWindow(v);
37 | }
38 |
39 | @Override
40 | public void toOption(View v) {
41 | if (mPopupArrowOption == null) {
42 | mPopupArrowOption = new PopupArrowOption(v.getContext());
43 | mPopupArrowOption.setInfo(this);
44 | }
45 | mPopupArrowOption.showPopupWindow(v);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/CommonAutoMirrorActivityInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.demo.model.DemoCommonUsageInfo;
6 | import razerdp.demo.ui.ActivityLauncher;
7 | import razerdp.demo.ui.AutoMirrorActivity;
8 | import razerdp.demo.utils.UIHelper;
9 |
10 | /**
11 | * Created by 大灯泡 on 2021/06/18
12 | *
13 | * Description:自动镜像
14 | */
15 | public class CommonAutoMirrorActivityInfo extends DemoCommonUsageInfo {
16 |
17 | public CommonAutoMirrorActivityInfo() {
18 | title = "自动镜像定位";
19 | sourceVisible = false;
20 | }
21 |
22 | @Override
23 | public void toShow(View v) {
24 | ActivityLauncher.start(v.getContext(), AutoMirrorActivity.class);
25 | }
26 |
27 | @Override
28 | public void toOption(View v) {
29 | UIHelper.toast("这里啥都没有哦");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/CommonBackgroundInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.graphics.drawable.Drawable;
4 | import android.view.Gravity;
5 | import android.view.View;
6 |
7 | import razerdp.demo.model.DemoCommonUsageInfo;
8 | import razerdp.demo.popup.DemoPopup;
9 | import razerdp.demo.popup.options.PopupBackgroundOption;
10 |
11 | /**
12 | * Created by 大灯泡 on 2019/9/20.
13 | */
14 | public class CommonBackgroundInfo extends DemoCommonUsageInfo {
15 | public Drawable background;
16 | public boolean blur;
17 |
18 | DemoPopup mDemoPopup;
19 | PopupBackgroundOption mPopupBackgroundOption;
20 |
21 | public CommonBackgroundInfo() {
22 | title = "背景控制";
23 | name = "DemoPopup";
24 | javaUrl = "https://github.com/razerdp/BasePopup/blob/master/app/src/main/java/razerdp/demo/popup/DemoPopup.java";
25 | resUrl = "https://github.com/razerdp/BasePopup/blob/master/app/src/main/res/layout/popup_demo.xml";
26 | }
27 |
28 | @Override
29 | public void toShow(View v) {
30 | if (mDemoPopup == null) {
31 | mDemoPopup = new DemoPopup(v.getContext()).setText("背景控制");
32 | }
33 | mDemoPopup.setBlurBackgroundEnable(blur)
34 | .setBackground(background)
35 | .setPopupGravity(Gravity.CENTER)
36 | .showPopupWindow();
37 |
38 | }
39 |
40 | @Override
41 | public void toOption(View v) {
42 | if (mPopupBackgroundOption == null) {
43 | mPopupBackgroundOption = new PopupBackgroundOption(v.getContext());
44 | mPopupBackgroundOption.setInfo(this);
45 | }
46 | mPopupBackgroundOption.showPopupWindow();
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/CommonDialogActivityInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.demo.model.DemoCommonUsageInfo;
6 | import razerdp.demo.ui.ActivityLauncher;
7 | import razerdp.demo.ui.dialog.DialogActivity;
8 | import razerdp.demo.utils.UIHelper;
9 |
10 | /**
11 | * Created by 大灯泡 on 2020/08/17
12 | *
13 | * Description:dialog activity
14 | */
15 | public class CommonDialogActivityInfo extends DemoCommonUsageInfo {
16 |
17 | public CommonDialogActivityInfo() {
18 | title = "Dialog Activity";
19 | sourceVisible = false;
20 | }
21 |
22 | @Override
23 | public void toShow(View v) {
24 | ActivityLauncher.start(v.getContext(), DialogActivity.class);
25 | }
26 |
27 | @Override
28 | public void toOption(View v) {
29 | UIHelper.toast("这里啥都没有哦");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/CommonFriendCircleInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.demo.model.DemoCommonUsageInfo;
6 | import razerdp.demo.ui.ActivityLauncher;
7 | import razerdp.demo.ui.friendcircle.FriendCircleActivity;
8 | import razerdp.demo.utils.UIHelper;
9 |
10 | /**
11 | * Created by 大灯泡 on 2019/9/24
12 | *
13 | * Description:朋友圈
14 | */
15 | public class CommonFriendCircleInfo extends DemoCommonUsageInfo {
16 |
17 | public CommonFriendCircleInfo() {
18 | title = "朋友圈评论";
19 | name="PopupFriendCircle";
20 | javaUrl="https://github.com/razerdp/BasePopup/blob/master/app/src/main/java/razerdp/demo/popup/PopupFriendCircle.java";
21 | resUrl="https://github.com/razerdp/BasePopup/blob/master/app/src/main/res/layout/popup_friend_circle_comment.xml";
22 | }
23 |
24 | @Override
25 | public void toShow(View v) {
26 | ActivityLauncher.start(v.getContext(), FriendCircleActivity.class);
27 | }
28 |
29 | @Override
30 | public void toOption(View v) {
31 | UIHelper.toast("请到朋友圈页面设置哦");
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/CommonFullScreenActivityInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.demo.model.DemoCommonUsageInfo;
6 | import razerdp.demo.ui.ActivityLauncher;
7 | import razerdp.demo.ui.fullscreen.FullScreenActivity;
8 | import razerdp.demo.utils.UIHelper;
9 |
10 | /**
11 | * Created by 大灯泡 on 2020/05/17
12 | *
13 | * Description:全屏
14 | */
15 | public class CommonFullScreenActivityInfo extends DemoCommonUsageInfo {
16 |
17 | public CommonFullScreenActivityInfo() {
18 | title = "全屏Activity";
19 | sourceVisible = false;
20 | }
21 |
22 | @Override
23 | public void toShow(View v) {
24 | ActivityLauncher.start(v.getContext(), FullScreenActivity.class);
25 | }
26 |
27 | @Override
28 | public void toOption(View v) {
29 | UIHelper.toast("这里啥都没有哦");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/CommonGestureNavInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.demo.model.DemoCommonUsageInfo;
6 | import razerdp.demo.popup.PopupDesc;
7 | import razerdp.demo.utils.RomUtils;
8 |
9 | /**
10 | * Created by 大灯泡 on 2019/9/27
11 | *
12 | * Description:兼容性测试 - 手势导航栏
13 | */
14 | public class CommonGestureNavInfo extends DemoCommonUsageInfo {
15 | PopupDesc popupDesc;
16 |
17 | public CommonGestureNavInfo() {
18 | title = "各种手势导航栏测试\n" + "系统:" + RomUtils.getRomInfo().getName();
19 | name = "PopupDesc";
20 | javaUrl = "https://github.com/razerdp/BasePopup/blob/master/app/src/main/java/razerdp/demo/popup/PopupDesc.java";
21 | resUrl = "https://github.com/razerdp/BasePopup/blob/master/app/src/main/res/layout/popup_description.xml";
22 |
23 | }
24 |
25 | @Override
26 | public void toShow(View v) {
27 | if (popupDesc == null) {
28 | popupDesc = new PopupDesc(v.getContext());
29 | popupDesc.setTitle("手势导航栏测试");
30 | popupDesc.setDesc("主要测试手势导航栏情况下背景蒙层能否铺满");
31 | }
32 | popupDesc.showPopupWindow();
33 | }
34 |
35 | @Override
36 | public void toOption(View v) {
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/CommonRTLInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.demo.model.DemoCommonUsageInfo;
6 | import razerdp.demo.ui.ActivityLauncher;
7 | import razerdp.demo.ui.rtl.RTLActivity;
8 | import razerdp.demo.utils.UIHelper;
9 |
10 | /**
11 | * Created by 大灯泡 on 2020/7/11.
12 | */
13 | public class CommonRTLInfo extends DemoCommonUsageInfo {
14 | public CommonRTLInfo() {
15 | title = "RTL布局";
16 | sourceVisible = false;
17 | }
18 |
19 | @Override
20 | public void toShow(View v) {
21 | ActivityLauncher.start(v.getContext(), RTLActivity.class);
22 | }
23 |
24 | @Override
25 | public void toOption(View v) {
26 | UIHelper.toast("这里啥都没有哦");
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/CommonUpdateInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.demo.model.DemoCommonUsageInfo;
6 | import razerdp.demo.ui.ActivityLauncher;
7 | import razerdp.demo.ui.updatetest.UpdateTestActivity;
8 | import razerdp.demo.utils.UIHelper;
9 |
10 | /**
11 | * Created by 大灯泡 on 2020/12/29.
12 | */
13 | public class CommonUpdateInfo extends DemoCommonUsageInfo {
14 | public CommonUpdateInfo() {
15 | title = "Update()方法测试";
16 | name = "PopupUpdateTest";
17 | javaUrl = "https://github.com/razerdp/BasePopup/blob/master/app/src/main/java/razerdp/demo/popup/PopupUpdateTest.java";
18 | resUrl = "https://github.com/razerdp/BasePopup/blob/master/app/src/main/res/layout/popup_update_test.xml";
19 | }
20 |
21 | @Override
22 | public void toShow(View v) {
23 | ActivityLauncher.start(v.getContext(), UpdateTestActivity.class);
24 | }
25 |
26 | @Override
27 | public void toOption(View v) {
28 | UIHelper.toast("这里啥都没有哦");
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/ScreenRotateActivityInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.demo.model.DemoCommonUsageInfo;
6 | import razerdp.demo.ui.ActivityLauncher;
7 | import razerdp.demo.ui.ScreenRotateActivity;
8 | import razerdp.demo.utils.UIHelper;
9 |
10 | /**
11 | * Created by 大灯泡 on 2020/05/17
12 | *
13 | * Description:屏幕旋转
14 | */
15 | public class ScreenRotateActivityInfo extends DemoCommonUsageInfo {
16 |
17 | public ScreenRotateActivityInfo() {
18 | title = "屏幕旋转";
19 | sourceVisible = false;
20 | }
21 |
22 | @Override
23 | public void toShow(View v) {
24 | ActivityLauncher.start(v.getContext(), ScreenRotateActivity.class);
25 | }
26 |
27 | @Override
28 | public void toOption(View v) {
29 | UIHelper.toast("这里啥都没有哦");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/common/WidthAndHeightLimitInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.common;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.demo.model.DemoCommonUsageInfo;
6 | import razerdp.demo.ui.ActivityLauncher;
7 | import razerdp.demo.ui.SizeLimitActivity;
8 | import razerdp.demo.utils.UIHelper;
9 |
10 | /**
11 | * Created by 大灯泡 on 2021/8/6.
12 | */
13 | public class WidthAndHeightLimitInfo extends DemoCommonUsageInfo {
14 | public WidthAndHeightLimitInfo() {
15 | title = "测试宽高限制";
16 | name = "PopupWidthHeightLimit";
17 | javaUrl = "https://github.com/razerdp/BasePopup/blob/master/app/src/main/java/razerdp/demo/popup/PopupWidthHeightLimit.java";
18 | resUrl = "https://github.com/razerdp/BasePopup/blob/master/app/src/main/res/layout/popup_width_height_limit.xml";
19 | }
20 |
21 | @Override
22 | public void toShow(View v) {
23 | ActivityLauncher.start(v.getContext(), SizeLimitActivity.class);
24 | }
25 |
26 |
27 | @Override
28 | public void toOption(View v) {
29 | UIHelper.toast("这里啥都没有哦");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/friendcircle/FriendCircleInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.friendcircle;
2 |
3 | import android.util.Pair;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by 大灯泡 on 2019/9/24
9 | *
10 | * Description:
11 | */
12 | public class FriendCircleInfo {
13 | public String name;
14 | public String avatar;
15 | public String content;
16 | public List> pics;
17 | public boolean started;
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/issue/IssueInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.issue;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 |
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | import razerdp.demo.base.baseactivity.BaseActivity;
9 |
10 | /**
11 | * Created by 大灯泡 on 2019/9/22.
12 | */
13 | public class IssueInfo {
14 | public String issue;
15 | public String title;
16 | public String desc;
17 | public String url;
18 | public List pics;
19 | public Class extends AppCompatActivity> activityClass;
20 | public boolean finished;
21 |
22 | public IssueInfo() {
23 | pics = new ArrayList<>();
24 | }
25 |
26 | public IssueInfo setIssue(String issue) {
27 | this.issue = issue;
28 | url = "https://github.com/razerdp/BasePopup/issues/" + issue;
29 | return this;
30 | }
31 |
32 | public IssueInfo setTitle(String title) {
33 | this.title = title;
34 | return this;
35 | }
36 |
37 | public IssueInfo setDesc(String desc) {
38 | this.desc = desc;
39 | return this;
40 | }
41 |
42 | public IssueInfo setUrl(String url) {
43 | this.url = url;
44 | return this;
45 | }
46 |
47 | public IssueInfo appendPic(String pic) {
48 | this.pics.add(pic);
49 | return this;
50 | }
51 |
52 | public IssueInfo setActivityClass(Class extends AppCompatActivity> activityClass) {
53 | this.activityClass = activityClass;
54 | return this;
55 | }
56 |
57 | public IssueInfo setFixed(boolean finished) {
58 | this.finished = finished;
59 | return this;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/lifecycle/ShowInServiceInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.lifecycle;
2 |
3 | import android.content.Intent;
4 | import android.view.View;
5 |
6 | import razerdp.demo.model.DemoCommonUsageInfo;
7 | import razerdp.demo.services.DemoService;
8 |
9 | /**
10 | * Created by 大灯泡 on 2020/2/3.
11 | */
12 | public class ShowInServiceInfo extends DemoCommonUsageInfo {
13 | public ShowInServiceInfo() {
14 | title = "在service(或非activity)中弹窗";
15 | }
16 |
17 | @Override
18 | public void toShow(View v) {
19 | Intent intent = new Intent(v.getContext(), DemoService.class);
20 | v.getContext().startService(intent);
21 | }
22 |
23 | @Override
24 | public void toOption(View v) {
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/model/lifecycle/ShowOnCreateInfo.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.model.lifecycle;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.demo.model.DemoCommonUsageInfo;
6 | import razerdp.demo.ui.ActivityLauncher;
7 | import razerdp.demo.ui.lifecycle.ShowOnCreateActivity;
8 |
9 | /**
10 | * Created by 大灯泡 on 2020/2/3.
11 | */
12 | public class ShowOnCreateInfo extends DemoCommonUsageInfo {
13 | public ShowOnCreateInfo() {
14 | title = "在activity#onCreate中弹窗";
15 | }
16 |
17 | @Override
18 | public void toShow(View v) {
19 | ActivityLauncher.start(v.getContext(), ShowOnCreateActivity.class);
20 | }
21 |
22 | @Override
23 | public void toOption(View v) {
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/popup/PopupAnimate.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.popup;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import razerdp.basepopup.BasePopupWindow;
7 | import razerdp.basepopup.R;
8 |
9 | /**
10 | * Created by 大灯泡 on 2019/9/20
11 | *
12 | * Description:
13 | */
14 | public class PopupAnimate extends BasePopupWindow {
15 | public PopupAnimate(Context context) {
16 | super(context);
17 | setContentView(R.layout.popup_animate);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/popup/PopupInput.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.popup;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.view.animation.Animation;
6 |
7 | import razerdp.basepopup.BasePopupWindow;
8 | import razerdp.basepopup.R;
9 | import razerdp.basepopup.databinding.PopupInputBinding;
10 | import razerdp.demo.model.common.CommonInputInfo;
11 | import razerdp.demo.utils.UIHelper;
12 | import razerdp.util.animation.AnimationHelper;
13 | import razerdp.util.animation.TranslationConfig;
14 |
15 | /**
16 | * Created by 大灯泡 on 2019/9/22.
17 | *
18 | * @see CommonInputInfo
19 | */
20 | public class PopupInput extends BasePopupWindow {
21 | PopupInputBinding mBinding;
22 |
23 | public PopupInput(Context context) {
24 | super(context);
25 | setContentView(R.layout.popup_input);
26 | mBinding.tvSend.setOnClickListener(v -> {
27 | UIHelper.toast(mBinding.edInput.getText().toString());
28 | dismiss();
29 | });
30 | }
31 |
32 | @Override
33 | public void onViewCreated(View contentView) {
34 | mBinding = PopupInputBinding.bind(contentView);
35 | }
36 |
37 |
38 | @Override
39 | protected Animation onCreateShowAnimation() {
40 | return AnimationHelper.asAnimation()
41 | .withTranslation(TranslationConfig.FROM_BOTTOM)
42 | .toShow();
43 | }
44 |
45 |
46 | @Override
47 | protected Animation onCreateDismissAnimation() {
48 | return AnimationHelper.asAnimation()
49 | .withTranslation(TranslationConfig.TO_BOTTOM)
50 | .toDismiss();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/popup/PopupShowOnCreate.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.popup;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.view.animation.Animation;
6 |
7 | import razerdp.basepopup.BasePopupWindow;
8 | import razerdp.basepopup.R;
9 | import razerdp.util.animation.AnimationHelper;
10 | import razerdp.util.animation.ScaleConfig;
11 |
12 | /**
13 | * Created by 大灯泡 on 2020/2/3.
14 | */
15 | public class PopupShowOnCreate extends BasePopupWindow {
16 | private onErrorPrintListener mOnErrorPrintListener;
17 |
18 | public PopupShowOnCreate(Context context) {
19 | super(context);
20 | setContentView(R.layout.popup_show_on_create);
21 | }
22 |
23 | @Override
24 | protected Animation onCreateShowAnimation() {
25 | return AnimationHelper.asAnimation()
26 | .withScale(ScaleConfig.CENTER)
27 | .toShow();
28 | }
29 |
30 | @Override
31 | protected Animation onCreateDismissAnimation() {
32 | return AnimationHelper.asAnimation()
33 | .withScale(ScaleConfig.CENTER)
34 | .toDismiss();
35 | }
36 |
37 |
38 | @Override
39 | protected void onLogInternal(String msg) {
40 | super.onLogInternal(msg);
41 | if (mOnErrorPrintListener != null) {
42 | mOnErrorPrintListener.onPrintError(msg);
43 | }
44 | }
45 |
46 | public PopupShowOnCreate setOnErrorPrintListener(onErrorPrintListener onErrorPrintListener) {
47 | mOnErrorPrintListener = onErrorPrintListener;
48 | return this;
49 | }
50 |
51 | public interface onErrorPrintListener {
52 | void onPrintError(String msg);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/popup/PopupSlide.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.popup;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.widget.TextView;
6 |
7 | import razerdp.basepopup.BasePopupWindow;
8 | import razerdp.basepopup.R;
9 | import razerdp.basepopup.databinding.PopupSlideBinding;
10 | import razerdp.demo.utils.UIHelper;
11 |
12 | /**
13 | * Created by 大灯泡 on 2019/9/20
14 | *
15 | * Description:{@link razerdp.demo.model.common.CommonSlideInfo}
16 | */
17 | public class PopupSlide extends BasePopupWindow {
18 | PopupSlideBinding mBinding;
19 |
20 | public PopupSlide(Context context) {
21 | super(context);
22 | setContentView(R.layout.popup_slide);
23 | setViewClickListener(this::click, mBinding.tvItem1, mBinding.tvItem2, mBinding.tvItem3);
24 | }
25 |
26 | @Override
27 | public void onViewCreated(View contentView) {
28 | mBinding = PopupSlideBinding.bind(contentView);
29 | }
30 |
31 | void click(View v) {
32 | UIHelper.toast(((TextView) v).getText().toString());
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/popup/PopupSlideSmall.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.popup;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.widget.TextView;
6 |
7 | import razerdp.basepopup.BasePopupWindow;
8 | import razerdp.basepopup.R;
9 | import razerdp.basepopup.databinding.PopupSlideSmallBinding;
10 | import razerdp.demo.model.common.CommonSlideInfo;
11 | import razerdp.demo.utils.UIHelper;
12 |
13 | /**
14 | * Created by 大灯泡 on 2019/9/20
15 | *
16 | * Description:{@link CommonSlideInfo}
17 | */
18 | public class PopupSlideSmall extends BasePopupWindow {
19 | PopupSlideSmallBinding mBinding;
20 |
21 | public PopupSlideSmall(Context context) {
22 | super(context);
23 | setContentView(R.layout.popup_slide_small);
24 | setViewClickListener(this::click, mBinding.tvItem1, mBinding.tvItem2, mBinding.tvItem3);
25 | }
26 |
27 | @Override
28 | public void onViewCreated(View contentView) {
29 | mBinding = PopupSlideSmallBinding.bind(contentView);
30 | }
31 |
32 |
33 | void click(View v) {
34 | UIHelper.toast(((TextView) v).getText().toString());
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/popup/common/PopupOptionsPickerView.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.popup.common;
2 |
3 | import android.view.View;
4 |
5 | import com.bigkoo.pickerview.configure.PickerOptions;
6 | import com.bigkoo.pickerview.view.OptionsPickerView;
7 |
8 | /**
9 | * Created by 大灯泡 on 2019/8/14
10 | *
11 | * Description:用于popup的picker,主要是防止select之后立刻dismiss导致消失的问题
12 | */
13 | public class PopupOptionsPickerView extends OptionsPickerView {
14 | public PopupOptionsPickerView(PickerOptions pickerOptions) {
15 | super(pickerOptions);
16 | }
17 |
18 | @Override
19 | public void onClick(View v) {
20 | String tag = (String) v.getTag();
21 | if (tag.equals("submit")) {
22 | returnData();
23 | } else if (tag.equals("cancel")) {
24 | if (mPickerOptions.cancelListener != null) {
25 | mPickerOptions.cancelListener.onClick(v);
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/popup/issue/PopupIssue210.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.popup.issue;
2 |
3 | import android.content.Context;
4 | import android.view.Gravity;
5 | import android.view.View;
6 | import android.view.animation.Animation;
7 |
8 | import razerdp.basepopup.BasePopupWindow;
9 | import razerdp.basepopup.R;
10 | import razerdp.basepopup.databinding.PopupIssue210Binding;
11 | import razerdp.util.animation.AnimationHelper;
12 | import razerdp.util.animation.TranslationConfig;
13 |
14 | /**
15 | * Created by 大灯泡 on 2019/9/22.
16 | */
17 | public class PopupIssue210 extends BasePopupWindow {
18 | PopupIssue210Binding mBinding;
19 |
20 | public PopupIssue210(Context context) {
21 | super(context);
22 | setContentView(R.layout.popup_issue_210);
23 | setPopupGravity(Gravity.BOTTOM);
24 | mBinding.tvGo.setOnClickListener(v -> dismiss());
25 | }
26 |
27 | @Override
28 | public void onViewCreated(View contentView) {
29 | mBinding = PopupIssue210Binding.bind(contentView);
30 | }
31 |
32 |
33 | @Override
34 | protected Animation onCreateShowAnimation() {
35 | return AnimationHelper.asAnimation()
36 | .withTranslation(TranslationConfig.FROM_TOP)
37 | .toShow();
38 | }
39 |
40 |
41 | @Override
42 | protected Animation onCreateDismissAnimation() {
43 | return AnimationHelper.asAnimation()
44 | .withTranslation(TranslationConfig.TO_TOP)
45 | .toDismiss();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/popup/issue/PopupIssue236.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.popup.issue;
2 |
3 | import android.content.Context;
4 | import android.view.Gravity;
5 | import android.view.View;
6 | import android.view.animation.Animation;
7 |
8 | import razerdp.basepopup.BasePopupWindow;
9 | import razerdp.basepopup.R;
10 | import razerdp.basepopup.databinding.PopupIssue236Binding;
11 | import razerdp.util.animation.AnimationHelper;
12 | import razerdp.util.animation.TranslationConfig;
13 |
14 | /**
15 | * Created by 大灯泡 on 2020/02/11.
16 | */
17 | public class PopupIssue236 extends BasePopupWindow {
18 | PopupIssue236Binding mBinding;
19 |
20 | public PopupIssue236(Context context) {
21 | super(context);
22 | setContentView(R.layout.popup_issue_236);
23 | setPopupGravity(Gravity.BOTTOM);
24 | mBinding.tvGo.setOnClickListener(v -> dismiss());
25 | }
26 |
27 | @Override
28 | public void onViewCreated(View contentView) {
29 | mBinding = PopupIssue236Binding.bind(contentView);
30 | }
31 |
32 | @Override
33 | protected Animation onCreateShowAnimation() {
34 | return AnimationHelper.asAnimation()
35 | .withTranslation(TranslationConfig.FROM_TOP)
36 | .toShow();
37 | }
38 |
39 |
40 | @Override
41 | protected Animation onCreateDismissAnimation() {
42 | return AnimationHelper.asAnimation()
43 | .withTranslation(TranslationConfig.TO_TOP)
44 | .toDismiss();
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/popup/options/BaseOptionPopup.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.popup.options;
2 |
3 | import android.content.Context;
4 | import android.view.Gravity;
5 | import android.view.animation.Animation;
6 |
7 | import razerdp.basepopup.BasePopupWindow;
8 | import razerdp.demo.model.DemoCommonUsageInfo;
9 | import razerdp.util.animation.AnimationHelper;
10 | import razerdp.util.animation.TranslationConfig;
11 |
12 | /**
13 | * Created by 大灯泡 on 2019/9/20.
14 | */
15 | public abstract class BaseOptionPopup extends BasePopupWindow {
16 | protected T mInfo;
17 |
18 | public BaseOptionPopup(Context context) {
19 | super(context);
20 | setPopupGravity(Gravity.BOTTOM);
21 | }
22 |
23 | @Override
24 | protected Animation onCreateShowAnimation() {
25 | return AnimationHelper.asAnimation()
26 | .withTranslation(TranslationConfig.FROM_TOP)
27 | .toShow();
28 | }
29 |
30 |
31 | @Override
32 | protected Animation onCreateDismissAnimation() {
33 | return AnimationHelper.asAnimation()
34 | .withTranslation(TranslationConfig.TO_TOP)
35 | .toDismiss();
36 | }
37 |
38 | public BaseOptionPopup setInfo(T info) {
39 | mInfo = info;
40 | return this;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/popup/options/PopupAnyPosOption.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.popup.options;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import androidx.annotation.NonNull;
7 | import razerdp.basepopup.R;
8 | import razerdp.basepopup.databinding.PopupOptionAnyposBinding;
9 | import razerdp.demo.model.common.CommonAnyPosInfo;
10 |
11 | /**
12 | * Created by 大灯泡 on 2019/9/20.
13 | *
14 | * @see CommonAnyPosInfo
15 | */
16 | public class PopupAnyPosOption extends BaseOptionPopup {
17 | PopupOptionAnyposBinding mBinding;
18 |
19 | public PopupAnyPosOption(Context context) {
20 | super(context);
21 | setContentView(R.layout.popup_option_anypos);
22 | mBinding.tvGo.setOnClickListener(v -> ok());
23 | }
24 |
25 | @Override
26 | public void onViewCreated(@NonNull View contentView) {
27 | mBinding = PopupOptionAnyposBinding.bind(contentView);
28 | }
29 |
30 | void ok() {
31 | mInfo.outSideTouchable = mBinding.checkOutsideTouch.isChecked();
32 | mInfo.blur = mBinding.checkBlur.isChecked();
33 | dismiss();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/popup/options/PopupCircleOption.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.popup.options;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.view.animation.Animation;
6 |
7 | import androidx.annotation.NonNull;
8 | import razerdp.basepopup.R;
9 | import razerdp.basepopup.databinding.PopupOptionCircleBinding;
10 | import razerdp.demo.popup.PopupFriendCircle;
11 | import razerdp.util.animation.AnimationHelper;
12 | import razerdp.util.animation.TranslationConfig;
13 |
14 | /**
15 | * Created by 大灯泡 on 2019/9/22.
16 | */
17 | public class PopupCircleOption extends BaseOptionPopup {
18 | PopupOptionCircleBinding mBinding;
19 |
20 | public PopupCircleOption(Context context) {
21 | super(context);
22 | setContentView(R.layout.popup_option_circle);
23 | mBinding.tvGo.setOnClickListener(v -> ok());
24 | }
25 |
26 | @Override
27 | public void onViewCreated(@NonNull View contentView) {
28 | mBinding = PopupOptionCircleBinding.bind(contentView);
29 | }
30 |
31 | @Override
32 | protected Animation onCreateShowAnimation() {
33 | return AnimationHelper.asAnimation()
34 | .withTranslation(TranslationConfig.FROM_BOTTOM)
35 | .toShow();
36 | }
37 |
38 |
39 | @Override
40 | protected Animation onCreateDismissAnimation() {
41 | return AnimationHelper.asAnimation()
42 | .withTranslation(TranslationConfig.TO_BOTTOM)
43 | .toDismiss();
44 | }
45 |
46 | void ok() {
47 | PopupFriendCircle.blur = mBinding.checkBlur.isChecked();
48 | PopupFriendCircle.outSideTouch = mBinding.checkOutsidetouch.isChecked();
49 | PopupFriendCircle.link = mBinding.checkLink.isChecked();
50 | dismiss();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/services/DemoService.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.services;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 | import android.os.IBinder;
6 | import android.view.Gravity;
7 |
8 | import razerdp.demo.popup.DemoPopup;
9 | import razerdp.util.animation.AlphaConfig;
10 | import razerdp.util.animation.AnimationHelper;
11 |
12 | /**
13 | * Created by 大灯泡 on 2019/5/16
14 | *
15 | * Description:
16 | */
17 | public class DemoService extends Service {
18 | private static final String TAG = "DemoService";
19 | DemoPopup demoPopup;
20 |
21 |
22 | @Override
23 | public int onStartCommand(Intent intent, int flags, int startId) {
24 | if (demoPopup == null) {
25 | demoPopup = new DemoPopup(getApplicationContext());
26 | demoPopup.setPopupGravity(Gravity.CENTER)
27 | .setBlurBackgroundEnable(true)
28 | .setShowAnimation(AnimationHelper.asAnimation()
29 | .withAlpha(AlphaConfig.IN)
30 | .toShow())
31 | .setDismissAnimation(AnimationHelper.asAnimation()
32 | .withAlpha(AlphaConfig.OUT)
33 | .toDismiss());
34 | demoPopup.setText("在Service弹出Popup,创建该Popup的context:" + getApplicationContext());
35 | }
36 | demoPopup.showPopupWindow();
37 | return super.onStartCommand(intent, flags, startId);
38 | }
39 |
40 | @Override
41 | public IBinder onBind(Intent intent) {
42 | return null;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/ui/ScreenRotateActivity.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.ui;
2 |
3 | import android.content.Intent;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.widget.TextView;
7 |
8 | import androidx.viewbinding.ViewBinding;
9 | import razerdp.basepopup.databinding.ActivityRotateBinding;
10 | import razerdp.demo.base.baseactivity.BaseActivity;
11 | import razerdp.demo.base.baseactivity.BaseBindingActivity;
12 | import razerdp.demo.model.common.CommonSlideInfo;
13 | import razerdp.demo.utils.DescBuilder;
14 |
15 | /**
16 | * Created by 大灯泡 on 2021/5/10
17 | *
18 | * Description:
19 | */
20 | public class ScreenRotateActivity extends BaseBindingActivity {
21 | public static final String DESC = DescBuilder.get()
22 | .append("测试屏幕旋转")
23 | .build();
24 | CommonSlideInfo info;
25 |
26 | @Override
27 | protected void onHandleIntent(Intent intent) {
28 |
29 | }
30 |
31 | @Override
32 | public ActivityRotateBinding onCreateViewBinding(LayoutInflater layoutInflater) {
33 | return ActivityRotateBinding.inflate(layoutInflater);
34 | }
35 |
36 | @Override
37 | protected void onInitView(View decorView) {
38 | info = new CommonSlideInfo();
39 | mBinding.tvShow.setOnClickListener(v -> info.toShow(v));
40 | mBinding.tvSetting.setOnClickListener(v -> info.toOption(v));
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/ui/apidemo/ApiDemoFragment.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.ui.apidemo;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.viewbinding.ViewBinding;
5 | import razerdp.demo.base.baseactivity.BaseFragment;
6 |
7 | /**
8 | * Created by 大灯泡 on 2020/4/4.
9 | */
10 | public abstract class ApiDemoFragment extends BaseFragment {
11 |
12 | protected void onInitSettingPopup(@NonNull ApiDemoActivity.SimpleSelectorPopupConfig config) {
13 |
14 | }
15 |
16 | protected void onSettingPopupSelected(String selected, int index) {
17 |
18 | }
19 |
20 | protected void onSettingClick() {
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/ui/apidemo/fragments/BackPressEnableApiFragment.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.ui.apidemo.fragments;
2 |
3 | import android.view.LayoutInflater;
4 | import android.view.View;
5 |
6 | import androidx.annotation.NonNull;
7 | import androidx.viewbinding.ViewBinding;
8 | import razerdp.basepopup.databinding.ApiDemoBackpressEnableBinding;
9 | import razerdp.demo.popup.DemoPopup;
10 | import razerdp.demo.ui.apidemo.ApiDemoActivity;
11 | import razerdp.demo.ui.apidemo.ApiDemoFragment;
12 |
13 | /**
14 | * Created by 大灯泡 on 2020/4/4.
15 | * backpressenable
16 | */
17 | public class BackPressEnableApiFragment extends ApiDemoFragment {
18 | DemoPopup mDemoPopup;
19 | boolean backPressEnable = true;
20 |
21 | @Override
22 | public ApiDemoBackpressEnableBinding onCreateViewBinding(LayoutInflater layoutInflater) {
23 | return ApiDemoBackpressEnableBinding.inflate(layoutInflater);
24 | }
25 |
26 | @Override
27 | protected void onInitViews(View mRootView) {
28 | mViewBinding.tvTest.setOnClickListener(v -> show());
29 | }
30 |
31 | @Override
32 | protected void onInitSettingPopup(@NonNull ApiDemoActivity.SimpleSelectorPopupConfig config) {
33 | config.setTitle("是否允许返回键Dismiss")
34 | .append("true")
35 | .append("false");
36 | }
37 |
38 | @Override
39 | protected void onSettingPopupSelected(String selected, int index) {
40 | backPressEnable = index == 0;
41 | }
42 |
43 |
44 | void show() {
45 | if (mDemoPopup == null) {
46 | mDemoPopup = new DemoPopup(this);
47 | }
48 | mDemoPopup.setBackPressEnable(backPressEnable)
49 | .showPopupWindow();
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/ui/apidemo/fragments/FadeEnableApiFragment.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.ui.apidemo.fragments;
2 |
3 | import android.view.LayoutInflater;
4 | import android.view.View;
5 |
6 | import androidx.annotation.NonNull;
7 | import androidx.viewbinding.ViewBinding;
8 | import razerdp.basepopup.databinding.ApiDemoFadeEnableBinding;
9 | import razerdp.demo.popup.DemoPopup;
10 | import razerdp.demo.ui.apidemo.ApiDemoActivity;
11 | import razerdp.demo.ui.apidemo.ApiDemoFragment;
12 |
13 | /**
14 | * Created by 大灯泡 on 2020/4/4.
15 | * fadeenable
16 | */
17 | public class FadeEnableApiFragment extends ApiDemoFragment {
18 | DemoPopup mDemoPopup;
19 | boolean fadeEnable = true;
20 |
21 | @Override
22 | public ApiDemoFadeEnableBinding onCreateViewBinding(LayoutInflater layoutInflater) {
23 | return ApiDemoFadeEnableBinding.inflate(layoutInflater);
24 | }
25 |
26 | @Override
27 | protected void onInitViews(View mRootView) {
28 | mViewBinding.tvTest.setOnClickListener(v -> this.show());
29 | }
30 |
31 | @Override
32 | protected void onInitSettingPopup(@NonNull ApiDemoActivity.SimpleSelectorPopupConfig config) {
33 | config.setTitle("淡入淡出功能")
34 | .append("开启淡入淡出")
35 | .append("关闭淡入淡出");
36 | }
37 |
38 | @Override
39 | protected void onSettingPopupSelected(String selected, int index) {
40 | fadeEnable = index == 0;
41 | }
42 |
43 |
44 | void show() {
45 | if (mDemoPopup == null) {
46 | mDemoPopup = new DemoPopup(this);
47 | }
48 | mDemoPopup.setPopupFadeEnable(fadeEnable)
49 | .showPopupWindow();
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/ui/issuestest/Issue210TestActivity.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.ui.issuestest;
2 |
3 | import android.content.Intent;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.widget.TextView;
7 |
8 | import androidx.appcompat.widget.AppCompatCheckBox;
9 | import androidx.viewbinding.ViewBinding;
10 | import razerdp.basepopup.databinding.ActivityIssue210Binding;
11 | import razerdp.demo.base.baseactivity.BaseActivity;
12 | import razerdp.demo.base.baseactivity.BaseBindingActivity;
13 | import razerdp.demo.popup.issue.PopupIssue210;
14 |
15 | /**
16 | * Created by 大灯泡 on 2019/9/22.
17 | *
18 | * 针对Issue:https://github.com/razerdp/BasePopup/issues/210
19 | */
20 | public class Issue210TestActivity extends BaseBindingActivity {
21 | PopupIssue210 mPopupIssue210;
22 |
23 | @Override
24 | protected void onHandleIntent(Intent intent) {
25 |
26 | }
27 |
28 | @Override
29 | public ActivityIssue210Binding onCreateViewBinding(LayoutInflater layoutInflater) {
30 | return ActivityIssue210Binding.inflate(layoutInflater);
31 | }
32 |
33 | @Override
34 | protected void onInitView(View decorView) {
35 | mBinding.tvBar.setOnClickListener(v -> show(v));
36 |
37 | }
38 |
39 | void show(View v) {
40 | if (mPopupIssue210 == null) {
41 | mPopupIssue210 = new PopupIssue210(this);
42 | }
43 | mPopupIssue210.setOutSideTouchable(mBinding.checkOutsideTouch.isChecked());
44 | mPopupIssue210.showPopupWindow(v);
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/ui/issuestest/Issue230TestActivity.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.ui.issuestest;
2 |
3 | import android.content.Intent;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 |
7 | import androidx.viewbinding.ViewBinding;
8 | import razerdp.basepopup.databinding.ActivityIssue230Binding;
9 | import razerdp.demo.base.baseactivity.BaseActivity;
10 | import razerdp.demo.base.baseactivity.BaseBindingActivity;
11 | import razerdp.demo.popup.issue.PopupIssue230;
12 | import razerdp.demo.widget.DPTextView;
13 |
14 | /**
15 | * Created by 大灯泡 on 2019/10/8.
16 | *
17 | * https://github.com/razerdp/BasePopup/issues/230
18 | */
19 | public class Issue230TestActivity extends BaseBindingActivity {
20 |
21 | @Override
22 | protected void onHandleIntent(Intent intent) {
23 |
24 | }
25 |
26 | @Override
27 | public ActivityIssue230Binding onCreateViewBinding(LayoutInflater layoutInflater) {
28 | return ActivityIssue230Binding.inflate(layoutInflater);
29 | }
30 |
31 | @Override
32 | protected void onInitView(View decorView) {
33 | mBinding.tvShow.setOnClickListener(v -> show());
34 |
35 | }
36 |
37 | void show() {
38 | new PopupIssue230(this).showPopupWindow();
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/ui/photobrowser/IPhotoBrowserExitViewProvider.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.ui.photobrowser;
2 |
3 | import android.widget.ImageView;
4 |
5 | /**
6 | * Created by 大灯泡 on 2019/8/22
7 | *
8 | * Description:
9 | */
10 | public interface IPhotoBrowserExitViewProvider {
11 | ImageView onGetTransitionExitView(ImageView from, int exitPosition);
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/ui/photobrowser/IPhotoBrowserProvider.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.ui.photobrowser;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by 大灯泡 on 2019/8/22
7 | *
8 | * Description:
9 | */
10 | public interface IPhotoBrowserProvider extends Serializable {
11 |
12 | String getPhoto();
13 |
14 | String getThumb();
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/ui/photobrowser/PhotoBrowserImpl.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.ui.photobrowser;
2 |
3 | import androidx.annotation.Nullable;
4 |
5 | import java.util.ArrayList;
6 | import java.util.Collections;
7 | import java.util.List;
8 |
9 | import razerdp.demo.utils.ToolUtil;
10 |
11 | /**
12 | * Created by 大灯泡 on 2019/8/22
13 | *
14 | * Description:
15 | */
16 | public class PhotoBrowserImpl implements IPhotoBrowserProvider {
17 | private String url;
18 | private String thumb;
19 |
20 | public PhotoBrowserImpl(String url) {
21 | this(url, null);
22 | }
23 |
24 | public PhotoBrowserImpl(String url, String thumb) {
25 | this.url = url;
26 | this.thumb = thumb;
27 | }
28 |
29 | @Override
30 | public String getPhoto() {
31 | return url;
32 | }
33 |
34 | @Override
35 | public String getThumb() {
36 | return thumb;
37 | }
38 |
39 |
40 | public static List fromList(List urls, @Nullable List thumbs) {
41 | if (ToolUtil.isEmpty(urls)) {
42 | return Collections.emptyList();
43 | }
44 | List result = new ArrayList<>(urls.size());
45 | for (String url : urls) {
46 | result.add(new PhotoBrowserImpl(url));
47 | }
48 | if (thumbs != null && thumbs.size() > 0) {
49 | for (int i = 0; i < result.size(); i++) {
50 | if (ToolUtil.indexIn(thumbs, i)) {
51 | PhotoBrowserImpl ret = (PhotoBrowserImpl) result.get(i);
52 | ret.thumb = thumbs.get(i);
53 | }
54 | }
55 | }
56 | return result;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/DescBuilder.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by 大灯泡 on 2019/9/20
8 | *
9 | * Description:
10 | */
11 | public class DescBuilder {
12 | private static final String SEP = "• ";
13 | private List datas;
14 |
15 | private DescBuilder() {
16 | datas = new ArrayList<>();
17 | }
18 |
19 | public static DescBuilder get() {
20 | return new DescBuilder();
21 | }
22 |
23 | public DescBuilder append(String desc) {
24 | datas.add(desc);
25 | return this;
26 | }
27 |
28 | public String build() {
29 | StringBuilder builder = new StringBuilder();
30 | for (int i = 0; i < datas.size(); i++) {
31 | builder.append(SEP)
32 | .append(datas.get(i));
33 | if (i < datas.size() - 1) {
34 | builder.append('\n');
35 | }
36 | }
37 | return builder.toString();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/DimensUtils.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Created by 大灯泡 on 2016/1/16.
7 | */
8 | public class DimensUtils {
9 | /**
10 | * dip转px
11 | */
12 | public static int dipToPx(Context context, float dip) {
13 | return (int) (dip * context.getResources().getDisplayMetrics().density + 0.5f);
14 | }
15 |
16 | /**
17 | * px转dip
18 | */
19 | public static int pxToDip(Context context, float pxValue) {
20 | final float scale = context.getResources().getDisplayMetrics().density;
21 | return (int) (pxValue / scale + 0.5f);
22 | }
23 |
24 | /**
25 | * 将sp值转换为px值
26 | */
27 | public static int sp2px(Context context, float spValue) {
28 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
29 | return (int) (spValue * fontScale + 0.5f);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/NumberFormatUtil.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils;
2 |
3 | import java.math.RoundingMode;
4 | import java.text.DecimalFormat;
5 |
6 | /**
7 | * Created by 大灯泡 on 2019/4/24.
8 | */
9 | public class NumberFormatUtil {
10 |
11 | /**
12 | * etc. 120,000,000,000
13 | */
14 | public static DecimalFormat format0 = new DecimalFormat(",###");
15 | /**
16 | * etc. 120000000000.15
17 | */
18 | public static DecimalFormat format2 = new DecimalFormat("#.##");
19 |
20 | static {
21 | //不允许四舍五入
22 | format2.setRoundingMode(RoundingMode.FLOOR);
23 | }
24 |
25 | public static String format2(double num) {
26 | return format2.format(num);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/OnClickListenerWrapper.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * Created by 大灯泡 on 2018/11/20.
7 | */
8 | public abstract class OnClickListenerWrapper implements View.OnClickListener {
9 | T data;
10 |
11 | public T getData() {
12 | return data;
13 | }
14 |
15 | public OnClickListenerWrapper setData(T data) {
16 | this.data = data;
17 | return this;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/ToastUtils.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils;
2 |
3 | import android.content.Context;
4 | import android.widget.Toast;
5 |
6 | /**
7 | * Created by 大灯泡 on 2016/1/15.
8 | */
9 | public class ToastUtils {
10 |
11 | public static void ToastMessage(Context context, String msg) {
12 | Toast.makeText(context,msg,Toast.LENGTH_SHORT).show();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/VersionUtil.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageInfo;
5 | import android.content.pm.PackageManager;
6 |
7 | import razerdp.demo.app.AppContext;
8 |
9 |
10 | public class VersionUtil {
11 |
12 | public static String getAppVersionName() {
13 | try {
14 | String versionName = "";
15 | Context context = AppContext.getAppContext();
16 | PackageManager packageManager = context.getPackageManager();
17 | String packageName = context.getPackageName();
18 | PackageInfo packageInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_CONFIGURATIONS);
19 | versionName = packageInfo.versionName;
20 | return versionName;
21 | } catch (Exception e) {
22 | e.printStackTrace();
23 | return "";
24 | }
25 | }
26 |
27 | public static int getAppVersionCode() {
28 | try {
29 | Context context = AppContext.getAppContext();
30 | PackageManager packageManager = context.getPackageManager();
31 | String packageName = context.getPackageName();
32 | int versionCode = 0;
33 | PackageInfo packageInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_CONFIGURATIONS);
34 | versionCode = packageInfo.versionCode;
35 | return versionCode;
36 | } catch (Exception e) {
37 | e.printStackTrace();
38 | return 0;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/gson/DoubleDefaultAdapter.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils.gson;
2 |
3 | import com.google.gson.JsonDeserializationContext;
4 | import com.google.gson.JsonDeserializer;
5 | import com.google.gson.JsonElement;
6 | import com.google.gson.JsonParseException;
7 | import com.google.gson.JsonPrimitive;
8 | import com.google.gson.JsonSerializationContext;
9 | import com.google.gson.JsonSerializer;
10 | import com.google.gson.JsonSyntaxException;
11 |
12 | import java.lang.reflect.Type;
13 |
14 | public class DoubleDefaultAdapter implements JsonSerializer, JsonDeserializer {
15 | @Override
16 | public Double deserialize(JsonElement json, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
17 | try {
18 | if (json.getAsString().equals("") || json.getAsString().equals("null")) {//定义为double类型,如果后台返回""或者null,则返回0.00
19 | return 0.0;
20 | }
21 | } catch (Exception ignore) {
22 | }
23 | try {
24 | return json.getAsDouble();
25 | } catch (NumberFormatException e) {
26 | throw new JsonSyntaxException(e);
27 | }
28 | }
29 |
30 | @Override
31 | public JsonElement serialize(Double aDouble, Type type, JsonSerializationContext jsonSerializationContext) {
32 | return new JsonPrimitive(aDouble);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/gson/IntegerDefaultAdapter.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils.gson;
2 |
3 | import com.google.gson.JsonDeserializationContext;
4 | import com.google.gson.JsonDeserializer;
5 | import com.google.gson.JsonElement;
6 | import com.google.gson.JsonParseException;
7 | import com.google.gson.JsonPrimitive;
8 | import com.google.gson.JsonSerializationContext;
9 | import com.google.gson.JsonSerializer;
10 | import com.google.gson.JsonSyntaxException;
11 |
12 | import java.lang.reflect.Type;
13 |
14 |
15 | public class IntegerDefaultAdapter implements JsonSerializer, JsonDeserializer {
16 | @Override
17 | public Integer deserialize(JsonElement json, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
18 | try {
19 | //定义为int类型,如果后台返回""或者null,则返回0
20 | if (json.getAsString().equals("") || json.getAsString().equals("null")) {
21 | return 0;
22 | }
23 | } catch (Exception ignore) {
24 | }
25 | try {
26 | return json.getAsInt();
27 | } catch (NumberFormatException e) {
28 | throw new JsonSyntaxException(e);
29 | }
30 | }
31 |
32 | @Override
33 | public JsonElement serialize(Integer integer, Type type, JsonSerializationContext jsonSerializationContext) {
34 | return new JsonPrimitive(integer);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/gson/LongDefaultAdapter.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils.gson;
2 |
3 | import com.google.gson.JsonDeserializationContext;
4 | import com.google.gson.JsonDeserializer;
5 | import com.google.gson.JsonElement;
6 | import com.google.gson.JsonParseException;
7 | import com.google.gson.JsonPrimitive;
8 | import com.google.gson.JsonSerializationContext;
9 | import com.google.gson.JsonSerializer;
10 | import com.google.gson.JsonSyntaxException;
11 |
12 | import java.lang.reflect.Type;
13 |
14 | public class LongDefaultAdapter implements JsonSerializer, JsonDeserializer {
15 | @Override
16 | public Long deserialize(JsonElement json, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
17 | try {
18 | //定义为long类型,如果后台返回""或者null,则返回0
19 | if (json.getAsString().equals("") || json.getAsString().equals("null")) {
20 | return 0L;
21 | }
22 | } catch (Exception ignore) {
23 | }
24 | try {
25 | return json.getAsLong();
26 | } catch (NumberFormatException e) {
27 | throw new JsonSyntaxException(e);
28 | }
29 | }
30 |
31 | @Override
32 | public JsonElement serialize(Long aLong, Type type, JsonSerializationContext jsonSerializationContext) {
33 | return new JsonPrimitive(aLong);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/rx/DefaultLogThrowableConsumer.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils.rx;
2 |
3 |
4 | import io.reactivex.functions.Consumer;
5 | import razerdp.util.log.PopupLog;
6 |
7 | /**
8 | * Created by 大灯泡 on 2019/4/9.
9 | * 默认打印日志的错误consumer
10 | */
11 | public final class DefaultLogThrowableConsumer implements Consumer {
12 | private String TAG = this.getClass().getSimpleName();
13 |
14 | public DefaultLogThrowableConsumer() {
15 | }
16 |
17 | public DefaultLogThrowableConsumer(String TAG) {
18 | this.TAG = TAG;
19 | }
20 |
21 | @Override
22 | public void accept(Throwable throwable) throws Exception {
23 | PopupLog.e(TAG, throwable);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/rx/RxCall.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils.rx;
2 |
3 | /**
4 | * Created by 大灯泡 on 2018/5/24.
5 | */
6 | public interface RxCall {
7 |
8 | void onCall(T data);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/rx/RxCallImpl.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils.rx;
2 |
3 | /**
4 | * Created by 大灯泡 on 2018/5/24.
5 | */
6 | public abstract class RxCallImpl implements RxCall {
7 | T data;
8 |
9 | public RxCallImpl() {
10 | }
11 |
12 | public RxCallImpl(T data) {
13 | this.data = data;
14 | }
15 |
16 | public T getData() {
17 | return data;
18 | }
19 |
20 | public RxCallImpl setData(T data) {
21 | this.data = data;
22 | return this;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/utils/rx/RxTaskCall.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.utils.rx;
2 |
3 | /**
4 | * Created by 大灯泡 on 2019/4/10
5 | *
6 | * Description:
7 | */
8 | public abstract class RxTaskCall {
9 |
10 | public abstract T doInBackground();
11 |
12 | public abstract void onResult(T result);
13 |
14 | public void onError(Throwable e){
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/widget/SquareLayout.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.widget;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.widget.LinearLayout;
7 |
8 |
9 | /**
10 | * 正方形控件
11 | */
12 | public class SquareLayout extends LinearLayout {
13 |
14 | public SquareLayout(Context context) {
15 | this(context, null);
16 | }
17 |
18 | public SquareLayout(Context context, AttributeSet attrs) {
19 | this(context, attrs, 0);
20 | }
21 |
22 | @TargetApi(11)
23 | public SquareLayout(Context context, AttributeSet attrs, int defStyle) {
24 | super(context, attrs, defStyle);
25 | }
26 |
27 | @Override
28 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
29 | if (getOrientation() == HORIZONTAL) {
30 | super.onMeasure(widthMeasureSpec, widthMeasureSpec);
31 | } else {
32 | super.onMeasure(heightMeasureSpec, heightMeasureSpec);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/widget/Type.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.widget;
2 |
3 | /**
4 | * Created by 大灯泡 on 2018/3/30.
5 | */
6 | public interface Type {
7 | int OVAL = 1;
8 | int RECTANGE = 2;
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/widget/bigimageviewer/view/ImageLoadCallback.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.widget.bigimageviewer.view;
2 |
3 | /**
4 | * Created by 大灯泡 on 2021/4/28
5 | *
6 | * Description:
7 | */
8 | public interface ImageLoadCallback {
9 | void onShowThumbnail();
10 |
11 | void onStart();
12 |
13 | void onSuccess();
14 |
15 | void onError();
16 |
17 | void onFinish();
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/widget/bigimageviewer/view/ImageSaveCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2018 Piasy
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package razerdp.demo.widget.bigimageviewer.view;
26 |
27 | /**
28 | * Created by Piasy{github.com/Piasy} on 10/11/2016.
29 | */
30 |
31 | public interface ImageSaveCallback {
32 | void onSuccess(String uri);
33 |
34 | void onFail(Throwable t);
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/widget/dialog/DialogClickListener.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.widget.dialog;
2 |
3 | /**
4 | * Created by 大灯泡 on 2019/4/22.
5 | *
6 | * dialog两个button点击事件
7 | */
8 | public interface DialogClickListener {
9 |
10 | /**
11 | * @return true for dismiss
12 | */
13 | boolean onPositiveClicked();
14 |
15 | /**
16 | * @return true for dismiss
17 | */
18 | boolean onNegativeClicked();
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/widget/span/ClickSpan.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.widget.span;
2 |
3 | import android.view.View;
4 |
5 | import razerdp.basepopup.R;
6 | import razerdp.demo.utils.UIHelper;
7 |
8 |
9 | /**
10 | * Created by 大灯泡 on 2019/4/9.
11 | */
12 | public class ClickSpan extends ClickableSpanEx {
13 |
14 | private View.OnClickListener mOnClickListener;
15 |
16 | public ClickSpan(View.OnClickListener onClickListener) {
17 | super(-1, UIHelper.getColor(R.color.press_color), false);
18 | mOnClickListener = onClickListener;
19 | }
20 |
21 | @Override
22 | public void onClick(View widget) {
23 | if (mOnClickListener != null) {
24 | mOnClickListener.onClick(widget);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/widget/span/SpannableStringBuilderCompat.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.widget.span;
2 |
3 | import android.text.SpannableStringBuilder;
4 |
5 | /**
6 | * Created by 大灯泡 on 2019/4/9.
7 | */
8 | public class SpannableStringBuilderCompat extends SpannableStringBuilder {
9 | public SpannableStringBuilderCompat() {
10 | super("");
11 | }
12 |
13 | public SpannableStringBuilderCompat(CharSequence text) {
14 | super(text, 0, text.length());
15 | }
16 |
17 | public SpannableStringBuilderCompat(CharSequence text, int start, int end) {
18 | super(text, start, end);
19 | }
20 |
21 | public SpannableStringBuilderCompat append(CharSequence text) {
22 | if (text == null) return this;
23 | int length = length();
24 | return (SpannableStringBuilderCompat) replace(length, length, text, 0, text.length());
25 | }
26 |
27 | /** 该方法在原API里面只支持API21或者以上,这里抽取出来以适应低版本 */
28 | public SpannableStringBuilderCompat append(CharSequence text, Object what, int flags) {
29 | if (text == null) return this;
30 | int start = length();
31 | append(text);
32 | setSpan(what, start, length(), flags);
33 | return this;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/widget/viewpager/HackyViewPager.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.widget.viewpager;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.MotionEvent;
6 |
7 | import androidx.annotation.NonNull;
8 | import androidx.annotation.Nullable;
9 | import androidx.viewpager.widget.ViewPager;
10 |
11 | /**
12 | * Created by 大灯泡 on 2019/9/22.
13 | */
14 | public class HackyViewPager extends ViewPager {
15 |
16 |
17 | public HackyViewPager(@NonNull Context context) {
18 | super(context);
19 | }
20 |
21 | public HackyViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | @Override
26 | public boolean onInterceptTouchEvent(MotionEvent ev) {
27 | try {
28 | return super.onInterceptTouchEvent(ev);
29 | } catch (IllegalArgumentException e) {
30 | //uncomment if you really want to see these errors
31 | //e.printStackTrace();
32 | return false;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/razerdp/demo/widget/viewpager/ViewpagerIndicator.java:
--------------------------------------------------------------------------------
1 | package razerdp.demo.widget.viewpager;
2 |
3 | /**
4 | * Created by 大灯泡 on 2019/4/24
5 | *
6 | * Description:Banner指示器
7 | */
8 | public interface ViewpagerIndicator {
9 |
10 | void onDataSizeChange(int dataSize);
11 |
12 | void onPageScrolled(int position, float positionOffset, int positionOffsetPixels);
13 |
14 | void onPageSelected(int position);
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/search_layout_animation.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/search_layout_animation_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_left_in.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_left_out.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_right_in.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_right_out.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/common_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 | -
8 |
9 |
12 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/common_selector_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 | -
8 |
9 |
12 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/common_selector_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 | -
8 |
9 |
12 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/alipay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/alipay.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_bubble.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_bubble.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_game_live_tag.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_game_live_tag.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_popup_guide.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_popup_guide.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_round_white_8dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_shadow_0dp.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_shadow_0dp.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_shadow_2dp.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_shadow_2dp.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_shadow_3dp.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_shadow_3dp.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_shadow_4dp.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_shadow_4dp.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_shadow_5dp.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_shadow_5dp.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_shadow_6dp.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_shadow_6dp.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_shadow_7dp.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_shadow_7dp.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_shadow_8dp.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_shadow_8dp.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_titlebar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/bg_titlebar.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_top_round_white_8dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_arrow_right.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_arrow_weibo_popup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_arrow_weibo_popup.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_comment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_comment.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_comment_show.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_comment_show.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_dialog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_dialog.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_error.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_error.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_error_gray.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_error_gray.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_fixed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_fixed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_like.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_like.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_loading_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_loading_1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_loading_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_loading_2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_loading_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_loading_3.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_loading_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_loading_4.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_loading_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_loading_5.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_loading_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_loading_6.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_loading_7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_loading_7.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_loading_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_loading_8.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_popup_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_popup_arrow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_setting_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_setting_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_tips.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_tips.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_wait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/ic_wait.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/icon_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/icon_add.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/icon_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/icon_back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/popup_bg_drawable.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/popup_bg_drawable.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/qrcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable-xhdpi/qrcode.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_comment_input.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_comment_popup.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_loading_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_selector_blue.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_stroke.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_update_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/common_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/common_selector_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/common_selector_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/divider.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawable_loading.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
10 |
13 |
16 |
19 |
22 |
25 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_update_app_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/drawable/ic_update_app_bg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/item_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_menu_popup.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_popup_animate.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_popup_animate_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_api_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_api_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
25 |
26 |
27 |
28 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_common_usage.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
16 |
17 |
23 |
24 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_friend_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_full_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_image_browser.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
13 |
14 |
18 |
19 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_issue.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_issue_210.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
24 |
25 |
28 |
29 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_issue_230.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
22 |
23 |
24 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_issue_236.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
22 |
23 |
24 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_issue_242.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
22 |
23 |
24 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_issue_358.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
23 |
24 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_issue_474.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
23 |
24 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_my_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_update_log.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_update_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_web.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_api_constructor.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
19 |
20 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_fragment_api_constructor.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
19 |
20 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_api_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_bigimageview_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_common_usage_title.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
19 |
20 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_guide_denpendence.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
23 |
24 |
25 |
30 |
31 |
32 |
35 |
36 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_image_browser.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_issue_pic.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_main_demo_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_ninegrid_image_single_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_ninegrid_image_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_popup_230.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_popup_animate.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_popup_issue_224.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_slide_option.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_animate.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_arrow.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_description.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
21 |
22 |
23 |
24 |
33 |
34 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_issue_210.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_issue_224.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_issue_230.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_issue_236.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_issue_238.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_issue_238_with_edittext.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_issue_358.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_my_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_show_on_create.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_text_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_update_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
19 |
20 |
24 |
25 |
34 |
35 |
39 |
40 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_width_height_limit.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
25 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_bottom_sheet.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
19 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
19 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/transition/imageviewer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/transition/photo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/transition/photo_large.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/attrs_transition.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs_imageviewer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs_titlebar_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 12dp
4 | 10sp
5 | 12sp
6 | 14sp
7 | 16sp
8 | 18sp
9 | 16sp
10 | 18sp
11 | 22sp
12 | 6dp
13 |
14 | 12dp
15 | 10dp
16 | 12dp
17 | 10dp
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BasePopup
3 | Settings
4 |
5 |
6 | 在Android众多弹窗中,论坑的数量,PopupWindow毫无疑问遥遥领先。\nPopupWindow很多时候真的是让人又爱又恨,爱的是它的定制自由,恨的是它的表现不同。\n本人从实习时接触到PopupWindow,就已经感到PopupWindow的强大之处,但因为坑实在太多,因此一直都是 “想用,但不敢用”,然而一直避免也无法解决问题,因此BasePopup的创作由此开始。\n从2016年第一版开始,到现在2019年,期间经历过数次重构,吸取了不少经验,自19年上半年也就是2.0版本开始,BasePopup开始正式宣传(其实也就投稿过一次而已。。。),同时也是从2.0版本开始确定了BasePopup的整体框架与方向。\nBasePopup并不是做一个【一句Api就完成功能】的库,相反,BasePopup并不包含任何具体的实现,它提供的,仅仅是画布以及画笔颜料,而这幅画会呈现出如何的画面,则交由您来实现创作。\n未来的路还很长,随着技术的提升,复盘,重构也会一直都会进行。\n当BasePopup走到10.x的时候,又会是怎样的一番景象呢?\n我们,拭目以待\n我们,一路前行\n
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings_api.xml:
--------------------------------------------------------------------------------
1 |
2 | • 最常用的构造器,传入context情况下会寻找其Activity作为依附的WindowToken,如果获取不到(如ApplicationContext)则取当前应用最顶层Activity作为依附的WindowToken\n\n• 此时PopupWindow的层级与Activity的Window一致,无法显示在别的Window上方(如弹出一个Dialog再弹出一个PopupWindow,此时PopupWindow显示在Dialog下层)\n\n• 该构造器构造的BasePopup可以在Dialog或DialogFragment下弹出
3 | • 构造器传入Fragment情况下会寻找其RootView作为依附的WindowToken,如果获取不到则取当前fragment所属Activity作为依附的WindowToken\n\n• 此时PopupWindow的层级与Fragment的Window一致,无法显示在其他Window上方(如弹出一个Dialog再弹出一个PopupWindow,此时PopupWindow显示在Dialog下层)\n\n• 该构造器构造的BasePopup可以在DialogFragment或者依附于Activity的Fragment下弹出,其余情况不能弹出\n\n• 【注意】:DialogFragment在getDialog()!=null的情况下,会获取其Dialog的WindowToken。
4 | • 构造器传入Dialog情况下会寻找其Window作为依附的WindowToken,如果获取不到则取Dialog所属Activity作为依附的WindowToken\n\n• 此时PopupWindow的层级与Dialog的Window一致,无法显示在其他Window上方(如弹出一个Dialog再弹出一个PopupWindow,此时PopupWindow显示在Dialog上层)\n\n• 该构造器构造的BasePopup只可以在Dialog显示(即Dialog的ContentView准备就绪)的时候弹出
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/file_paths_public_popup.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
9 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | maven { url "https://raw.githubusercontent.com/Pgyer/mvn_repo_pgyer/master" }
6 | maven { url "https://jitpack.io" }
7 | google()
8 | mavenCentral()
9 | jcenter()
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:7.3.1'
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | maven { url "https://raw.githubusercontent.com/Pgyer/mvn_repo_pgyer/master" }
19 | maven { url "https://jitpack.io" }
20 | google()
21 | mavenCentral()
22 | jcenter()
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
29 |
30 | ext {
31 | //Android
32 | compileSdkVersion = 30
33 | minSdkVersion = 19
34 | minLibSdkVersion = 16
35 | targetSdkVersion = 30
36 | versionCode = 336
37 | versionName = '3.2.1'
38 |
39 | candy = false
40 | group = 'io.github.razerdp'
41 |
42 | pkg_name = 'BasePopup'
43 | }
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Fri Jan 15 11:26:57 CST 2016
16 |
17 | android.enableJetifier=true
18 | android.injected.testOnly=false
19 | android.useAndroidX=true
20 |
21 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 28 16:30:40 CST 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
7 |
--------------------------------------------------------------------------------
/img/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/img/1.png
--------------------------------------------------------------------------------
/img/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/img/2.png
--------------------------------------------------------------------------------
/img/TIM截图20170920164421.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/img/TIM截图20170920164421.png
--------------------------------------------------------------------------------
/img/alipay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/img/alipay.png
--------------------------------------------------------------------------------
/img/download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/img/download.png
--------------------------------------------------------------------------------
/img/etc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/img/etc.png
--------------------------------------------------------------------------------
/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/img/logo.png
--------------------------------------------------------------------------------
/img/qrcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/razerdp/BasePopup/79589872cbe7ea266370609d572aecfca351d91b/img/qrcode.png
--------------------------------------------------------------------------------
/lib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/lib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion
5 |
6 | defaultConfig {
7 | minSdkVersion rootProject.ext.minLibSdkVersion
8 | targetSdkVersion rootProject.ext.targetSdkVersion
9 | }
10 | buildTypes {
11 | release {
12 | minifyEnabled false
13 | consumerProguardFiles 'proguard-rules.pro'
14 | }
15 | }
16 | lint {
17 | abortOnError false
18 | }
19 | namespace 'razerdp.library'
20 | }
21 |
22 | dependencies {
23 | compileOnly 'androidx.appcompat:appcompat:1.2.0'
24 | }
25 |
26 | apply from: "$rootProject.rootDir/scripts/upload.gradle"
27 |
28 |
29 |
--------------------------------------------------------------------------------
/lib/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 |
7 | com.github.razerdp
8 | BasePopup
9 | 2.2.1
10 | ../pom.xml
11 |
12 |
13 | BasePopup
14 | BasePopup
15 |
16 | Android下打造通用便捷的PopupWindow
17 | https://github.com/razerdp/BasePopup
18 |
19 |
20 | The Apache Software License, Version 2.0
21 | http://www.apache.org/licenses/LICENSE-2.0.txt
22 |
23 |
24 |
25 |
26 | razerdp
27 | razerdp
28 | razerdp123@gmail.com
29 |
30 |
31 |
32 | https://github.com/razerdp/BasePopup.git
33 | https://github.com/razerdp/BasePopup.git
34 | https://github.com/razerdp/BasePopup
35 |
36 |
37 |
--------------------------------------------------------------------------------
/lib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\android developer\adt-bundle-windows-x86_64-20140702\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView inject JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 |
20 | ## Android architecture components: Lifecycle
21 | # LifecycleObserver's empty constructor is considered to be unused by proguard
22 | -dontnote android.arch.lifecycle.**
23 | -keepclassmembers class * implements android.arch.lifecycle.LifecycleObserver {
24 | (...);
25 | }
26 | # ViewModel's empty constructor is considered to be unused by proguard
27 | -keepclassmembers class * extends android.arch.lifecycle.ViewModel {
28 | (...);
29 | }
30 | # keep Lifecycle State and Event enums values
31 | -keepclassmembers class android.arch.lifecycle.Lifecycle$State { *; }
32 | -keepclassmembers class android.arch.lifecycle.Lifecycle$Event { *; }
33 | # keep methods annotated inject @OnLifecycleEvent even if they seem to be unused
34 | # (Mostly for LiveData.LifecycleBoundObserver.onStateChange(), but who knows)
35 | -keepclassmembers class * {
36 | @android.arch.lifecycle.OnLifecycleEvent *;
37 | }
38 | -keep class * implements android.arch.lifecycle.GeneratedAdapter {
39 | (...);
40 | }
41 |
--------------------------------------------------------------------------------
/lib/src/androidTest/java/razerdp/library/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package razerdp.library;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/lib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/lib/src/main/java/razerdp/basepopup/BasePopupEvent.java:
--------------------------------------------------------------------------------
1 | package razerdp.basepopup;
2 |
3 | import android.os.Message;
4 |
5 | /**
6 | * Created by 大灯泡 on 2019/8/16
7 | *
8 | * Description:popup事件
9 | */
10 | class BasePopupEvent {
11 | public static final int EVENT_SHOW = 1;
12 | public static final int EVENT_DISMISS = 2;
13 | public static final int EVENT_ALIGN_KEYBOARD = 3;
14 |
15 |
16 | static Message getMessage(int event) {
17 | Message msg = Message.obtain();
18 | msg.what = event;
19 | return msg;
20 | }
21 |
22 | public interface EventObserver {
23 | void onEvent(Message msg);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/lib/src/main/java/razerdp/basepopup/BasePopupInitializer.java:
--------------------------------------------------------------------------------
1 | package razerdp.basepopup;
2 |
3 | import android.content.ContentProvider;
4 | import android.content.ContentValues;
5 | import android.database.Cursor;
6 | import android.net.Uri;
7 |
8 | /**
9 | * Created by 大灯泡 on 2020/2/11.
10 | */
11 | public class BasePopupInitializer extends ContentProvider {
12 | @Override
13 | public boolean onCreate() {
14 | BasePopupSDK.getInstance().init(getContext());
15 | return true;
16 | }
17 |
18 | @Override
19 | public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
20 | return null;
21 | }
22 |
23 | @Override
24 | public String getType(Uri uri) {
25 | return null;
26 | }
27 |
28 | @Override
29 | public Uri insert(Uri uri, ContentValues values) {
30 | return null;
31 | }
32 |
33 | @Override
34 | public int delete(Uri uri, String selection, String[] selectionArgs) {
35 | return 0;
36 | }
37 |
38 | @Override
39 | public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
40 | return 0;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/lib/src/main/java/razerdp/basepopup/ClearMemoryObject.java:
--------------------------------------------------------------------------------
1 | package razerdp.basepopup;
2 |
3 | /**
4 | * Created by 大灯泡 on 2020/1/20
5 | *
6 | * Description:
7 | */
8 | interface ClearMemoryObject {
9 | void clear(boolean destroy);
10 | }
11 |
--------------------------------------------------------------------------------
/lib/src/main/java/razerdp/basepopup/FirstOpenActivityLiveData.java:
--------------------------------------------------------------------------------
1 | package razerdp.basepopup;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.lifecycle.MutableLiveData;
5 | import androidx.lifecycle.Observer;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | /**
11 | * Created by 大灯泡 on 2021/6/24
12 | *
13 | * Description:
14 | */
15 | class FirstOpenActivityLiveData extends MutableLiveData {
16 | List> observers;
17 |
18 | @Override
19 | public void observeForever(@NonNull Observer super T> observer) {
20 | super.observeForever(observer);
21 | if (observers == null) {
22 | observers = new ArrayList<>();
23 | }
24 | observers.add(observer);
25 | }
26 |
27 | void clear() {
28 | if (observers != null) {
29 | for (Observer super T> observer : observers) {
30 | removeObserver(observer);
31 | }
32 | observers.clear();
33 | }
34 | observers = null;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/lib/src/main/java/razerdp/util/animation/AnimationApi.java:
--------------------------------------------------------------------------------
1 | package razerdp.util.animation;
2 |
3 | import android.util.SparseArray;
4 |
5 | import androidx.annotation.NonNull;
6 |
7 | import razerdp.util.log.PopupLog;
8 |
9 | @SuppressWarnings({"unchecked", "rawtypes"})
10 | public abstract class AnimationApi {
11 | SparseArray configs;
12 |
13 |
14 | //-----------alpha-------------
15 | public T withAlpha(@NonNull AlphaConfig config) {
16 | appendConfigs(config);
17 | return (T) this;
18 | }
19 |
20 | //-----------scale-------------
21 | public T withScale(@NonNull ScaleConfig config) {
22 | appendConfigs(config);
23 | return (T) this;
24 | }
25 |
26 | //-----------translation-------------
27 | public T withTranslation(@NonNull TranslationConfig config) {
28 | appendConfigs(config);
29 | return (T) this;
30 | }
31 |
32 | //-----------rotation-------------
33 | public T withRotation(@NonNull RotationConfig config) {
34 | appendConfigs(config);
35 | return (T) this;
36 | }
37 |
38 | void appendConfigs(@NonNull BaseAnimationConfig config) {
39 | if (configs == null) {
40 | configs = new SparseArray<>();
41 | }
42 | configs.delete(config.key());
43 | configs.append(config.key(), config);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/lib/src/main/java/razerdp/util/animation/Direction.java:
--------------------------------------------------------------------------------
1 | package razerdp.util.animation;
2 |
3 | import android.view.Gravity;
4 |
5 | /**
6 | * 方向枚举
7 | * 讲道理,系统的gravity真的好用,不用我自己去慢慢定各种位,而且位运算十分爽啊
8 | * 要不是gravity不太符合【方向】这个描述,我还真的想直接用它
9 | */
10 | public enum Direction {
11 | IDLE(Gravity.NO_GRAVITY),
12 | LEFT(Gravity.LEFT),
13 | TOP(Gravity.TOP),
14 | RIGHT(Gravity.RIGHT),
15 | BOTTOM(Gravity.BOTTOM),
16 | CENTER(Gravity.CENTER),
17 | CENTER_HORIZONTAL(Gravity.CENTER_HORIZONTAL),
18 | CENTER_VERTICAL(Gravity.CENTER_VERTICAL);
19 |
20 | final int flag;
21 |
22 | Direction(int flag) {
23 | this.flag = flag;
24 | }
25 |
26 | public static boolean isDirectionFlag(Direction direction, int flag) {
27 | return (flag & Gravity.HORIZONTAL_GRAVITY_MASK) == direction.flag ||
28 | (flag & Gravity.VERTICAL_GRAVITY_MASK) == direction.flag;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib/src/main/java/razerdp/util/animation/FloatPropertyCompat.java:
--------------------------------------------------------------------------------
1 | package razerdp.util.animation;
2 |
3 | import android.util.Property;
4 |
5 | public abstract class FloatPropertyCompat extends Property {
6 |
7 | public FloatPropertyCompat(String name) {
8 | super(Float.class, name);
9 | }
10 |
11 | /**
12 | * A type-specific variant of {@link #set(Object, Float)} that is faster when dealing
13 | * with fields of type float
.
14 | */
15 | public abstract void setValue(T object, float value);
16 |
17 | @Override
18 | final public void set(T object, Float value) {
19 | setValue(object, value);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/lib/src/main/java/razerdp/widget/OnQuickPopupClickListenerWrapper.java:
--------------------------------------------------------------------------------
1 | package razerdp.widget;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * Created by 大灯泡 on 2019/1/18.
7 | */
8 | public abstract class OnQuickPopupClickListenerWrapper implements View.OnClickListener {
9 | QuickPopup mQuickPopup;
10 |
11 | @Deprecated
12 | @Override
13 | public void onClick(View v) {
14 | onClick(mQuickPopup, v);
15 | }
16 |
17 | public abstract void onClick(QuickPopup basePopup, View v);
18 | }
19 |
--------------------------------------------------------------------------------
/lib/src/main/res/values-en/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | No host Activity found, please ensure you have at least one Activity open.
4 | Please operate in the main thread.
5 | The BasePopup has been Destroyed and cannot continue to perform show.
6 | PopupWindow needs %s of DecorView\'s WindowToken, please check if DecorView exists.
7 | The %s window is not ready, wait for it to pop up when ready
8 | The %s window is ready to execute the popup.
9 | BasePopup has been shown.
10 | Show successful
11 | popupwindow host (%s)
12 | The popupwindow\'s host has been destroyed
13 |
14 |
--------------------------------------------------------------------------------
/lib/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/lib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 找不到宿主Activity,请确保您至少打开了一个Activity
4 | 请在主线程操作
5 | 该BasePopup已经被Destroy,无法继续执行show
6 | PopupWindow需要%s的DecorView的WindowToken,请检查是否存在DecorView
7 | %s窗口尚未准备好,等待准备就绪后弹出
8 | %s窗口已经准备好,执行弹出
9 | BasePopup已经显示了
10 | 弹窗成功
11 | 宿主(%s)
12 | 宿主已经被销毁
13 |
14 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | com.github.razerdp
9 | BasePopup
10 | 2.2.1
11 | ../pom.xml
12 |
13 |
14 | BasePopup
15 | BasePopup
16 |
17 |
18 | lib
19 | lib_supporter
20 | lib_supporter_lifecycle
21 | lib_supporter_x
22 | app
23 |
24 |
25 | Android下打造通用便捷的PopupWindow
26 | https://github.com/razerdp/BasePopup
27 |
28 |
29 | The Apache Software License, Version 2.0
30 | http://www.apache.org/licenses/LICENSE-2.0.txt
31 |
32 |
33 |
34 |
35 | razerdp
36 | razerdp
37 | razerdp123@gmail.com
38 |
39 |
40 |
41 | https://github.com/razerdp/BasePopup.git
42 | https://github.com/razerdp/BasePopup.git
43 | https://github.com/razerdp/BasePopup
44 |
45 |
46 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':lib'
2 |
--------------------------------------------------------------------------------