@@ -13,152 +13,126 @@ package com.omega_r.libs.omegaintentbuilder
1313
1414import android.app.Activity
1515import android.app.Service
16- import android.content.Context
1716import android.net.Uri
1817import com.omega_r.libs.omegaintentbuilder.builders.*
19- import com.omega_r.libs.omegaintentbuilder.builders.share.EmailIntentBuilder
20- import com.omega_r.libs.omegaintentbuilder.builders.PlayStoreBuilder
2118import com.omega_r.libs.omegaintentbuilder.builders.pick.PickBuilder
19+ import com.omega_r.libs.omegaintentbuilder.builders.share.EmailIntentBuilder
2220import com.omega_r.libs.omegaintentbuilder.builders.share.ShareIntentBuilder
2321import com.omega_r.libs.omegaintentbuilder.types.CalendarActionTypes
2422import com.omega_r.libs.omegaintentbuilder.types.MapTypes
2523
2624/* *
2725 * OmegaIntentBuilder class for creating supports createdIntent builders.
2826 */
29- open class OmegaIntentBuilder (private val context : Context ) {
30-
31- companion object {
32- @JvmStatic
33- @Suppress(" NON_FINAL_MEMBER_IN_OBJECT" )
34- open fun from (context : Context ): OmegaIntentBuilder = OmegaIntentBuilder (context)
35- }
36-
37- /* *
38- * @param phoneNumber String for calling
39- * @return CallIntentBuilder for creating call Intent
40- */
41- @JvmOverloads
42- fun call (phoneNumber : String = ""): CallIntentBuilder {
43- return CallIntentBuilder (context, phoneNumber)
44- }
45-
46- /* *
47- * @return ShareIntentBuilder for creating share Intent
48- */
49- fun share (): ShareIntentBuilder {
50- return ShareIntentBuilder (context)
51- }
52-
53- /* *
54- * @return ShareIntentBuilder for creating email Intent
55- */
56- fun email (): EmailIntentBuilder {
57- return EmailIntentBuilder (context)
58- }
59-
60- /* *
61- * @param urlAddress String
62- * @return BrowserBuilder for creating intent to start web browser
63- */
64- fun web (urlAddress : String ): BrowserBuilder {
65- return BrowserBuilder (context, urlAddress)
66- }
67-
68- /* *
69- * @param uri Uri
70- * @return BrowserBuilder for creating intent to start web browser
71- */
72- fun web (uri : Uri ): BrowserBuilder {
73- return BrowserBuilder (context, uri)
74- }
75-
76- /* *
77- * @return SettingsIntentBuilder for creating intent to start settings
78- */
79- fun settings (): SettingsIntentBuilder {
80- return SettingsIntentBuilder (context)
81- }
82-
83- /* *
84- * @return PlayStoreBuilder for creating intent to open PlayStore
85- */
86- fun playStore (): PlayStoreBuilder {
87- return PlayStoreBuilder (context)
88- }
89-
90- /* *
91- * @param actionType CalendarActionTypes
92- * @return CalendarIntentBuilder for method chaining
93- */
94- @JvmOverloads
95- fun calendar (actionType : CalendarActionTypes = CalendarActionTypes .VIEW_DATE ): CalendarIntentBuilder {
96- return CalendarIntentBuilder (context, actionType)
97- }
98-
99- /* *
100- * @param addresses Array
101- * @return SmsIntentBuilder for method chaining
102- */
103- fun sms (vararg addresses : String ): SmsIntentBuilder {
104- return SmsIntentBuilder (addresses.asList(), context)
105- }
106-
107- /* *
108- * @param addresses Collection
109- * @return SmsIntentBuilder for method chaining
110- */
111- fun sms (addresses : Collection <String >): SmsIntentBuilder {
112- return SmsIntentBuilder (addresses, context)
113- }
114-
115- /* *
116- * @return SmsIntentBuilder for method chaining
117- */
118- fun photoCapture (): PhotoCaptureBuilder {
119- return PhotoCaptureBuilder (context)
120- }
121-
122- /* *
123- * @return CropImageIntentBuilder for method chaining
124- */
125- fun cropImage (): CropImageIntentBuilder {
126- return CropImageIntentBuilder (context)
127- }
128-
129- /* *
130- * @return ActivityIntentBuilder for creating activity intent
131- */
132- fun <T : Activity > activity (activity : Class <T >): ActivityIntentBuilder <T > {
133- return ActivityIntentBuilder (context, activity)
134- }
135-
136- /* *
137- * @return ServiceIntentBuilder for creating service intent
138- */
139- fun <T : Service > service (service : Class <T >): ServiceIntentBuilder <T > {
140- return ServiceIntentBuilder (context, service)
141- }
142-
143- /* *
144- * @return MapIntentBuilder for creating intent to open Map application
145- */
146- fun map (vararg types : MapTypes ): MapIntentBuilder {
147- return MapIntentBuilder (context, * types)
148- }
149-
150- /* *
151- * @return PickBuilder for pick different files
152- */
153- fun pick (): PickBuilder {
154- return PickBuilder (context)
155- }
156-
157- /* *
158- * @return SpeechToTextBuilder
159- */
160- fun speechToText (): SpeechToTextBuilder {
161- return SpeechToTextBuilder (context)
162- }
27+ object OmegaIntentBuilder {
28+
29+ /* *
30+ * @param phoneNumber String for calling
31+ * @return CallIntentBuilder for creating call Intent
32+ */
33+ @JvmStatic
34+ fun call (phoneNumber : String = "") = CallIntentBuilder (phoneNumber)
35+
36+ /* *
37+ * @return ShareIntentBuilder for creating share Intent
38+ */
39+ @JvmStatic
40+ fun share () = ShareIntentBuilder ()
41+
42+ /* *
43+ * @return ShareIntentBuilder for creating email Intent
44+ */
45+ @JvmStatic
46+ fun email () = EmailIntentBuilder ()
47+
48+ /* *
49+ * @param urlAddress String
50+ * @return BrowserBuilder for creating intent to start web browser
51+ */
52+ @JvmStatic
53+ fun web (urlAddress : String ) = BrowserBuilder (urlAddress)
54+
55+ /* *
56+ * @param uri Uri
57+ * @return BrowserBuilder for creating intent to start web browser
58+ */
59+ @JvmStatic
60+ fun web (uri : Uri ) = BrowserBuilder (uri)
61+
62+ /* *
63+ * @return SettingsIntentBuilder for creating intent to start settings
64+ */
65+ @JvmStatic
66+ fun settings () = SettingsIntentBuilder ()
67+
68+ /* *
69+ * @return PlayStoreBuilder for creating intent to open PlayStore
70+ */
71+ @JvmStatic
72+ fun playStore () = PlayStoreBuilder ()
73+
74+ /* *
75+ * @param actionType CalendarActionTypes
76+ * @return CalendarIntentBuilder for method chaining
77+ */
78+ @JvmOverloads
79+ @JvmStatic
80+ fun calendar (actionType : CalendarActionTypes = CalendarActionTypes .VIEW_DATE ) = CalendarIntentBuilder (actionType)
81+
82+ /* *
83+ * @param addresses Array
84+ * @return SmsIntentBuilder for method chaining
85+ */
86+ @JvmStatic
87+ fun sms (vararg addresses : String ) = SmsIntentBuilder (addresses.asList())
88+
89+ /* *
90+ * @param addresses Collection
91+ * @return SmsIntentBuilder for method chaining
92+ */
93+ @JvmStatic
94+ fun sms (addresses : Collection <String >) = SmsIntentBuilder (addresses)
95+
96+ /* *
97+ * @return SmsIntentBuilder for method chaining
98+ */
99+ @JvmStatic
100+ fun photoCapture () = PhotoCaptureBuilder ()
101+
102+ /* *
103+ * @return CropImageIntentBuilder for method chaining
104+ */
105+ @JvmStatic
106+ fun cropImage () = CropImageIntentBuilder ()
107+
108+ /* *
109+ * @return ActivityIntentBuilder for creating activity intent
110+ */
111+ @JvmStatic
112+ fun <T : Activity > activity (activity : Class <T >) = ActivityIntentBuilder (activity)
113+
114+ /* *
115+ * @return ServiceIntentBuilder for creating service intent
116+ */
117+ @JvmStatic
118+ fun <T : Service > service (service : Class <T >) = ServiceIntentBuilder (service)
119+
120+ /* *
121+ * @return MapIntentBuilder for creating intent to open Map application
122+ */
123+ @JvmStatic
124+ fun map (vararg types : MapTypes ) = MapIntentBuilder (* types)
125+
126+ /* *
127+ * @return PickBuilder for pick different files
128+ */
129+ @JvmStatic
130+ fun pick () = PickBuilder
131+
132+ /* *
133+ * @return SpeechToTextBuilder
134+ */
135+ @JvmStatic
136+ fun speechToText () = SpeechToTextBuilder ()
163137
164138}
0 commit comments