本文整理汇总了Java中net.rdrei.android.dirchooser.DirectoryChooserFragment.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java DirectoryChooserFragment.newInstance方法的具体用法?Java DirectoryChooserFragment.newInstance怎么用?Java DirectoryChooserFragment.newInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.rdrei.android.dirchooser.DirectoryChooserFragment
的用法示例。
在下文中一共展示了DirectoryChooserFragment.newInstance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import net.rdrei.android.dirchooser.DirectoryChooserFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_folder);
mDialog = DirectoryChooserFragment.newInstance("DialogSample", null);
prefs = PreferenceManager
.getDefaultSharedPreferences(this);
editor = prefs.edit();
String settingDir = prefs.getString(Constants.SETTINGS_FAKKUDROID_FOLDER, "");
if (!settingDir.isEmpty()) {
EditText editText = (EditText) findViewById(R.id.etFolder);
editText.setText(settingDir);
} else {
selectDefault(null);
}
}
示例2: onCreate
import net.rdrei.android.dirchooser.DirectoryChooserFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog);
final DirectoryChooserConfig config = DirectoryChooserConfig.builder()
.newDirectoryName("DialogSample")
.build();
mDialog = DirectoryChooserFragment.newInstance(config);
mDirectoryTextView = (TextView) findViewById(R.id.textDirectory);
findViewById(R.id.btnChoose)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDialog.show(getFragmentManager(), null);
}
});
}
示例3: onCreate
import net.rdrei.android.dirchooser.DirectoryChooserFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final DirectoryChooserConfig config = DirectoryChooserConfig.builder()
.newDirectoryName("DialogSample")
.build();
mDialog = DirectoryChooserFragment.newInstance(config);
mDialog.show(getFragmentManager(), null);
}
示例4: showSaveLocation
import net.rdrei.android.dirchooser.DirectoryChooserFragment; //导入方法依赖的package包/类
private void showSaveLocation() {
if (dirChooser == null) {
dirChooser = DirectoryChooserFragment.newInstance(DirectoryChooserConfig.builder().initialDirectory(PREF_SAVE_LOCATION_VALUE)
.newDirectoryName(getApplicationContext().getString(getApplicationContext().getApplicationInfo().labelRes))
.build());
dirChooser.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.AppTheme_DialogTheme);
}
dirChooser.show(getFragmentManager(), null);
}
示例5: openDirectChooserDialog
import net.rdrei.android.dirchooser.DirectoryChooserFragment; //导入方法依赖的package包/类
public void openDirectChooserDialog() {
DirectoryChooserConfig config = DirectoryChooserConfig.builder()
.newDirectoryName("HHComicDownload")
.allowNewDirectoryNameModification(true)
.initialDirectory(mDownloadPath)
.build();
mDialog = DirectoryChooserFragment.newInstance(config);
mDialog.setTargetFragment(this, 0);
mDialog.show(getFragmentManager(), null);
}
示例6: onCreate
import net.rdrei.android.dirchooser.DirectoryChooserFragment; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_export);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mAssetsFiles = Arrays.asList(getIntent().getStringArrayExtra(EXTRA_SELECTED_ITEMS));
View colorButton = findViewById(R.id.color_button);
colorButton.setOnClickListener(mColorClickListener);
mColorPreview = findViewById(R.id.color_preview);
mColorPreview.setBackgroundColor(mColor);
View pathButton = findViewById(R.id.path_button);
pathButton.setOnClickListener(mPathClickListener);
mPathTextView = (TextView) findViewById(R.id.path_text);
mPathTextView.setText(Environment.getExternalStorageDirectory().getPath());
ListView listView = (ListView) findViewById(R.id.list_view);
listView.setOnItemClickListener(mOnItemClickListener);
listView.setOnItemLongClickListener(mOnItemLongClickListener);
listView.setAdapter(mListAdapter);
findViewById(R.id.start_export_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startExport();
}
});
mDialog = DirectoryChooserFragment.newInstance(getString(R.string.app_name), null);
}
示例7: onCreate
import net.rdrei.android.dirchooser.DirectoryChooserFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog);
//Pass the previously selected path.
mDialog = DirectoryChooserFragment.newInstance("AudioRecorder", Environment.getExternalStorageDirectory() + "/AudioRecorder");
mDirectoryTextView = (TextView) findViewById(R.id.textDirectory);
findViewById(R.id.btnChoose)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDialog.show(getFragmentManager(), null);
}
});
}
示例8: onCreate
import net.rdrei.android.dirchooser.DirectoryChooserFragment; //导入方法依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ThemeInitializer.init(this);
File workingDir = AppDirs.root(this);
directoryChooserDialog = DirectoryChooserFragment.newInstance(workingDir.getName(), workingDir.getParent());
// Display the fragment as the main content.
settingsFragment = new SettingsFragment();
getFragmentManager().beginTransaction()
.replace(android.R.id.content, settingsFragment)
.commit();
}
示例9: onCreate
import net.rdrei.android.dirchooser.DirectoryChooserFragment; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getPreferenceManager().setSharedPreferencesName(SharedPreferencesUtil.FILE_NAME);
addPreferencesFromResource(R.xml.preferences);
String downloadPath = DownloadManager.getDownloadPath();
if (downloadPath != null) {
String displayPath = Uri.decode(downloadPath);
getPreferenceManager().findPreference(KEY_PREF_DOWNLOAD_PATH).setSummary(displayPath);
}
ListPreference listPreference = (ListPreference) getPreferenceManager().findPreference(KEY_PREF_VIEW_DIRECTION);
CharSequence[] entries = listPreference.getEntries();
int i = listPreference.findIndexOfValue(listPreference.getValue());
i = (i <= 0) ? 0 : i;
listPreference.setSummary(entries[i]);
listPreference.setOnPreferenceChangeListener(this);
listPreference = (ListPreference) getPreferenceManager().findPreference(KEY_PREF_VIEW_VIDEO_PLAYER);
entries = listPreference.getEntries();
i = listPreference.findIndexOfValue(listPreference.getValue());
i = (i <= 0) ? 0 : i;
listPreference.setSummary(entries[i]);
listPreference.setOnPreferenceChangeListener(this);
getPreferenceScreen().setOnPreferenceChangeListener(this);
final DirectoryChooserConfig config = DirectoryChooserConfig.builder()
.initialDirectory((downloadPath.startsWith("/")) ? downloadPath : DownloadManager.DEFAULT_PATH)
.newDirectoryName("download")
.allowNewDirectoryNameModification(true)
.build();
mDialog = DirectoryChooserFragment.newInstance(config);
mDialog.setTargetFragment(this, 0);
float size = (float) Fresco.getImagePipelineFactory().getMainFileCache().getSize() / ByteConstants.MB;
Preference cacheCleanPreference = getPreferenceManager().findPreference(KEY_PREF_CACHE_CLEAN);
cacheCleanPreference.setSummary(String.format("已使用 %.2f MB", size));
LongClickPreference prefDownloadPath = (LongClickPreference) getPreferenceManager().findPreference(KEY_PREF_DOWNLOAD_PATH);
prefDownloadPath.setOnLongClickListener(v -> {
new AlertDialog.Builder(activity)
.setTitle("选择路径方式")
.setItems(new String[]{"系统文档(新)", "路径选择框(旧)"}, (dialogInterface, pos) -> {
if (pos == 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
try {
startActivityForResult(intent, RESULT_CHOOSE_DIRECTORY);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
mDialog.show(getFragmentManager(), null);
}
new Handler().postDelayed(() -> {
if (!opened)
activity.showSnackBar("如无法开启系统文档,长按使用旧工具");
}, 1000);
} else if (pos == 1) {
mDialog.show(getFragmentManager(), null);
} else
activity.showSnackBar("当前系统版本不支持");
})
.setNegativeButton(getString(R.string.cancel), null)
.show();
return true;
});
}