Search in sources :

Example 1 with CurtainView

use of com.movitech.aicaprio.CurtainView in project CurtainView by aicaprio.

the class SampleActivity method showSample2.

private void showSample2() {
    setContentView(R.layout.activity_sample2);
    final CurtainView curtainView = (CurtainView) findViewById(R.id.cv1);
    final ImageView iv1 = (ImageView) findViewById(R.id.iv1);
    final GridView gv1 = (GridView) findViewById(R.id.gv1);
    final List<Map<String, Integer>> data = getData();
    gv1.setAdapter(new SimpleAdapter(this, data, R.layout.item_numbers, new String[] { TEXT_TAG }, new int[] { R.id.item_tvNum }));
    gv1.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            showToast(data.get(position).get(TEXT_TAG) + " clicked");
        }
    });
    iv1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            curtainView.toggleStatus();
        }
    });
    curtainView.setScrollerInterpolator(new BounceInterpolator());
    curtainView.post(new Runnable() {

        @Override
        public void run() {
            curtainView.setCurtainGravityAndFixedValue(null, iv1.getHeight());
        }
    });
}
Also used : BounceInterpolator(android.view.animation.BounceInterpolator) SimpleAdapter(android.widget.SimpleAdapter) GridView(android.widget.GridView) ImageView(android.widget.ImageView) CurtainView(com.movitech.aicaprio.CurtainView) View(android.view.View) AdapterView(android.widget.AdapterView) CurtainView(com.movitech.aicaprio.CurtainView) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView) GridView(android.widget.GridView) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with CurtainView

use of com.movitech.aicaprio.CurtainView in project CurtainView by aicaprio.

the class SampleActivity method showSample1.

private void showSample1() {
    setContentView(R.layout.activity_sample);
    mCurtainView = (CurtainView) findViewById(R.id.cv1);
    final Button btn1 = (Button) findViewById(R.id.btn1);
    btn1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (mCurtainView.isAutoScrolling()) {
                showToast();
            } else {
                mCurtainView.toggleStatus();
            }
        }
    });
    mCurtainView.setAutoScrollingListener(new ICurtainViewBase.AutoScrollingListener() {

        @Override
        public void onScrolling(int currValue, int currVelocity, int startValue, int finalValue) {
        }

        @Override
        public void onScrollFinished() {
            boolean isOpened = mCurtainView.getCurtainStatus() == ICurtainViewBase.CurtainStatus.OPENED;
            Button checkedBtn = mCurtainView.getCurtainStatus() == ICurtainViewBase.CurtainStatus.OPENED ? btnOpened : btnClosed;
            setChecked(checkedBtn);
        }
    });
    findViewById(R.id.btnCGravityLeft).setOnClickListener(mOnGravityChangedListener);
    findViewById(R.id.btnCGravityTop).setOnClickListener(mOnGravityChangedListener);
    findViewById(R.id.btnCGravityRight).setOnClickListener(mOnGravityChangedListener);
    findViewById(R.id.btnCGravityBottom).setOnClickListener(mOnGravityChangedListener);
    findViewById(R.id.btnAlwaysBack).setOnClickListener(mOnReboundModeChangedListener);
    findViewById(R.id.btnHalf).setOnClickListener(mOnReboundModeChangedListener);
    btnOpened = (Button) findViewById(R.id.btnOpened);
    btnClosed = (Button) findViewById(R.id.btnClosed);
}
Also used : Button(android.widget.Button) GridView(android.widget.GridView) ImageView(android.widget.ImageView) CurtainView(com.movitech.aicaprio.CurtainView) View(android.view.View) AdapterView(android.widget.AdapterView) ICurtainViewBase(com.movitech.aicaprio.ICurtainViewBase)

Aggregations

View (android.view.View)2 AdapterView (android.widget.AdapterView)2 GridView (android.widget.GridView)2 ImageView (android.widget.ImageView)2 CurtainView (com.movitech.aicaprio.CurtainView)2 BounceInterpolator (android.view.animation.BounceInterpolator)1 Button (android.widget.Button)1 SimpleAdapter (android.widget.SimpleAdapter)1 ICurtainViewBase (com.movitech.aicaprio.ICurtainViewBase)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1