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 import org.exoplatform.utils.CompatibleFileOpen;
23 import org.exoplatform.utils.ExoDocumentUtils;
24
25 import android.app.Dialog;
26 import android.content.Context;
27 import android.view.View;
28 import android.view.Window;
29 import android.widget.Button;
30 import android.widget.ImageView;
31 import android.widget.TextView;
32
33 public class CompatibleFileOpenDialog extends Dialog implements android.view.View.OnClickListener {
34
35 private Button okButton;
36
37 private Button cancelButton;
38
39 private String fileType;
40
41 private String filePath;
42
43 private String fileName;
44
45 public CompatibleFileOpenDialog(Context context, String fType, String fPath, String fName) {
46 super(context);
47 requestWindowFeature(Window.FEATURE_NO_TITLE);
48 setContentView(R.layout.compatible_open_file_dialog_layout);
49 TextView titleView = (TextView) findViewById(R.id.com_dialog_title_view);
50 titleView.setText(fName);
51 TextView contentView = (TextView) findViewById(R.id.com_warning_content);
52 contentView.setText(context.getResources().getString(R.string.CompatibleFileSuggest));
53 okButton = (Button) findViewById(R.id.com_ok_button);
54 okButton.setOnClickListener(this);
55 cancelButton = (Button) findViewById(R.id.com_cancel_button);
56 cancelButton.setOnClickListener(this);
57 ImageView iconView = (ImageView) findViewById(R.id.com_warning_image);
58 iconView.setBackgroundResource(ExoDocumentUtils.getIconFromType(fType));
59 fileType = fType;
60 filePath = fPath;
61 fileName = fName;
62 }
63
64 public void onClick(View view) {
65 if (view.equals(cancelButton)) {
66 dismiss();
67 }
68 if (view.equals(okButton)) {
69 new CompatibleFileOpen(view.getContext(), fileType, filePath, fileName);
70 dismiss();
71 }
72 }
73
74 }