-
Notifications
You must be signed in to change notification settings - Fork 2
Core Module Wiki
Util related modules required to use the Gallery.
- DI Hilt Library Used
com.gallery.core.Factory.kt
class Factory {
companion object {
/**
* Do not Activity Context!
* @param context Application Context
*/
fun create(context: Context): GalleryProvider {
return GalleryProviderImpl(context)
}
}
}
Hilt.kt
@Singleton
@Provides
fun provideGalleryCore(
@ApplicationContext context: Context
): GalleryProvider = Factory.create(context)
Find information about the album in the gallery.
- Return Type
- List GalleryFilterData
- Return Data Model
data class GalleryFilterData( val bucketId: String, // Album Id val bucketName: String, // Album Name val photoUri: String, // Album First Image Thumb val count: Int // Album Total Count )
Find information about the album you want to view in the gallery.
- Parameter Data Model
class GalleryQueryParameter {
var filterId: String = "" // Album id
var isAscOrder: Boolean = false // is Ascending order
}
- Return Type
- Cursor
Search for all the pictures in the gallery.
- Return Type
- Cursor
Converter Current Cursor -> Images Local Uri content://
- Return Type
- String (Nullable)
- Return Example
- content://....
Converter Local Path -> Bitmap
- Return Type
- Bitmap
- Return Exception
- IOException, IllegalArgumentException, FileNotFoundException
Converter Local Path -> Resize Bitmap (Limit Width Type)
- Return Type
- Bitmap
- Return Exception
- IOException, IllegalArgumentException, FileNotFoundException
Converter Local Drawable Resource Id -> Bitmap
- Return Type
- Bitmap
- Return Exception
- IOException, IllegalArgumentException, FileNotFoundException
Converter Contents Path to Multipart
- Return Type
- MultipartBody.Part
- Return Exception
- NullPointerException, IllegalArgumentException
Converter Bitmap -> okhttp3.MultipartBody.Part.
File Format .jpg
- Parameter 'name'
- MultipartBody key Name
- Return Type
- okhttp3.MultipartBody.part
Converter Bitmap -> okhttp3.MultipartBody.Part.
Custom FileName, Custom File Format Overriding Func Type
- Parameter
- 'name' -> MultipartBody key Name
- 'fileName' -> MultipartBody File Name
- 'suffix' -> .jpg, .png
- Return Type
- okhttp3.MultipartBody.part
Copy the bitmap to a file.
DeleteFile
- Return Type
- Boolean
- Success True, Fail False
Delete Cache Directory
- Return Type
- Boolean
- Success True, Fail False
A function that resizes the bitmap according to the ratio. Calculate the desired width and height value and resize it to the largest value according to the ratio. It's a logic similar to ImageView centerCrop.
-
Parameter
- width -> Resize Width
- height -> Resize Height
-
Return Type
- Bitmap
create Temp File .jpg
create Temp File Custom File Format
Return to bitmap according to the settings edited in 'Flexible ImageEditView'.
- Return Type
- Bitmap
Return to bitmap according to the settings edited in 'Flexible ImageEditView'.
-
Parameter
- srcRect
- FlexibleImageEditView Edit State Item
- @see FlexibleImageEditView.getStateItem()
- width
- FlexibleImageEditView Root Width
- height
- FlexibleImageEditView Root Height
- srcRect
-
Return Type
- Bitmap
getFlexibleImageToBitmap(originalBitmap: Bitmap, srcRect: RectF, width: Int, height: Int, @colorInt color: Int)
getFlexibleImageToBitmap Function Custom Background Color Type.
- Return Type
- Bitmap
getFlexibleImageToMultipart(originalImagePath: String, flexibleItem: FlexibleStateItem, multipartKey: String
FlexibleImageView Capture Bitmap And MultipartBody
- Return Exception
- NullPointerException, IllegalArgumentException
Save Bitmap File Completed File Info Return.
File Location Cache Directory
- Return Type
- File (Nullable)
Return to bitmap according to the settings edited in 'CropImageEditView'.
- Parameter Data Model
data class CropImageEditModel(
val bitmap: Bitmap?,
val points: FloatArray,
val degreesRotated: Int,
val fixAspectRatio: Boolean,
val aspectRatioX: Int,
val aspectRatioY: Int,
val flipHorizontally: Boolean,
val flipVertically: Boolean
)
- Return Type
- Bitmap (Nullable)
Return to bitmap according to the settings edited in 'CropImageEditView'.
Not CropImageEditModel Type
-
Parameter
- originalBitmap: Bitmap?
- points: FloatArray
- degreesRotated: Int
- fixAspectRatio: Boolean
- aspectRatioX: Int
- aspectRatioY: Int
- flipHorizontally: Boolean
- flipVertically: Boolean
-
Return Type
- Bitmap (Nullable)
A function that generates the uri required by the camera.
-
Parameter
- authority: String
- Example. 'com.gallery.example.provider'
<provider android:name="androidx.core.content.FileProvider" android:authorities="com.gallery.example.provider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /> </provider>
-
Return Type
- Uri (Nullable)
A function that takes pictures from a camera and saves them in a gallery.
-
Parameter
- pictureUri: String (@see createGalleryPhotoUri Uri)
- name: String (Save File Name)
-
Return Type
- Pair Boolean, String
- Success True, PictureUri
- Fail False, Error Message
This function returns the image type.
-
Parameter
- imagePath: String ex) content://media/external/images/media/1
-
Return Type
- ImageType (Camera, ScreenShot, Etc)