11package kr .co .bootpay ;
22
3+ import android .app .Dialog ;
34import android .app .DialogFragment ;
5+ import android .content .DialogInterface ;
46import android .os .Bundle ;
7+ import android .view .KeyEvent ;
58import android .view .LayoutInflater ;
69import android .view .View ;
710import android .view .ViewGroup ;
@@ -16,6 +19,16 @@ public class BootpayDialog extends DialogFragment {
1619 protected BootpayWebView bootpay ;
1720 private EventListener listener ;
1821
22+ // @Override
23+ // public Dialog onCreateDialog(Bundle savedInstanceState) {
24+ // return new Dialog(getActivity(), getTheme()){
25+ // @Override
26+ // public void onBackPressed() {
27+ // //do your stuff
28+ // }
29+ // };
30+ // }
31+
1932 @ Override
2033 public void onCreate (Bundle savedInstanceState ) {
2134 super .onCreate (savedInstanceState );
@@ -31,16 +44,38 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
3144
3245 @ Override
3346 public void onDestroyView () {
34-
35- // UserInfo.getInstance(getContext()).update();
3647 super .onDestroyView ();
3748 }
3849
3950 private void afterViewInit () {
40- if (bootpay != null )
51+ if (bootpay != null ) {
52+ Dialog dialog = getDialog ();
53+ dialog .setOnKeyListener (new DialogInterface .OnKeyListener () {
54+ @ Override
55+ public boolean onKey (DialogInterface dialogInterface , int keyCode , KeyEvent keyEvent ) {
56+ if (keyCode == KeyEvent .KEYCODE_BACK ) {
57+ if (listener != null )
58+ listener .onClose ("android backbutton clicked" );
59+ }
60+ return false ;
61+ }
62+ });
4163 bootpay .setRequest (request )
42- .setDialog (getDialog () )
64+ .setDialog (dialog )
4365 .setOnResponseListener (listener );
66+ }
67+
68+
69+
70+ // setOnKeyListener(new DialogInterface.OnKeyListener() {
71+ // @Override
72+ // public boolean onKey(android.content.DialogInterface dialog, int keyCode, android.view.KeyEvent event) {
73+ //
74+ // if ((keyCode == android.view.KeyEvent.KEYCODE_BACK)) {
75+ //
76+ // }
77+ // }
78+ // }
4479 }
4580
4681 public BootpayDialog setOnResponseListener (EventListener listener ) {
0 commit comments