1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 17:59:33 +02:00

permissionDenied resource

This commit is contained in:
Nikolay Pultsin 2014-04-15 04:49:52 +01:00
parent 221aa49067
commit 86ecbf9e62
3 changed files with 39 additions and 42 deletions

View file

@ -306,11 +306,21 @@
<node name="Preferences"> <node name="Preferences">
<node name="directories" value="Directories"> <node name="directories" value="Directories">
<node name="summary" value="Directories to seek for files"/> <node name="summary" value="Directories to seek for files"/>
<node name="bookPath" value="Where to seek for books"/> <node name="bookPath" value="Where to seek for books">
<node name="downloadDir" value="Where to store downloaded books"/> <node name="chooserTitle" value="Books folder"/>
<node name="fontPath" value="Where to seek for fonts"/> </node>
<node name="wallpaperPath" value="Where to seek for background images"/> <node name="downloadDir" value="Where to store downloaded books">
<node name="tempDir" value="Where to store temporary files"/> <node name="chooserTitle" value="Books folder"/>
</node>
<node name="fontPath" value="Where to seek for fonts">
<node name="chooserTitle" value="Fonts folder"/>
</node>
<node name="wallpaperPath" value="Where to seek for background images">
<node name="chooserTitle" value="Images folder"/>
</node>
<node name="tempDir" value="Where to store temporary files">
<node name="chooserTitle" value="Temp files folder"/>
</node>
</node> </node>
<node name="appearance" value="Appearance"> <node name="appearance" value="Appearance">
<node name="summary" value="Display settings, status bar, button lights"/> <node name="summary" value="Display settings, status bar, button lights"/>
@ -861,20 +871,20 @@
<node name="message1" value="FBReader works in fullscreen mode by default. Tap center third of the screen to show controls. You can change this behaviour in “Appearance” section of the Settings dialog."/> <node name="message1" value="FBReader works in fullscreen mode by default. Tap center third of the screen to show controls. You can change this behaviour in “Appearance” section of the Settings dialog."/>
<node name="message2" value="Well done! Now tap the center third again to hide the controls and this hint. If you want to keep controls on the screen during reading, select “Show action bar” option in “Appearance” section of the Settings dialog."/> <node name="message2" value="Well done! Now tap the center third again to hide the controls and this hint. If you want to keep controls on the screen during reading, select “Show action bar” option in “Appearance” section of the Settings dialog."/>
</node> </node>
<node name="fileChooser" value="File chooser"> <node name="fileChooser">
<node name="root" value="Root"/> <node name="root" value="Root"/>
<node name="newFolder" value="New folder"/> <node name="newFolder" value="New folder"/>
<node name="folderName" value="Folder name"/> <node name="folderNameHint" value="Folder name"/>
<node name="chooseFolder" value="Choose a folder…"/> <node name="menu">
<node name="chooseFolders" value="Choose folders…"/> <node name="origin" value="Origin"/>
<node name="chooseFile" value="Choose a file…"/> <node name="reload" value="Reload"/>
<node name="menuHome" value="Home"/> </node>
<node name="menuReload" value="Reload"/>
<node name="sortBy" value="Sort by"> <node name="sortBy" value="Sort by">
<node name="name" value="Name"/> <node name="name" value="Name"/>
<node name="size" value="Size"/> <node name="size" value="Size"/>
<node name="date" value="Date"/> <node name="date" value="Date"/>
</node> </node>
<node name="permissionDenied" value="Permission denied"/>
</node> </node>
</node> </node>
<node name="errorMessage"> <node name="errorMessage">

View file

