Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/JAVA/Threema/app/src/main/java/ch/threema/app/ui/     Datei vom 25.3.2026 mit Größe 3 kB image not shown  

Quelle  ImagePopup.java

  Sprache: JAVA
 

package ch.threema.app.ui;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.ScaleAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;

import androidx.annotation.NonNull;
import ch.threema.app.R;
import ch.threema.app.utils.AnimationUtil;

public class ImagePopup extends DimmingPopupWindow {
    private ImageView imageView;
    private View topLayout;
    private View parentView;
    final int[] location = new int[2];

    public ImagePopup(Context context, @NonNull View parentView) {
        super(context);
        init(context, parentView, parentView.getWidth(), parentView.getHeight());
    }

    private void init(Context context, View parentView, int screenWidth, int screenHeight) {
        this.parentView = parentView;

        topLayout = LayoutInflater.from(context).inflate(R.layout.popup_image_nomargin, nulltrue);

        this.imageView = topLayout.findViewById(R.id.thumbnail_view);

        int borderSize = context.getResources().getDimensionPixelSize(R.dimen.image_popup_screen_border_width);
        setContentView(topLayout);

        if (screenHeight > screenWidth) {
            // portrait
            setWidth(screenWidth - borderSize);
            setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
        } else {
            // landscape
            setWidth(LinearLayout.LayoutParams.WRAP_CONTENT);
            setHeight(screenHeight - borderSize);
        }
        setBackgroundDrawable(new BitmapDrawable());
        setAnimationStyle(0);
        setElevation(0);
        setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
    }

    public void show(@NonNull final View sourceView, @NonNull Bitmap bitmap) {
        this.imageView.setImageBitmap(bitmap);

        showAtLocation(parentView, Gravity.CENTER, 0, 0);
        dimBackground();
        getContentView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                getContentView().getViewTreeObserver().removeOnGlobalLayoutListener(this);
                AnimationUtil.getViewCenter(sourceView, getContentView(), location);

                AnimationSet animation = new AnimationSet(true);
                Animation scale = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.ABSOLUTE, location[0], Animation.ABSOLUTE, location[1]);
                Animation fade = new AlphaAnimation(0.0f, 1.0f);

                animation.addAnimation(scale);
                animation.addAnimation(fade);
                animation.setInterpolator(new DecelerateInterpolator());
                animation.setDuration(150);

                getContentView().startAnimation(animation);
            }
        });

        topLayout.setOnClickListener(v -> dismiss());
    }

    @Override
    public void dismiss() {
        AnimationUtil.popupAnimateOut(getContentView(), ImagePopup.super::dismiss);
    }
}

Messung V0.5 in Prozent
C=95 H=96 G=95

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-04-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.