diff --git a/LifxAppEclipse/.classpath b/LifxAppEclipse/.classpath index 6818a28..bbb60df 100644 --- a/LifxAppEclipse/.classpath +++ b/LifxAppEclipse/.classpath @@ -15,7 +15,7 @@ - + diff --git a/LifxTools/app/build.gradle b/LifxTools/app/build.gradle index af7f439..89eaeff 100644 --- a/LifxTools/app/build.gradle +++ b/LifxTools/app/build.gradle @@ -30,7 +30,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'com.google.android.material:material:1.4.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.1' implementation 'androidx.navigation:navigation-fragment:2.3.5' implementation 'androidx.navigation:navigation-ui:2.3.5' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' diff --git a/LifxTools/app/src/main/java/de/jeisfeld/lifx/app/view/PickedImageDialogFragment.java b/LifxTools/app/src/main/java/de/jeisfeld/lifx/app/view/PickedImageDialogFragment.java index 601a1d2..84fc9a1 100644 --- a/LifxTools/app/src/main/java/de/jeisfeld/lifx/app/view/PickedImageDialogFragment.java +++ b/LifxTools/app/src/main/java/de/jeisfeld/lifx/app/view/PickedImageDialogFragment.java @@ -46,13 +46,17 @@ public class PickedImageDialogFragment extends DialogFragment { * The overhead size taken when prescaling the image before setting contrast and saturation. */ private static final int PRESCALE_OVERHEAD_FACTOR = 4; + /** + * Flag indicating if ok has been pressed. + */ + private boolean isOkPressed = false; /** * Display a dialog for handling a picked image for a tile chain. * * @param activity the current activity - * @param model the light model. - * @param bitmap the picked image. + * @param model the light model. + * @param bitmap the picked image. * @param listener The listener waiting for the response */ public static void displayPickedImageDialog(final FragmentActivity activity, @@ -204,13 +208,14 @@ public final Dialog onCreateDialog(final Bundle savedInstanceState) { builder.setTitle(R.string.title_dialog_image) .setView(view) // .setNegativeButton(R.string.button_cancel, (dialog, id) -> { - // Send the positive button event back to the host activity + // Send the negative button event back to the host activity if (mListener != null && mListener.getValue() != null) { mListener.getValue().onDialogNegativeClick(PickedImageDialogFragment.this); } }) // .setPositiveButton(R.string.button_ok, (dialog, id) -> { - // Send the negative button event back to the host activity + // Send the positive button event back to the host activity + isOkPressed = true; if (mListener != null && mListener.getValue() != null) { mListener.getValue().onDialogPositiveClick(PickedImageDialogFragment.this, mCurrentColors); } @@ -229,8 +234,7 @@ public final void onCancel(@Nonnull final DialogInterface dialogInterface) { @Override public final void onPause() { super.onPause(); - // this dialog does not support onPause as it has serialization issues in colors. - if (mListener != null && mListener.getValue() != null) { + if (mListener != null && mListener.getValue() != null && !isOkPressed) { mListener.getValue().onDialogNegativeClick(PickedImageDialogFragment.this); } dismiss();