package com.ikea.kompis.util;

import android.app.Dialog;
import android.content.Context;
import android.os.Parcelable;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.ikea.kompis.products.PackageListAdapter;
import com.ikea.shared.products.model.RetailItemCommChild;
import java.util.List;

public class PackageInfoPopUp
{
  private Dialog mAlertDialog;
  private ListView mPackageList;

  public PackageInfoPopUp(Context paramContext, List<RetailItemCommChild> paramList, String paramString)
  {
    init(paramContext, paramList, paramString);
  }

  private int getDialogWidth()
  {
    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    this.mAlertDialog.getWindow().getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    return localDisplayMetrics.widthPixels;
  }

  private void init(Context paramContext, List<RetailItemCommChild> paramList, String paramString)
  {
    View localView = LayoutInflater.from(paramContext).inflate(2130903108, null, false);
    ((TextView)localView.findViewById(2131624049)).setText(paramString);
    this.mPackageList = ((ListView)localView.findViewById(2131624197));
    PackageListAdapter localPackageListAdapter = new PackageListAdapter(paramContext, paramList);
    this.mPackageList.setAdapter(localPackageListAdapter);
    ((ImageView)localView.findViewById(2131624198)).setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        PackageInfoPopUp.this.mAlertDialog.dismiss();
      }
    });
    this.mAlertDialog = new Dialog(paramContext, 2131558449);
    this.mAlertDialog.setContentView(localView);
    this.mAlertDialog.setCancelable(true);
    this.mAlertDialog.setCanceledOnTouchOutside(true);
    int i = (int)UiUtil.pxFromDp(paramContext, 400.0F);
    int j = getDialogWidth();
    WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
    localLayoutParams.copyFrom(this.mAlertDialog.getWindow().getAttributes());
    if (j > i);
    for (localLayoutParams.width = i; ; localLayoutParams.width = -1)
    {
      this.mAlertDialog.getWindow().setAttributes(localLayoutParams);
      return;
    }
  }

  public Parcelable getListState()
  {
    if (this.mPackageList != null)
      return this.mPackageList.onSaveInstanceState();
    return null;
  }

  public boolean isShowing()
  {
    return this.mAlertDialog.isShowing();
  }

  public void setListState(Parcelable paramParcelable)
  {
    if (paramParcelable != null)
      this.mPackageList.onRestoreInstanceState(paramParcelable);
  }

  public void show()
  {
    if (this.mAlertDialog != null)
      this.mAlertDialog.show();
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.util.PackageInfoPopUp
 * JD-Core Version:    0.6.2
 */