-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20960 from wordpress-mobile/convert-blockprocesso…
…rfactory-to-kotlin Convert BlockProcessor's child classes to Kotlin
- Loading branch information
Showing
18 changed files
with
416 additions
and
518 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
62 changes: 0 additions & 62 deletions
62
...org/wordpress/android/ui/posts/mediauploadcompletionprocessors/BlockProcessorFactory.java
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
...a/org/wordpress/android/ui/posts/mediauploadcompletionprocessors/BlockProcessorFactory.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,37 @@ | ||
package org.wordpress.android.ui.posts.mediauploadcompletionprocessors | ||
|
||
import org.wordpress.android.util.helpers.MediaFile | ||
|
||
/** | ||
* This factory initializes block processors for all media block types and provides a method to retrieve a block | ||
* processor instance for a given block type. | ||
* @param localId The local media id that needs replacement | ||
* @param mediaFile The mediaFile containing the remote id and remote url` | ||
* @param siteUrl The site url - used to generate the attachmentPage url | ||
* @return The factory instance - useful for chaining this method upon instantiation | ||
*/ | ||
internal class BlockProcessorFactory( | ||
mediaUploadCompletionProcessor: MediaUploadCompletionProcessor, | ||
localId: String, | ||
mediaFile: MediaFile, | ||
siteUrl: String | ||
) { | ||
private val mediaBlockTypeBlockProcessorMap = hashMapOf( | ||
MediaBlockType.IMAGE to ImageBlockProcessor(localId, mediaFile), | ||
MediaBlockType.VIDEOPRESS to VideoPressBlockProcessor(localId, mediaFile), | ||
MediaBlockType.VIDEO to VideoBlockProcessor(localId, mediaFile), | ||
MediaBlockType.MEDIA_TEXT to MediaTextBlockProcessor(localId, mediaFile), | ||
MediaBlockType.GALLERY to GalleryBlockProcessor(localId, mediaFile, siteUrl, mediaUploadCompletionProcessor), | ||
MediaBlockType.COVER to CoverBlockProcessor(localId, mediaFile, mediaUploadCompletionProcessor), | ||
MediaBlockType.FILE to FileBlockProcessor(localId, mediaFile), | ||
MediaBlockType.AUDIO to AudioBlockProcessor(localId, mediaFile) | ||
) | ||
|
||
/** | ||
* Retrieves the block processor instance for the given media block type. | ||
* | ||
* @param blockType The media block type for which to provide a [BlockProcessor] | ||
* @return The [BlockProcessor] for the given media block type | ||
*/ | ||
fun getProcessorForMediaBlockType(blockType: MediaBlockType) = mediaBlockTypeBlockProcessorMap[blockType] | ||
} |
105 changes: 0 additions & 105 deletions
105
...a/org/wordpress/android/ui/posts/mediauploadcompletionprocessors/CoverBlockProcessor.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.