package com.ikea.kompis.view;

import android.content.Context;
import android.content.res.Resources;
import android.text.Html;
import android.text.Spannable.Factory;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.StyleSpan;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.ikea.kompis.TypeFaceProvider;
import com.ikea.kompis.stores.event.InStoreMapClickedEvent;
import com.ikea.kompis.util.DateUtil;
import com.ikea.kompis.util.UiUtil;
import com.ikea.shared.AppConfigData;
import com.ikea.shared.AppConfigManager;
import com.ikea.shared.analytics.UsageTracker;
import com.ikea.shared.campaign.model.Link;
import com.ikea.shared.campaign.model.LinkList;
import com.ikea.shared.cart.ShoppingCart;
import com.ikea.shared.config.model.Country;
import com.ikea.shared.notification.StoreOpenInfo;
import com.ikea.shared.store.service.StoreCache;
import com.ikea.shared.store.service.StoreCacheInfo;
import com.ikea.shared.stores.model.CalenderEntry;
import com.ikea.shared.stores.model.CalenderEntryList;
import com.ikea.shared.stores.model.DateRangeFilter;
import com.ikea.shared.stores.model.DateRangeFilterId;
import com.ikea.shared.stores.model.DateRangeFilterList;
import com.ikea.shared.stores.model.HourRangeFilter;
import com.ikea.shared.stores.model.HourRangeFilterList;
import com.ikea.shared.stores.model.OpeningHours;
import com.ikea.shared.stores.model.OpeningHoursList;
import com.ikea.shared.stores.model.Paragraph;
import com.ikea.shared.stores.model.ParagraphList;
import com.ikea.shared.stores.model.Store;
import com.ikea.shared.stores.model.StoreAddress;
import com.ikea.shared.stores.model.StoreClosedFilterList;
import com.ikea.shared.stores.model.StoreContactInfo;
import com.ikea.shared.stores.model.StoreContactMethod;
import com.ikea.shared.stores.model.StoreContactMethodList;
import com.ikea.shared.stores.model.StoreInformation;
import com.ikea.shared.stores.model.StoreOpeningHours;
import com.ikea.shared.stores.model.StoreRef;
import com.ikea.shared.stores.model.StoreSectionOpeningHours;
import com.ikea.shared.stores.model.StoreSectionOpeningHoursList;
import com.ikea.shared.stores.model.WeekDayFilter;
import com.ikea.shared.stores.model.WeekDayFilterList;
import com.ikea.shared.user.event.FavStoreChangeEvent;
import com.ikea.shared.util.Constant;
import com.ikea.shared.util.L;
import com.ikea.shared.util.NetworkUtil;
import com.ikea.shared.util.Util;
import com.squareup.otto.Bus;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
import java.util.UnknownFormatConversionException;

public class StoreDetailsLayout extends LinearLayout
{
  private Context mCtx;
  private LayoutInflater mInflater;
  private LinearLayout storeOpeningLayout;

  public StoreDetailsLayout(Context paramContext)
  {
    super(paramContext);
    init(paramContext);
  }

  public StoreDetailsLayout(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
    init(paramContext);
  }

  public StoreDetailsLayout(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
    init(paramContext);
  }

  private void addStoreOpeningView(String paramString1, String paramString2, String paramString3, String paramString4, int paramInt1, int paramInt2, String paramString5, List<DateRangeFilterId> paramList, List<DateRangeFilter> paramList1, ViewGroup paramViewGroup, LinearLayout.LayoutParams paramLayoutParams)
  {
    if ((paramString1 != null) && (paramString2 != null) && (paramString1.equals(paramString2)));
    for (String str = paramString1; (paramList != null) && (!paramList.isEmpty()) && (paramList1 != null) && (!paramList1.isEmpty()); str = paramString1 + " - " + paramString2)
    {
      Iterator localIterator1 = paramList.iterator();
      while (true)
      {
        if (!localIterator1.hasNext())
          return;
        DateRangeFilterId localDateRangeFilterId = (DateRangeFilterId)localIterator1.next();
        Iterator localIterator2 = paramList1.iterator();
        if (localIterator2.hasNext())
        {
          DateRangeFilter localDateRangeFilter = (DateRangeFilter)localIterator2.next();
          if (!localDateRangeFilterId.getDateRangeFilterId().equalsIgnoreCase(localDateRangeFilter.getDateRangeFilterId()))
            break;
          View localView2 = this.mInflater.inflate(2130903156, paramViewGroup, false);
          ((TextView)localView2.findViewById(2131624474)).setText(localDateRangeFilter.getDateRangeFilterDescription());
          ((TextView)localView2.findViewById(2131624475)).setText(paramString5);
          paramViewGroup.addView(localView2, paramLayoutParams);
        }
      }
    }
    View localView1 = this.mInflater.inflate(2130903156, paramViewGroup, false);
    ((TextView)localView1.findViewById(2131624474)).setText(str);
    ((TextView)localView1.findViewById(2131624475)).setText(paramString5);
    paramViewGroup.addView(localView1, paramLayoutParams);
  }

