Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
io.github.samuel-unknown:gallery-image-picker-coil
Advanced tools
Android library for picking images
Android library for picking images.
Add the mavenCentral repository in root build.gradle:
allprojects {
repositories {
mavenCentral()
}
}
Add the following dependency in app build.gradle:
dependencies {
implementation 'io.github.samuel-unknown:gallery-image-picker:1.7.0'
// if you want to use default Glide implementation for ImageLoaderFactory
implementation 'io.github.samuel-unknown:gallery-image-picker-glide:1.7.0'
// if you want to use default Coil implementation for ImageLoaderFactory
implementation 'io.github.samuel-unknown:gallery-image-picker-coil:1.7.0'
}
Create custom ImageLoaderFactory
implementation or use default implementation (Glide or Coil) by adding dependency as said above. Glide implementation works faster.
Initialize library with ImageLoaderFactory
implementation
// MyApplication.kt
class MyApplication: Application(R.layout.activity_main) {
override fun onCreate() {
super.onCreate()
initGalleryImagePickerLib()
}
private fun initGalleryImagePickerLib() {
GalleryImagePicker.init(ImageLoaderFactoryGlideImpl(appContext = this))
}
}
<!--AndroidManifest.xml-->
<application
android:name=".MyApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true">
</application>
Register launcher and launch it when it needed
// MyApplication.kt
class MainActivity : AppCompatActivity(R.layout.activity_main) {
private val getImagesLauncher = registerForActivityResult(ImagesResultContract()) { result: ImagesResultDto ->
when (result) {
is ImagesResultDto.Success -> {
result.images.forEach { imageDto ->
Log.d(TAG, "imageDto: $imageDto")
}
}
is ImagesResultDto.Error -> {
Log.d(TAG, "error: ${result.message}")
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
findViewById<Button>(R.id.open_gallery_button_view).setOnClickListener {
getImagesLauncher.launch(
GalleryConfigurationDto(
spacingSizeInPixels = 30,
spanCount = 4,
openLikeBottomSheet = true,
singleSelection = false,
peekHeightInPercents = 60
)
)
}
}
companion object {
private val TAG = MainActivity::class.java.simpleName
}
}
Customizations
class GalleryConfigurationDto
uses for customizations. There are different arguments for that:
@Px val spacingSizeInPixels: Int
- for spacing between cells.
val spanCount: Int
- for setting cells count.
val openLikeBottomSheet: Boolean
- should be gallery opened like BottomSheet or in full-screen mode.
val singleSelection: Boolean
- limits selection to one image.
val peekHeightInPercents: Int
- for setting BottomSheet height.
val mimeTypes: List<String>? = null
- filtering images by mimeTypes.
@StyleRes val themeResId: Int
- for creating a custom theme.
val selectorSizeRatio: Float
- determines the size of selector (ring and counter).
val selectedImageScale: Float
- scale for selected images.
selectionAnimationDurationInMillis: Long
- how fast selection animation plays.
You can find an example of using here here
Copyright 2021 Samuel Unknown
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
FAQs
Android library for picking images
We found that io.github.samuel-unknown:gallery-image-picker-coil demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.