Android 技术博客(4):滑动卡片的 view 。

EnableDisableActivity.java

package com.meetic.shuffle.sample;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.meetic.shuffle.Shuffle;
import com.meetic.shuffle.sample.adapter.TestAdapter;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class EnableDisableActivity extends AppCompatActivity {

    @Bind(R.id.shuffle) Shuffle shuffle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_enable_disable);
        ButterKnife.bind(this);
        shuffle.setShuffleAdapter(new TestAdapter());
    }

    @OnClick(R.id.enable)
    public void onClickEnable() {
        shuffle.enable(true);
    }

    @OnClick(R.id.disable)
    public void onClickDisable() {
        shuffle.enable(false);
    }

}

HorizontalActivity.java

package com.meetic.shuffle.sample;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.meetic.shuffle.Shuffle;
import com.meetic.shuffle.sample.adapter.TestAdapter;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class HorizontalActivity extends AppCompatActivity {

    @Bind(R.id.shuffle) Shuffle shuffle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_horizontal);
        ButterKnife.bind(this);
        shuffle.setShuffleAdapter(new TestAdapter());
    }

    @OnClick(R.id.left)
    public void onClickLeft() {
        shuffle.swipeLeft(1000);
    }

    @OnClick(R.id.right)
    public void onClickRight() {
        shuffle.swipeRight(1000);
    }

}

MainActivity.java

package com.meetic.shuffle.sample;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.horizontal)
    public void launchHorizontal() {
        startActivity(new Intent(this, HorizontalActivity.class));
    }

    @OnClick(R.id.horizontalInline)
    public void launchHorizontalInline() {
        startActivity(new Intent(this, HorizontalInlineActivity.class));
    }

    @OnClick(R.id.horizontalInlineBehind)
    public void launchHorizontalInlineBehind() {
        startActivity(new Intent(this, HorizontalInlineBehindActivity.class));
    }

    @OnClick(R.id.horizontalInlineWithoutRotation)
    public void launchHorizontalWithoutRotation() {
        startActivity(new Intent(this, HorizontalInlineWithoutRotationActivity.class));
    }

    @OnClick(R.id.vertical)
    public void launchVertical() {
        startActivity(new Intent(this, VerticalActivity.class));
    }

    @OnClick(R.id.enableDisable)
    public void launchEnableDisable() {
        startActivity(new Intent(this, EnableDisableActivity.class));
    }

    @OnClick(R.id.stackChange)
    public void launchStackChange() {
        startActivity(new Intent(this, StackChangeActivity.class));
    }

    @OnClick(R.id.wrapContent)
    public void launchWrapContent() {
        startActivity(new Intent(this, HorizontalInlineWrapContentActivity.class));
    }

    @OnClick(R.id.restart)
    public void launchRestart() {
        startActivity(new Intent(this, RestartActivity.class));
    }

    @OnClick(R.id.revert)
    public void launchRevert() {
        startActivity(new Intent(this, RevertActivity.class));
    }

    @OnClick(R.id.infinite)
    public void launchInfinite() {
        startActivity(new Intent(this, InfitiniteActivity.class));
    }

}

Android 技术博客(4):滑动卡片的 view 。_第1张图片

你可能感兴趣的:(Android 技术博客(4):滑动卡片的 view 。)