-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMainActivity.java
More file actions
365 lines (331 loc) · 12.5 KB
/
MainActivity.java
File metadata and controls
365 lines (331 loc) · 12.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
package com.omega_r.omegaintentbuilder;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.omega_r.libs.omegaintentbuilder.OmegaIntentBuilder;
import com.omega_r.libs.omegaintentbuilder.handlers.FailCallback;
import com.omega_r.libs.omegaintentbuilder.types.CalendarActionTypes;
import com.omega_r.libs.omegaintentbuilder.types.EmailAddressType;
import com.omega_r.libs.omegaintentbuilder.types.MapTypes;
import com.omega_r.libs.omegaintentbuilder.types.PhoneType;
import org.jetbrains.annotations.NotNull;
import java.util.Date;
import java.util.concurrent.TimeUnit;
//import com.omega_r.libs.omegaintentbuilder.AppOmegaIntentBuilder;
public class MainActivity extends BaseActivity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.button_call).setOnClickListener(this);
findViewById(R.id.button_send_email).setOnClickListener(this);
findViewById(R.id.button_share).setOnClickListener(this);
findViewById(R.id.button_share_files).setOnClickListener(this);
findViewById(R.id.button_web).setOnClickListener(this);
findViewById(R.id.button_settings).setOnClickListener(this);
findViewById(R.id.button_playstore).setOnClickListener(this);
findViewById(R.id.button_navigation).setOnClickListener(this);
findViewById(R.id.button_calendar).setOnClickListener(this);
findViewById(R.id.button_sms).setOnClickListener(this);
findViewById(R.id.button_photo_capture).setOnClickListener(this);
findViewById(R.id.button_crop_image).setOnClickListener(this);
findViewById(R.id.button_pick_image).setOnClickListener(this);
findViewById(R.id.button_speech_to_text).setOnClickListener(this);
findViewById(R.id.button_service_extra).setOnClickListener(this);
findViewById(R.id.button_fragment_extra).setOnClickListener(this);
findViewById(R.id.button_create_alarm).setOnClickListener(this);
findViewById(R.id.button_insert_contact).setOnClickListener(this);
findViewById(R.id.button_search_web).setOnClickListener(this);
findViewById(R.id.button_create_timer).setOnClickListener(this);
findViewById(R.id.button_show_timers).setOnClickListener(this);
findViewById(R.id.button_show_alarms).setOnClickListener(this);
findViewById(R.id.button_record_video).setOnClickListener(this);
findViewById(R.id.button_dismiss_alarm).setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.button_call:
startCallIntent();
break;
case R.id.button_send_email:
startEmailIntent();
break;
case R.id.button_share:
startShareIntent();
break;
case R.id.button_share_files:
startShareFilesActivity();
break;
case R.id.button_web:
openUrl();
break;
case R.id.button_settings:
openSettings();
break;
case R.id.button_playstore:
openPlayStore();
break;
case R.id.button_navigation:
openGoogleMap();
break;
case R.id.button_calendar:
onCalendarClicked();
break;
case R.id.button_sms:
onSmsClicked();
break;
case R.id.button_photo_capture:
onPhotoCaptureClicked();
break;
case R.id.button_crop_image:
onCropImageClicked();
break;
case R.id.button_pick_image:
onPickImageClicked();
break;
case R.id.button_speech_to_text:
onSpeechToTextClicked();
break;
case R.id.button_service_extra:
onExtrasToServiceClicked();
break;
case R.id.button_fragment_extra:
onExtrasToFragmentClicked();
break;
case R.id.button_insert_contact:
onInsertContactClicked();
break;
case R.id.button_search_web:
onSearchWebClicked();
break;
case R.id.button_create_alarm:
onCreateAlarmClicked();
break;
case R.id.button_create_timer:
onCreateTimerClicked();
break;
case R.id.button_show_timers:
onShowTimersClicked();
break;
case R.id.button_show_alarms:
onShowAlarmsClicked();
break;
case R.id.button_record_video:
onRecordVideoClicked();
break;
case R.id.button_dismiss_alarm:
onDismissAlarmClicked();
break;
}
}
private void startShareFilesActivity() {
OmegaIntentBuilder.activity(ShareFilesActivity.class)
.startActivity(this);
// AppOmegaIntentBuilder
// .appActivities()
// .shareFilesActivity()
// .url1("https://developer.android.com/studio/images/hero_image_studio.png")
// .modelVar2("https://avatars1.githubusercontent.com/u/28600571?s=200&v=4")
// .startActivity();
}
private void startCallIntent() {
OmegaIntentBuilder
.call("88000000008")
.createIntentHandler(this)
.failToast("Sorry, you don't have app for making call phone")
.startActivity();
}
private void startEmailIntent() {
OmegaIntentBuilder
.email()
.text("Hello world")
.emailTo("develop@omega-r.com")
.subject("Great library")
.createIntentHandler(this)
.failCallback(new FailCallback() {
@Override
public void onActivityStartError(@NotNull Exception exc) {
Toast.makeText(getApplicationContext(), "Sorry, you don't have app for sending email", Toast.LENGTH_SHORT).show();
}
})
.startActivity();
}
private void startShareIntent() {
OmegaIntentBuilder
.share()
.emailTo("develop@omega-r.com")
.emailBcc("bcc1@test.com", "bcc2@test.com")
.emailCc("cc1@test.com", "cc2@test.com")
.subject("Great library")
.createIntentHandler(this)
.chooserTitle("Choose")
.startActivity();
}
private void openUrl() {
OmegaIntentBuilder
.web("https://omega-r.com/")
.createIntentHandler(this)
.chooserTitle("Omega-R")
.failToast("You don't have app for open urls")
.startActivity();
}
private void openSettings() {
OmegaIntentBuilder
.settings()
.startActivity(this);
}
private void openPlayStore() {
OmegaIntentBuilder
.playStore()
.packageName("com.omegar.coloring")
.startActivity(this);
}
private void openGoogleMap() {
OmegaIntentBuilder
.map(MapTypes.YANDEX_MAP, MapTypes.GOOGLE_MAP)
.latitude(56.6327622)
.longitude(47.910693)
.address("Omega-R")
.createIntentHandler(this)
.failToast("You don't have Map application")
.startActivity();
}
private void onCalendarClicked() {
Date startDate = new Date();
long endDate = startDate.getTime() + TimeUnit.DAYS.toMillis(7);
OmegaIntentBuilder
.calendar(CalendarActionTypes.INSERT_EVENT)
.startDate(startDate)
.endDate(endDate)
.title("Omega-R")
.description("Great library")
.location("New York")
.allDay(false)
.organizer("develop@omega-r.com")
.hasAlarm(false)
.startActivity(this);
}
private void onSmsClicked() {
OmegaIntentBuilder
.sms("88000000008", "88888888888")
.message("Great library")
.createIntentHandler(this)
.startActivity();
}
private void onPhotoCaptureClicked() {
OmegaIntentBuilder
.activity(PhotoCaptureActivity.class)
.startActivity(this);
}
private void onCropImageClicked() {
OmegaIntentBuilder
.activity(CropImageActivity.class)
.startActivity(this);
}
private void onPickImageClicked() {
OmegaIntentBuilder
.activity(PickImageActivity.class)
.startActivity(this);
}
private void onSpeechToTextClicked() {
OmegaIntentBuilder
.activity(SpeechToTextActivity.class)
.createIntentHandler(this)
.startActivity();
}
private void onExtrasToServiceClicked() {
// AppOmegaIntentBuilder.from(this)
// .appServices()
// .testService()
// .value("Great library")
// .modelVar2("Omega-R")
// .startService();
}
private void onExtrasToFragmentClicked() {
// AppOmegaIntentBuilder.from(this)
// .appActivities()
// .tabActivity()
// .startActivity();
}
private void onCreateAlarmClicked() {
OmegaIntentBuilder
.createAlarm()
.message("It's your alarm")
.hour(15)
.vibrate()
.minutes(23)
.startActivity(this);
}
private void onInsertContactClicked() {
OmegaIntentBuilder
.insertContact()
.name("John")
.fullMode()
.phoneticName("phoneticName")
.company("company")
.jobTitle("jobTitle")
.notes("notes")
.phone("88000000008")
.phoneType(PhoneType.TYPE_HOME)
.phoneIsPrimary(true)
.secondaryPhone("88000001008")
.secondaryPhoneType("YOUR_CUSTOM_TYPE")
.tertiaryPhone("888888888")
.tertiaryPhoneType(PhoneType.TYPE_WORK_MOBILE)
.email("develop@omega-r.com")
.emailType(EmailAddressType.TYPE_HOME)
.emailIsPrimary(false)
.secondaryEmail("secondaryEmail")
.secondaryEmailType(EmailAddressType.TYPE_WORK)
.tertiaryEmail("tertiaryEmail")
.tertiaryEmailType("YOUR_CUSTOM_EMAIL_TYPE")
.postal("postal")
.postalType("Home")
.postalIsPrimary(true)
.createIntentHandler(this)
.startActivity();
}
private void onSearchWebClicked() {
OmegaIntentBuilder
.searchWeb()
.query("How much does an elephant weigh")
.startActivity(this);
}
private void onCreateTimerClicked() {
OmegaIntentBuilder
.createTimer()
.message("It's your timer")
.seconds(5)
.startActivity(this);
}
private void onShowTimersClicked() {
OmegaIntentBuilder
.showTimers()
.startActivity(this);
}
private void onShowAlarmsClicked() {
OmegaIntentBuilder
.showAlarms()
.startActivity(this);
}
private void onRecordVideoClicked() {
OmegaIntentBuilder
.activity(VideoRecordActivity.class)
.startActivity(this);
}
private void onDismissAlarmClicked() {
OmegaIntentBuilder
.dismissAlarm()
//BY LABEL
//.label("It's your alarm")
//or BY TIME
//.hour(0)
//.minute(0)
//.isPM(true)
//or DISMISS NEXT
//.next()
//or SEARCH ALL
.startActivity(this);
}
}