-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added feature to update the task name and description * added accessibility for update task name and description * codacy correction * removed unused code
- Loading branch information
1 parent
635f86e
commit a750c53
Showing
21 changed files
with
145 additions
and
53 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
41 changes: 41 additions & 0 deletions
41
actions/src/main/kotlin/com/alfresco/content/actions/ActionUpdateNameDescription.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,41 @@ | ||
package com.alfresco.content.actions | ||
|
||
import android.content.Context | ||
import com.alfresco.content.data.AnalyticsManager | ||
import com.alfresco.content.data.EventName | ||
import com.alfresco.content.data.ParentEntry | ||
import com.alfresco.content.data.TaskEntry | ||
import kotlin.coroutines.cancellation.CancellationException | ||
import kotlin.coroutines.resume | ||
import kotlin.coroutines.suspendCoroutine | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.withContext | ||
|
||
/** | ||
* Mark as ActionUpdateNameDescription class | ||
*/ | ||
data class ActionUpdateNameDescription( | ||
override var entry: TaskEntry, | ||
override val icon: Int = R.drawable.ic_action_create_folder, | ||
override val title: Int = R.string.action_update_task_name_description, | ||
override val eventName: EventName = EventName.None | ||
) : Action { | ||
override suspend fun execute(context: Context): TaskEntry { | ||
val result = showCreateTaskDialog(context) ?: throw CancellationException("User Cancellation") | ||
AnalyticsManager().taskEvent(eventName) | ||
return TaskEntry.updateTaskNameDescription(entry, result.name, result.description) | ||
} | ||
|
||
private suspend fun showCreateTaskDialog(context: Context) = withContext(Dispatchers.Main) { | ||
suspendCoroutine { | ||
CreateTaskDialog.Builder(context, true, entry) | ||
.onSuccess { title, description -> | ||
it.resume(CreateMetadata(title, description)) | ||
} | ||
.onCancel { it.resume(null) } | ||
.show() | ||
} | ||
} | ||
|
||
override fun copy(_entry: ParentEntry): Action = copy(entry = _entry as TaskEntry) | ||
} |
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
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
Oops, something went wrong.