|
|
@@ -1753,14 +1753,22 @@ public class ViewUtil {
|
|
|
showShareDialog(activity, url, description, null);
|
|
|
}
|
|
|
|
|
|
- public static void showShareDialog(final Activity activity, final String url, final String description, Action1<View> action1) {
|
|
|
+ /**
|
|
|
+ * 显示分享弹出框
|
|
|
+ * @param activity
|
|
|
+ * @param url
|
|
|
+ * @param description
|
|
|
+ * @param action1 回调的view为nul时,代表流程结束;不为空时,代表初始化dialog的view,可以做自定义
|
|
|
+ */
|
|
|
+ public static void showShareDialog(final Activity activity, final String url, final String description, final Action1<View> action1) {
|
|
|
View dialogView = View.inflate(activity, R.layout.ask_to_share, null);
|
|
|
final AlertDialog dialog = new AlertDialog.Builder(activity, R.style.AppTheme_Dialog_Alert)
|
|
|
.setView(dialogView)
|
|
|
.create();
|
|
|
// TextView ask_share_title = dialogView.findViewById(R.id.ask_share_title);
|
|
|
RecyclerView ask_share_list = dialogView.findViewById(R.id.ask_share_list);
|
|
|
- action1.call(dialogView);
|
|
|
+ if(action1 != null)
|
|
|
+ action1.call(dialogView);
|
|
|
// ask_share_list.setHasFixedSize(true);
|
|
|
// ask_share_list.setNestedScrollingEnabled(false);
|
|
|
List<String> list = ListUtil.emptyList();
|
|
|
@@ -1818,6 +1826,13 @@ public class ViewUtil {
|
|
|
}
|
|
|
};
|
|
|
ask_share_list.setAdapter(adapter);
|
|
|
+ dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss(DialogInterface dialogInterface) {
|
|
|
+ if(action1 != null)
|
|
|
+ action1.call(null);
|
|
|
+ }
|
|
|
+ });
|
|
|
try {
|
|
|
dialog.show();
|
|
|
Window window = dialog.getWindow();
|
|
|
@@ -1829,6 +1844,8 @@ public class ViewUtil {
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ if(action1 != null)
|
|
|
+ action1.call(null);
|
|
|
}
|
|
|
}
|
|
|
|