Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

FilePicker Dialog

Angad Singh edited this page Apr 1, 2017 · 18 revisions

public class FilePickerDialog
extends Dialog implements AdapterView.OnItemClickListener

FilePickerDialog shows the list of files and directories in the device storage, based on properties they can be selected.

Summary

Constants
static final int EXTERNAL_READ_PERMISSION_GRANT
Use this constant as requestCode for granting external read permission.
Public constructors
FilePickerDialog(Context context)
Creates dialog window with default DialogProperties.
FilePickerDialog(Context context, DialogPropertiesproperties)
Creates a dialog window with custom DialogProperties.
FilePickerDialog(Context context, DialogProperties properties, int themeResId)
Creates a dialog window with custom DialogProperties.
Inherited Methods
void show()
Start the dialog and display it on screen.
void dismiss()
Dismiss this dialog, removing it from the screen..
void setTitle(CharSequence title)
Set the title text for this dialog's window.
Public Methods
DialogProperties getProperties()
Retrieve the Properties this Dialog is using.
void setProperties(DialogProperties properties)
Set properties dialog would be using.
void setDialogSelectionListener(DialogSelectionListener callbacks)
Set a listener to be invoked when SELECT button is pressed.
void setPositiveBtnName(CharSequence positiveBtnNameStr)
CharSequence to be shown on positive action button.
void setNegativeBtnName(CharSequence negativeBtnNameStr)
CharSequence to be shown on negative action button.
void markFiles(List<String> paths)
File Paths specified in list are pre marked in the dialog before showing.

Constants

EXTERNAL_READ_PERMISSION_GRANT

Use this constant as requestCode for granting external read permission.

Constant Value: 112

Public Constructors

FilePickerDialog

FilePickerDialog(Context context)

Creates dialog window with default DialogProperties.

The supplied context is used to obtain the window manager, populate dialog list and checking permissions.

Parameters
context Context: the context in which the dialog should run

FilePickerDialog

FilePickerDialog(Context context, DialogProperties properties)

Creates a dialog window with custom DialogProperties.

The supplied context is used to obtain the window manager, populate dialog list and checking permissions.

The supplied properties is used to define selection modes, types and directories.

Parameters
context Context: the context in which the dialog should run
properties DialogProperties: the properties dialog would be using

FilePickerDialog

FilePickerDialog(Context context, DialogProperties properties, int themeResId)

Creates a dialog window with custom DialogProperties.

The supplied context is used to obtain the window manager, populate dialog list and checking permissions.

The supplied properties is used to define selection modes, types and directories.

Parameters
context Context: the context in which the dialog should run
properties DialogProperties: the properties dialog would be using
themeResId int: a style resource describing the theme to use for the window, or 0 to use the default dialog theme

Inherited Methods

show

void show ()

Start the dialog and display it on screen. The window is placed in the application layer and opaque. Note that you should not override this method to do initialization when the dialog is shown, instead implement that in onStart().

dismiss

void dismiss ()

Dismiss this dialog, removing it from the screen. This method can be invoked safely from any thread. Note that you should not override this method to do cleanup when the dialog is dismissed, instead implement that in onStop().

setTitle

void setTitle(CharSequence titleStr) Set the title text for this dialog's window.

Parameters
titleStr CharSequence: The new text to display in the title.

Public Methods

getProperties

DialogProperties getProperties()

Retrieve the Properties this Dialog is using.

Returns
DialogProperties properties dialog is using.

setProperties

void setProperties(DialogProperties properties)

Set properties dialog would be using.

Parameters
properties DialogProperties: properties dialog will be using.

setDialogSelectionListener

void setDialogSelectionListener(DialogSelectionListener callbacks)

Set a listener to be invoked when SELECT button is pressed.

Parameters
callbacks DialogSelectionListener: listener to be invoked when SELECT button is pressed.