java类android.widget.AdapterViewFlipper的实例源码

TutColorMatchActivity.java 文件源码 项目:braingames 阅读 23 收藏 0 点赞 0 评论 0
@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);
}
TestSetupAssetLayout1.java 文件源码 项目:itsnat_droid 阅读 19 收藏 0 点赞 0 评论 0
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);
}
AdapterViewProtocols.java 文件源码 项目:android-test-kit 阅读 23 收藏 0 点赞 0 评论 0
@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);
  }
}
GameCompareFastActivity.java 文件源码 项目:braingames 阅读 21 收藏 0 点赞 0 评论 0
@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);
    }
GameFindOperationActivity.java 文件源码 项目:braingames 阅读 21 收藏 0 点赞 0 评论 0
@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);
}
GameColorMatchActivity.java 文件源码 项目:braingames 阅读 45 收藏 0 点赞 0 评论 0
@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);
    }
GameShapeMatchActivity.java 文件源码 项目:braingames 阅读 20 收藏 0 点赞 0 评论 0
@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);
}
GameCalculateFastActivity.java 文件源码 项目:braingames 阅读 72 收藏 0 点赞 0 评论 0
@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);
}


问题


面经


文章

微信
公众号

扫码关注公众号