Search in sources :

Example 36 with SettableFuture

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;
}
Also used : SettableFuture(org.thoughtcrime.securesms.util.concurrent.SettableFuture) TranslateAnimation(android.view.animation.TranslateAnimation) ScaleAnimation(android.view.animation.ScaleAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation)

Example 37 with SettableFuture

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;
}
Also used : SettableFuture(org.thoughtcrime.securesms.util.concurrent.SettableFuture) Bitmap(android.graphics.Bitmap) MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) GoogleMap(com.google.android.gms.maps.GoogleMap) OnMapReadyCallback(com.google.android.gms.maps.OnMapReadyCallback)

Aggregations

SettableFuture (org.thoughtcrime.securesms.util.concurrent.SettableFuture)37 Context (android.content.Context)9 Animation (android.view.animation.Animation)8 ExecutionException (java.util.concurrent.ExecutionException)8 SdpObserver (org.webrtc.SdpObserver)8 SessionDescription (org.webrtc.SessionDescription)8 ScaleAnimation (android.view.animation.ScaleAnimation)6 TranslateAnimation (android.view.animation.TranslateAnimation)6 Bitmap (android.graphics.Bitmap)4 NonNull (android.support.annotation.NonNull)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 IOException (java.io.IOException)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 DraftDatabase (org.thoughtcrime.securesms.database.DraftDatabase)4 Drafts (org.thoughtcrime.securesms.database.DraftDatabase.Drafts)4 Recipient (org.thoughtcrime.securesms.recipients.Recipient)4 SuppressLint (android.annotation.SuppressLint)3 SpannableString (android.text.SpannableString)3 List (java.util.List)3 VoiceNoteDraft (org.thoughtcrime.securesms.components.voice.VoiceNoteDraft)3