Giter Site home page Giter Site logo

mahdiasd / bottomdialogfilepicker Goto Github PK

View Code? Open in Web Editor NEW
32.0 2.0 3.0 1.27 MB

An android bottom dialog picker for all version of android like telegram | Written in kotlin

License: Apache License 2.0

Kotlin 95.20% Java 4.80%
file-picker document-picker image-picker video-picker bottom-dialog-picker fil-chooser picker picker-dialog

bottomdialogfilepicker's Introduction

Bottom Dialog Android Picker

Bottom dialog picker like telegram for all version of android (1 ... , 10 , 11 , 12 , 13)

Take picture with camera and save to storage

Search in Files

Support android 10+

Expandable and scrollable dialog

Full Customisable (Color , text , minimum and maximum selected file size , ...)

No required runtime permission

Screenshots

demo demo demo demo demo

Installation

Step 1. Add the JitPack repository to your build file

Install my project with gradle Add it in your root build.gradle at the end of repositories:

  allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Step 2. Add the dependency

  dependencies {
	        implementation 'com.github.mahdiasd:BottomDialogFilePicker:3.0.4'
	}

Ho To Use

A- Easy Use:

 FilePicker(this, supportFragmentManager)
            .setMode(PickerMode.Image, PickerMode.Audio, PickerMode.File, PickerMode.Video)
            .setListener(object : FilePickerListener {
                override fun selectedFiles(list: List<FileModel>?) {
                    // your code...
                }
            })
            .show()

B- Adcanced Use:

 FilePicker(context, supportFragmentManager)
            .setMode(PickerMode.Audio, PickerMode.Video, PickerMode.File, PickerMode.Image, PickerMode.Camera)
            .setDefaultMode(PickerMode.Image)
            .setMaxSelection(5)
            .setMaxEachFileSize(1 * 1024) // mean -> 1 mb 
            .setMaxTotalFileSize(15 * 1024) // mean -> 15 mb
            .setCustomText("video", "audio", "storage", "image", "openStorage")
            .setShowFileWhenClick(true)
            .setCardBackgroundColor(ContextCompat.getColor(context, R.color.white))
            .setDeActiveColor(ContextCompat.getColor(context, R.color.gray))
            .setActiveColor(ContextCompat.getColor(context, R.color.colorPrimary))
            .setIcons(
                videoIcon = ContextCompat.getDrawable(context, R.drawable.ic_video),
                audioIcon = ContextCompat.getDrawable(context, R.drawable.ic_audio),
                imageIcon = ContextCompat.getDrawable(context, R.drawable.ic_image),
                fileManagerIcon = ContextCompat.getDrawable(context, R.drawable.ic_file),
            )
            .setListener(object : FilePickerListener {
                override fun selectedFiles(list: List<FileModel>?) {
                    // your code ...
                }
            })
            .show()

You can also make some changes through the strings file

<string name="mahdiasd_file_picker_failed_open_file">Error when open file, please choose another!</string>

