package com.ikea.kompis.extendedcontent;

import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnKeyListener;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;
import com.ikea.kompis.util.UiUtil;

public class LoadingContentDialogFragment extends DialogFragment
{
  private static LoadingContentDialogFragment mLoadingContentDialogFragment;
  private LoadingDialogEvent loadingEvent;

  public static LoadingContentDialogFragment newInstance()
  {
    if (mLoadingContentDialogFragment == null)
      mLoadingContentDialogFragment = new LoadingContentDialogFragment();
    return mLoadingContentDialogFragment;
  }

  public void dismissDilaog()
  {
    if (getDialog() != null)
      getDialog().dismiss();
  }

  public boolean isShowing()
  {
    return (getDialog() != null) && (getDialog().isShowing());
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setRetainInstance(true);
    setCancelable(false);
  }

  public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
  {
    View localView = paramLayoutInflater.inflate(2130903074, paramViewGroup, false);
    getDialog().getWindow().requestFeature(1);
    ((Button)localView.findViewById(2131624081)).setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        LoadingContentDialogFragment.this.loadingEvent.onEvent();
      }
    });
    return localView;
  }

  public void onDestroyView()
  {
    if ((getDialog() != null) && (getRetainInstance()))
      getDialog().setDismissMessage(null);
    super.onDestroyView();
  }

  public void onResume()
  {
    super.onResume();
    if (getDialog() != null)
      getDialog().setOnKeyListener(new DialogInterface.OnKeyListener()
      {
        public boolean onKey(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt, KeyEvent paramAnonymousKeyEvent)
        {
          if (paramAnonymousInt == 4)
          {
            LoadingContentDialogFragment.this.loadingEvent.onEvent();
            LoadingContentDialogFragment.this.dismiss();
            return true;
          }
          return false;
        }
      });
  }

  public void onStart()
  {
    WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
    localLayoutParams.copyFrom(getDialog().getWindow().getAttributes());
    if (UiUtil.isTablet(getActivity()))
      localLayoutParams.width = ((int)getResources().getDimension(2131362059));
    for (localLayoutParams.height = -2; ; localLayoutParams.height = -2)
    {
      getDialog().getWindow().setAttributes(localLayoutParams);
      super.onStart();
      return;
      localLayoutParams.width = -1;
    }
  }

  public void show(FragmentManager paramFragmentManager, LoadingDialogEvent paramLoadingDialogEvent)
  {
    this.loadingEvent = paramLoadingDialogEvent;
    show(paramFragmentManager, "dialog");
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.extendedcontent.LoadingContentDialogFragment
 * JD-Core Version:    0.6.2
 */