-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Kotlin extensions to work with PendingTask and PendingTaskErro…
…rs more easily.
- Loading branch information
1 parent
0ccfbb6
commit b998e26
Showing
30 changed files
with
355 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/levibostian/wendyexample/MainApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,36 @@ | ||
package com.levibostian.wendyexample | ||
|
||
import android.annotation.SuppressLint | ||
import android.app.Application | ||
import com.curiosityio.wendyexample.BuildConfig | ||
import android.app.NotificationChannel | ||
import android.app.NotificationManager | ||
import android.content.Context | ||
import com.levibostian.wendy.service.PendingTasks | ||
import android.os.Build | ||
import android.support.v4.app.NotificationCompat | ||
import android.support.v4.app.NotificationManagerCompat | ||
import com.curiosityio.wendyexample.R | ||
import com.levibostian.wendyexample.NotificationChannelUtil.Companion.ERROR_OCCURRED_CHANNEL_DESCRIPTION | ||
import com.levibostian.wendyexample.NotificationChannelUtil.Companion.ERROR_OCCURRED_CHANNEL_ID | ||
import com.levibostian.wendyexample.NotificationChannelUtil.Companion.ERROR_OCCURRED_CHANNEL_NAME | ||
|
||
class MainApplication : Application() { | ||
|
||
@SuppressLint("NewApi") | ||
override fun onCreate() { | ||
super.onCreate() | ||
|
||
PendingTasks.init(this, WendyExamplePendingTasksFactory()) | ||
.debug(BuildConfig.DEBUG) | ||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
val channel = NotificationChannel(ERROR_OCCURRED_CHANNEL_ID, ERROR_OCCURRED_CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT) | ||
channel.description = ERROR_OCCURRED_CHANNEL_DESCRIPTION | ||
|
||
val notificationManager = this.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager | ||
notificationManager.createNotificationChannel(channel) | ||
} | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/levibostian/wendyexample/NotificationChannelUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.levibostian.wendyexample | ||
|
||
class NotificationChannelUtil { | ||
companion object { | ||
const val ERROR_OCCURRED_CHANNEL_ID = "ERROR_OCCURRED_CHANNEL_ID" | ||
const val ERROR_OCCURRED_CHANNEL_NAME = "PendingTask errors" | ||
const val ERROR_OCCURRED_CHANNEL_DESCRIPTION = "Recorded errors for PendingTasks" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
docs/wendy/com.levibostian.wendy.extension/add-task-status-listener-for-task.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<HTML> | ||
<HEAD> | ||
<meta charset="UTF-8"> | ||
<title>addTaskStatusListenerForTask - wendy</title> | ||
<link rel="stylesheet" href="../../style.css"> | ||
</HEAD> | ||
<BODY> | ||
<a href="../index.html">wendy</a> / <a href="index.html">com.levibostian.wendy.extension</a> / <a href="./add-task-status-listener-for-task.html">addTaskStatusListenerForTask</a><br/> | ||
<br/> | ||
<h1>addTaskStatusListenerForTask</h1> | ||
<a name="com.levibostian.wendy.extension$addTaskStatusListenerForTask(com.levibostian.wendy.service.PendingTask, com.levibostian.wendy.listeners.PendingTaskStatusListener)"></a> | ||
<code><span class="keyword">fun </span><a href="../com.levibostian.wendy.service/-pending-task/index.html"><span class="identifier">PendingTask</span></a><span class="symbol">.</span><span class="identifier">addTaskStatusListenerForTask</span><span class="symbol">(</span><span class="identifier" id="com.levibostian.wendy.extension$addTaskStatusListenerForTask(com.levibostian.wendy.service.PendingTask, com.levibostian.wendy.listeners.PendingTaskStatusListener)/listener">listener</span><span class="symbol">:</span> <a href="../com.levibostian.wendy.listeners/-pending-task-status-listener/index.html"><span class="identifier">PendingTaskStatusListener</span></a><span class="symbol">)</span><span class="symbol">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html"><span class="identifier">Unit</span></a></code> | ||
<p>Extension to <a href="../com.levibostian.wendy/-wendy-config/add-task-status-listener-for-task.html">WendyConfig.addTaskStatusListenerForTask</a> easily from a <a href="../com.levibostian.wendy.service/-pending-task/index.html">PendingTask</a> instance.</p> | ||
</BODY> | ||
</HTML> |
15 changes: 15 additions & 0 deletions
15
docs/wendy/com.levibostian.wendy.extension/get-latest-error.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<HTML> | ||
<HEAD> | ||
<meta charset="UTF-8"> | ||
<title>getLatestError - wendy</title> | ||
<link rel="stylesheet" href="../../style.css"> | ||
</HEAD> | ||
<BODY> | ||
<a href="../index.html">wendy</a> / <a href="index.html">com.levibostian.wendy.extension</a> / <a href="./get-latest-error.html">getLatestError</a><br/> | ||
<br/> | ||
<h1>getLatestError</h1> | ||
<a name="com.levibostian.wendy.extension$getLatestError(com.levibostian.wendy.service.PendingTask)"></a> | ||
<code><span class="keyword">fun </span><a href="../com.levibostian.wendy.service/-pending-task/index.html"><span class="identifier">PendingTask</span></a><span class="symbol">.</span><span class="identifier">getLatestError</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><a href="../com.levibostian.wendy.db/-pending-task-error/index.html"><span class="identifier">PendingTaskError</span></a><span class="symbol">?</span></code> | ||
<p>Extension to <a href="../com.levibostian.wendy.service/-pending-tasks/get-latest-error.html">PendingTasks.getLatestError</a> easily from a <a href="../com.levibostian.wendy.service/-pending-task/index.html">PendingTask</a> instance.</p> | ||
</BODY> | ||
</HTML> |
Oops, something went wrong.