mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 09:17:44 +00:00
Fixed crash when ScribbleView failed to save.
Previously, if an operation failed, we set the result to "null". However, this was a mistake. Setting the result at all assumes success. Instead, we need to set an exception so the ListenableFuture knows that the operation failed.
This commit is contained in:
parent
e65cd2636b
commit
542e962be9
@ -584,6 +584,9 @@
|
|||||||
<string name="RingtonePreference_add_ringtone_text">Add ringtone</string>
|
<string name="RingtonePreference_add_ringtone_text">Add ringtone</string>
|
||||||
<string name="RingtonePreference_unable_to_add_ringtone">Unable to add custom ringtone</string>
|
<string name="RingtonePreference_unable_to_add_ringtone">Unable to add custom ringtone</string>
|
||||||
|
|
||||||
|
<!-- ScribbleActivity -->
|
||||||
|
<string name="ScribbleActivity_save_failure">Failed to save image changes</string>
|
||||||
|
|
||||||
<!-- Search -->
|
<!-- Search -->
|
||||||
<string name="SearchFragment_begin_searching">Begin typing to search for conversations, messages, and contacts.</string>
|
<string name="SearchFragment_begin_searching">Begin typing to search for conversations, messages, and contacts.</string>
|
||||||
<string name="SearchFragment_no_results">No results found for \'%s\'</string>
|
<string name="SearchFragment_no_results">No results found for \'%s\'</string>
|
||||||
|
@ -14,6 +14,7 @@ import android.support.annotation.NonNull;
|
|||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity;
|
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity;
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
@ -242,6 +243,8 @@ public class ScribbleActivity extends PassphraseRequiredActionBarActivity implem
|
|||||||
@Override
|
@Override
|
||||||
public void onFailure(ExecutionException e) {
|
public void onFailure(ExecutionException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
|
Toast.makeText(ScribbleActivity.this, R.string.ScribbleActivity_save_failure, Toast.LENGTH_SHORT).show();
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class ScribbleView extends FrameLayout {
|
|||||||
final boolean isLowMemory = Util.isLowMemory(context);
|
final boolean isLowMemory = Util.isLowMemory(context);
|
||||||
|
|
||||||
if (imageUri == null) {
|
if (imageUri == null) {
|
||||||
future.set(null);
|
future.setException(new IllegalStateException("No image URI."));
|
||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ public class ScribbleView extends FrameLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||||
future.set(null);
|
future.setException(new Throwable("Failed to load image."));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user