Java Code Examples for android.widget.AdapterViewFlipper

The following are top voted examples for showing how to use android.widget.AdapterViewFlipper. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: braingames   File: TutColorMatchActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tut_color_match);

    mAdapterFlipper = (AdapterViewFlipper)findViewById(R.id.flipper);
    mAdapter = new ColorMatchAdapter(10, null, new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mAdapterFlipper.showNext();

        }
    }, new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mAdapterFlipper.showPrevious();
        }
    });

    mAdapterFlipper.setAdapter(mAdapter);
}
 
Example 2
Project: itsnat_droid   File: TestSetupAssetLayout1.java   View source code 5 votes vote down vote up
private static void defineAdapterViewAnimator(TestActivity act, View rootView)
{
    // Resources res = act.getResources();
    AdapterViewFlipper viewFlipper = (AdapterViewFlipper) rootView.findViewById(R.id.adapterViewAnimatorTestId);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(act, R.array.sports_array, android.R.layout.simple_list_item_1);
    //adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    viewFlipper.setAdapter(adapter);
}
 
Example 3
Project: android-test-kit   File: AdapterViewProtocols.java   View source code 5 votes vote down vote up
@Override
public void makeDataRenderedWithinAdapterView(
    AdapterView<? extends Adapter> adapterView, AdaptedData data) {
  checkArgument(data.opaqueToken instanceof Integer, "Not my data: %s", data);
  int position = ((Integer) data.opaqueToken).intValue();

  boolean moved = false;
  // set selection should always work, we can give a little better experience if per subtype
  // though.
  if (Build.VERSION.SDK_INT > 7) {
    if (adapterView instanceof AbsListView) {
      if (Build.VERSION.SDK_INT > 10) {
        ((AbsListView) adapterView).smoothScrollToPositionFromTop(position,
            adapterView.getPaddingTop(), 0);
      } else {
        ((AbsListView) adapterView).smoothScrollToPosition(position);
      }
      moved = true;
    }
    if (Build.VERSION.SDK_INT > 10) {
      if (adapterView instanceof AdapterViewAnimator) {
        if (adapterView instanceof AdapterViewFlipper) {
          ((AdapterViewFlipper) adapterView).stopFlipping();
        }
        ((AdapterViewAnimator) adapterView).setDisplayedChild(position);
        moved = true;
      }
    }
  }
  if (!moved) {
    adapterView.setSelection(position);
  }
}
 
Example 4
Project: braingames   File: GameCompareFastActivity.java   View source code 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setGameName(getApplicationContext().getResources().getString(R.string.game_compare_fast));
        setGameCategory(GameCategory.PROBLEM_SOLVING);
        setGameType(GameType.COMPARE_FAST);
        // show tutorial if user plays this game for the first time
//        if(getShowTutorial()) {
//            Intent i = new Intent(getApplicationContext(),TutColorMatchActivity.class);
//            startActivity(i);
//        }
        setContentView(R.layout.activity_game_compare_fast);


        mAdapterFlipper = (AdapterViewFlipper)findViewById(R.id.flipper);

        mAdapter = new CompareFastAdapter(QUESTION_NUM, this, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mAdapterFlipper.showNext();
                positiveSound();
            }
        }, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mAdapterFlipper.showNext();
                negativeSound();
            }
        });

        mAdapterFlipper.setAdapter(mAdapter);
        mAdapterFlipper.setVisibility(View.INVISIBLE);
    }
 
Example 5
Project: braingames   File: GameFindOperationActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setGameName(getApplicationContext().getResources().getString(R.string.game_find_operation));
    setGameCategory(GameCategory.PROBLEM_SOLVING);
    setGameType(GameType.FIND_OPERATION);

    setContentView(R.layout.activity_game_find_operation);

    mAdapterFlipper = (AdapterViewFlipper)findViewById(R.id.flipper);

    mAdapter = new FindOperationAdapter(QUESTION_NUM, this,
        new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mAdapterFlipper.showNext();
            positiveSound();
        }
    },
        new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mAdapterFlipper.showNext();
            negativeSound();
        }
    });

    mAdapterFlipper.setAdapter(mAdapter);
    mAdapterFlipper.setVisibility(View.INVISIBLE);
}
 
Example 6
Project: braingames   File: GameColorMatchActivity.java   View source code 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setGameName(getApplicationContext().getResources().getString(R.string.game_color_match));
        setGameCategory(GameCategory.ATTENTION);
        setGameType(GameType.COLOR_MATCH);
        // show tutorial if user plays this game for the first time
//        if(getShowTutorial()) {
//            Intent i = new Intent(getApplicationContext(),TutColorMatchActivity.class);
//            startActivity(i);
//        }
        setContentView(R.layout.activity_game_color_match);


        mAdapterFlipper = (AdapterViewFlipper)findViewById(R.id.flipper);

        mAdapter = new ColorMatchAdapter(QUESTION_NUM, this, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mAdapterFlipper.showNext();
                positiveSound();
            }
        }, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mAdapterFlipper.showNext();
                negativeSound();
            }
        });

        mAdapterFlipper.setAdapter(mAdapter);
        mAdapterFlipper.setVisibility(View.INVISIBLE);
    }
 
Example 7
Project: braingames   File: GameShapeMatchActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setGameName(getApplicationContext().getResources().getString(R.string.game_shape_match));
    setGameCategory(GameCategory.MEMORY);
    setGameType(GameType.SHAPE_MATCH);
    setContentView(R.layout.activity_game_shape_match);

    mAdapterFlipper = (AdapterViewFlipper)findViewById(R.id.flipper);

    mAdapter = new ShapeMatchAdapter(QUESTION_NUM, this, new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mAdapterFlipper.showNext();
            positiveSound();
        }
    }, new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mAdapterFlipper.showNext();
            negativeSound();
        }
    });

    mAdapterFlipper.setAdapter(mAdapter);
    mAdapterFlipper.setVisibility(View.INVISIBLE);
}
 
Example 8
Project: braingames   File: GameCalculateFastActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setGameName(getApplicationContext().getResources().getString(R.string.game_calculate_fast));
    setGameCategory(GameCategory.PROBLEM_SOLVING);
    setGameType(GameType.CALCULATE_FAST);

    setContentView(R.layout.activity_game_calculate_fast);

    mAdapterFlipper = (AdapterViewFlipper)findViewById(R.id.flipper);

    mAdapter = new CalculateFastAdapter(QUESTION_NUM, this,
            new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    mAdapterFlipper.showNext();
                    positiveSound();
                }
            },
            new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    mAdapterFlipper.showNext();
                    negativeSound();
                }
            });

    mAdapterFlipper.setAdapter(mAdapter);
    mAdapterFlipper.setVisibility(View.INVISIBLE);
}