1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.exoplatform.widget;
20
21 import org.exoplatform.R;
22
23 import android.app.Dialog;
24 import android.content.Context;
25 import android.view.Window;
26 import android.widget.TextView;
27
28 public class WaitingDialog extends Dialog {
29
30 private boolean mIsAttachedToWindow;
31
32 private TextView mContentView;
33
34 public WaitingDialog(Context context, String titleString, String contentString) {
35 super(context);
36 if (titleString == null) {
37 requestWindowFeature(Window.FEATURE_NO_TITLE);
38 } else {
39 setTitle(titleString);
40 }
41 setContentView(R.layout.waiting_dialog_layout);
42 mContentView = (TextView) findViewById(R.id.waiting_content);
43 mContentView.setText(contentString);
44 }
45
46 public boolean isAttachedToWindow() {
47 return mIsAttachedToWindow;
48 }
49
50 @Override
51 public void onDetachedFromWindow() {
52 mIsAttachedToWindow = false;
53 super.onDetachedFromWindow();
54 }
55
56 @Override
57 public void onAttachedToWindow() {
58 mIsAttachedToWindow = true;
59 super.onAttachedToWindow();
60 }
61
62 @Override
63 public void onBackPressed() {
64 super.onBackPressed();
65 dismiss();
66 }
67
68 public void setMessage(String message) {
69 mContentView.setText(message);
70 }
71 }