@@ -17,299 +17,69 @@ allprojects {
1717}
1818```
1919** Step 2.** Add the dependency
20+ #### If you use only Java.
2021```
2122dependencies {
22- compile 'com.github.Omega-R.OmegaIntentBuilder:core:1.1.0 '
23+ implementation 'com.github.Omega-R.OmegaIntentBuilder:core:1.1.1 '
2324 // For extras
24- compile 'com.github.Omega-R.OmegaIntentBuilder:annotations:1.1.0 '
25- annotationProcessor 'com.github.Omega-R.OmegaIntentBuilder:processor:1.1.0 '
25+ implementation 'com.github.Omega-R.OmegaIntentBuilder:annotations:1.1.1 '
26+ annotationProcessor 'com.github.Omega-R.OmegaIntentBuilder:processor:1.1.1 '
2627}
2728```
28- # Usage
2929
30- ** Call Intent**
31- ```
32- OmegaIntentBuilder.from(this)
33- .call("Your phone number")
34- .createIntentHandler(this)
35- .failToast("Sorry, you don't have app for making call phone")
36- .startActivity();
37- ```
38-
39- ** Email Intent**
40- ```
41- OmegaIntentBuilder.from(this)
42- .email()
43- .text("Hello world")
44- .emailTo("develop@omega-r.com")
45- .subject("Great library")
46- .createIntentHandler()
47- .failCallback(new FailCallback() {
48- @Override
49- public void onActivityStartError(@NotNull Exception exc) {
50- Toast.makeText(getApplicationContext(), "Sorry, you don't have app for sending email", Toast.LENGTH_SHORT).show();
51- }
52- })
53- .startActivity();
54- ```
55-
56- ** Share Intent**
57- ```
58- OmegaIntentBuilder.from(context)
59- .share()
60- .emailTo("develop@omega-r.com")
61- .emailBcc("bcc1@test.com","bcc2@test.com") // Concealed addresses
62- .emailCc("cc1@test.com","cc2@test.com") // Copy addresses
63- .subject("Great library")
64- .createIntentHandler()
65- .chooserTitle("Choose")
66- .startActivity();
67- ```
68-
69- You can download file from internet and put it to intent.
70- ```
71- OmegaIntentBuilder.from(context)
72- .share()
73- .emailTo("your_email_here@gmail.com")
74- .subject("Great library")
75- .filesUrls("https://developer.android.com/studio/images/hero_image_studio.png")
76- .fileUrlWithMimeType("https://avatars1.githubusercontent.com/u/28600571?s=200&v=4", MimeTypes.IMAGE_PNG)
77- .download(new DownloadCallback() {
78- @Override
79- public void onDownloaded(boolean success, @NotNull ContextIntentHandler contextIntentHandler) {
80- contextIntentHandler.startActivity();
81- }
82- });
83- ```
84-
85- ** Web Intent**
86- ```
87- OmegaIntentBuilder.from(context)
88- .web("https://omega-r.com/")
89- .createIntentHandler()
90- .chooserTitle("Omega-R")
91- .failToast("You don't have app for open urls")
92- .startActivity();
93- ```
94-
95- ** Settings Intent**
96- ```
97- OmegaIntentBuilder.from(context)
98- .settings()
99- .wifi()
100- .createIntentHandler()
101- .startActivity();
102- ```
103-
104- ** Map Intent**
105-
106- Supported map application : Google, Yandex, Kakao, Naver;
107- ```
108- OmegaIntentBuilder.from(context)
109- .map(MapTypes.GOOGLE_MAP)
110- .latitude(56.6327622)
111- .longitude(47.910693)
112- .address("Omega-R")
113- .createIntentHandler()
114- .failToast("You don't have Google Map application")
115- .startActivity();
30+ #### If you use Kotlin or Java with Kotlin, please use kapt instead java annotationProcessor. Main build.gradle file should look like this
11631```
32+ apply plugin: 'com.android.application'
33+ apply plugin: 'kotlin-android'
34+ apply plugin: 'kotlin-kapt'
11735
118- ** Calendar Intent**
119- ```
120- OmegaIntentBuilder.from(this)
121- .calendar(CalendarActionTypes.INSERT_EVENT)
122- .startDate(startDate)
123- .endDate(endDate)
124- .title("Omega-R")
125- .description("Great library")
126- .location("New York")
127- .allDay(false)
128- .organizer("develop@omega-r.com")
129- .hasAlarm(false)
130- .createIntentHandler()
131- .startActivity();
132- ```
133-
134- ** Sms Intent**
135- ```
136- OmegaIntentBuilder.from(this)
137- .sms("Your phone number here")
138- .message("Your message here")
139- .createIntentHandler()
140- .startActivity();
141- ```
142-
143- ** Photo capture Intent**
144- ```
145- OmegaIntentBuilder.from(this)
146- .photoCapture()
147- // .file("Path to file") Also you can use your full path to captured file
148- .createIntentHandler(this)
149- // You can use startActivityForResult() method without Activity participate.
150- .startActivityForResult(new ActivityResultCallback() {
151- @Override
152- public void onActivityResult(int resultCode, @NotNull Intent data) {
153- if (resultCode == RESULT_OK) {
154- Bundle extras = data.getExtras();
155- if (extras != null) {
156- Bitmap imageBitmap = (Bitmap) extras.get("data");
157- imageView.setImageBitmap(imageBitmap);
158- }
159- }
160- }
161- });
162- ```
163-
164- ** Crop image Intent**
165- ```
166- OmegaIntentBuilder.from(this)
167- .cropImage()
168- .property(DEFAULT_OUTPUT_X, DEFAULT_OUTPUT_Y)
169- .bitmap(BitmapFactory.decodeResource(getResources(), R.drawable.crop_image))
170- //.file("Your image file here") Also you can use your image file instead bitmap
171- //.fileUri("Your URI here") Also you can use your URI instead bitmap, file
172- .createIntentHandler(this)
173- .failToast("You don't have app for cropping image")
174- .startActivityForResult(CROP_REQUEST_CODE);
175- ```
176-
177- ** Pick file Intent**
178- ```
179- OmegaIntentBuilder.from(this)
180- .pick()
181- .file()
182- .mimeType("Your mimeType here") // Default mimeType "file/*"
183- .multiply(false)
184- .createIntentHandler(this)
185- .startActivityForResult("Your result code here");
186- ```
187-
188- ** Pick image Intent**
189- ```
190- OmegaIntentBuilder.from(this)
191- .pick()
192- .image()
193- .multiply(false)
194- .createIntentHandler(this)
195- .startActivityForResult("Your result code here");
196- ```
197-
198- ** Speech to text Intent**
199- ```
200- OmegaIntentBuilder.from(this)
201- .speechToText()
202- .prompt("Say something")
203- .createIntentHandler(this)
204- .failToast("You don't have app for \"Speech to text\"")
205- .startActivityForResult(request_code)
206- ```
207-
208- # Extras
209-
210- ** Activity**
211- ```
212- @OmegaActivity
213- public class ExampleActivity extends Activity {
214-
215- @OmegaExtra("parameter_name") // You can use your own generated parameter name
216- String message;
217-
218- @OmegaExtra() // Or parameter name will be automatically generated by value name
219- String title;
220-
221-
222- @OmegaExtraModel(prefix = "model") // You can use your model class with OmegaExtra annotation parameters
223- Model model = new Model();
224-
225- @Override
226- protected void onCreate(Bundle savedInstanceState) {
227- super.onCreate(savedInstanceState);
228- ...
229- AppOmegaIntentBuilder.inject(this);
230- }
36+ kapt {
37+ generateStubs = true
23138}
232- ```
233-
234- ```
235- public class Model {
23639
237- @OmegaExtra("Var2")
238- public String url;
239-
240- public String getUrl() {
241- return url;
242- }
40+ android {
41+ ......
42+ }
43+
44+ dependencies {
45+ implementation 'com.github.Omega-R.OmegaIntentBuilder:core:1.1.1'
46+ // For extras
47+ implementation 'com.github.Omega-R.OmegaIntentBuilder:annotations:1.1.1'
48+ kapt 'com.github.Omega-R.OmegaIntentBuilder:processor:1.1.1'
24349}
24450```
24551
246- ```
247- AppOmegaIntentBuilder.from(this)
248- .appActivities()
249- .exampleActivity()
250- .parameter_name("Omega-R")
251- .title("https://omega-r.com/")
252- .modelVar2("https://avatars1.githubusercontent.com/u/28600571?s=200&v=4")
253- .createIntentHandler()
254- .startActivity();
255- ```
25652
257- ** Fragment**
25853
259- ```
260- @OmegaFragment
261- public class FirstFragment extends BaseFragment {
54+ ## [ Wiki] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki )
55+
56+ Supported features.
57+
58+ * [ Build Extras] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Build-Extra )
59+ * [ Activity Extras Builder] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Activity-Extras-builder )
60+ * [ Fragment Extras Builder] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Fragment-Extras-Builder )
61+ * [ Service Extras Builder] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Service-Extras-Builder )
62+ * [ Supported intents] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Supported-intents )
63+ * [ Activity Intent Builder] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Activity-Intent-builder )
64+ * [ Service Intent Builder] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Service-Intent-Builder )
65+ * [ Call Intent] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Call-Intent )
66+ * [ Email Intent] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Email-Intent )
67+ * [ Share Intent] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Share-Intent )
68+ * [ Web Browser Intent] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Web-Intent )
69+ * [ Settings Intent] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Settings-Intent )
70+ * [ Speech to text] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Speech-to-text )
71+ * [ GooglePlayStore Intent] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Google-play-store )
72+ * [ Photo Capture Intent] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Photo-Capture-Intent )
73+ * [ Map Intent] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Map-Intent )
74+ * [ Crop Image Intent] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Crop-Image-Intent )
75+ * [ Calendar Intent] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Calendar-Intent )
76+ * [ Pick Files] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Pick-files )
77+ * [ File] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/File-Pick )
78+ * [ Image] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Image-Pick )
79+ * [ Audio] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Audio-Pick )
80+ * [ Contact] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Contact-Pick )
81+ * [ Video] ( https://github.com/Omega-R/OmegaIntentBuilder/wiki/Video-Pick )
26282
263- @OmegaExtra
264- String value;
265-
266- @Override
267- public void onCreate(Bundle savedInstanceState) {
268- super.onCreate(savedInstanceState);
269- AppOmegaFragmentBuilder.inject(this);
270- }
271- ```
272-
273- ```
274- AppOmegaFragmentBuilder.firstFragment()
275- .value("First fragment")
276- .createFragment();
277- ```
278-
279- ** Service**
280- ```
281- @OmegaService
282- public class TestService extends IntentService {
283-
284- private static final String TAG = TestService.class.getSimpleName();
285-
286- @OmegaExtra
287- String value;
288-
289- @OmegaExtraModel(prefix = "model")
290- Model model = new Model();
291-
292- public TestService() {
293- super(TAG);
294- }
295-
296- @Override
297- protected void onHandleIntent(@Nullable Intent intent) {
298- AppOmegaIntentBuilder.inject(this, intent);
299- Log.d(TAG, value);
300- Log.d(TAG, model.getUrl());
301- }
302- }
303- ```
304-
305- ```
306- AppOmegaIntentBuilder.from(context)
307- .appServices()
308- .testService()
309- .value("Great library")
310- .modelVar2("Omega-R")
311- .startService();
312- ```
31383
31484# License
31585```
0 commit comments