package kankan.wheel.demo;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AnticipateOvershootInterpolator;
import android.widget.Button;
import android.widget.TextView;
import kankan.wheel.widget.OnWheelChangedListener;
import kankan.wheel.widget.OnWheelScrollListener;
import kankan.wheel.widget.WheelView;
import kankan.wheel.widget.adapters.NumericWheelAdapter;

public class PasswActivity extends Activity
{
  private OnWheelChangedListener changedListener = new OnWheelChangedListener()
  {
    public void onChanged(WheelView paramAnonymousWheelView, int paramAnonymousInt1, int paramAnonymousInt2)
    {
      if (!PasswActivity.this.wheelScrolled)
        PasswActivity.this.updateStatus();
    }
  };
  OnWheelScrollListener scrolledListener = new OnWheelScrollListener()
  {
    public void onScrollingFinished(WheelView paramAnonymousWheelView)
    {
      PasswActivity.this.wheelScrolled = false;
      PasswActivity.this.updateStatus();
    }

    public void onScrollingStarted(WheelView paramAnonymousWheelView)
    {
      PasswActivity.this.wheelScrolled = true;
    }
  };
  private boolean wheelScrolled = false;

  private WheelView getWheel(int paramInt)
  {
    return (WheelView)findViewById(paramInt);
  }

  private void initWheel(int paramInt)
  {
    WheelView localWheelView = getWheel(paramInt);
    localWheelView.setViewAdapter(new NumericWheelAdapter(this, 0, 9));
    localWheelView.setCurrentItem((int)(10.0D * Math.random()));
    localWheelView.addChangingListener(this.changedListener);
    localWheelView.addScrollingListener(this.scrolledListener);
    localWheelView.setCyclic(true);
    localWheelView.setInterpolator(new AnticipateOvershootInterpolator());
  }

  private void mixWheel(int paramInt)
  {
    getWheel(paramInt).scroll(-25 + (int)(50.0D * Math.random()), 2000);
  }

  private boolean testPin(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    return (testWheelValue(2130968583, paramInt1)) && (testWheelValue(2130968584, paramInt2)) && (testWheelValue(2130968585, paramInt3)) && (testWheelValue(2130968586, paramInt4));
  }

  private boolean testWheelValue(int paramInt1, int paramInt2)
  {
    return getWheel(paramInt1).getCurrentItem() == paramInt2;
  }

  private void updateStatus()
  {
    TextView localTextView = (TextView)findViewById(2130968587);
    if (testPin(2, 4, 6, 1))
    {
      localTextView.setText("Congratulation!");
      return;
    }
    localTextView.setText("Invalid PIN");
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903043);
    initWheel(2130968583);
    initWheel(2130968584);
    initWheel(2130968585);
    initWheel(2130968586);
    ((Button)findViewById(2130968588)).setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        PasswActivity.this.mixWheel(2130968583);
        PasswActivity.this.mixWheel(2130968584);
        PasswActivity.this.mixWheel(2130968585);
        PasswActivity.this.mixWheel(2130968586);
      }
    });
    updateStatus();
  }
}

/* Location:           C:\q\classes_dex2jar.jar
 * Qualified Name:     kankan.wheel.demo.PasswActivity
 * JD-Core Version:    0.6.2
 */