Coder Social home page Coder Social logo

droidninja / android-filepicker Goto Github PK

View Code? Open in Web Editor NEW
2.7K 70.0 553.0 557 KB

Photopicker and document picker for android

Home Page: https://arunsharma.me/blog/integrate-android-file-picker-photopicker-document-picker-android/

Java 25.73% Kotlin 74.27%
photopicker android-filepicker demo videopicker video android whatsapp-like-picker

android-filepicker's Introduction

Hi there 👋

droidninja github stats

Top Langs


Hits

android-filepicker's People

Contributors

aneophyte avatar droidninja avatar gaumala avatar hamen avatar jamshidrostami avatar johnernest02 avatar marcauberer avatar mhzdev avatar mrsurana avatar rajnish23 avatar subhrajyotisen avatar verticalakash avatar vnavarro 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  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  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  avatar  avatar  avatar  avatar

Watchers

 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  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  avatar  avatar  avatar  avatar  avatar  avatar

android-filepicker's Issues

Translating text

Activity where I can pick files by this lib has some texts in english. How it is possible to translate them to russian?

Crash If I doesnt add this method .setSelectedFiles()

I dont want to set selected Files. If I doesnt add this method The app crashed.
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2452)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1376)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5481)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
at droidninja.filepicker.PickerManager.add(PickerManager.java:83)
at droidninja.filepicker.FilePickerActivity.initView(FilePickerActivity.java:60)
at droidninja.filepicker.FilePickerActivity.onCreate(FilePickerActivity.java:45)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2405)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1376) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5481) 
at java.lang.reflect.Method.invoke(Native Method

Custom icons not displaying

FilePickerBuilder.getInstance().setMaxCount(20) .setActivityTheme(R.style.AppTheme) .addFileSupport("ALL EBOOKS",extensions) .addFileSupport("EPUB",new String[]{".epub"},R.drawable.epub) .addFileSupport("MOBI",new String[]{".mobi"},R.drawable.mobi) .addFileSupport("AZW",new String[]{".azw"}) .addFileSupport("PDF",new String[]{".pdf"},R.drawable.pdf) .addFileSupport("DOC",new String[]{".doc",".docx"},R.drawable.doc) .addFileSupport("ZIP",new String[]{".zip"}) .enableDocSupport(false) .addFileSupport("OTHER",new String[]{".txt",".odt",".szw",".rtf"}) .pickFile(this);

The custom drawables aren't being set.
The resultant picker shows the default gray file icon

screenshot_20170506-141835

Problem when set Max count is 1

At version 1.0.7, when setMaxCount(1), it auto back to the activity when pick an image ( no need to click "Done"), but latest version (2.0.0), the issue is happened. Please make the behavior like old version. Thank you

Binary XML file line #6: Error inflating class com.facebook.drawee.view.SimpleDraweeView

FATAL EXCEPTION: main
Process: com.yuehu.cola.projectcola, PID: 6757
android.view.InflateException: Binary XML file line #6: Error inflating class com.facebook.drawee.view.SimpleDraweeView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at droidninja.filepicker.adapters.PhotoGridAdapter.onCreateViewHolder(PhotoGridAdapter.java:42)
at droidninja.filepicker.adapters.PhotoGridAdapter.onCreateViewHolder(PhotoGridAdapter.java:24)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5833)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5057)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4967)
at android.support.v7.widget.LayoutState.next(LayoutState.java:100)
at android.support.v7.widget.StaggeredGridLayoutManager.fill(StaggeredGridLayoutManager.java:1556)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:666)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:598)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3315)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3124)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3568)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2086)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1843)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.
08

Need improve when setMaxtCount is 1

When I pick a photo and set maxCount is 1, then I touch to select a photo. And if I want to change select photo, I need to uncheck the photo I checked before first. It should automatically uncheck the old one and select new one. Hope you fix this issue.

'addVideoPicker' method should get boolean to enable or disable.

Problem exactly is when we call FilePickerBuilder with addVideoPicker included for the first time in the app and then in some part of application I don't need video tab. In such case I don't have that option to disable where the video tab continuously shown since I initialised addVideoPicker first time in the app using getInstance.

Set Max count issue

