Android Open Source - android-whogoesfirst Arrow Row






From Project

Back to project page android-whogoesfirst.

License

The source code is released under:

MIT License

If you think the Android project android-whogoesfirst listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.idunnolol.whogoesfirst;
//from w w w  .j  a  va 2  s . c  o  m
import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;

public class ArrowRow extends LinearLayout {

  private List<ArrowView> mArrowViews;

  public ArrowRow(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    mArrowViews = new ArrayList<ArrowView>();
    mArrowViews.add((ArrowView) Ui.findView(this, R.id.arrow_view1));
    mArrowViews.add((ArrowView) Ui.findView(this, R.id.arrow_view2));
    mArrowViews.add((ArrowView) Ui.findView(this, R.id.arrow_view3));
  }

  public void bind(int rotation, int num) {
    if (num < 0 || num > 3) {
      throw new IllegalArgumentException("Num has to be between 0 and 3, you chose " + num);
    }

    for (int a = 0; a < mArrowViews.size(); a++) {
      ArrowView arrowView = mArrowViews.get(a);
      arrowView.setArrowRotation(rotation);
      arrowView.setVisibility((a < num) ? View.VISIBLE : View.GONE);
    }
  }
}




Java Source Code List

com.idunnolol.whogoesfirst.ArrowRow.java
com.idunnolol.whogoesfirst.ArrowView.java
com.idunnolol.whogoesfirst.MainActivity.java
com.idunnolol.whogoesfirst.MorePlayersDialogFragment.java
com.idunnolol.whogoesfirst.PlayerCountFragment.java
com.idunnolol.whogoesfirst.PlayerCountListener.java
com.idunnolol.whogoesfirst.Ui.java
com.idunnolol.whogoesfirst.WhoGoesFragment.java