package ඓ.ᨨ.K.ඓ.㸾.㸾;

import android.content.Context;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.View;
import android.widget.AdapterView;
import android.widget.CursorAdapter;
import android.widget.TextView;
import com.zhihu.matisse.R$attr;
import com.zhihu.matisse.R$dimen;
import com.zhihu.matisse.internal.entity.Album;
import ῲ.ῲ.㴹.C1995;

/* renamed from: ඓ.ᨨ.K.ඓ.㸾.㸾.K  reason: contains not printable characters */
/* compiled from: AlbumsSpinner */
public class C0801 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public C1995 f4000;

    /* renamed from: ῲ  reason: contains not printable characters */
    public TextView f4001;

    /* renamed from: K  reason: contains not printable characters */
    public CursorAdapter f4002;

    /* renamed from: 㸾  reason: contains not printable characters */
    public AdapterView.OnItemSelectedListener f4003;

    /* renamed from: ඓ.ᨨ.K.ඓ.㸾.㸾.K$ῲ  reason: contains not printable characters */
    /* compiled from: AlbumsSpinner */
    public class View$OnClickListenerC0802 implements View.OnClickListener {
        public View$OnClickListenerC0802() {
        }

        public void onClick(View view) {
            int i;
            int dimensionPixelSize = view.getResources().getDimensionPixelSize(R$dimen.album_item_height);
            C0801 k = C0801.this;
            C1995 r1 = k.f4000;
            if (k.f4002.getCount() > 6) {
                i = dimensionPixelSize * 6;
            } else {
                i = dimensionPixelSize * C0801.this.f4002.getCount();
            }
            r1.m5173(i);
            C0801.this.f4000.show();
        }
    }

    /* renamed from: ඓ.ᨨ.K.ඓ.㸾.㸾.K$K  reason: contains not printable characters */
    /* compiled from: AlbumsSpinner */
    public class C0803 implements AdapterView.OnItemClickListener {
        public C0803() {
        }

        @Override // android.widget.AdapterView.OnItemClickListener
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
            C0801.this.m2388(adapterView.getContext(), i);
            AdapterView.OnItemSelectedListener onItemSelectedListener = C0801.this.f4003;
            if (onItemSelectedListener != null) {
                onItemSelectedListener.onItemSelected(adapterView, view, i, j);
            }
        }
    }

    public C0801(Context context) {
        this.f4000 = new C1995(context, null, R$attr.listPopupWindowStyle, 0);
        this.f4000.m5179(true);
        float f = context.getResources().getDisplayMetrics().density;
        this.f4000.m5163((int) (216.0f * f));
        this.f4000.m5176((int) (16.0f * f));
        this.f4000.m5169((int) (f * -48.0f));
        this.f4000.setOnItemClickListener(new C0803());
    }

    public void setOnItemSelectedListener(AdapterView.OnItemSelectedListener onItemSelectedListener) {
        this.f4003 = onItemSelectedListener;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m2387(Context context, int i) {
        this.f4000.m5184(i);
        m2388(context, i);
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m2388(Context context, int i) {
        this.f4000.dismiss();
        Cursor cursor = this.f4002.getCursor();
        cursor.moveToPosition(i);
        String r4 = Album.m1903(cursor).m1907(context);
        if (this.f4001.getVisibility() == 0) {
            this.f4001.setText(r4);
            return;
        }
        int i2 = Build.VERSION.SDK_INT;
        this.f4001.setAlpha(0.0f);
        this.f4001.setVisibility(0);
        this.f4001.setText(r4);
        this.f4001.animate().alpha(1.0f).setDuration((long) context.getResources().getInteger(17694722)).start();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m2390(CursorAdapter cursorAdapter) {
        this.f4000.m5178(cursorAdapter);
        this.f4002 = cursorAdapter;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m2391(TextView textView) {
        this.f4001 = textView;
        Drawable drawable = this.f4001.getCompoundDrawables()[2];
        TypedArray obtainStyledAttributes = this.f4001.getContext().getTheme().obtainStyledAttributes(new int[]{R$attr.album_element_color});
        int color = obtainStyledAttributes.getColor(0, 0);
        obtainStyledAttributes.recycle();
        drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
        this.f4001.setVisibility(8);
        this.f4001.setOnClickListener(new View$OnClickListenerC0802());
        TextView textView2 = this.f4001;
        textView2.setOnTouchListener(this.f4000.m5174(textView2));
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m2389(View view) {
        this.f4000.m5170(view);
    }
}
