Android Open Source - android-cardview Main Activity






From Project

Back to project page android-cardview.

License

The source code is released under:

Apache License

If you think the Android project android-cardview listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.pecheur.card;
//from  w w  w . j a  va  2s. co m
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import de.pecheur.card.CardView.OnItemSettleListener;


public class MainActivity extends Activity implements OnItemSettleListener {
  HelloWorldAdapter mAdapter;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    CardView cardView = (CardView) findViewById(R.id.cardView);
    
    // set empty view
    View emptyView = findViewById(R.id.emptyView);
    cardView.setEmptyView( emptyView);
    
    // set adapter
    mAdapter = new HelloWorldAdapter(this);
    cardView.setAdapter(mAdapter);
    
    // set settle listener
    cardView.setOnItemSettleListener(this);
  }

  @Override
  public void onItemUp(AdapterView<?> parent, View view, int position, long id) {
    // each card, which was moved up, is removed
    // from the stack.
    mAdapter.remove(position);
  }

  @Override
  public void onItemDown(AdapterView<?> parent, View view, int position,
      long id) {
    // TODO Auto-generated method stub
    
  }

}




Java Source Code List

de.pecheur.card.AbsStack.java
de.pecheur.card.CardUtil.java
de.pecheur.card.CardView.java
de.pecheur.card.HelloWorldAdapter.java
de.pecheur.card.MainActivity.java