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


Java FileBrowserAppsAdapter类代码示例

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


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

示例1: openFileChooser

import no.nordicsemi.android.nrftoolbox.dfu.adapter.FileBrowserAppsAdapter; //导入依赖的package包/类
private void openFileChooser() {
	final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
	intent.setType(mFileTypeTmp == DfuService.TYPE_AUTO ? DfuService.MIME_TYPE_ZIP : DfuService.MIME_TYPE_OCTET_STREAM);
	intent.addCategory(Intent.CATEGORY_OPENABLE);
	if (intent.resolveActivity(getPackageManager()) != null) {
		// file browser has been found on the device
		startActivityForResult(intent, SELECT_FILE_REQ);
	} else {
		// there is no any file browser app, let's try to download one
		final View customView = getLayoutInflater().inflate(R.layout.app_file_browser, null);
		final ListView appsList = customView.findViewById(android.R.id.list);
		appsList.setAdapter(new FileBrowserAppsAdapter(this));
		appsList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
		appsList.setItemChecked(0, true);
		new AlertDialog.Builder(this).setTitle(R.string.dfu_alert_no_filebrowser_title).setView(customView)
				.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss()).setPositiveButton(R.string.ok, (dialog, which) -> {
					final int pos = appsList.getCheckedItemPosition();
					if (pos >= 0) {
						final String query = getResources().getStringArray(R.array.dfu_app_file_browser_action)[pos];
						final Intent storeIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(query));
						startActivity(storeIntent);
					}
				}).show();
	}
}
 
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Toolbox,代码行数:26,代码来源:DfuActivity.java

示例2: onImportClick

import no.nordicsemi.android.nrftoolbox.dfu.adapter.FileBrowserAppsAdapter; //导入依赖的package包/类
@Override
public void onImportClick() {
	// No item has been selected. We must close the spinner manually.
	mConfigurationSpinner.close();

	final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
	intent.setType("text/xml");
	intent.addCategory(Intent.CATEGORY_OPENABLE);
	if (intent.resolveActivity(getPackageManager()) != null) {
		// file browser has been found on the device
		startActivityForResult(intent, SELECT_FILE_REQ);
	} else {
		// there is no any file browser app, let's try to download one
		final View customView = getLayoutInflater().inflate(R.layout.app_file_browser, null);
		final ListView appsList = customView.findViewById(android.R.id.list);
		appsList.setAdapter(new FileBrowserAppsAdapter(this));
		appsList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
		appsList.setItemChecked(0, true);
		new AlertDialog.Builder(this).setTitle(R.string.dfu_alert_no_filebrowser_title).setView(customView).setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss()).setPositiveButton(R.string.yes, (dialog, which) -> {
			final int pos = appsList.getCheckedItemPosition();
			if (pos >= 0) {
				final String query = getResources().getStringArray(R.array.dfu_app_file_browser_action)[pos];
				final Intent storeIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(query));
				startActivity(storeIntent);
			}
		}).show();
	}
}
 
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Toolbox,代码行数:29,代码来源:UARTActivity.java


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