com.ipaulpro.afilechooser.FileChooserActivity Java Examples

The following examples show how to use com.ipaulpro.afilechooser.FileChooserActivity. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SettingsFragment.java    From secrecy with Apache License 2.0 6 votes vote down vote up
private void preparePreferenceVaultRoot(){
    Preference vault_root = findPreference("vault_root");
    vault_root.setSummary(Storage.getRoot().getAbsolutePath());
    vault_root.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            choosePath(new getFileListener() {
                @Override
                public void get(File file) {
                    Intent intent = new Intent(context, FileChooserActivity.class);
                    intent.putStringArrayListExtra(
                            FileChooserActivity.EXTRA_FILTER_INCLUDE_EXTENSIONS,
                            INCLUDE_EXTENSIONS_LIST);
                    intent.putExtra(FileChooserActivity.PATH, file.getAbsolutePath());
                    intent.putExtra(FileChooserActivity.EXTRA_SELECT_FOLDER, true);
                    startActivityForResult(intent, REQUEST_CODE_SET_VAULT_ROOT);
                }
            });
            return true;
        }
    });
}
 
Example #2
Source File: SettingsFragment.java    From secrecy with Apache License 2.0 6 votes vote down vote up
private void preparePreferenceVaultMove(){
    Preference vault_move = findPreference("vault_move");
    vault_move.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            choosePath(new getFileListener() {
                @Override
                public void get(File file) {
                    Intent intent = new Intent(context, FileChooserActivity.class);
                    intent.putStringArrayListExtra(
                            FileChooserActivity.EXTRA_FILTER_INCLUDE_EXTENSIONS,
                            INCLUDE_EXTENSIONS_LIST);
                    intent.putExtra(FileChooserActivity.PATH, file.getAbsolutePath());
                    intent.putExtra(FileChooserActivity.EXTRA_SELECT_FOLDER, true);
                    startActivityForResult(intent, REQUEST_CODE_MOVE_VAULT);
                }
            });
            return true;
        }
    });
}
 
Example #3
Source File: AFileChooserSampleActivity.java    From android-opensource-library-56 with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_afile_chooser_sample);
    findViewById(R.id.button).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(This(), FileChooserActivity.class);
            // 汎用的なファイル選択を呼び出す場合
            // Intent getContentIntent = FileUtils.createGetContentIntent();
            // getContentIntent.setType("image/*");
            // Intent intent = Intent.createChooser(getContentIntent,
            // "Select Image File.");
            startActivityForResult(intent, FILE_CHOOSE);
        }
    });
}
 
Example #4
Source File: LauncherActivity.java    From Boardwalk with Apache License 2.0 5 votes vote down vote up
public void doBrowseForCredentials() {
	new AlertDialog.Builder(this).setMessage(R.string.login_import_credentials_info).
		setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialogI, int button) {
					Intent target = FileUtils.createGetContentIntent();
					target.setType("application/json");
					target.setClass(LauncherActivity.this, FileChooserActivity.class);

					startActivityForResult(target, REQUEST_BROWSE_FOR_CREDENTIALS);
				}
		}).
		setNegativeButton(android.R.string.cancel, null).
		show();
}
 
Example #5
Source File: LauncherActivity.java    From Boardwalk with Apache License 2.0 5 votes vote down vote up
private void doBrowseForResourcePack() {
	Intent target = FileUtils.createGetContentIntent();
	target.setType("application/zip");
	target.setClass(LauncherActivity.this, FileChooserActivity.class);

	startActivityForResult(target, REQUEST_BROWSE_FOR_RESOURCE_PACK);
}
 
Example #6
Source File: ChooseFolder.java    From secrecy with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = new Intent(this, FileChooserActivity.class);

    intent.putStringArrayListExtra(
            FileChooserActivity.EXTRA_FILTER_INCLUDE_EXTENSIONS,
            INCLUDE_EXTENSIONS_LIST);
    intent.putExtra(FileChooserActivity.EXTRA_SELECT_FOLDER, true);
    startActivityForResult(intent, REQUEST_CODE);
}
 
Example #7
Source File: VaultsListFragment.java    From secrecy with Apache License 2.0 5 votes vote down vote up
void restore() {
    ArrayList<String> INCLUDE_EXTENSIONS_LIST = new ArrayList<String>();
    INCLUDE_EXTENSIONS_LIST.add(".zip");

    Intent intent = new Intent(context, FileChooserActivity.class);

    intent.putStringArrayListExtra(
            FileChooserActivity.EXTRA_FILTER_INCLUDE_EXTENSIONS,
            INCLUDE_EXTENSIONS_LIST);
    intent.putExtra(FileChooserActivity.PATH, Storage.getRoot().getAbsolutePath());
    startActivityForResult(intent, REQUESTCODE);
}
 
Example #8
Source File: TexturePacksActivity.java    From MCPELauncher with Apache License 2.0 5 votes vote down vote up
public void onClick(View v) {
	if (v == addButton) {
		Intent target = FileUtils.createGetContentIntent();
		target.setType("application/zip");
		target.putExtra(FileUtils.EXTRA_MIME_TYPES, new String[] {
			"application/zip", "application/x-appx", "application/vnd.android.package-archive"});
		target.setClass(this, FileChooserActivity.class);
		startActivityForResult(target, REQUEST_ADD_TEXTURE);
	}
}
 
Example #9
Source File: ManagePatchesActivity.java    From MCPELauncher with Apache License 2.0 5 votes vote down vote up
public void importPatch() {
	Intent target = FileUtils.createGetContentIntent();
	target.setType("application/x-ptpatch");
	target.setClass(this, FileChooserActivity.class);
	target.putExtra(FileUtils.EXTRA_SORT_METHOD, FileUtils.SORT_LAST_MODIFIED);
	startActivityForResult(target, REQUEST_IMPORT_PATCH);
}
 
Example #10
Source File: ManageScriptsActivity.java    From MCPELauncher with Apache License 2.0 5 votes vote down vote up
public void importPatchFromFile() {
	Intent target = FileUtils.createGetContentIntent();
	target.setType("application/javascript");
	target.setClass(this, FileChooserActivity.class);
	target.putExtra(FileUtils.EXTRA_MIME_TYPES, ALL_SCRIPT_MIMETYPES);
	target.putExtra(FileUtils.EXTRA_SORT_METHOD, FileUtils.SORT_LAST_MODIFIED);
	startActivityForResult(target, REQUEST_IMPORT_PATCH);
}