Skip to content
Open
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 @@ -163,4 +163,11 @@ object OmegaIntentBuilder {
@RequiresApi(Build.VERSION_CODES.KITKAT)
fun createAlarm() = AlarmIntentBuilder()

/**
* @return DismissTimerIntentBuilder
*/
@JvmStatic
@RequiresApi(Build.VERSION_CODES.P)
fun dismissTimer() = DismissTimerIntentBuilder()

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

import android.content.Context
import android.content.Intent
import android.os.Build
import android.provider.AlarmClock.ACTION_DISMISS_TIMER
import android.provider.AlarmClock.EXTRA_SKIP_UI
import androidx.annotation.RequiresApi

class DismissTimerIntentBuilder: BaseActivityBuilder() {

override fun createIntent(context: Context): Intent {
return Intent(ACTION_DISMISS_TIMER).apply {
putExtra(EXTRA_SKIP_UI, false)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ 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_dismiss_timer).setOnClickListener(this);
}

@Override
Expand Down Expand Up @@ -109,6 +110,9 @@ public void onClick(View v) {
case R.id.button_create_timer:
onCreateTimerClicked();
break;
case R.id.button_dismiss_timer:
onDismissTimerClicked();
break;
}
}

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

private void onDismissTimerClicked() {
OmegaIntentBuilder
.dismissTimer()
.startActivity(this);
}

}
7 changes: 7 additions & 0 deletions examples/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@
android:theme="@style/ButtonStyle"
android:text="@string/create_timer"/>

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

</LinearLayout>

</androidx.core.widget.NestedScrollView>
1 change: 1 addition & 0 deletions examples/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
<string name="create_timer">Create Timer</string>
<string name="insert_contact">Insert Contact</string>
<string name="search_web">Search Web</string>
<string name="dismiss_timer">Dismiss Timer</string>
</resources>