MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / run

Method run

CodenameOne/src/com/codename1/share/EmailShare.java:76–151  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74 Display.getInstance().startThread(new Runnable() {
75
76 @Override
77 public void run() {
78
79 String[] ids = ContactsManager.getAllContacts();
80 if (ids == null || ids.length == 0) {
81 Display.getInstance().callSerially(new Runnable() {
82 @Override
83 public void run() {
84 Dialog.show("Failed to Share", "No Contacts Found", "Ok", null);
85 currentForm.showBack();
86 }
87 });
88 return;
89 }
90 ContactsModel model = new ContactsModel(ids);
91 final List contacts = new List(model);
92 contacts.setRenderer(createListRenderer());
93 Display.getInstance().callSerially(new Runnable() {
94
95 @Override
96 public void run() {
97
98 contacts.addActionListener(new ActionListener() {
99
100 @Override
101 public void actionPerformed(ActionEvent evt) {
102 final ShareForm[] f = new ShareForm[1];
103 Hashtable contact = (Hashtable) contacts.getSelectedItem();
104 if (image == null) {
105 f[0] = new ShareForm(contactsForm, "Send Email", (String) contact.get("email"), toShare,
106 new ActionListener() {
107
108 @Override
109 public void actionPerformed(ActionEvent evt) {
110 String[] recieptents = new String[1];
111 recieptents[0] = f[0].getTo();
112 Message msg = new Message(toShare);
113 Message.sendMessage(recieptents, "share", msg);
114 finish();
115 }
116 });
117 f[0].show();
118 } else {
119 f[0] = new ShareForm(contactsForm, "Send Email", (String) contact.get("email"), toShare, image,
120 new ActionListener() {
121
122 @Override
123 public void actionPerformed(ActionEvent evt) {
124 String[] recieptents = new String[1];
125 recieptents[0] = f[0].getTo();
126 Message msg = new Message(toShare);
127 msg.setAttachment(image);
128 msg.setMimeType(mimeType);
129 Message.sendMessage(recieptents, "share", msg);
130 finish();
131 }
132 });
133 f[0].show();

Callers

nothing calls this directly

Calls 12

getAllContactsMethod · 0.95
getInstanceMethod · 0.95
showMethod · 0.95
setRendererMethod · 0.95
createListRendererMethod · 0.95
callSeriallyMethod · 0.65
addActionListenerMethod · 0.65
addComponentMethod · 0.65
revalidateMethod · 0.65
showBackMethod · 0.45
addCommandMethod · 0.45
setBackCommandMethod · 0.45

Tested by

no test coverage detected