<string name="mahdiasd_file_picker_cant_find_this_file">Can`t find this file</string>

<string name="mahdiasd_file_picker_video">Video</string>

<string name="mahdiasd_file_picker_audio">Audio</string>

<string name="mahdiasd_file_picker_file_manager">File Manager</string>

<string name="mahdiasd_file_picker_image">Image</string>

<string name="mahdiasd_file_picker_open_storage">Open Storage</string>

<string name="mahdiasd_file_picker_max_total_size">Max size for total files is</string>

<string name="mahdiasd_file_picker_max_each_size">Max size for each files is</string>

<string name="mahdiasd_file_picker_search">Search…</string>

<string name="mahdiasd_file_picker_permission_denied_toast">Permission needed!</string>

Version 2 features:

  • Add camera to take picture
  • Fix show preview bug
  • Add search icon to replace with default
  • Add done icon to replace with default
  • Fix card background color bug

This library uses the following libraries

Thanks to the very powerful Glide and Handle Path Oz

Proguard

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule {
 <init>(...);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
  *** rewind();
}

# Uncomment for DexGuard only
#-keepresourcexmlelements manifest/application/meta-data@value=GlideModule

LICENCE

Copyright 2022 Mahdi Asadollahpour BottomDialogFilePicker

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.

| ~~~~ Thank you for your support of my project and star it ~~~~ |

bottomdialogfilepicker's People

Contributors

mahdiasd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bottomdialogfilepicker's Issues

Permission needed in android API 33

I am getting 'permission needed' toast in android 13 or API 33 emulator, even i manually check the permissions are enabled properly.

No logs nothing.

A few suggestions

I'm considering your project to use in https://github.com/tinode/chat
Here are a few things that make it difficult for me to use it:

  1. I need camera (CameraX) integration. Telegram's picker has camera as the first tile. Your widget does not. That means I have to create a separate button for camera and if so, I can just use the new PhotoPicker from Google.
  2. The [send] button is too much like Telegram and it's not actually sending anything, it's a [done] button, not [send]. Please consider using a more neutral icon, like a checkmark or text [DONE], or make the icon replaceable.
  3. Please use standard material design icon for search or make it replaceable.
  4. Please consider adding an option to remove circular colored background under icons. Otherwise styling is too much like Telegram.
  5. Please consider moving all hardcoded dimension values to Theme, like this:
    https://github.com/mahdiasd/BottomDialogFilePicker/blob/master/FilePicker/src/main/res/layout/item_file_picker.xml#L59
  6. If mode is single-selection, then there should be an option to just pick on the first click. I.e. not click on image to select, then click [done], but the first click immediately selects the image/video and returns it to the app. In such a case the selection checkmarks on the image tiles are not needed.
  7. There is a visual bug in the UI:

Screenshot 2023-01-05 at 09 17 42

The corners are white, not transparent.

Thank you!

Jitpack

jitpack is not downloading the dependency to be used on the gradle

MANAGE_EXTERNAL_STORAGE should not be requested.

Your widget requests and uses MANAGE_EXTERNAL_STORAGE (All files access) which makes it unsuitable for most apps. Google Play Store restricts use of MANAGE_EXTERNAL_STORAGE to apps which specifically manage storage:

  • File managers
  • Backup and restore apps
  • Anti-virus apps
  • Document management apps
  • On-device file search
  • Disk and file encryption
  • Device-to-device data migration

If the app is not in one of the listed categories, it should not request MANAGE_EXTERNAL_STORAGE permission.

Quote from https://developer.android.com/about/versions/11/privacy/storage

Note: If you publish your app to Google Play, carefully read the notice. If you target Android 11 and declare All files access, it can affect your ability to publish and update your app on Google Play.

Quote from https://developer.android.com/training/data-storage/manage-all-files#all-files-access-google-play

You should request the MANAGE_EXTERNAL_STORAGE permission only when your app cannot effectively make use of the more privacy-friendly APIs, such as Storage Access Framework or the Media Store API. Additionally, the app's usage of the permission must fall within permitted uses, and must be directly tied to the core functionality of the app.

Add Uri to FileModel

Thanks again for the library, I was suggesting you add Uri (content URI) to the FileModel, I have not been able to get URI from File or Path in Android 11, 13

crashing when called in fragment

 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mahdiasd.filepicker.BR" on path: DexPathList[[dex file "/data/data/moluccus.app/code_cache/.overlay/base.apk/classes3.dex", zip file "/data/app/~~jMZRkVwxQBrHaAVyc7jufQ==/moluccus.app-2MA7ltBC_tWriCclUHS8hg==/base.apk"],nativeLibraryDirectories=[/data/app/~~jMZRkVwxQBrHaAVyc7jufQ==/moluccus.app-2MA7ltBC_tWriCclUHS8hg==/lib/arm64, /system/lib64, /system_ext/lib64]]

LICENSE

Please add a license file. Otherwise it's unclear if I can use your library in my project. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.