Android Open Source - AndroidSwipeLayout Grid View Example






From Project

Back to project page AndroidSwipeLayout.

License

The source code is released under:

MIT License

If you think the Android project AndroidSwipeLayout 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 com.daimajia.swipedemo;
/*from ww  w . j  a v  a 2  s.  c o  m*/
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;

import com.daimajia.swipe.implments.SwipeItemMangerImpl;
import com.daimajia.swipedemo.adapter.GridViewAdapter;

public class GridViewExample extends Activity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gridview);
        final GridView gridView = (GridView)findViewById(R.id.gridview);
        final GridViewAdapter adapter = new GridViewAdapter(this);
        adapter.setMode(SwipeItemMangerImpl.Mode.Multiple);
        gridView.setAdapter(adapter);
        gridView.setSelected(false);
        gridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
                Log.e("onItemLongClick","onItemLongClick:" + position);
                return false;
            }
        });
        gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Log.e("onItemClick","onItemClick:" + position);
            }
        });


        gridView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                Log.e("onItemSelected","onItemSelected:" + position);
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

    }
}




Java Source Code List

com.daimajia.swipe.SimpleSwipeListener.java
com.daimajia.swipe.SwipeLayout.java
com.daimajia.swipe.adapters.ArraySwipeAdapter.java
com.daimajia.swipe.adapters.BaseSwipeAdapter.java
com.daimajia.swipe.adapters.CursorSwipeAdapter.java
com.daimajia.swipe.adapters.SimpleCursorSwipeAdapter.java
com.daimajia.swipe.implments.SwipeItemMangerImpl.java
com.daimajia.swipe.interfaces.SwipeAdapterInterface.java
com.daimajia.swipe.interfaces.SwipeItemMangerInterface.java
com.daimajia.swipedemo.GridViewExample.java
com.daimajia.swipedemo.ListViewExample.java
com.daimajia.swipedemo.MyActivity.java
com.daimajia.swipedemo.NestedExample.java
com.daimajia.swipedemo.adapter.ArraySwipeAdapterSample.java
com.daimajia.swipedemo.adapter.GridViewAdapter.java
com.daimajia.swipedemo.adapter.ListViewAdapter.java