  private int getWeekDay(String paramString)
  {
    try
    {
      int i = Integer.parseInt(paramString);
      return i;
    }
    catch (NumberFormatException localNumberFormatException)
    {
      L.I("Exception :: " + localNumberFormatException);
      return 0;
    }
    catch (Exception localException)
    {
      L.I("Exception :: " + localException);
    }
    return 0;
  }

  private void init(Context paramContext)
  {
    this.mCtx = paramContext;
    this.mInflater = ((LayoutInflater)paramContext.getSystemService("layout_inflater"));
  }

  private boolean isOpeningHourExist(StoreSectionOpeningHours paramStoreSectionOpeningHours)
  {
    boolean bool1 = false;
    List localList1;
    if (paramStoreSectionOpeningHours != null)
    {
      CalenderEntryList localCalenderEntryList = paramStoreSectionOpeningHours.getCalenderEntryList();
      bool1 = false;
      if (localCalenderEntryList != null)
      {
        localList1 = paramStoreSectionOpeningHours.getCalenderEntryList().getCalenderEntry();
        bool1 = false;
        if (localList1 != null)
        {
          boolean bool2 = localList1.isEmpty();
          bool1 = false;
          if (bool2);
        }
      }
    }
    for (int i = 0; ; i++)
    {
      int j = localList1.size();
      bool1 = false;
      List localList2;
      if (i < j)
      {
        localList2 = ((CalenderEntry)localList1.get(i)).getOpeningHoursList().getOpeningHours();
        if ((localList2 == null) || (localList2.isEmpty()));
      }
      else
      {
        for (int k = 0; k < localList2.size(); k++)
          if ((((OpeningHours)localList2.get(k)).getWeekDayFilterList() != null) && (((OpeningHours)localList2.get(k)).getWeekDayFilterList().getWeekDayFilter() != null) && (((OpeningHours)localList2.get(0)).getHourRangeFilterList() != null) && (((OpeningHours)localList2.get(k)).getHourRangeFilterList().getHourRangeFilter() != null) && (((OpeningHours)localList2.get(k)).getHourRangeFilterList().getHourRangeFilter().size() > 0))
          {
            bool1 = true;
            return bool1;
          }
      }
    }
  }