I found a big issue on set Max Count.
Follow these step:

  1. Set Max Count is 4
  2. Select 4 file
  3. Stay on this screen, I can be able to select more file by double click to a file.

Demo App

Hi, i think there should be a demo app for your great project.

.showGifs(false) not working

FilePickerBuilder.getInstance().setMaxCount(maxCount)
.setSelectedFiles(photoPaths)
.setActivityTheme(R.style.FilePickerTheme)
.addVideoPicker()
.enableCameraSupport(true)
.showGifs(false)
.showFolderView(true)
.pickPhoto(this);

When i pick image and set .showGifs(false) but gif files show in picker unable to avoid gif files

Pick a folder

It would be useful to have an api to pick a folder.

Selection count in docs picker is improper

When I set docs max count to five and I select the files one by one till five selection count is increasing properly.When I do sixth selection count is reducing to four and further selection of any file makes the count in negative value.

Can't show custom file

I want to show the tab for zip files but when I run this code I don't see them anywhere. I'm running version 2.2 of your library.

String[] fileTypes = new String[]{".zip"};
        FilePickerBuilder.getInstance()
                .addFileSupport("Zip", fileTypes)
                .setMaxCount(5)
             .setActivityTheme(android.support.v7.appcompat.R.style.Base_Theme_AppCompat_Light)
                .setSelectedFiles(filePaths)
                .enableDocSupport(true)
                .pickFile(this);

UpperCase file names.

Hi, in not quite sure how should i marge into your files.
But i found interesting problem, some devices use uppercase names in files.
So i think you should change
Utils class function:
public static boolean contains(String[] types, String path) {
for (String string : types) {
if (path.endsWith(string)) return true;
}
return false;
}
into
public static boolean contains(String[] types, String path) {
for (String string : types) {
if (path.toLowerCase().endsWith(string)) return true;
}
return false;
}

Tab names aren't visible

Hey! Thanks for making the Android-FilePicker. I used it for my Demo App for testing my module.

I was testing the Demo App in my Fire Tablet, which has Android 5.1. And I noticed that the tab names weren't shown for the document picker. I was able to swipe through the PDF and other tabs. But the names of the tabs weren't visible.

What is this bug ? I don't get it. And I haven't tried it on any other device, since I don't have any other than my Tablet

Toolbar options not visible

My app theme is Theme.AppCompat.Light.NoActionBar and by this theme ,the picker toolbar items such as back button, title and done button is not visible. But when I set a specific theme for file picker such as Theme.AppCompat.Light.DarkActionBar my main toolbar is visible below the theme toolbar.

screenshot_20161113-123803

another issue is I want to change the toolbar title and done button texts.

On custom toolbar done button not show

Hello @DroidNinja,
Thanks for great lib for file picker.
I am using it in my android app for image picking. In my app there is custom toolbar with NoActionbar style it will not show me action bar in attachment activity. Is there any option for custom toolbar, show the done button within.

tools not found in manifiest

Hello Team,

Library seems very nice. i am getting this error while working with Manifiest.

Error:The prefix "tools" for attribute "tools:replace" associated with an element type "application" is not bound.

Orientation issue

Hello,

The library dont support the view orientation. It's fixed to portait mode.

Have you a reason to do that ?

Sb

onActivityResult is never called on the Fragment when the chooser is activated from a fragment

In order to onActivityResult be called on the fragment, startActivityForResult should be called from the fragment (as far as I know). However, the library calls the startActivityForResult on behalf of the application in FilePickerBuilder

private void start(Activity context)
    {
        Intent intent = new Intent(context, FilePickerActivity.class);
        intent.putExtras(mPickerOptionsBundle);
        context.startActivityForResult(intent,FilePickerConst.REQUEST_CODE);
    }

It accepts a one parameter, context of type Activity. In order to call the method in a fragment, one would use getActivity() since it returns it's parent activity. But startActivityForResult is called on the activity rather than on the fragment. The fragment never receives the onActivityResult callback.

Has a bug

FileListAdapter-->onBindViewHolder()-->holder.fileSizeTextView.setText
(Formatter.formatShortFileSize(context, Long.parseLong(document.getSize())));
document.getSize() has bean a nullpointerexception

