GboardOnboardingInstructionsFragment.java 5.07 KB
package com.bitstrips.imoji.onboarding.gboard;

import android.animation.Animator;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import com.crashlytics.android.Crashlytics;

public class GboardOnboardingInstructionsFragment
  extends BaseOnboardingFragment
  implements ViewTreeObserver.OnGlobalLayoutListener, GboardFakeEditText.OnImageEnterredListener
{
  private GboardFakeEditText c;
  private View d;
  private int e = 0;
  
  private void a()
  {
    this.c.post(new Runnable()
    {
      public final void run()
      {
        Context localContext = GboardOnboardingInstructionsFragment.this.getContext();
        if (localContext == null) {}
        while (!GboardOnboardingInstructionsFragment.c(GboardOnboardingInstructionsFragment.this).requestFocus()) {
          return;
        }
        ((InputMethodManager)localContext.getSystemService("input_method")).showSoftInput(GboardOnboardingInstructionsFragment.c(GboardOnboardingInstructionsFragment.this), 1);
      }
    });
  }
  
  private void b()
  {
    ((InputMethodManager)getContext().getSystemService("input_method")).hideSoftInputFromWindow(this.c.getWindowToken(), 0);
  }
  
  public static GboardOnboardingInstructionsFragment newInstance(GboardOnboardingSource paramGboardOnboardingSource)
  {
    GboardOnboardingInstructionsFragment localGboardOnboardingInstructionsFragment = new GboardOnboardingInstructionsFragment();
    localGboardOnboardingInstructionsFragment.setArguments(BaseOnboardingFragment.createArguments(paramGboardOnboardingSource));
    return localGboardOnboardingInstructionsFragment;
  }
  
  @Nullable
  public View onCreateView(LayoutInflater paramLayoutInflater, @Nullable ViewGroup paramViewGroup, @Nullable Bundle paramBundle)
  {
    paramLayoutInflater = paramLayoutInflater.inflate(2130903117, paramViewGroup, false);
    paramViewGroup = (Button)paramLayoutInflater.findViewById(2131689703);
    paramBundle = (Button)paramLayoutInflater.findViewById(2131689748);
    this.c = ((GboardFakeEditText)paramLayoutInflater.findViewById(2131689746));
    this.d = paramLayoutInflater.findViewById(2131689745);
    paramViewGroup.setOnClickListener(new View.OnClickListener()
    {
      public final void onClick(View paramAnonymousView)
      {
        GboardOnboardingInstructionsFragment.a(GboardOnboardingInstructionsFragment.this);
        GboardOnboardingInstructionsFragment.this.skip("instructions");
      }
    });
    paramBundle.setOnClickListener(new View.OnClickListener()
    {
      public final void onClick(View paramAnonymousView)
      {
        GboardOnboardingInstructionsFragment.b(GboardOnboardingInstructionsFragment.this);
      }
    });
    this.c.setOnImageEnterredListener(this);
    this.d.setAlpha(0.0F);
    return paramLayoutInflater;
  }
  
  public void onDestroyView()
  {
    super.onDestroyView();
    getView().getViewTreeObserver().removeOnGlobalLayoutListener(this);
    getActivity().getWindow().setSoftInputMode(16);
  }
  
  public void onGlobalLayout()
  {
    View localView = getView();
    if (localView == null) {
      return;
    }
    int i = localView.getRootView().getHeight() - localView.getHeight();
    float f = getResources().getDisplayMetrics().density;
    if (i > f * 150.0F)
    {
      localView = getView().findViewById(2131689747);
      ViewGroup.LayoutParams localLayoutParams = localView.getLayoutParams();
      getView().getViewTreeObserver().removeOnGlobalLayoutListener(this);
      localLayoutParams.height = (i - this.e);
      localView.setLayoutParams(localLayoutParams);
      this.d.setAlpha(1.0F);
      GboardOnboardingUtils.fadeInAnimator(this.d).start();
      getActivity().getWindow().setSoftInputMode(48);
      return;
    }
    this.e = i;
  }
  
  public void onImageEnterred()
  {
    b();
    finish();
    if (didSaveInstanceState())
    {
      Crashlytics.logException(new IllegalStateException("Performing action after onSaveInstanceState!"));
      return;
    }
    getFragmentManager().beginTransaction().setCustomAnimations(2130968609, 2130968612).replace(2131689651, GboardOnboardingFinishFragment.newInstance(getSource())).addToBackStack(null).commit();
  }
  
  public void onResume()
  {
    super.onResume();
    getView().getViewTreeObserver().addOnGlobalLayoutListener(this);
    a();
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/onboarding/gboard/GboardOnboardingInstructionsFragment.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */