mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
file chooser used in FixBooksDirectoryActivity
This commit is contained in:
parent
c4418f673c
commit
64de74460d
11 changed files with 160 additions and 72 deletions
|
@ -5,10 +5,10 @@ DONE same problem with 'Ok' button
|
||||||
DONE all/writable only option (use writable only for books & temp, all for fonts & wallpapers)
|
DONE all/writable only option (use writable only for books & temp, all for fonts & wallpapers)
|
||||||
NOT NECESSARY activity orientation (use fbreader's OrientaionUtil mechanism)
|
NOT NECESSARY activity orientation (use fbreader's OrientaionUtil mechanism)
|
||||||
DONE resource strings
|
DONE resource strings
|
||||||
* use in fix book catalog dialog
|
DONE use in fix book catalog dialog
|
||||||
* standard temp dir (?)
|
DELAYED standard temp dir (?)
|
||||||
DONE layout for versions < v11
|
DONE layout for versions < v11
|
||||||
* create missing catalogs for fonts/wallpapers (if possible)
|
DELAYED create missing catalogs for fonts/wallpapers (if possible)
|
||||||
* special icon for inaccessible folders
|
DONE special icon for inaccessible folders
|
||||||
* set impossible value for temp folder & check
|
* set impossible value for temp folder & check
|
||||||
* set impossible value for downloads folder & check
|
* set impossible value for downloads folder & check
|
||||||
|
|
|
@ -925,7 +925,7 @@
|
||||||
<node name="crash">
|
<node name="crash">
|
||||||
<node name="fixBooksDirectory">
|
<node name="fixBooksDirectory">
|
||||||
<node name="title" value="FBReader issue"/>
|
<node name="title" value="FBReader issue"/>
|
||||||
<node name="text" value="FBReader cache directory is not accessible for writing. May be you forget to insert or unmount your memory card. Please fix this issue or enter another directory name below."/>
|
<node name="text" value="FBReader cache directory is not accessible for writing. May be you forget to insert or unmount your memory card. Please fix this issue or select another directory."/>
|
||||||
</node>
|
</node>
|
||||||
<node name="missingNativeLibrary">
|
<node name="missingNativeLibrary">
|
||||||
<node name="title" value="FBReader issue"/>
|
<node name="title" value="FBReader issue"/>
|
||||||
|
|
|
@ -930,7 +930,7 @@
|
||||||
<node name="crash">
|
<node name="crash">
|
||||||
<node name="fixBooksDirectory">
|
<node name="fixBooksDirectory">
|
||||||
<node name="title" value="Проблема у FBReader"/>
|
<node name="title" value="Проблема у FBReader"/>
|
||||||
<node name="text" value="FBReader не может сохранить временные файлы. Возможно, вы забыли вставить карту памяти, или она недоступна из-за подключения к компьютеру. Пожалуйста, исправьте эту проблему или введите другое имя каталога для временных файлов."/>
|
<node name="text" value="FBReader не может сохранить временные файлы. Возможно, вы забыли вставить карту памяти, или она недоступна из-за подключения к компьютеру. Пожалуйста, исправьте эту проблему или выберите другой каталог для временных файлов."/>
|
||||||
</node>
|
</node>
|
||||||
<node name="missingNativeLibrary">
|
<node name="missingNativeLibrary">
|
||||||
<node name="title" value="Проблема у FBReader"/>
|
<node name="title" value="Проблема у FBReader"/>
|
||||||
|
|
|
@ -16,13 +16,28 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
/>
|
/>
|
||||||
<EditText
|
<LinearLayout
|
||||||
android:id="@+id/books_directory_fix_directory"
|
android:id="@+id/books_directory_fix_select_area"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:orientation="horizontal"
|
||||||
/>
|
>
|
||||||
|
<ImageView
|
||||||
|
android:src="@drawable/ic_list_library_folder"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:gravity="center_vertical|left"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:id="@+id/books_directory_fix_directory"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:gravity="center_vertical|left"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
<include layout="@layout/ok_cancel_buttons" android:id="@+id/books_directory_fix_buttons" />
|
<include layout="@layout/ok_cancel_buttons" android:id="@+id/books_directory_fix_buttons" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
@ -19,9 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.android.fbreader.crash;
|
package org.geometerplus.android.fbreader.crash;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -38,8 +35,11 @@ import org.geometerplus.fbreader.Paths;
|
||||||
import org.geometerplus.zlibrary.ui.android.R;
|
import org.geometerplus.zlibrary.ui.android.R;
|
||||||
|
|
||||||
import org.geometerplus.android.fbreader.FBReader;
|
import org.geometerplus.android.fbreader.FBReader;
|
||||||
|
import org.geometerplus.android.util.FileChooserUtil;
|
||||||
|
|
||||||
public class FixBooksDirectoryActivity extends Activity {
|
public class FixBooksDirectoryActivity extends Activity {
|
||||||
|
private TextView myDirectoryView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle bundle) {
|
protected void onCreate(Bundle bundle) {
|
||||||
super.onCreate(bundle);
|
super.onCreate(bundle);
|
||||||
|
@ -48,24 +48,38 @@ public class FixBooksDirectoryActivity extends Activity {
|
||||||
final ZLResource resource = ZLResource.resource("crash").getResource("fixBooksDirectory");
|
final ZLResource resource = ZLResource.resource("crash").getResource("fixBooksDirectory");
|
||||||
final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button");
|
final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button");
|
||||||
|
|
||||||
setTitle(resource.getResource("title").getValue());
|
final String title = resource.getResource("title").getValue();
|
||||||
|
setTitle(title);
|
||||||
|
|
||||||
final TextView textView = (TextView)findViewById(R.id.books_directory_fix_text);
|
final TextView textView = (TextView)findViewById(R.id.books_directory_fix_text);
|
||||||
textView.setText(resource.getResource("text").getValue());
|
textView.setText(resource.getResource("text").getValue());
|
||||||
|
|
||||||
final EditText directoryView = (EditText)findViewById(R.id.books_directory_fix_directory);
|
myDirectoryView = (TextView)findViewById(R.id.books_directory_fix_directory);
|
||||||
|
|
||||||
final View buttonsView = findViewById(R.id.books_directory_fix_buttons);
|
final View buttonsView = findViewById(R.id.books_directory_fix_buttons);
|
||||||
final Button okButton = (Button)buttonsView.findViewById(R.id.ok_button);
|
final Button okButton = (Button)buttonsView.findViewById(R.id.ok_button);
|
||||||
okButton.setText(buttonResource.getResource("ok").getValue());
|
okButton.setText(buttonResource.getResource("ok").getValue());
|
||||||
|
|
||||||
|
final View selectArea = findViewById(R.id.books_directory_fix_select_area);
|
||||||
|
|
||||||
Config.Instance().runOnStart(new Runnable() {
|
Config.Instance().runOnStart(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
final ZLStringOption tempDirectoryOption = Paths.TempDirectoryOption();
|
final ZLStringOption tempDirectoryOption = Paths.TempDirectoryOption();
|
||||||
directoryView.setText(tempDirectoryOption.getValue());
|
myDirectoryView.setText(tempDirectoryOption.getValue());
|
||||||
|
selectArea.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
FileChooserUtil.runDirectoryChooser(
|
||||||
|
FixBooksDirectoryActivity.this,
|
||||||
|
1,
|
||||||
|
title,
|
||||||
|
tempDirectoryOption.getValue(),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
okButton.setOnClickListener(new Button.OnClickListener() {
|
okButton.setOnClickListener(new Button.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final String newDirectory = directoryView.getText().toString();
|
final String newDirectory = myDirectoryView.getText().toString();
|
||||||
tempDirectoryOption.setValue(newDirectory);
|
tempDirectoryOption.setValue(newDirectory);
|
||||||
startActivity(new Intent(FixBooksDirectoryActivity.this, FBReader.class));
|
startActivity(new Intent(FixBooksDirectoryActivity.this, FBReader.class));
|
||||||
finish();
|
finish();
|
||||||
|
@ -82,4 +96,11 @@ public class FixBooksDirectoryActivity extends Activity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (requestCode == 1 && resultCode == RESULT_OK) {
|
||||||
|
myDirectoryView.setText(FileChooserUtil.pathFromData(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,12 @@ import java.util.List;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
import group.pals.android.lib.ui.filechooser.FileChooserActivity;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
||||||
import org.geometerplus.zlibrary.core.options.ZLStringListOption;
|
import org.geometerplus.zlibrary.core.options.ZLStringListOption;
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
|
||||||
|
import org.geometerplus.android.util.FileChooserUtil;
|
||||||
|
|
||||||
public class FileChooserCollection {
|
public class FileChooserCollection {
|
||||||
private final Context myContext;
|
private final Context myContext;
|
||||||
private final List<FileChooserPreference> myPreferences = new ArrayList<FileChooserPreference>();
|
private final List<FileChooserPreference> myPreferences = new ArrayList<FileChooserPreference>();
|
||||||
|
@ -61,9 +61,7 @@ public class FileChooserCollection {
|
||||||
|
|
||||||
public void update(int index, Intent data) {
|
public void update(int index, Intent data) {
|
||||||
try {
|
try {
|
||||||
myPreferences.get(index).setValue(
|
myPreferences.get(index).setValue(FileChooserUtil.pathFromData(data));
|
||||||
data.getStringExtra(FileChooserActivity._FolderPath)
|
|
||||||
);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,68 +19,37 @@
|
||||||
|
|
||||||
package org.geometerplus.android.fbreader.preferences.fileChooser;
|
package org.geometerplus.android.fbreader.preferences.fileChooser;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
|
|
||||||
import group.pals.android.lib.ui.filechooser.FileChooserActivity;
|
|
||||||
import group.pals.android.lib.ui.filechooser.services.IFileProvider;
|
|
||||||
import group.pals.android.lib.ui.filechooser.io.localfile.LocalFile;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
|
||||||
|
import org.geometerplus.android.util.FileChooserUtil;
|
||||||
|
|
||||||
abstract class FileChooserPreference extends Preference {
|
abstract class FileChooserPreference extends Preference {
|
||||||
private final int myRegCode;
|
private final int myRegCode;
|
||||||
private final ZLResource myResource;
|
private final ZLResource myResource;
|
||||||
private final IFileProvider.FilterMode myFilterMode;
|
private final boolean myChooseWritableDirectoriesOnly;
|
||||||
|
|
||||||
FileChooserPreference(Context context, ZLResource rootResource, String resourceKey, IFileProvider.FilterMode filterMode, int regCode) {
|
FileChooserPreference(Context context, ZLResource rootResource, String resourceKey, boolean chooseWritableDirectoriesOnly, int regCode) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
myRegCode = regCode;
|
myRegCode = regCode;
|
||||||
myFilterMode = filterMode;
|
myChooseWritableDirectoriesOnly = chooseWritableDirectoriesOnly;
|
||||||
myResource = rootResource.getResource(resourceKey);
|
myResource = rootResource.getResource(resourceKey);
|
||||||
setTitle(myResource.getValue());
|
setTitle(myResource.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
final HashMap<String,String> textResources = new HashMap<String,String>();
|
FileChooserUtil.runDirectoryChooser(
|
||||||
textResources.put("title", myResource.getResource("chooserTitle").getValue());
|
(Activity)getContext(),
|
||||||
final ZLResource dialogResource = ZLResource.resource("dialog");
|
myRegCode,
|
||||||
final ZLResource buttonResource = dialogResource.getResource("button");
|
myResource.getResource("chooserTitle").getValue(),
|
||||||
textResources.put("ok", buttonResource.getResource("ok").getValue());
|
getStringValue(),
|
||||||
textResources.put("cancel", buttonResource.getResource("cancel").getValue());
|
myChooseWritableDirectoriesOnly
|
||||||
final ZLResource resource = dialogResource.getResource("fileChooser");
|
);
|
||||||
textResources.put("root", resource.getResource("root").getValue());
|
|
||||||
textResources.put("newFolder", resource.getResource("newFolder").getValue());
|
|
||||||
textResources.put("folderNameHint", resource.getResource("folderNameHint").getValue());
|
|
||||||
final ZLResource menuResource = resource.getResource("menu");
|
|
||||||
textResources.put("menuOrigin", menuResource.getResource("origin").getValue());
|
|
||||||
textResources.put("menuReload", menuResource.getResource("reload").getValue());
|
|
||||||
final ZLResource sortResource = resource.getResource("sortBy");
|
|
||||||
textResources.put("sortBy", sortResource.getValue());
|
|
||||||
textResources.put("sortByName", sortResource.getResource("name").getValue());
|
|
||||||
textResources.put("sortBySize", sortResource.getResource("size").getValue());
|
|
||||||
textResources.put("sortByDate", sortResource.getResource("date").getValue());
|
|
||||||
textResources.put("permissionDenied", resource.getResource("permissionDenied").getValue());
|
|
||||||
|
|
||||||
final Intent intent = new Intent(getContext(), FileChooserActivity.class);
|
|
||||||
intent.putExtra(FileChooserActivity._TextResources, textResources);
|
|
||||||
intent.putExtra(FileChooserActivity._Rootpath, (Parcelable)new LocalFile(getStringValue()));
|
|
||||||
intent.putExtra(FileChooserActivity._ActionBar, true);
|
|
||||||
intent.putExtra(FileChooserActivity._SaveLastLocation, false);
|
|
||||||
intent.putExtra(FileChooserActivity._DisplayHiddenFiles, true);
|
|
||||||
intent.putExtra(FileChooserActivity._FilterMode, myFilterMode);
|
|
||||||
//intent.putExtra(FileChooserActivity._FilterMode, IFileProvider.FilterMode.AnyDirectories);
|
|
||||||
//intent.putExtra(FileChooserActivity._FilterMode, IFileProvider.FilterMode.DirectoriesOnly);
|
|
||||||
//intent.putExtra(FileChooserActivity._FilterMode, IFileProvider.FilterMode.FilesOnly);
|
|
||||||
//intent.putExtra(FileChooserActivity._FilterMode, IFileProvider.FilterMode.FilesAndDirectories);
|
|
||||||
((Activity)getContext()).startActivityForResult(intent, myRegCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract String getStringValue();
|
protected abstract String getStringValue();
|
||||||
|
|
|
@ -24,8 +24,6 @@ import java.util.List;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import group.pals.android.lib.ui.filechooser.services.IFileProvider;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLStringListOption;
|
import org.geometerplus.zlibrary.core.options.ZLStringListOption;
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
import org.geometerplus.zlibrary.core.util.MiscUtil;
|
import org.geometerplus.zlibrary.core.util.MiscUtil;
|
||||||
|
@ -35,7 +33,7 @@ class FileChooserStringListPreference extends FileChooserPreference {
|
||||||
private final Runnable myOnValueSetAction;
|
private final Runnable myOnValueSetAction;
|
||||||
|
|
||||||
FileChooserStringListPreference(Context context, ZLResource rootResource, String resourceKey, ZLStringListOption option, int regCode, Runnable onValueSetAction) {
|
FileChooserStringListPreference(Context context, ZLResource rootResource, String resourceKey, ZLStringListOption option, int regCode, Runnable onValueSetAction) {
|
||||||
super(context, rootResource, resourceKey, IFileProvider.FilterMode.AnyDirectories, regCode);
|
super(context, rootResource, resourceKey, false, regCode);
|
||||||
|
|
||||||
myOption = option;
|
myOption = option;
|
||||||
myOnValueSetAction = onValueSetAction;
|
myOnValueSetAction = onValueSetAction;
|
||||||
|
|
|
@ -21,8 +21,6 @@ package org.geometerplus.android.fbreader.preferences.fileChooser;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import group.pals.android.lib.ui.filechooser.services.IFileProvider;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
import org.geometerplus.zlibrary.core.util.MiscUtil;
|
import org.geometerplus.zlibrary.core.util.MiscUtil;
|
||||||
|
@ -31,7 +29,7 @@ class FileChooserStringPreference extends FileChooserPreference {
|
||||||
private final ZLStringOption myOption;
|
private final ZLStringOption myOption;
|
||||||
|
|
||||||
FileChooserStringPreference(Context context, ZLResource rootResource, String resourceKey, ZLStringOption option, int regCode) {
|
FileChooserStringPreference(Context context, ZLResource rootResource, String resourceKey, ZLStringOption option, int regCode) {
|
||||||
super(context, rootResource, resourceKey, IFileProvider.FilterMode.DirectoriesOnly, regCode);
|
super(context, rootResource, resourceKey, true, regCode);
|
||||||
myOption = option;
|
myOption = option;
|
||||||
|
|
||||||
setSummary(getStringValue());
|
setSummary(getStringValue());
|
||||||
|
|
88
src/org/geometerplus/android/util/FileChooserUtil.java
Normal file
88
src/org/geometerplus/android/util/FileChooserUtil.java
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2007-2014 Geometer Plus <contact@geometerplus.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.geometerplus.android.util;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
import group.pals.android.lib.ui.filechooser.FileChooserActivity;
|
||||||
|
import group.pals.android.lib.ui.filechooser.services.IFileProvider;
|
||||||
|
import group.pals.android.lib.ui.filechooser.io.localfile.LocalFile;
|
||||||
|
|
||||||
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
|
||||||
|
public abstract class FileChooserUtil {
|
||||||
|
private FileChooserUtil() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void runDirectoryChooser(
|
||||||
|
Activity activity,
|
||||||
|
int requestCode,
|
||||||
|
String title,
|
||||||
|
String initinalValue,
|
||||||
|
boolean chooseWritableDirsOnly
|
||||||
|
) {
|
||||||
|
final Intent intent = new Intent(activity, FileChooserActivity.class);
|
||||||
|
intent.putExtra(FileChooserActivity._TextResources, textResources(title));
|
||||||
|
intent.putExtra(FileChooserActivity._Rootpath, (Parcelable)new LocalFile(initinalValue));
|
||||||
|
intent.putExtra(FileChooserActivity._ActionBar, true);
|
||||||
|
intent.putExtra(FileChooserActivity._SaveLastLocation, false);
|
||||||
|
intent.putExtra(FileChooserActivity._DisplayHiddenFiles, true);
|
||||||
|
intent.putExtra(
|
||||||
|
FileChooserActivity._FilterMode,
|
||||||
|
chooseWritableDirsOnly
|
||||||
|
? IFileProvider.FilterMode.DirectoriesOnly
|
||||||
|
: IFileProvider.FilterMode.AnyDirectories
|
||||||
|
);
|
||||||
|
activity.startActivityForResult(intent, requestCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String pathFromData(Intent data) {
|
||||||
|
return data.getStringExtra(FileChooserActivity._FolderPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HashMap<String,String> textResources(String title) {
|
||||||
|
final HashMap<String,String> map = new HashMap<String,String>();
|
||||||
|
|
||||||
|
map.put("title", title);
|
||||||
|
final ZLResource dialogResource = ZLResource.resource("dialog");
|
||||||
|
final ZLResource buttonResource = dialogResource.getResource("button");
|
||||||
|
map.put("ok", buttonResource.getResource("ok").getValue());
|
||||||
|
map.put("cancel", buttonResource.getResource("cancel").getValue());
|
||||||
|
final ZLResource resource = dialogResource.getResource("fileChooser");
|
||||||
|
map.put("root", resource.getResource("root").getValue());
|
||||||
|
map.put("newFolder", resource.getResource("newFolder").getValue());
|
||||||
|
map.put("folderNameHint", resource.getResource("folderNameHint").getValue());
|
||||||
|
final ZLResource menuResource = resource.getResource("menu");
|
||||||
|
map.put("menuOrigin", menuResource.getResource("origin").getValue());
|
||||||
|
map.put("menuReload", menuResource.getResource("reload").getValue());
|
||||||
|
final ZLResource sortResource = resource.getResource("sortBy");
|
||||||
|
map.put("sortBy", sortResource.getValue());
|
||||||
|
map.put("sortByName", sortResource.getResource("name").getValue());
|
||||||
|
map.put("sortBySize", sortResource.getResource("size").getValue());
|
||||||
|
map.put("sortByDate", sortResource.getResource("date").getValue());
|
||||||
|
map.put("permissionDenied", resource.getResource("permissionDenied").getValue());
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
|
@ -52,6 +52,7 @@ public abstract class Paths {
|
||||||
if ("".equals(ourTempDirectoryOption.getValue())) {
|
if ("".equals(ourTempDirectoryOption.getValue())) {
|
||||||
ourTempDirectoryOption.setValue(mainBookDirectory() + "/.FBReader");
|
ourTempDirectoryOption.setValue(mainBookDirectory() + "/.FBReader");
|
||||||
}
|
}
|
||||||
|
//ourTempDirectoryOption.setValue("/X/Y/Z");
|
||||||
return ourTempDirectoryOption;
|
return ourTempDirectoryOption;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue