-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow DSiWare data files to be imported and exported
- Loading branch information
1 parent
32b1721
commit 3374059
Showing
19 changed files
with
491 additions
and
50 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
24 changes: 24 additions & 0 deletions
24
app/src/main/java/me/magnum/melonds/common/contracts/CreateFileContract.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,24 @@ | ||
package me.magnum.melonds.common.contracts | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.net.Uri | ||
import androidx.activity.result.contract.ActivityResultContract | ||
|
||
class CreateFileContract : ActivityResultContract<String, Uri?>() { | ||
override fun createIntent(context: Context, input: String): Intent { | ||
return Intent(Intent.ACTION_CREATE_DOCUMENT) | ||
.putExtra(Intent.EXTRA_TITLE, input) | ||
.addCategory(Intent.CATEGORY_OPENABLE) | ||
.setType("application/octet-stream") | ||
} | ||
|
||
override fun parseResult(resultCode: Int, intent: Intent?): Uri? { | ||
return if (intent == null || resultCode != Activity.RESULT_OK) { | ||
null | ||
} else { | ||
intent.data | ||
} | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
app/src/main/java/me/magnum/melonds/domain/model/dsinand/DSiWareTitleFileType.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,7 @@ | ||
package me.magnum.melonds.domain.model.dsinand | ||
|
||
enum class DSiWareTitleFileType(val fileName: String) { | ||
PUBLIC_SAV("public.sav"), | ||
PRIVATE_SAV("private.sav"), | ||
BANNER_SAV("banner.sav"), | ||
} |
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
8 changes: 8 additions & 0 deletions
8
app/src/main/java/me/magnum/melonds/ui/dsiwaremanager/model/DSiWareItemDropdownMenu.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,8 @@ | ||
package me.magnum.melonds.ui.dsiwaremanager.model | ||
|
||
enum class DSiWareItemDropdownMenu { | ||
NONE, | ||
MAIN, | ||
IMPORT, | ||
EXPORT, | ||
} |
8 changes: 8 additions & 0 deletions
8
.../main/java/me/magnum/melonds/ui/dsiwaremanager/model/ImportExportDSiWareTitleFileEvent.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,8 @@ | ||
package me.magnum.melonds.ui.dsiwaremanager.model | ||
|
||
sealed class ImportExportDSiWareTitleFileEvent { | ||
data class ImportSuccess(val fileName: String) : ImportExportDSiWareTitleFileEvent() | ||
data object ImportError : ImportExportDSiWareTitleFileEvent() | ||
data class ExportSuccess(val fileName: String) : ImportExportDSiWareTitleFileEvent() | ||
data object ExportError : ImportExportDSiWareTitleFileEvent() | ||
} |
Oops, something went wrong.