Skip to content

Commit 159e58f

Browse files
committed
Merge branches 'develop' and 'feature/video_record_intent_builder' of https://github.com/Omega-R/OmegaIntentBuilder into feature/video_record_intent_builder
� Conflicts: � core/src/main/java/com/omega_r/libs/omegaintentbuilder/OmegaIntentBuilder.kt � examples/src/main/java/com/omega_r/omegaintentbuilder/MainActivity.java � examples/src/main/res/values/strings.xml
2 parents 050d88a + a99276d commit 159e58f

6 files changed

Lines changed: 111 additions & 42 deletions

File tree

core/src/main/java/com/omega_r/libs/omegaintentbuilder/OmegaIntentBuilder.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.omega_r.libs.omegaintentbuilder.builders.share.EmailIntentBuilder
2222
import com.omega_r.libs.omegaintentbuilder.builders.share.ShareIntentBuilder
2323
import com.omega_r.libs.omegaintentbuilder.types.CalendarActionTypes
2424
import com.omega_r.libs.omegaintentbuilder.types.MapTypes
25+
import com.omega_r.libs.omegaintentbuilder.types.ShowType
2526

2627
/**
2728
* OmegaIntentBuilder class for creating supports createdIntent builders.
@@ -163,6 +164,18 @@ object OmegaIntentBuilder {
163164
@RequiresApi(Build.VERSION_CODES.KITKAT)
164165
fun createAlarm() = AlarmIntentBuilder()
165166

167+
/**
168+
* @return ShowAlarmsTimersIntentBuilder
169+
*/
170+
@JvmStatic
171+
fun showTimers() = ShowAlarmsTimersIntentBuilder(ShowType.TIMERS)
172+
173+
/**
174+
* @return ShowAlarmsTimersIntentBuilder
175+
*/
176+
@JvmStatic
177+
fun showAlarms() = ShowAlarmsTimersIntentBuilder(ShowType.ALARMS)
178+
166179
/**
167180
* @return VideoRecordBuilder
168181
*/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.omega_r.libs.omegaintentbuilder.builders
2+
3+
import android.content.Context
4+
import android.content.Intent
5+
import com.omega_r.libs.omegaintentbuilder.types.ShowType
6+
7+
class ShowAlarmsTimersIntentBuilder(private val showType: ShowType) : BaseActivityBuilder() {
8+
9+
override fun createIntent(context: Context): Intent {
10+
return Intent(showType.actionType)
11+
}
12+
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.omega_r.libs.omegaintentbuilder.types
2+
3+
import android.provider.AlarmClock.ACTION_SHOW_ALARMS
4+
import android.provider.AlarmClock.ACTION_SHOW_TIMERS
5+
6+
enum class ShowType(val actionType: String) {
7+
ALARMS(ACTION_SHOW_ALARMS),
8+
TIMERS(ACTION_SHOW_TIMERS)
9+
}

examples/src/main/java/com/omega_r/omegaintentbuilder/MainActivity.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ protected void onCreate(Bundle savedInstanceState) {
4444
findViewById(R.id.button_insert_contact).setOnClickListener(this);
4545
findViewById(R.id.button_search_web).setOnClickListener(this);
4646
findViewById(R.id.button_create_timer).setOnClickListener(this);
47+
findViewById(R.id.button_show_timers).setOnClickListener(this);
48+
findViewById(R.id.button_show_alarms).setOnClickListener(this);
4749
findViewById(R.id.button_record_video).setOnClickListener(this);
4850
}
4951

@@ -110,6 +112,12 @@ public void onClick(View v) {
110112
case R.id.button_create_timer:
111113
onCreateTimerClicked();
112114
break;
115+
case R.id.button_show_timers:
116+
onShowTimersClicked();
117+
break;
118+
case R.id.button_show_alarms:
119+
onShowAlarmsClicked();
120+
break;
113121
case R.id.button_record_video:
114122
onRecordVideoClicked();
115123
break;
@@ -317,6 +325,17 @@ private void onCreateTimerClicked() {
317325
.startActivity(this);
318326
}
319327

328+
private void onShowTimersClicked() {
329+
OmegaIntentBuilder
330+
.showTimers()
331+
.startActivity(this);
332+
}
333+
334+
private void onShowAlarmsClicked() {
335+
OmegaIntentBuilder
336+
.showAlarms()
337+
.startActivity(this);
338+
}
320339

321340
private void onRecordVideoClicked() {
322341
OmegaIntentBuilder

examples/src/main/res/layout/activity_main.xml

Lines changed: 55 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<androidx.core.widget.NestedScrollView
3-
xmlns:android="http://schemas.android.com/apk/res/android"
2+
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
43
xmlns:tools="http://schemas.android.com/tools"
54
android:layout_width="match_parent"
65
android:layout_height="match_parent"
@@ -17,155 +16,169 @@
1716
android:layout_height="wrap_content"
1817
android:layout_marginTop="8dp"
1918
android:layout_marginBottom="20dp"
20-
android:theme="@style/ButtonStyle"
21-
android:text="@string/share_files"/>
19+
android:text="@string/share_files"
20+
android:theme="@style/ButtonStyle" />
2221

2322
<Button
2423
android:id="@+id/button_call"
2524
android:layout_width="match_parent"
2625
android:layout_height="wrap_content"
27-
android:theme="@style/ButtonStyle"
28-
android:text="@string/call"/>
26+
android:text="@string/call"
27+
android:theme="@style/ButtonStyle" />
2928

3029
<Button
3130
android:id="@+id/button_send_email"
3231
android:layout_width="match_parent"
3332
android:layout_height="wrap_content"
3433
android:layout_marginTop="8dp"
3534
android:layout_marginBottom="8dp"
36-
android:theme="@style/ButtonStyle"
37-
android:text="@string/send_emal"/>
35+
android:text="@string/send_emal"
36+
android:theme="@style/ButtonStyle" />
3837

3938
<Button
4039
android:id="@+id/button_share"
4140
android:layout_width="match_parent"
4241
android:layout_height="wrap_content"
43-
android:theme="@style/ButtonStyle"
44-
android:text="@string/share"/>
42+
android:text="@string/share"
43+
android:theme="@style/ButtonStyle" />
4544

4645
<Button
4746
android:id="@+id/button_web"
4847
android:layout_width="match_parent"
4948
android:layout_height="wrap_content"
5049
android:layout_marginTop="8dp"
5150
android:layout_marginBottom="8dp"
52-
android:theme="@style/ButtonStyle"
53-
android:text="@string/web"/>
51+
android:text="@string/web"
52+
android:theme="@style/ButtonStyle" />
5453

5554
<Button
5655
android:id="@+id/button_settings"
5756
android:layout_width="match_parent"
5857
android:layout_height="wrap_content"
59-
android:theme="@style/ButtonStyle"
60-
android:text="@string/settings"/>
58+
android:text="@string/settings"
59+
android:theme="@style/ButtonStyle" />
6160

6261
<Button
6362
android:id="@+id/button_playstore"
6463
android:layout_width="match_parent"
6564
android:layout_height="wrap_content"
6665
android:layout_marginTop="8dp"
6766
android:layout_marginBottom="8dp"
68-
android:theme="@style/ButtonStyle"
69-
android:text="@string/playstore"/>
67+
android:text="@string/playstore"
68+
android:theme="@style/ButtonStyle" />
7069

7170
<Button
7271
android:id="@+id/button_navigation"
7372
android:layout_width="match_parent"
7473
android:layout_height="wrap_content"
75-
android:theme="@style/ButtonStyle"
76-
android:text="@string/navigation"/>
74+
android:text="@string/navigation"
75+
android:theme="@style/ButtonStyle" />
7776

7877
<Button
7978
android:id="@+id/button_calendar"
8079
android:layout_width="match_parent"
8180
android:layout_height="wrap_content"
8281
android:layout_marginTop="8dp"
8382
android:layout_marginBottom="8dp"
84-
android:theme="@style/ButtonStyle"
85-
android:text="@string/calendar"/>
83+
android:text="@string/calendar"
84+
android:theme="@style/ButtonStyle" />
8685

8786
<Button
8887
android:id="@+id/button_sms"
8988
android:layout_width="match_parent"
9089
android:layout_height="wrap_content"
91-
android:theme="@style/ButtonStyle"
92-
android:text="@string/sms"/>
90+
android:text="@string/sms"
91+
android:theme="@style/ButtonStyle" />
9392

9493
<Button
9594
android:id="@+id/button_photo_capture"
9695
android:layout_width="match_parent"
9796
android:layout_height="wrap_content"
9897
android:layout_marginTop="8dp"
9998
android:layout_marginBottom="8dp"
100-
android:theme="@style/ButtonStyle"
101-
android:text="@string/photo_capture"/>
99+
android:text="@string/photo_capture"
100+
android:theme="@style/ButtonStyle" />
102101

103102
<Button
104103
android:id="@+id/button_crop_image"
105104
android:layout_width="match_parent"
106105
android:layout_height="wrap_content"
107-
android:theme="@style/ButtonStyle"
108-
android:text="@string/crop_image"/>
106+
android:text="@string/crop_image"
107+
android:theme="@style/ButtonStyle" />
109108

110109
<Button
111110
android:id="@+id/button_pick_image"
112111
android:layout_width="match_parent"
113112
android:layout_height="wrap_content"
114113
android:layout_marginTop="8dp"
115114
android:layout_marginBottom="8dp"
116-
android:theme="@style/ButtonStyle"
117-
android:text="@string/pick_image"/>
115+
android:text="@string/pick_image"
116+
android:theme="@style/ButtonStyle" />
118117

119118
<Button
120119
android:id="@+id/button_speech_to_text"
121120
android:layout_width="match_parent"
122121
android:layout_height="wrap_content"
123-
android:theme="@style/ButtonStyle"
124-
android:text="@string/speech_to_text"/>
122+
android:text="@string/speech_to_text"
123+
android:theme="@style/ButtonStyle" />
125124

126125
<Button
127126
android:id="@+id/button_service_extra"
128127
android:layout_width="match_parent"
129128
android:layout_height="wrap_content"
130129
android:layout_marginTop="8dp"
131130
android:layout_marginBottom="8dp"
132-
android:theme="@style/ButtonStyle"
133-
android:text="@string/service_extra"/>
131+
android:text="@string/service_extra"
132+
android:theme="@style/ButtonStyle" />
134133

135134
<Button
136135
android:id="@+id/button_fragment_extra"
137136
android:layout_width="match_parent"
138137
android:layout_height="wrap_content"
139-
android:theme="@style/ButtonStyle"
140-
android:text="@string/fragment_extra"/>
138+
android:text="@string/fragment_extra"
139+
android:theme="@style/ButtonStyle" />
141140

142141
<Button
143142
android:id="@+id/button_create_alarm"
144143
android:layout_width="match_parent"
145144
android:layout_height="wrap_content"
146-
android:theme="@style/ButtonStyle"
147-
android:text="@string/create_alarm"/>
145+
android:text="@string/create_alarm"
146+
android:theme="@style/ButtonStyle" />
148147

149148
<Button
150149
android:id="@+id/button_search_web"
151150
android:layout_width="match_parent"
152151
android:layout_height="wrap_content"
153-
android:theme="@style/ButtonStyle"
154-
android:text="@string/search_web"/>
152+
android:text="@string/search_web"
153+
android:theme="@style/ButtonStyle" />
155154

156155
<Button
157156
android:id="@+id/button_insert_contact"
158157
android:layout_width="match_parent"
159158
android:layout_height="wrap_content"
160-
android:theme="@style/ButtonStyle"
161-
android:text="@string/insert_contact"/>
159+
android:text="@string/insert_contact"
160+
android:theme="@style/ButtonStyle" />
162161

163162
<Button
164163
android:id="@+id/button_create_timer"
165164
android:layout_width="match_parent"
166165
android:layout_height="wrap_content"
167-
android:theme="@style/ButtonStyle"
168-
android:text="@string/create_timer"/>
166+
android:text="@string/create_timer"
167+
android:theme="@style/ButtonStyle" />
168+
169+
<Button
170+
android:id="@+id/button_show_timers"
171+
android:layout_width="match_parent"
172+
android:layout_height="wrap_content"
173+
android:text="@string/show_timers"
174+
android:theme="@style/ButtonStyle" />
175+
176+
<Button
177+
android:id="@+id/button_show_alarms"
178+
android:layout_width="match_parent"
179+
android:layout_height="wrap_content"
180+
android:text="@string/show_alarms"
181+
android:theme="@style/ButtonStyle" />
169182

170183
<Button
171184
android:id="@+id/button_record_video"

examples/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<string name="create_timer">Create Timer</string>
2626
<string name="insert_contact">Insert Contact</string>
2727
<string name="search_web">Search Web</string>
28+
<string name="show_timers">Show Timers</string>
29+
<string name="show_alarms">Show Alarms</string>
2830
<string name="open_camera_to_record">Open Camera To Record</string>
2931
<string name="record_video">Record Video</string>
3032
</resources>

0 commit comments

Comments
 (0)