-
-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- do basic logging in SignalExecutorTask itself Signed-off-by: Arka Prava Basu <[email protected]>
- Loading branch information
Showing
4 changed files
with
10 additions
and
27 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
18 changes: 0 additions & 18 deletions
18
src/main/java/org/havenapp/main/service/LoggingTaskListener.kt
This file was deleted.
Oops, something went wrong.
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
8 changes: 8 additions & 0 deletions
8
src/main/java/org/havenapp/main/service/SignalExecutorTask.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,24 +1,32 @@ | ||
package org.havenapp.main.service | ||
|
||
import android.os.AsyncTask | ||
import android.util.Log | ||
import net.sourceforge.argparse4j.inf.Namespace | ||
import org.asamk.signal.Main | ||
|
||
/** | ||
* Created by Arka Prava Basu<[email protected]> on 20/03/19 | ||
**/ | ||
private val TAG = SignalExecutorTask::class.java.simpleName | ||
class SignalExecutorTask(private val commandMap: HashMap<String, Any>, | ||
private val mainSignal: Main, | ||
private val listener: TaskResult?) | ||
: AsyncTask<Unit, Unit, Int>() { | ||
|
||
override fun onPreExecute() { | ||
super.onPreExecute() | ||
Log.i(TAG, "Requesting with request map $commandMap") | ||
} | ||
|
||
override fun doInBackground(vararg params: Unit?): Int { | ||
val namespace = Namespace(commandMap) | ||
return mainSignal.handleCommands(namespace) | ||
} | ||
|
||
override fun onPostExecute(result: Int) { | ||
super.onPostExecute(result) | ||
Log.i(TAG, "result = $result for request map $commandMap") | ||
if (result == 0) { | ||
listener?.onSuccess("Success for request map $commandMap") | ||
} else { | ||
|