You should that document.getSize()==null?"0":document.getSize());

Hide default tabs

I want to hide some default tabs on the document picker, like PPT, DOC, TXT. How would I do that?

Get file path and file size

I want to get the file path of selected document and also want size of that document.
How would i get it ?
Any help ?

LeakCanary reports a memory leak at FilePickerActivity

The following is a detailed message

Android version 7.0

In com.shiyan.netdisk_android:1.0:1.

  • droidninja.filepicker.FilePickerActivity has leaked:

  • GC ROOT static droidninja.filepicker.PickerManager.ourInstance

  • references droidninja.filepicker.PickerManager.pickerManagerListener

  • leaks droidninja.filepicker.FilePickerActivity instance

  • Retaining: 35 KB.

  • Reference Key: a59d7d50-a8c1-4f9c-885f-72cf96a60d1b

  • Device: samsung samsung SM-G9350 hero2qltezc

  • Android Version: 7.0 API: 24 LeakCanary: 1.5 00f37f5

  • Durations: watch=5026ms, gc=131ms, heap dump=2120ms, analysis=60082ms

  • Details:

  • Class droidninja.filepicker.PickerManager
    | static $classOverhead = byte[852]@319163393 (0x13060c01)
    | static ourInstance = droidninja.filepicker.PickerManager@319097872 (0x13050c10)

  • Instance of droidninja.filepicker.PickerManager
    | static $classOverhead = byte[852]@319163393 (0x13060c01)
    | static ourInstance = droidninja.filepicker.PickerManager@319097872 (0x13050c10)
    | alreadySelectedFiles = null
    | currentCount = 0
    | docFiles = java.util.ArrayList@319149824 (0x1305d700)
    | docSupport = true
    | enableCamera = true
    | enableOrientation = false
    | fileTypes = java.util.ArrayList@319149848 (0x1305d718)
    | maxCount = 3
    | mediaFiles = java.util.ArrayList@319149800 (0x1305d6e8)
    | pickerManagerListener = droidninja.filepicker.FilePickerActivity@319243456 (0x130744c0)
    | providerAuthorities = java.lang.String@315786288 (0x12d28430)
    | showFolderView = true
    | showGif = false
    | showVideos = true
    | theme = 2131361960
    | shadow$klass = droidninja.filepicker.PickerManager
    | shadow$monitor = 0

  • Instance of droidninja.filepicker.FilePickerActivity
    | static TAG = java.lang.String@319098768 (0x13050f90)
    | static $classOverhead = byte[4692]@319193089 (0x13068001)
    | type = 18
    | mDelegate = android.support.v7.app.AppCompatDelegateImplN@315482752 (0x12cde280)
    | mEatKeyUpEvent = false
    | mResources = null
    | mThemeId = 2131361960
    | mCreated = true
    | mFragments = android.support.v4.app.FragmentController@315157536 (0x12c8ec20)
    | mHandler = android.support.v4.app.FragmentActivity$1@320115104 (0x131491a0)
    | mNextCandidateRequestIndex = 0
    | mOptionsMenuInvalidated = false
    | mPendingFragmentActivityResults = android.support.v4.util.SparseArrayCompat@315201136 (0x12c99670)
    | mReallyStopped = true
    | mRequestedPermissionsFromFragment = false
    | mResumed = false
    | mRetaining = false
    | mStopped = true
    | mStartedActivityFromFragment = false
    | mStartedIntentSenderFromFragment = false
    | mExtraDataMap = android.support.v4.util.SimpleArrayMap@315130664 (0x12c88328)
    | mActionBar = null
    | mActionModeTypeStarting = 0
    | mActivityInfo = android.content.pm.ActivityInfo@315787872 (0x12d28a60)
    | mActivityTransitionState = android.app.ActivityTransitionState@315056072 (0x12c75fc8)
    | mAppLockCheckRunnable = android.app.Activity$1@315157296 (0x12c8eb30)
    | mAppLockIsInMultiWindowMode = false
    | mApplication = com.shiyan.netdisk_android.SecuDiskApplication@315811552 (0x12d2e6e0)
    | mCalled = true
    | mChangeCanvasToTranslucent = false
    | mChangingConfigurations = false
    | mComponent = android.content.ComponentName@315383776 (0x12cc5fe0)
    | mConfigChangeFlags = 0
    | mCurrentConfig = android.content.res.Configuration@315402968 (0x12ccaad8)
    | mDecor = null
    | mDefaultKeyMode = 0
    | mDefaultKeySsb = null
    | mDestroyed = true
    | mDoReportFullyDrawn = false
    | mEatKeyUpEvent = false
    | mEmbeddedID = null
    | mEnableDefaultActionBarUp = false
    | mEnterTransitionListener = android.app.SharedElementCallback$1@1883687040 (0x7046c880)
    | mExitTransitionListener = android.app.SharedElementCallback$1@1883687040 (0x7046c880)
    | mFinished = true
    | mFlipfont = 0
    | mFragments = android.app.FragmentController@315157152 (0x12c8eaa0)
    | mHandler = android.os.Handler@320115040 (0x13149160)
    | mHasCurrentPermissionsRequest = false
    | mIdent = 138615481
    | mInstanceTracker = android.os.StrictMode$InstanceTracker@315157184 (0x12c8eac0)
    | mInstrumentation = android.app.Instrumentation@315596512 (0x12cf9ee0)
    | mIntent = android.content.I

