Do not set download button state when cancelling download (#731)

This commit is contained in:
H. Lehmann 2020-04-25 11:03:58 +02:00 committed by GitHub
parent 937008a4bd
commit a16cf771ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 23 deletions

View File

@ -87,6 +87,11 @@ android {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
ext {

View File

@ -269,13 +269,8 @@ public class MusicVideoInfoFragment extends AbstractInfoFragment
callbackHandler);
}
})
.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Nothing to do
}
})
.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel())
.show();
} else {
FileDownloadHelper.downloadFiles(getActivity(), getHostInfo(),

View File

@ -94,12 +94,6 @@ public class MovieInfoFragment extends AbstractInfoFragment
setOnDownloadListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DialogInterface.OnClickListener noopClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) { }
};
// Check if the directory exists and whether to overwrite it
File file = new File(movieDownloadInfo.getAbsoluteFilePath());
if (file.exists()) {
@ -124,7 +118,7 @@ public class MovieInfoFragment extends AbstractInfoFragment
callbackHandler);
}
})
.setNegativeButton(android.R.string.cancel, noopClickListener)
.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel())
.show();
} else {
// Confirm that the user really wants to download the file
@ -140,7 +134,8 @@ public class MovieInfoFragment extends AbstractInfoFragment
callbackHandler);
}
})
.setNegativeButton(android.R.string.cancel, noopClickListener)
.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel())
.setOnCancelListener(dialog -> setDownloadButtonState(false))
.show();
}

View File

@ -244,12 +244,6 @@ public class TVShowEpisodeInfoFragment extends AbstractInfoFragment
}
private void downloadEpisode() {
DialogInterface.OnClickListener noopClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) { }
};
// Check if the directory exists and whether to overwrite it
File file = new File(fileDownloadHelper.getAbsoluteFilePath());
if (file.exists()) {
@ -274,7 +268,7 @@ public class TVShowEpisodeInfoFragment extends AbstractInfoFragment
callbackHandler);
}
})
.setNegativeButton(android.R.string.cancel, noopClickListener)
.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel())
.show();
} else {
// Confirm that the user really wants to download the file
@ -290,7 +284,8 @@ public class TVShowEpisodeInfoFragment extends AbstractInfoFragment
callbackHandler);
}
})
.setNegativeButton(android.R.string.cancel, noopClickListener)
.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel())
.setOnCancelListener(dialog -> setDownloadButtonState(false))
.show();
}
}