Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.omega_r.libs.omegaintentbuilder.builders.share.EmailIntentBuilder
import com.omega_r.libs.omegaintentbuilder.builders.share.ShareIntentBuilder
import com.omega_r.libs.omegaintentbuilder.types.CalendarActionTypes
import com.omega_r.libs.omegaintentbuilder.types.MapTypes
import com.omega_r.libs.omegaintentbuilder.types.ShowType

/**
* OmegaIntentBuilder class for creating supports createdIntent builders.
Expand Down Expand Up @@ -163,4 +164,16 @@ object OmegaIntentBuilder {
@RequiresApi(Build.VERSION_CODES.KITKAT)
fun createAlarm() = AlarmIntentBuilder()

/**
* @return ShowAlarmsTimersIntentBuilder
*/
@JvmStatic
fun showTimers() = ShowAlarmsTimersIntentBuilder(ShowType.TIMERS)

/**
* @return ShowAlarmsTimersIntentBuilder
*/
@JvmStatic
fun showAlarms() = ShowAlarmsTimersIntentBuilder(ShowType.ALARMS)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.omega_r.libs.omegaintentbuilder.builders

import android.content.Context
import android.content.Intent
import com.omega_r.libs.omegaintentbuilder.types.ShowType

class ShowAlarmsTimersIntentBuilder(private val showType: ShowType) : BaseActivityBuilder() {

override fun createIntent(context: Context): Intent {
return Intent(showType.actionType)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.omega_r.libs.omegaintentbuilder.types

import android.provider.AlarmClock.ACTION_SHOW_ALARMS
import android.provider.AlarmClock.ACTION_SHOW_TIMERS

enum class ShowType(val actionType: String) {
ALARMS(ACTION_SHOW_ALARMS),
TIMERS(ACTION_SHOW_TIMERS)
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ protected void onCreate(Bundle savedInstanceState) {
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);
}

@Override
Expand Down Expand Up @@ -109,6 +111,12 @@ public void onClick(View v) {
case R.id.button_create_timer:
onCreateTimerClicked();
break;
case R.id.button_show_timers:
onShowTimersClicked();
break;
case R.id.button_show_alarms:
onShowAlarmsClicked();
break;
}
}

Expand Down Expand Up @@ -313,4 +321,16 @@ private void onCreateTimerClicked() {
.startActivity(this);
}

private void onShowTimersClicked() {
OmegaIntentBuilder
.showTimers()
.startActivity(this);
}

private void onShowAlarmsClicked() {
OmegaIntentBuilder
.showAlarms()
.startActivity(this);
}

}
97 changes: 55 additions & 42 deletions examples/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -17,155 +16,169 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="20dp"
android:theme="@style/ButtonStyle"
android:text="@string/share_files"/>
android:text="@string/share_files"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_call"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/call"/>
android:text="@string/call"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_send_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:theme="@style/ButtonStyle"
android:text="@string/send_emal"/>
android:text="@string/send_emal"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_share"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/share"/>
android:text="@string/share"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_web"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:theme="@style/ButtonStyle"
android:text="@string/web"/>
android:text="@string/web"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/settings"/>
android:text="@string/settings"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_playstore"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:theme="@style/ButtonStyle"
android:text="@string/playstore"/>
android:text="@string/playstore"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/navigation"/>
android:text="@string/navigation"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_calendar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:theme="@style/ButtonStyle"
android:text="@string/calendar"/>
android:text="@string/calendar"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_sms"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/sms"/>
android:text="@string/sms"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_photo_capture"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:theme="@style/ButtonStyle"
android:text="@string/photo_capture"/>
android:text="@string/photo_capture"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_crop_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/crop_image"/>
android:text="@string/crop_image"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_pick_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:theme="@style/ButtonStyle"
android:text="@string/pick_image"/>
android:text="@string/pick_image"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_speech_to_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/speech_to_text"/>
android:text="@string/speech_to_text"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_service_extra"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:theme="@style/ButtonStyle"
android:text="@string/service_extra"/>
android:text="@string/service_extra"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_fragment_extra"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/fragment_extra"/>
android:text="@string/fragment_extra"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_create_alarm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/create_alarm"/>
android:text="@string/create_alarm"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_search_web"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/search_web"/>
android:text="@string/search_web"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_insert_contact"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/insert_contact"/>
android:text="@string/insert_contact"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_create_timer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ButtonStyle"
android:text="@string/create_timer"/>
android:text="@string/create_timer"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_show_timers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_timers"
android:theme="@style/ButtonStyle" />

<Button
android:id="@+id/button_show_alarms"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_alarms"
android:theme="@style/ButtonStyle" />

</LinearLayout>

Expand Down
2 changes: 2 additions & 0 deletions examples/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@
<string name="create_timer">Create Timer</string>
<string name="insert_contact">Insert Contact</string>
<string name="search_web">Search Web</string>
<string name="show_timers">Show Timers</string>
<string name="show_alarms">Show Alarms</string>
</resources>