@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); }
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); }
@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); } }
@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); }
@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); }
@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); }
@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); }
@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); }