/LFilePicker

Android 检索手机目录方式的文件选择器,轻量且界面友好,定制性高。This is a lightweight file selector, it can select files by retrieve phone directory

Primary LanguageJava


This is a lightweight file selector, it can select files by retrieve phone directory. At the same time contains:

  • A variety of interface style
  • Support file multiple-choice or radio
  • Support the file type filter
  • Support the fragments

Running effect:

dynamic effect(If the picture can't display properly, you can view the screenshot GIF files in the folder)

the page:

Quick to use

1. add reference

compile 'com.leon:lfilepickerlibrary:1.0'

2. open Activity

new LFilePicker()
            .withActivity(MainActivity.this)
            .withRequestCode(Consant.REQUESTCODE_FROM_ACTIVITY)
            .start();

3. accept the results of the return

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {
        if (requestCode == Consant.REQUESTCODE_FROM_ACTIVITY) {
            List<String> list = data.getStringArrayListExtra(Constant.RESULT_INFO);
            Toast.makeText(getApplicationContext(), "选中了" + list.size() + "个文件", Toast.LENGTH_SHORT).show();
        }
    }
}

Interface methods

method statement

method statement
withActivity(Activity activity) bind Activity
withFragment(Fragment fragment) bind Fragment
withSupportFragment(Fragment supportFragment) bind V4 Fragment
withRequestCode(int requestCode) set the request code
withTitle(String title) Set the title
withTitleColor(String color) Set the title color
withBackgroundColor(String color) Set the title background color
withIconStyle(int style) set the list icon style
withBackIcon(int backStyle) set back icon style
withFileFilter(String[] arrs) set the file type filter
withMutilyMode(boolean isMutily) setting a multiple-choice or radio mode
withAddText(String text) set the multiselect mode selected text

Provide style

withIconStyle(int style) Value model:

  • Constant.BACKICON_STYLEONE
  • Constant.BACKICON_STYLETWO
  • Constant.BACKICON_STYLETHREE

withBackIcon(int backStyle) Value model:

  • Constant.ICON_STYLE_YELLOW
  • Constant.ICON_STYLE_BLUE
  • Constant.ICON_STYLE_GREEN

withFileFilter(String[] arrs) Value model:

 withFileFilter(new String[]{".txt", ".png", ".docx"})

Thanks


If the library is useful to you, welcome to star or fork! Welcome to visit [blog] 4 for more articles.