当前位置: 首页>>代码示例>>Java>>正文


Java FilePickerActivity类代码示例

本文整理汇总了Java中com.nononsenseapps.filepicker.FilePickerActivity的典型用法代码示例。如果您正苦于以下问题:Java FilePickerActivity类的具体用法?Java FilePickerActivity怎么用?Java FilePickerActivity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FilePickerActivity类属于com.nononsenseapps.filepicker包,在下文中一共展示了FilePickerActivity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onOptionsItemSelected

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
/**
 * This method handles the action menu item selections.
 *
 * @param item the item which has been selected
 * @return if the item was found in the menu
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.action_switch_user:
            startActivity(new Intent(getApplicationContext(), UserSelectionActivity.class));
            return true;
        case R.id.action_about:
            startActivity(new Intent(getApplicationContext(), AboutActivity.class));
            return true;
        case R.id.action_settings:
            startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
            return true;
        case 0: // Only in debug mode: File Picker
            Intent i = new Intent(getApplicationContext(), FilePickerActivity.class);
            startActivityForResult(i, CODE_FILEPICKER);
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
开发者ID:Kamshak,项目名称:BrainPhaser,代码行数:26,代码来源:MainActivity.java

示例2: launchPicker

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
private void launchPicker() {
    File path = null;
    if (!Strings.isNullOrEmpty(startPath)) {
        path = new File(startPath);
    }
    if (path == null || !path.exists()) {
        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
            path = new File(Environment.getExternalStorageDirectory().toString());
        } else {
            path = Environment.getRootDirectory();
        }
    }

    Intent i = new Intent(this, MyFilePickerActivity.class);
    i.putExtra(FilePickerActivity.EXTRA_START_PATH, path.getAbsolutePath());
    if (directoryMode) {
        i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true);
        i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR);
    }
    startActivityForResult(i, REQUEST_PICKER);
}
 
开发者ID:andyCano,项目名称:TaskApp,代码行数:22,代码来源:FileExplore.java

示例3: onOptionsItemSelected

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {
        case R.id.newitem:
            Intent intent = new Intent(this, NoticeTreeActivity.class);
            intent.putExtra(ARG_NOTICE, new NoticeItem(ROOT_BRANCH_TITLE));
            startActivity(intent);
            break;
        case R.id.openitem:
            Intent intent1 = new Intent(this, FilePickerActivity.class);
            intent1.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
            intent1.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
            intent1.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE);
            intent1.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath());
            startActivityForResult(intent1, FILE_CODE);
            break;
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:NoticEditorTeam,项目名称:NoticEditorAndroid,代码行数:21,代码来源:MainActivity.java

示例4: selectFodler

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
private void selectFodler()
{
    Intent i = new Intent(getActivity(), FilePickerActivity.class);
    // This works if you defined the intent filter
    // Intent i = new Intent(Intent.ACTION_GET_CONTENT);

    // Set these depending on your use case. These are the defaults.
    i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
    i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true);
    i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR);

    // Configure initial directory by specifying a String.
    // You could specify a String like "/storage/emulated/0/", but that can
    // dangerous. Always use Android's API calls to get paths to the SD-card or
    // internal memory.
    String initialPath = App.getAdvancedCameraPrefHelper().getCustomStorage();

    if( !(new File(initialPath).exists()) )
    {
        initialPath = Environment.getExternalStorageDirectory().getPath();
    }
    i.putExtra(FilePickerActivity.EXTRA_START_PATH, initialPath);

    startActivityForResult(i, FILE_CODE);
}
 
开发者ID:joseliko7,项目名称:Snapmatic-Life,代码行数:26,代码来源:AdvancedCameraSettingsFragment.java

示例5: onStartFilePicker

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
public void onStartFilePicker(MenuItem menuItem) {
    Intent i = new Intent(Intent.ACTION_GET_CONTENT);

    // Set these depending on your use case. These are the defaults.
    i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
    i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
    i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE);

    // Configure initial directory by specifying a String.
    // You could specify a String like "/storage/emulated/0/", but that can
    // dangerous. Always use Android's API calls to get paths to the SD-card or
    // internal memory.
    i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath());

    startActivityForResult(i, FILE_CODE);
}
 
开发者ID:rostskadat,项目名称:OTGDiskBackup,代码行数:17,代码来源:MainActivity.java

示例6: onCreate

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);

    // Setup the file chooser for the To field.
    Preference filePicker = findPreference(PreferencesActivity.PREFS_TO_FILE);
    filePicker.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            intent.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
            intent.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
            intent.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR);
            intent.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getPath());
            startActivityForResult(intent, REQUEST_CODE_TO);
            return true;
        }
    });
}
 
开发者ID:rostskadat,项目名称:OTGDiskBackup,代码行数:21,代码来源:PreferencesActivityFragment.java

示例7: onPreferenceClick

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
@Override
public boolean onPreferenceClick(Preference preference) {
    if (preference == update) {
        Updater.checkForUpdates(getActivity(), true);
    } else if (preference == storagePath) {
        Intent i = new Intent(context, FilePickerActivity.class);
        i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
        i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true);
        i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR);
        startActivityForResult(i, 69);
        return true;
    } else if (preference == facebook) {
        Utils.viewURL(context, FACEBOOK_URL);
    } else if (preference == googlePlus) {
        Utils.viewURL(context, GOOGLE_PLUS_URL);
    } else if (preference == privacy) {
        Utils.viewURL(context, PRIVACY_URL);
    } else if (preference == terms) {
        Utils.viewURL(context, TOS_URL);
    } else if (preference == about) {
        Utils.viewURL(context, ABOUT_URL);
    } else if (preference == madeWithLove) {
        Utils.viewURL(context, MADE_WITH_LOVE_URL);
    }
    return false;
}
 
开发者ID:AnandChowdhary,项目名称:saga-android,代码行数:27,代码来源:PrefFragment.java

示例8: onActivityResult

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == FILE_CODE && resultCode == Activity.RESULT_OK) {
        if (!intent.getBooleanExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)) {
            // The URI will now be something like content://PACKAGE-NAME/root/path/to/file
            Uri uri = intent.getData();
            // A utility method is provided to transform the URI to a File object
            File file = com.nononsenseapps.filepicker.Utils.getFileForUri(uri);

            if (S.INFO)
                Log.i(S.TAG, "XML path Uri (" + file.toString() + ")");

            try {
                SharedPreferences.Editor editor = mPrefs.edit();
                editor.putString("settingCatalogLocation", file.toString());
                editor.apply();
                updateSummary(mPrefs, KEY_PREF_CATALOG_LOCATION);
            } catch (Exception e) {
                if (S.ERROR)
                    Log.e(S.TAG, "File select error " + e.getLocalizedMessage());
            }
        }
    }
}
 
开发者ID:elman22,项目名称:pocket-amc-reader,代码行数:25,代码来源:SettingsFragment.java

示例9: pickFileDialog

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
public static void pickFileDialog(Activity activity, String location, int requestCode) {
// This always works
        Intent i = new Intent(activity, FilePickerActivity.class);
        // This works if you defined the intent filter
        // Intent i = new Intent(Intent.ACTION_GET_CONTENT);

        // Set these depending on your use case. These are the defaults.
        i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
        i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
        i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE);

        // Configure initial directory by specifying a String.
        // You could specify a String like "/storage/emulated/0/", but that can
        // dangerous. Always use Android's API calls to get paths to the SD-card or
        // internal memory.
        i.putExtra(FilePickerActivity.EXTRA_START_PATH, location);
        // Environment.getExternalStorageDirectory().getPath()

        activity.startActivityForResult(i, requestCode);
    }
 
开发者ID:moneymanagerex,项目名称:android-money-manager-ex,代码行数:21,代码来源:UIHelper.java

示例10: onOptionsItemSelected

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
    if (menuItem.getItemId() == android.R.id.home) {
        onBackPressed();
    }
    else if (menuItem.getItemId() == R.id.action_find) {
        // load custom image
        Intent i = new Intent(this, FilePickerActivity.class);
        i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
        i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true);
        i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE);
        i.putExtra(FilePickerActivity.EXTRA_START_PATH,
                GlobalConfig.pathPickedSave == null || GlobalConfig.pathPickedSave.length() == 0 ?
                        Environment.getExternalStorageDirectory().getPath() : GlobalConfig.pathPickedSave);
        startActivityForResult(i, 0);
    }
    return super.onOptionsItemSelected(menuItem);
}
 
开发者ID:MewX,项目名称:light-novel-library_Wenku8_Android,代码行数:19,代码来源:MenuBackgroundSelectorActivity.java

示例11: selectFile

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
void selectFile(){
    Intent i = new Intent(this, FilePickerActivity.class);
    // This works if you defined the intent filter
    // Intent i = new Intent(Intent.ACTION_GET_CONTENT);

    // Set these depending on your use case. These are the defaults.
    i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
    i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
    i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE);
    i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath());
    startActivityForResult(i, FILE_CODE);
}
 
开发者ID:mmjang,项目名称:quiz_helper,代码行数:13,代码来源:CustomDictionaryActivity.java

示例12: importData

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
public void importData()
{
    Intent intent = new Intent(ClassDetailsActivity.this, FilePickerActivity.class);
    intent.setAction(Intent.ACTION_GET_CONTENT);
    intent.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
    intent.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
    intent.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE);
    startActivityForResult(intent, FILE_SELECT_CODE);
}
 
开发者ID:suchoX,项目名称:Simplify,代码行数:10,代码来源:ClassDetailsActivity.java

示例13: showUploadHereDialog

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
private void showUploadHereDialog() {
    if (indexBrowser == null) {
        Log.w("showUploadHereDialog", "unable to open dialog, null index browser");
    } else {
        Intent i = new Intent(this, MIVFilePickerActivity.class);
        String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
        Log.i("showUploadHereDialog", "path = " + path);
        i.putExtra(FilePickerActivity.EXTRA_START_PATH, path);
        startActivityForResult(i, 0);
    }
}
 
开发者ID:davide-imbriaco,项目名称:a-sync-browser,代码行数:12,代码来源:MainActivity.java

示例14: pickRootDir

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
public void pickRootDir(View v) {
	// https://github.com/spacecowboy/NoNonsense-FilePicker
	Intent i = new Intent(this, FilePickerActivity.class);
	i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
	i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
	i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR);
	i.putExtra(FilePickerActivity.EXTRA_START_PATH, "/");
	startActivityForResult(i, ROOT_DIR_REQ_CODE);
}
 
开发者ID:GokulNC,项目名称:USB_Mass_Storage_Enabler,代码行数:10,代码来源:AdvancedOptions.java

示例15: selectBlockManually

import com.nononsenseapps.filepicker.FilePickerActivity; //导入依赖的package包/类
void selectBlockManually() {
	Intent i = new Intent(this, FilePickerActivity.class);
	i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
	i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
	i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE);
	i.putExtra(FilePickerActivity.EXTRA_START_PATH, "/");
	startActivityForResult(i, BLOCK_FILE_REQ_CODE);
}
 
开发者ID:GokulNC,项目名称:USB_Mass_Storage_Enabler,代码行数:9,代码来源:AdvancedOptions.java


注:本文中的com.nononsenseapps.filepicker.FilePickerActivity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。