@ -35,35 +35,37 @@ import org.geometerplus.zlibrary.core.resources.ZLResource;
abstract class FileChooserPreference extends Preference { abstract class FileChooserPreference extends Preference {
private final int myRegCode; private final int myRegCode;
private final ZLResource myResource;
FileChooserPreference(Context context, ZLResource rootResource, String resourceKey, int regCode) { FileChooserPreference(Context context, ZLResource rootResource, String resourceKey, int regCode) {
super(context); super(context);
myRegCode = regCode; myRegCode = regCode;
myResource = rootResource.getResource(resourceKey);
setTitle(rootResource.getResource(resourceKey).getValue()); setTitle(myResource.getValue());
} }
@Override @Override
protected void onClick() { protected void onClick() {
final ZLResource resource = ZLResource.resource("dialog").getResource("fileChooser");
final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button");
final HashMap<String,String> textResources = new HashMap<String,String>(); final HashMap<String,String> textResources = new HashMap<String,String>();
textResources.put("root", resource.getResource("root").getValue()); textResources.put("title", myResource.getResource("chooserTitle").getValue());
final ZLResource dialogResource = ZLResource.resource("dialog");
final ZLResource buttonResource = dialogResource.getResource("button");
textResources.put("ok", buttonResource.getResource("ok").getValue()); textResources.put("ok", buttonResource.getResource("ok").getValue());
textResources.put("cancel", buttonResource.getResource("cancel").getValue()); textResources.put("cancel", buttonResource.getResource("cancel").getValue());
final ZLResource resource = dialogResource.getResource("fileChooser");
textResources.put("root", resource.getResource("root").getValue());
textResources.put("newFolder", resource.getResource("newFolder").getValue()); textResources.put("newFolder", resource.getResource("newFolder").getValue());
textResources.put("folderName", resource.getResource("folderName").getValue()); textResources.put("folderNameHint", resource.getResource("folderNameHint").getValue());
textResources.put("chooseFolder", resource.getResource("chooseFolder").getValue()); final ZLResource menuResource = resource.getResource("menu");
textResources.put("chooseFolders", resource.getResource("chooseFolders").getValue()); textResources.put("menuOrigin", menuResource.getResource("origin").getValue());
textResources.put("chooseFile", resource.getResource("chooseFile").getValue()); textResources.put("menuReload", menuResource.getResource("reload").getValue());
final ZLResource sortResource = resource.getResource("sortBy"); final ZLResource sortResource = resource.getResource("sortBy");
textResources.put("sortBy", sortResource.getValue()); textResources.put("sortBy", sortResource.getValue());
textResources.put("sortByName", sortResource.getResource("name").getValue()); textResources.put("sortByName", sortResource.getResource("name").getValue());
textResources.put("sortBySize", sortResource.getResource("size").getValue()); textResources.put("sortBySize", sortResource.getResource("size").getValue());
textResources.put("sortByDate", sortResource.getResource("date").getValue()); textResources.put("sortByDate", sortResource.getResource("date").getValue());
textResources.put("menuHome", resource.getResource("menuHome").getValue()); textResources.put("permissionDenied", resource.getResource("permissionDenied").getValue());
textResources.put("menuReload", resource.getResource("menuReload").getValue());
final Intent intent = new Intent(getContext(), FileChooserActivity.class); final Intent intent = new Intent(getContext(), FileChooserActivity.class);
intent.putExtra(FileChooserActivity._TextResources, textResources); intent.putExtra(FileChooserActivity._TextResources, textResources);

View file

@ -404,7 +404,7 @@ public class FileChooserActivity extends Activity {
inflater.inflate(R.menu.afc_file_chooser_activity, menu); inflater.inflate(R.menu.afc_file_chooser_activity, menu);
MenuItem item = menu.findItem(R.id.afc_filechooser_activity_menuitem_home); MenuItem item = menu.findItem(R.id.afc_filechooser_activity_menuitem_home);
if(item != null) if(item != null)
item.setTitle(mTextResources.get("menuHome")); item.setTitle(mTextResources.get("menuOrigin"));
item = menu.findItem(R.id.afc_filechooser_activity_menuitem_reload); item = menu.findItem(R.id.afc_filechooser_activity_menuitem_reload);
if(item != null) if(item != null)
item.setTitle(mTextResources.get("menuReload")); item.setTitle(mTextResources.get("menuReload"));
@ -658,22 +658,7 @@ public class FileChooserActivity extends Activity {
* - button go forward; * - button go forward;
*/ */
private void setupHeader() { private void setupHeader() {
if (mIsSaveDialog) { setTitle(mTextResources.get("title"));
setTitle(R.string.afc_title_save_as);
} else {
switch (mFileProvider.getFilterMode()) {
case FilesOnly:
setTitle(R.string.afc_title_choose_files);
break;
case FilesAndDirectories:
setTitle(R.string.afc_title_choose_files_and_directories);
break;
case DirectoriesOnly:
//setTitle(R.string.afc_title_choose_directories);
setTitle(mTextResources.get("chooseFolder"));
break;
}
}// title of activity
mViewSort.setOnClickListener(mBtnSortOnClickListener); mViewSort.setOnClickListener(mBtnSortOnClickListener);
if(DisplayPrefs.isSortAscending(this)){ if(DisplayPrefs.isSortAscending(this)){
@ -1020,7 +1005,7 @@ public class FileChooserActivity extends Activity {
View view = getLayoutInflater().inflate(R.layout.afc_simple_text_input_view, null); View view = getLayoutInflater().inflate(R.layout.afc_simple_text_input_view, null);
final EditText _textFile = (EditText) view.findViewById(R.id.afc_simple_text_input_view_text1); final EditText _textFile = (EditText) view.findViewById(R.id.afc_simple_text_input_view_text1);
_textFile.setHint(mTextResources.get("folderName")); _textFile.setHint(mTextResources.get("folderNameHint"));
_textFile.setOnEditorActionListener(new TextView.OnEditorActionListener() { _textFile.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override @Override
@ -1335,7 +1320,7 @@ public class FileChooserActivity extends Activity {
super.onPostExecute(result); super.onPostExecute(result);
if (files == null) { if (files == null) {
Dlg.toast(FileChooserActivity.this, getString(R.string.afc_pmsg_cannot_access_dir, path.getName()), Dlg.toast(FileChooserActivity.this, mTextResources.get("permissionDenied"),
Dlg._LengthShort); Dlg._LengthShort);
if (listener != null) if (listener != null)
listener.onFinish(false, path); listener.onFinish(false, path);