Skip to content

Commit

Permalink
resources: more stability (fixes open-learning-exchange#2805) (open-l…
Browse files Browse the repository at this point in the history
  • Loading branch information
Okuro3499 and dogi authored Dec 5, 2023
1 parent 65ae47b commit 954abfb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 21
targetSdkVersion 34
versionCode 1182
versionName "0.11.82"
versionCode 1183
versionName "0.11.83"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,17 @@ protected void showDownloadDialog(final List<RealmMyLibrary> db_myLibrary) {
@Override
public void isAvailable() {
if (!db_myLibrary.isEmpty()) {
LayoutInflater inflater = getLayoutInflater();
convertView = inflater.inflate(R.layout.my_library_alertdialog, null);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
alertDialogBuilder.setView(convertView).setTitle(R.string.download_suggestion);
alertDialogBuilder.setPositiveButton(R.string.download_selected, (dialogInterface, i) -> startDownload(DownloadUtils.downloadFiles(db_myLibrary, lv.getSelectedItemsList(), settings))).setNeutralButton(R.string.download_all, (dialogInterface, i) -> startDownload(DownloadUtils.downloadAllFiles(db_myLibrary, settings))).setNegativeButton(R.string.txt_cancel, null);
AlertDialog alertDialog = alertDialogBuilder.create();
createListView(db_myLibrary, alertDialog);
alertDialog.show();
(alertDialog).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(lv.getSelectedItemsList().size() > 0);
if (isAdded() && getActivity() != null) {
LayoutInflater inflater = getActivity().getLayoutInflater();
convertView = inflater.inflate(R.layout.my_library_alertdialog, null);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
alertDialogBuilder.setView(convertView).setTitle(R.string.download_suggestion);
alertDialogBuilder.setPositiveButton(R.string.download_selected, (dialogInterface, i) -> startDownload(DownloadUtils.downloadFiles(db_myLibrary, lv.getSelectedItemsList(), settings))).setNeutralButton(R.string.download_all, (dialogInterface, i) -> startDownload(DownloadUtils.downloadAllFiles(db_myLibrary, settings))).setNegativeButton(R.string.txt_cancel, null);
AlertDialog alertDialog = alertDialogBuilder.create();
createListView(db_myLibrary, alertDialog);
alertDialog.show();
(alertDialog).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(lv.getSelectedItemsList().size() > 0);
}
} else {
Utilities.toast(requireContext(), getString(R.string.no_resources_to_download));
}
Expand Down

0 comments on commit 954abfb

Please sign in to comment.