mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-23 04:33:54 -04:00
Bug fix: Add Note Dialog
Prevent 'Add Note Dialog' from opening if no zim file is currently open
This commit is contained in:
parent
9c1d36657a
commit
76d20d1271
@ -70,6 +70,7 @@ public class AddNoteDialog extends DialogFragment implements ConfirmationAlertDi
|
|||||||
|
|
||||||
private Unbinder unbinder;
|
private Unbinder unbinder;
|
||||||
|
|
||||||
|
private String zimFileName;
|
||||||
private String zimFileTitle;
|
private String zimFileTitle;
|
||||||
private String articleTitle;
|
private String articleTitle;
|
||||||
private String zimNoteDirectoryName; // Corresponds to "ZimFileName" of "{External Storage}/Kiwix/Notes/ZimFileName/ArticleUrl.txt"
|
private String zimNoteDirectoryName; // Corresponds to "ZimFileName" of "{External Storage}/Kiwix/Notes/ZimFileName/ArticleUrl.txt"
|
||||||
@ -89,6 +90,9 @@ public class AddNoteDialog extends DialogFragment implements ConfirmationAlertDi
|
|||||||
|
|
||||||
setStyle(DialogFragment.STYLE_NORMAL, sharedPreferenceUtil.nightMode() ? R.style.AddNoteDialogStyle_Night : R.style.AddNoteDialogStyle);
|
setStyle(DialogFragment.STYLE_NORMAL, sharedPreferenceUtil.nightMode() ? R.style.AddNoteDialogStyle_Night : R.style.AddNoteDialogStyle);
|
||||||
|
|
||||||
|
zimFileName = ZimContentProvider.getZimFile(); // Returns name of the form ".../Kiwix/granbluefantasy_en_all_all_nopic_2018-10.zim"
|
||||||
|
|
||||||
|
if(zimFileName != null) { // No zim file currently opened
|
||||||
zimFileTitle = ZimContentProvider.getZimFileTitle();
|
zimFileTitle = ZimContentProvider.getZimFileTitle();
|
||||||
articleTitle = ((MainActivity)getActivity()).getCurrentWebView().getTitle();
|
articleTitle = ((MainActivity)getActivity()).getCurrentWebView().getTitle();
|
||||||
|
|
||||||
@ -96,6 +100,12 @@ public class AddNoteDialog extends DialogFragment implements ConfirmationAlertDi
|
|||||||
articleNotefileName = getArticleNotefileName();
|
articleNotefileName = getArticleNotefileName();
|
||||||
|
|
||||||
ZIM_NOTES_DIRECTORY = NOTES_DIRECTORY + zimNoteDirectoryName + "/";
|
ZIM_NOTES_DIRECTORY = NOTES_DIRECTORY + zimNoteDirectoryName + "/";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
showToast(R.string.error_filenotfound, Toast.LENGTH_LONG);
|
||||||
|
closeKeyboard();
|
||||||
|
getFragmentManager().beginTransaction().remove(AddNoteDialog.this).commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -159,7 +169,7 @@ public class AddNoteDialog extends DialogFragment implements ConfirmationAlertDi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private @NonNull String getZimNoteDirectoryName() {
|
private @NonNull String getZimNoteDirectoryName() {
|
||||||
String zimFileName = ZimContentProvider.getZimFile(); // Returns name of the form ".../Kiwix/granbluefantasy_en_all_all_nopic_2018-10.zim"
|
/*String zimFileName = ZimContentProvider.getZimFile(); // Returns name of the form ".../Kiwix/granbluefantasy_en_all_all_nopic_2018-10.zim"*/
|
||||||
|
|
||||||
String noteDirectoryName = getTextAfterLastSlashWithoutExtension(zimFileName);
|
String noteDirectoryName = getTextAfterLastSlashWithoutExtension(zimFileName);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user