use of org.thoughtcrime.securesms.util.concurrent.SettableFuture in project Signal-Android by WhisperSystems.
the class VerificationPinKeyboard method displayFailure.
public ListenableFuture<Boolean> displayFailure() {
SettableFuture<Boolean> result = new SettableFuture<>();
this.keyboardView.setVisibility(View.INVISIBLE);
this.progressBar.setVisibility(View.GONE);
this.failureView.setVisibility(View.GONE);
this.lockedView.setVisibility(View.GONE);
this.failureView.getBackground().setColorFilter(getResources().getColor(R.color.red_500), PorterDuff.Mode.SRC_IN);
this.failureView.setVisibility(View.VISIBLE);
TranslateAnimation shake = new TranslateAnimation(0, 30, 0, 0);
shake.setDuration(50);
shake.setRepeatCount(7);
shake.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
result.set(true);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
this.failureView.startAnimation(shake);
return result;
}
use of org.thoughtcrime.securesms.util.concurrent.SettableFuture in project Signal-Android by WhisperSystems.
the class SignalMapView method display.
public ListenableFuture<Bitmap> display(final SignalPlace place) {
final SettableFuture<Bitmap> future = new SettableFuture<>();
this.mapView.onCreate(null);
this.mapView.onResume();
this.mapView.setVisibility(View.VISIBLE);
this.imageView.setVisibility(View.GONE);
this.mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final GoogleMap googleMap) {
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(place.getLatLong(), 13));
googleMap.addMarker(new MarkerOptions().position(place.getLatLong()));
googleMap.setBuildingsEnabled(true);
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
googleMap.getUiSettings().setAllGesturesEnabled(false);
googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
@Override
public void onMapLoaded() {
googleMap.snapshot(new GoogleMap.SnapshotReadyCallback() {
@Override
public void onSnapshotReady(Bitmap bitmap) {
future.set(bitmap);
imageView.setImageBitmap(bitmap);
imageView.setVisibility(View.VISIBLE);
mapView.setVisibility(View.GONE);
mapView.onPause();
mapView.onDestroy();
}
});
}
});
}
});
this.textView.setText(place.getDescription());
return future;
}
Aggregations