  private void updateContactDetails(Store paramStore, View.OnClickListener paramOnClickListener)
  {
    LinearLayout localLinearLayout = (LinearLayout)findViewById(2131624463);
    StoreContactInfo localStoreContactInfo1 = paramStore.getStoreContactInfo();
    List localList1 = null;
    if (localStoreContactInfo1 != null)
    {
      StoreContactMethodList localStoreContactMethodList = paramStore.getStoreContactInfo().getStoreContactMethodList();
      localList1 = null;
      if (localStoreContactMethodList != null)
        localList1 = paramStore.getStoreContactInfo().getStoreContactMethodList().getStoreContactMethod();
    }
    LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, -2);
    localLayoutParams.bottomMargin = ((int)getResources().getDimension(2131362090));
    if ((localList1 != null) && (!localList1.isEmpty()))
    {
      int j = 0;
      if (j < localList1.size())
      {
        View localView2 = this.mInflater.inflate(2130903151, localLinearLayout, false);
        ((TextView)localView2.findViewById(2131624439)).setText(((StoreContactMethod)localList1.get(j)).getStoreContactMethodText());
        TextView localTextView2 = (TextView)localView2.findViewById(2131624440);
        ImageView localImageView = (ImageView)localView2.findViewById(2131624441);
        if (((StoreContactMethod)localList1.get(j)).getStoreContactMethodType().equalsIgnoreCase("PHONE"))
          localTextView2.setText(((StoreContactMethod)localList1.get(j)).getPhoneNo());
        while (true)
        {
          localImageView.setTag(localList1.get(j));
          localTextView2.setTag(localList1.get(j));
          localImageView.setOnClickListener(paramOnClickListener);
          localTextView2.setOnClickListener(paramOnClickListener);
          if ((localTextView2.getText() != null) && (!localTextView2.getText().equals("")))
            localLinearLayout.addView(localView2, localLayoutParams);
          j++;
          break;
          if (((StoreContactMethod)localList1.get(j)).getStoreContactMethodType().equalsIgnoreCase("EMAIL"))
          {
            localTextView2.setText(((StoreContactMethod)localList1.get(j)).getEmail());
            localImageView.setImageDrawable(getResources().getDrawable(2130837647));
          }
          else if (((StoreContactMethod)localList1.get(j)).getStoreContactMethodType().equalsIgnoreCase("FAX"))
          {
            localTextView2.setText(((StoreContactMethod)localList1.get(j)).getFax());
          }
        }
      }
    }
    StoreContactInfo localStoreContactInfo2 = paramStore.getStoreContactInfo();
    List localList2 = null;
    if (localStoreContactInfo2 != null)
    {
      ParagraphList localParagraphList = paramStore.getStoreContactInfo().getParagraphList();
      localList2 = null;
      if (localParagraphList != null)
        localList2 = paramStore.getStoreContactInfo().getParagraphList().getParagraph();
    }
    if ((localList2 != null) && (!localList2.isEmpty()))
    {
      TextView localTextView1 = new TextView(this.mCtx);
      localTextView1.setTextSize(2, 12.0F);
      localTextView1.setTextColor(getResources().getColor(2131492915));
      localTextView1.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
      localTextView1.setTypeface(TypeFaceProvider.getTypeFace(this.mCtx, "verdana"));
      localTextView1.setClickable(true);
      localTextView1.setMovementMethod(LinkMovementMethod.getInstance());
      String str1 = "";
      Iterator localIterator1 = localList2.iterator();
      while (localIterator1.hasNext())
      {
        Paragraph localParagraph = (Paragraph)localIterator1.next();
        str1 = str1 + localParagraph.getParagraphText().trim() + "<br><br>";
      }
      if ((paramStore.getStoreContactInfo() != null) && (paramStore.getStoreContactInfo().getLinkList() != null) && (paramStore.getStoreContactInfo().getLinkList().getLink() != null) && (!paramStore.getStoreContactInfo().getLinkList().getLink().isEmpty()))
      {
        List localList3 = paramStore.getStoreContactInfo().getLinkList().getLink();
        int i = 1;
        str1 = str1.replace("{0}", "");
        Iterator localIterator2 = localList3.iterator();
        while (localIterator2.hasNext())
        {
          Link localLink = (Link)localIterator2.next();
          String str2 = "{" + i + "}";
          if ((str1.contains(str2)) && (localLink.getLinkName() != null) && (localLink.getLinkUrl() != null))
          {
            String str3 = "{" + i + "}";
            String str4 = "<a  href=\"" + localLink.getLinkUrl() + "\" style=\"text-decoration: none" + "\">" + localLink.getLinkName() + "</a>";
            str1 = str1.replace(str3, str4);
          }
          i++;
        }
      }
      localTextView1.setText(UiUtil.removeUnderlines(Spannable.Factory.getInstance().newSpannable(Html.fromHtml(str1.trim()))));
      if (!TextUtils.isEmpty(str1))
        localLinearLayout.addView(localTextView1);
    }
    View localView1 = findViewById(2131624462);
    if (localView1 != null)
    {
      if (localLinearLayout.getChildCount() > 0)
        localView1.setVisibility(0);
    }
    else
      return;
    localView1.setVisibility(8);
  }

  public void updateStoreData(Context paramContext, final Bus paramBus, final StoreRef paramStoreRef, int paramInt, boolean paramBoolean1, View.OnClickListener paramOnClickListener, View.OnTouchListener paramOnTouchListener, boolean paramBoolean2)
  {
    final View localView1 = findViewById(2131624300);
    final TextView localTextView1 = (TextView)findViewById(2131624450);
    TextView localTextView2;
    double d1;
    if ((UiUtil.isTablet(this.mCtx)) && (UiUtil.isLandscape(this.mCtx)))
    {
      localTextView1.setText(UiUtil.getFormatedStoreName(this.mCtx, paramStoreRef.getStoreName()));
      String str1 = paramStoreRef.getStoreDistance();
      localTextView2 = (TextView)findViewById(2131624455);
      boolean bool1 = StoreCache.i(paramContext).isInStore();
      String str2 = StoreCache.i(paramContext).getStoreCacheInfo().getGeofenceStoreId();
      if (("-1".equals(str1)) || ((bool1) && (paramStoreRef != null) && (str2.equalsIgnoreCase(paramStoreRef.getStoreNo()))))
        break label509;
      d1 = Double.parseDouble(str1);
      if ((AppConfigManager.i(paramContext) != null) && (AppConfigManager.i(paramContext).getAppConfigData() != null) && (AppConfigManager.i(paramContext).getAppConfigData().getConfig() != null))
      {
        findViewById(2131624454).setVisibility(0);
        findViewById(2131624453).setVisibility(0);
        if (!AppConfigManager.i(paramContext).getAppConfigData().getConfig().isMetricStoreDistance())
          break label390;
        if (d1 >= 1.0D)
          break label340;
        String str17 = Util.getFormatedDistance(d1 * 1000.0D, true);
        localTextView2.setText(str17 + " " + this.mCtx.getString(2131165465));
      }
    }
    while (true)
    {
      if (((paramStoreRef == null) || (paramStoreRef.getStoreInformation() != null)) && (paramStoreRef.getStoreInformation().getStore() != null))
        break label542;
      localView1.setEnabled(false);
      return;
      localTextView1.setText(getResources().getString(2131165243) + " " + UiUtil.getFormatedStoreName(this.mCtx, paramStoreRef.getStoreName()));
      break;
      label340: String str16 = Util.getFormatedDistance(d1, true);
      localTextView2.setText(str16 + " " + this.mCtx.getString(2131165423));
      continue;
      label390: double d2 = d1 * 0.6214D;
      if (d2 < 1.0D)
      {
        String str15 = Util.getFormatedDistance(d2 * 1760.0D, true);
        localTextView2.setText(str15 + " " + this.mCtx.getString(2131165742));
      }
      else
      {
        String str14 = Util.getFormatedDistance(d2, true);
        localTextView2.setText(str14 + " " + this.mCtx.getString(2131165466));
        continue;
        label509: localTextView2.setText("");
        findViewById(2131624454).setVisibility(4);
        findViewById(2131624453).setVisibility(4);
      }
    }
    label542: Store localStore = paramStoreRef.getStoreInformation().getStore();
    TextView localTextView3 = (TextView)findViewById(2131624452);
    if ((paramStoreRef != null) && (localStore.getStoreAddress() != null))
      localTextView3.setText(Html.fromHtml(localStore.getStoreAddress().getCompleteAddress()));
    TextView localTextView4 = (TextView)findViewById(2131624451);
    StoreOpenInfo localStoreOpenInfo = DateUtil.getStoreOpenInfo(paramStoreRef, this.mCtx);
    if (localStoreOpenInfo != null)
    {
      if (localStoreOpenInfo.isOpen)
        localTextView4.setText(getResources().getString(2131165520) + " " + DateUtil.formatTime(localStoreOpenInfo.opentime, this.mCtx) + " - " + DateUtil.formatTime(localStoreOpenInfo.openUntil, this.mCtx));
    }
    else
    {
      View localView2 = findViewById(2131624456);
      if (!paramBoolean2)
        break label1428;
      localView2.setVisibility(4);
    }
    LinearLayout localLinearLayout1;
    LinearLayout.LayoutParams localLayoutParams1;
    LinearLayout.LayoutParams localLayoutParams2;
    List localList1;
    List localList2;
    LinearLayout localLinearLayout2;
    while (true)
    {
      View localView4 = findViewById(2131624449);
      localView4.setOnClickListener(paramOnClickListener);
      localView4.setOnTouchListener(paramOnTouchListener);
      localView1.setOnTouchListener(paramOnTouchListener);
      final TextView localTextView5 = (TextView)findViewById(2131624457);
      localView1.setOnClickListener(new View.OnClickListener()
      {
        public void onClick(View paramAnonymousView)
        {
          if (NetworkUtil.isConnectionAvailable(StoreDetailsLayout.this.getContext()))
            try
            {
              Constant.i().setProductModified(true);
              AppConfigManager.i(StoreDetailsLayout.this.mCtx).saveFavStore(paramStoreRef);
              ShoppingCart.i(StoreDetailsLayout.this.mCtx).changeFavoriteStore(paramStoreRef.getStoreNo());
              localTextView5.setVisibility(0);
              localView1.setVisibility(8);
              UsageTracker.i().currentStoreChanged(StoreDetailsLayout.this.mCtx, paramStoreRef);
              StoreDetailsLayout.this.postDelayed(new Runnable()
              {
                public void run()
                {
                  StoreDetailsLayout.1.this.val$mStoreName.setTextColor(StoreDetailsLayout.this.getResources().getColor(2131492870));
                  StoreDetailsLayout.1.this.val$bus.post(new FavStoreChangeEvent(StoreDetailsLayout.1.this.val$storeRef));
                }
              }
              , 100L);
              String str1 = StoreDetailsLayout.this.mCtx.getResources().getString(2131165302) + " \n\n";
              String str2 = StoreDetailsLayout.this.getResources().getString(2131165389) + " " + UiUtil.getFormatedStoreName(StoreDetailsLayout.this.mCtx, paramStoreRef.getStoreName());
              String str3 = str1 + str2;
              SpannableString localSpannableString = new SpannableString(str3);
              localSpannableString.setSpan(new StyleSpan(1), str1.length(), str3.length(), 33);
              UiUtil.showCustomToast(localSpannableString, StoreDetailsLayout.this.mCtx);
              return;
            }
            catch (IOException localIOException)
            {
              while (true)
                L.E("saving fav store error  :: " + localIOException.getMessage());
            }
          UiUtil.showNetworkToast(StoreDetailsLayout.this.mCtx, false);
        }
      });
      if (paramBoolean1)
      {
        localTextView5.setVisibility(0);
        localView1.setVisibility(8);
        localTextView1.setTextColor(getResources().getColor(2131492870));
      }
      localLinearLayout1 = (LinearLayout)findViewById(2131624458);
      if (!UiUtil.isTablet(getContext()))
        this.storeOpeningLayout = ((LinearLayout)findViewById(2131624460));
      localLayoutParams1 = new LinearLayout.LayoutParams(-1, -2);
      localLayoutParams1.bottomMargin = ((int)getResources().getDimension(2131362102));
      localLayoutParams2 = new LinearLayout.LayoutParams(-1, -2);
      localLayoutParams2.topMargin = ((int)getResources().getDimension(2131362100));
      StoreInformation localStoreInformation1 = paramStoreRef.getStoreInformation();
      localList1 = null;
      if (localStoreInformation1 != null)
      {
        StoreOpeningHours localStoreOpeningHours3 = localStore.getStoreOpeningHours();
        localList1 = null;
        if (localStoreOpeningHours3 != null)
        {
          DateRangeFilterList localDateRangeFilterList = localStore.getStoreOpeningHours().getDateRangeFilterList();
          localList1 = null;
          if (localDateRangeFilterList != null)
            localList1 = localStore.getStoreOpeningHours().getDateRangeFilterList().getDateRangeFilter();
        }
      }
      StoreInformation localStoreInformation2 = paramStoreRef.getStoreInformation();
      localList2 = null;
      if (localStoreInformation2 != null)
      {
        StoreOpeningHours localStoreOpeningHours2 = localStore.getStoreOpeningHours();
        localList2 = null;
        if (localStoreOpeningHours2 != null)
        {
          StoreSectionOpeningHoursList localStoreSectionOpeningHoursList = localStore.getStoreOpeningHours().getStoreSectionOpeningHoursList();
          localList2 = null;
          if (localStoreSectionOpeningHoursList != null)
            localList2 = localStore.getStoreOpeningHours().getStoreSectionOpeningHoursList().getStoreSectionOpeningHours();
        }
      }
      StoreInformation localStoreInformation3 = paramStoreRef.getStoreInformation();
      List localList3 = null;
      if (localStoreInformation3 != null)
      {
        StoreOpeningHours localStoreOpeningHours1 = localStore.getStoreOpeningHours();
        localList3 = null;
        if (localStoreOpeningHours1 != null)
        {
          StoreClosedFilterList localStoreClosedFilterList = localStore.getStoreOpeningHours().getStoreClosedFilterList();
          localList3 = null;
          if (localStoreClosedFilterList != null)
            localList3 = localStore.getStoreOpeningHours().getStoreClosedFilterList().getDateRangeFilterId();
        }
      }
      localLinearLayout2 = null;
      if (localList3 == null)
        break label1454;
      boolean bool3 = localList3.isEmpty();
      localLinearLayout2 = null;
      if (bool3)
        break label1454;
      localLinearLayout2 = (LinearLayout)this.mInflater.inflate(2130903155, localLinearLayout1, false);
      ((TextView)localLinearLayout2.findViewById(2131624473)).setText(getResources().getString(2131165290));
      Iterator localIterator2 = localList3.iterator();
      while (true)
      {
        if (!localIterator2.hasNext())
          break label1454;
        DateRangeFilterId localDateRangeFilterId = (DateRangeFilterId)localIterator2.next();
        if ((localDateRangeFilterId != null) && (localList1 != null) && (!localList1.isEmpty()))
        {
          Iterator localIterator3 = localList1.iterator();
          if (localIterator3.hasNext())
          {
            DateRangeFilter localDateRangeFilter = (DateRangeFilter)localIterator3.next();
            if (!localDateRangeFilterId.getDateRangeFilterId().equalsIgnoreCase(localDateRangeFilter.getDateRangeFilterId()))
              break;
            View localView11 = this.mInflater.inflate(2130903156, localLinearLayout2, false);
            ((TextView)localView11.findViewById(2131624474)).setText(localDateRangeFilter.getDateRangeFilterDescription());
            localLinearLayout2.addView(localView11, localLayoutParams2);
          }
        }
      }
      String str12 = localStoreOpenInfo.openDay;
      Object localObject = "";
      if (str12 != null);
      while (true)
      {
        try
        {
          Resources localResources = getResources();
          Object[] arrayOfObject = new Object[2];
          arrayOfObject[0] = str12;
          arrayOfObject[1] = DateUtil.formatTime(localStoreOpenInfo.opentime, this.mCtx);
          String str13 = localResources.getString(2131165291, arrayOfObject);
          localObject = str13;
          localTextView4.setText(Html.fromHtml((String)localObject));
        }
        catch (UnknownFormatConversionException localUnknownFormatConversionException)
        {
          localUnknownFormatConversionException.printStackTrace();
          continue;
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
          continue;
        }
        if (!TextUtils.isEmpty(localStoreOpenInfo.message))
          localObject = localStoreOpenInfo.message;
        else
          localObject = getResources().getString(2131165290);
      }
      label1428: View localView3 = findViewById(2131624454);
      localView3.setOnClickListener(paramOnClickListener);
      localView3.setOnTouchListener(paramOnTouchListener);
    }
    label1454: if ((localList2 != null) && (!localList2.isEmpty()))
    {
      int i = 0;
      int j = localList2.size();
      if (i < j)
      {
        LinearLayout localLinearLayout3;
        String str4;
        String str5;
        String str6;
        if (isOpeningHourExist((StoreSectionOpeningHours)localList2.get(i)))
        {
          localLinearLayout3 = (LinearLayout)this.mInflater.inflate(2130903155, localLinearLayout1, false);
          str4 = ((StoreSectionOpeningHours)localList2.get(i)).getStoreSectionName();
          str5 = ((StoreSectionOpeningHours)localList2.get(i)).getStoreSectionType();
          List localList4;
          if (("STORE".equalsIgnoreCase(str4)) || ("STORE".equalsIgnoreCase(str5)))
          {
            ((TextView)localLinearLayout3.findViewById(2131624473)).setText(getResources().getString(2131165677));
            str6 = ((StoreSectionOpeningHours)localList2.get(i)).getStoreSectionFreeText();
            CalenderEntryList localCalenderEntryList = ((StoreSectionOpeningHours)localList2.get(i)).getCalenderEntryList();
            localList4 = null;
            if (localCalenderEntryList != null)
              localList4 = ((StoreSectionOpeningHours)localList2.get(i)).getCalenderEntryList().getCalenderEntry();
            if ((localList4 == null) || (localList4.isEmpty()));
          }
          else
          {
            for (int k = 0; ; k++)
            {
              int m = localList4.size();
              if (k >= m)
                break label2409;
              List localList5 = ((CalenderEntry)localList4.get(k)).getDateRangeFilterList().getDateRangeFilterId();
              List localList6 = ((CalenderEntry)localList4.get(k)).getOpeningHoursList().getOpeningHours();
              if ((localList6 != null) && (!localList6.isEmpty()))
              {
                int n = 0;
                label1759: int i1 = localList6.size();
                if (n < i1)
                {
                  String str7;
                  String str8;
                  if ((((OpeningHours)localList6.get(n)).getWeekDayFilterList() != null) && (((OpeningHours)localList6.get(n)).getWeekDayFilterList().getWeekDayFilter() != null))
                  {
                    HourRangeFilterList localHourRangeFilterList = ((OpeningHours)localList6.get(0)).getHourRangeFilterList();
                    str7 = null;
                    str8 = null;
                    if (localHourRangeFilterList != null)
                    {
                      List localList7 = ((OpeningHours)localList6.get(n)).getHourRangeFilterList().getHourRangeFilter();
                      str7 = null;
                      str8 = null;
                      if (localList7 != null)
                      {
                        int i6 = ((OpeningHours)localList6.get(n)).getHourRangeFilterList().getHourRangeFilter().size();
                        str7 = null;
                        str8 = null;
                        if (i6 > 0)
                        {
                          str8 = ((HourRangeFilter)((OpeningHours)localList6.get(n)).getHourRangeFilterList().getHourRangeFilter().get(0)).getHourRangeBegin();
                          str7 = ((HourRangeFilter)((OpeningHours)localList6.get(n)).getHourRangeFilterList().getHourRangeFilter().get(0)).getHourRangeEnd();
                        }
                      }
                    }
                    if ((!TextUtils.isEmpty(str8)) && (!TextUtils.isEmpty(str7)))
                      break label2016;
                  }
                  while (true)
                  {
                    n++;
                    break label1759;
                    ((TextView)localLinearLayout3.findViewById(2131624473)).setText(Html.fromHtml(str4));
                    break;
                    label2016: String[] arrayOfString1 = str8.split(":");
                    String[] arrayOfString2 = str7.split(":");
                    Calendar localCalendar1 = Calendar.getInstance();
                    try
                    {
                      localCalendar1.set(11, Integer.parseInt(arrayOfString1[0]));
                      localCalendar1.set(12, Integer.parseInt(arrayOfString1[1]));
                      l1 = localCalendar1.getTimeInMillis();
                      localCalendar2 = Calendar.getInstance();
                    }
                    catch (NumberFormatException localNumberFormatException1)
                    {
                      try
                      {
                        long l1;
                        Calendar localCalendar2;
                        localCalendar2.set(11, Integer.parseInt(arrayOfString2[0]));
                        localCalendar2.set(12, Integer.parseInt(arrayOfString2[1]));
                        long l2 = localCalendar2.getTimeInMillis();
                        str9 = DateUtil.formatTime(l1, this.mCtx) + " - " + DateUtil.formatTime(l2, this.mCtx);
                        if (((OpeningHours)localList6.get(n)).getWeekDayFilterList().getWeekDayFilter().size() > 0)
                        {
                          Iterator localIterator1 = ((OpeningHours)localList6.get(n)).getWeekDayFilterList().getWeekDayFilter().iterator();
                          while (localIterator1.hasNext())
                          {
                            WeekDayFilter localWeekDayFilter = (WeekDayFilter)localIterator1.next();
                            int i4 = getWeekDay(localWeekDayFilter.getWeekDayFrom());
                            int i5 = getWeekDay(localWeekDayFilter.getWeekDayTo());
                            addStoreOpeningView(DateUtil.getDayText(i4, paramContext), DateUtil.getDayText(i5, paramContext), str4, str5, i4, i5, str9, localList5, localList1, localLinearLayout3, localLayoutParams2);
                          }
                          localNumberFormatException1 = localNumberFormatException1;
                          localNumberFormatException1.printStackTrace();
                        }
                      }
                      catch (NumberFormatException localNumberFormatException2)
                      {
                        String str9;
                        while (true)
                          localNumberFormatException2.printStackTrace();
                        String str10 = null;
                        String str11 = null;
                        int i2 = 0;
                        int i3 = 0;
                        if (localList5 != null)
                        {
                          boolean bool2 = localList5.isEmpty();
                          str10 = null;
                          str11 = null;
                          i2 = 0;
                          i3 = 0;
                          if (bool2)
                          {
                            i2 = 2;
                            i3 = 1;
                            str10 = DateUtil.getDayText(i2, paramContext);
                            str11 = DateUtil.getDayText(i3, paramContext);
                          }
                        }
                        addStoreOpeningView(str10, str11, str4, str5, i2, i3, str9, localList5, localList1, localLinearLayout3, localLayoutParams2);
                      }
                    }
                  }
                }
              }
            }
          }
          label2409: if ((str6 != null) && (!str6.isEmpty()))
          {
            View localView10 = this.mInflater.inflate(2130903156, localLinearLayout2, false);
            localView10.findViewById(2131624475).setVisibility(8);
            ((TextView)localView10.findViewById(2131624474)).setText(Html.fromHtml(str6));
            localLinearLayout3.addView(localView10, localLayoutParams2);
            str6 = "";
          }
          if (localLinearLayout3.getChildCount() <= 1)
            break label2598;
          if (!UiUtil.isTablet(getContext()))
            break label2531;
          localLinearLayout1.addView(localLinearLayout3, localLayoutParams1);
          if (localLinearLayout2 != null)
          {
            localLinearLayout1.addView(localLinearLayout2, localLayoutParams1);
            localLinearLayout2 = null;
          }
        }
        while (true)
        {
          i++;
          break;
          label2531: if (("STORE".equalsIgnoreCase(str4)) || ("STORE".equalsIgnoreCase(str5)))
          {
            localLinearLayout1.addView(localLinearLayout3, localLayoutParams1);
            if (localLinearLayout2 != null)
            {
              this.storeOpeningLayout.addView(localLinearLayout2, localLayoutParams1);
              localLinearLayout2 = null;
            }
          }
          else
          {
            this.storeOpeningLayout.addView(localLinearLayout3, localLayoutParams1);
            continue;
            if (("STORE".equalsIgnoreCase(str4)) || ("STORE".equalsIgnoreCase(str5)))
            {
              View localView9 = this.mInflater.inflate(2130903156, localLinearLayout2, false);
              ((TextView)localView9.findViewById(2131624474)).setText(str6);
              localLinearLayout3.addView(localView9, localLayoutParams2);
              localLinearLayout1.addView(localLinearLayout3, localLayoutParams1);
            }
          }
        }
      }
    }
    label2598: final View localView6;
    if (!UiUtil.isTablet(getContext()))
    {
      localView6 = findViewById(2131624459);
      if (this.storeOpeningLayout.getChildCount() <= 0)
        break label2854;
      View localView8 = findViewById(2131624461);
      if (localView8 != null)
        localView8.setVisibility(0);
      localView6.setVisibility(0);
    }
    while (true)
    {
      localView6.setOnClickListener(new View.OnClickListener()
      {
        public void onClick(View paramAnonymousView)
        {
          localView6.setVisibility(8);
          int i;
          LinearLayout localLinearLayout;
          int j;
          if (StoreDetailsLayout.this.storeOpeningLayout.getVisibility() == 8)
          {
            i = 1;
            localLinearLayout = StoreDetailsLayout.this.storeOpeningLayout;
            j = 0;
            if (i == 0)
              break label53;
          }
          while (true)
          {
            localLinearLayout.setVisibility(j);
            return;
            i = 0;
            break;
            label53: j = 8;
          }
        }
      });
      final String str3 = localStore.getStoreMapURI();
      View localView5 = findViewById(2131624466);
      if ((str3 != null) && (!str3.isEmpty()) && (!Util.isNWP(paramContext)))
        localView5.setVisibility(0);
      localView5.setOnClickListener(new View.OnClickListener()
      {
        public void onClick(View paramAnonymousView)
        {
          if (UiUtil.isConnectionAvailable(StoreDetailsLayout.this.mCtx))
          {
            ArrayList localArrayList = new ArrayList();
            localArrayList.add(str3);
            paramBus.post(new InStoreMapClickedEvent(localArrayList, paramStoreRef));
            return;
          }
          UiUtil.showCustomToast(StoreDetailsLayout.this.mCtx.getString(2131165514), StoreDetailsLayout.this.mCtx);
        }
      });
      updateContactDetails(localStore, paramOnClickListener);
      ((TextView)findViewById(2131624465)).setText(getResources().getString(2131165436));
      ((TextView)findViewById(2131624467)).setText(getResources().getString(2131165406));
      return;
      label2854: View localView7 = findViewById(2131624461);
      if (localView7 != null)
        localView7.setVisibility(8);
      localView6.setVisibility(8);
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.kompis.view.StoreDetailsLayout
 * JD-Core Version:    0.6.2
 */