예제 #1
0
 @Override
 public void onBackPressed() {
   if (mc.isDisplaying()) {
     mc.hide(mc.getDisplayingCard());
   } else {
     super.onBackPressed();
   }
 }
예제 #2
0
  private void initView() {
    mc = (MultiCardMenu) findViewById(R.id.multi_card_menu);
    mc.setOnDisplayOrHideListener(
        new MultiCardMenu.OnDisplayOrHideListener() {
          @Override
          public void onDisplay(int which) {
            Log.d(TAG, "onDisplay:" + which);
          }

          @Override
          public void onHide(int which) {
            Log.d(TAG, "onHide:" + which);
          }

          @Override
          public void onTouchCard(int which) {
            Log.d(TAG, "onTouchCard:" + which);
          }
        });
    CheckBox fade = (CheckBox) findViewById(R.id.fade);
    fade.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mc.setFade(isChecked);
          }
        });
    CheckBox boundary = (CheckBox) findViewById(R.id.boundary);
    boundary.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mc.setBoundary(isChecked);
          }
        });
    //        int [] imgRes = {R.drawable.ent,R.drawable.qa};
    final int[] imgRes = {
      R.drawable.nuan1,
      R.drawable.nuan2,
      R.drawable.ic_launcher,
      R.drawable.qa,
      R.drawable.ent,
      R.drawable.nuan1,
      R.drawable.nuan2,
      R.drawable.ic_launcher,
      R.drawable.qa,
      R.drawable.ent,
      R.drawable.nuan1,
      R.drawable.nuan2,
      R.drawable.ic_launcher,
      R.drawable.qa,
      R.drawable.ent
    };
    final ViewPager mViewPager = (ViewPager) findViewById(R.id.view_pager);
    mViewPager.setAdapter(
        new PagerAdapter() {
          @Override
          public int getCount() {
            return imgRes.length;
          }

          @Override
          public boolean isViewFromObject(View view, Object object) {
            return view == object;
          }

          @Override
          public void destroyItem(ViewGroup container, int position, Object object) {
            mViewPager.removeView((View) object);
          }

          @Override
          public Object instantiateItem(ViewGroup container, int position) {
            ImageView imageView = new ImageView(MainActivity.this);
            imageView.setImageResource(imgRes[position]);
            container.addView(imageView);
            return imageView;
          }
        });

    ListView listView = (ListView) findViewById(R.id.lv);
    listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, data));
  }
예제 #3
0
 public void four(View view) {
   mc.show(3);
 }
예제 #4
0
 public void three(View view) {
   mc.show(2);
 }
예제 #5
0
 public void two(View view) {
   mc.show(1);
 }
예제 #6
0
 public void one(View view) {
   mc.show(0);
 }
예제 #7
0
 public void hide(View view) {
   mc.hide(mc.getDisplayingCard());
 }