ntent@315445952 (0x12cd52c0)
| mLastNonConfigurationInstances = null
| mMainThread = android.app.ActivityThread@315618048 (0x12cff300)
| mManagedCursors = java.util.ArrayList@315130688 (0x12c88340)
| mManagedDialogs = null
| mMenuInflater = null
| mParent = null
| mPolicyManager = android.net.NetworkPolicyManager@315157824 (0x12c8ed40)
| mReferrer = java.lang.String@315083720 (0x12c7cbc8)
| mResultCode = 0
| mResultData = null
| mResumed = false
| mScreenChangeListener = null
| mSearchEvent = null
| mSearchManager = null
| mStartedActivity = false
| mStopped = true
| mTaskDescription = android.app.ActivityManager$TaskDescription@320115072 (0x13149180)
| mTemporaryPause = false
| mTitle = java.lang.String@316482016 (0x12dd21e0)
| mTitleColor = 0
| mTitleReady = true
| mToken = android.os.BinderProxy@315183040 (0x12c94fc0)
| mTranslucentCallback = null
| mUiThread = java.lang.Thread@1991870256 (0x76b98730)
| mVisibleBehind = false
| mVisibleFromClient = true
| mVisibleFromServer = true
| mVoiceInteractor = null
| mWindow = com.android.internal.policy.PhoneWindow@319550960 (0x130bf5f0)
| mWindowAdded = true
| mWindowManager = android.view.WindowManagerImpl@315203152 (0x12c99e50)
| mInflater = com.android.internal.policy.PhoneLayoutInflater@314614928 (0x12c0a490)
| mOverrideConfiguration = null
| mResources = android.content.res.Resources@315386624 (0x12cc6b00)
| mTheme = android.content.res.Resources$Theme@315158256 (0x12c8eef0)
| mThemeResource = 2131361960
| mBase = android.app.ContextImpl@315481552 (0x12cdddd0)
| shadow$klass = droidninja.filepicker.FilePickerActivity
| shadow$monitor = 1073742660

  • Excluded Refs:
    | Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always)
    | Thread:FinalizerWatchdogDaemon (always)
    | Thread:main (always)
    | Thread:LeakCanary-Heap-Dump (always)
    | Class:java.lang.ref.WeakReference (always)
    | Class:java.lang.ref.SoftReference (always)
    | Class:java.lang.ref.PhantomReference (always)
    | Class:java.lang.ref.Finalizer (always)
    | Class:java.lang.ref.FinalizerReference (always)

FilePicker Changed my demo app's name

after i add compile ... to "build.gradle"

my demo app's name changed to "FilePicker"
[when i debug it on my phone]

i know there's some conflects in res folder

is it a bug or did i use it in a wrong way ?

can't select ssl certificate file

i have a ssl certificate file with extension .p12 and am not able to view and select it
is there anyway you can add a filter for the extension we want to display ?

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.