Skip to content

Commit

Permalink
Add more JavaDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
marcauberer committed Jan 1, 2021
1 parent 1a03584 commit 534c5aa
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion adobecolor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionCode library_version_code
versionName library_version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,45 @@ class AdobeColorTool(

// ------------------------------------------- Export ------------------------------------------

/**
* Exports a list of colors as ACO file without setting a custom palette name.
* The resulting file will have the name export.aco
*
* @param colors List of colors to be exported
*/
fun exportColorListAsACO(colors: List<AdobeColor>) {
val bytes = colors.toACOBytes()
writeToFileAndShare(bytes, "export", EXT.ACO)
}

/**
* Exports a list of colors as ACO file with a custom palette name
*
* @param colors List of colors to be exported
* @param paletteName Name that will be set as file name
*/
fun exportColorListAsACO(colors: List<AdobeColor>, paletteName: String) {
val bytes = colors.toACOBytes()
writeToFileAndShare(bytes, paletteName, EXT.ACO)
}

/**
* Exports a list of colors as ASE file without setting a custom palette name.
* The resulting file will have the name export.ase
*
* @param colors List of colors to be exported
*/
fun exportColorListAsASE(colors: List<AdobeColor>) {
val bytes = colors.toASEBytes()
writeToFileAndShare(bytes, "export", EXT.ASE)
}

/**
* Exports a list of colors as ASE file with a custom palette name
*
* @param colors List of colors to be exported
* @param paletteName Name that will be set as palette and file name
*/
fun exportColorListAsASE(colors: List<AdobeColor>, paletteName: String) {
val bytes = colors.toASEBytes(paletteName)
writeToFileAndShare(bytes, paletteName, EXT.ASE)
Expand All @@ -73,10 +97,7 @@ class AdobeColorTool(
putExtra(Intent.EXTRA_STREAM, uri)
}
context.startActivity(
Intent.createChooser(
i,
context.getString(R.string.export_adobe_palette)
)
Intent.createChooser(i, context.getString(R.string.export_adobe_palette))
)
} catch (e: IOException) {
Log.e("Exception", "File write failed: $e")
Expand All @@ -85,6 +106,10 @@ class AdobeColorTool(

// ------------------------------------------- Import ------------------------------------------

/**
* Function to open up a file picker and import colors from the selected file.
* Valid file extensions are: .aco, .ase
*/
fun importColorList(activity: AppCompatActivity, listener: AdobeImportListener) {
val i = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
type = "application/octet-stream"
Expand All @@ -103,7 +128,6 @@ class AdobeColorTool(
return
} catch (e: Exception) { listener.onError(e) }
}

}
listener.onCancel()
}
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ android {
applicationId "com.chillibits.adobecolorsample"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionCode library_version_code
versionName library_version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*/

buildscript {
ext.library_version = '1.0.0-alpha01'
ext.library_version = '1.0.0-alpha02'
ext.library_version_code = 2
ext.kotlin_version = "1.4.21-2"
repositories {
google()
Expand Down
Binary file modified media/aco_structure.docx
Binary file not shown.
Binary file modified media/aco_structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 534c5aa

Please sign in to comment.