Skip to content

lhoyong/ImagePicker

Repository files navigation

ImagePickerView

DOWNLOAD Build Android Arsenal

This is Simple Android ImagePicker Library.

Support DayNight Mode.

OverView

ScreenShot

Setup

Add the dependency

dependencies {
    implementation "com.lhoyong:imagepicker:$latestVersion"
}

Usage

Add ImagePickerView your Activity or Fragments Example.

When you Click on the Image, it will move to Detail Screen. If Long Click Image, start scale Animations and visible checkbox. Bul Already Clicked Images, can not move to Detail Screen.

  • Single Select
ImagePickerView.Builder()
    .setup {
        name { RESULT_NAME }
        title { "Image Picker" } // optional
        single { true } 
    }
    .start(this)
  • Multiple Select
ImagePickerView.Builder()
    .setup {
        max { 5} // default 30
        name { RESULT_NAME }
        title { "Image Picker" } // optional, if not used toolbar title display selected image count
        single { false }  // optional, single = false
    }
    .start(this)

Finish image select task, update ui for onActivityResult received data.

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if (resultCode == Activity.RESULT_OK) {
            val images = data?.getParcelableArrayListExtra<Uri>(RESULT_NAME)
            images?.let {
                (recycler_view.adapter as ImageAdapter).submitList(it)
            }
        }
    }

License

Copyright (C) 2020 lhoyong.

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.