Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wade
DnsChanger
Commits
dd685b04
Commit
dd685b04
authored
Apr 11, 2018
by
Daniel Wolf
Browse files
The FileChooserDialog has to be dismissed if the import dialog is dismissed
parent
d63e5480
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/frostnerd/dnschanger/dialogs/RuleImportChooserDialog.java
View file @
dd685b04
...
...
@@ -52,6 +52,7 @@ class RuleImportChooserDialog extends UtilityDialog {
private
RadioButton
hosts
;
private
RadioButton
domains
;
private
RadioButton
adblock
;
private
FileChooserDialog
fileChooserDialog
;
<
T
extends
Activity
&
RuleImport
.
ImportStartedListener
>
RuleImportChooserDialog
(
@NonNull
final
T
context
)
{
super
(
context
,
ThemeHandler
.
getDialogTheme
(
context
));
...
...
@@ -115,6 +116,12 @@ class RuleImportChooserDialog extends UtilityDialog {
getButton
(
BUTTON_POSITIVE
).
setVisibility
(
View
.
INVISIBLE
);
}
});
setOnDismissListener
(
new
OnDismissListener
()
{
@Override
public
void
onDismiss
(
DialogInterface
dialog
)
{
if
(
fileChooserDialog
!=
null
)
fileChooserDialog
.
dismiss
();
}
});
}
@Override
...
...
@@ -127,18 +134,20 @@ class RuleImportChooserDialog extends UtilityDialog {
private
<
T
extends
Activity
&
RuleImport
.
ImportStartedListener
>
void
handlePermissionOrShowFileDialog
(
T
context
)
{
if
(
ActivityCompat
.
checkSelfPermission
(
getContext
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
F
ileChooserDialog
dialog
=
new
FileChooserDialog
(
getContext
(),
false
,
FileChooserDialog
.
SelectionMode
.
FILE
,
ThemeHandler
.
getDialogTheme
(
getContext
()));
d
ialog
.
setFileListener
(
new
FileChooserDialog
.
FileSelectedListener
()
{
f
ileChooserDialog
=
new
FileChooserDialog
(
getContext
(),
false
,
FileChooserDialog
.
SelectionMode
.
FILE
,
ThemeHandler
.
getDialogTheme
(
getContext
()));
fileChooserD
ialog
.
setFileListener
(
new
FileChooserDialog
.
FileSelectedListener
()
{
@Override
public
void
fileSelected
(
File
f
,
FileChooserDialog
.
SelectionMode
selectionMode
)
{
files
.
clear
();
if
(
tryDetectType
.
isChecked
())
detectFileTypes
(
f
);
fileChooserDialog
=
null
;
}
@Override
public
void
multipleFilesSelected
(
File
...
selected
)
{
files
.
clear
();
detectFileTypes
(
selected
);
fileChooserDialog
=
null
;
}
private
void
detectFileTypes
(
final
File
...
selectedFiles
)
{
...
...
@@ -250,9 +259,9 @@ class RuleImportChooserDialog extends UtilityDialog {
else
getButton
(
BUTTON_POSITIVE
).
setVisibility
(
View
.
VISIBLE
);
}
});
d
ialog
.
setCanSelectMultiple
(
true
);
d
ialog
.
setNavigateToLastPath
(
true
);
d
ialog
.
showDialog
();
fileChooserD
ialog
.
setCanSelectMultiple
(
true
);
fileChooserD
ialog
.
setNavigateToLastPath
(
true
);
fileChooserD
ialog
.
showDialog
();
}
else
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
ActivityCompat
.
requestPermissions
(
context
,
new
String
[]{
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
},
999
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment