Search in sources :

Example 1 with CurtainView

use of org.aicaprio.curtainview.CurtainView in project CurtainView by aicaprio.

the class MainActivity method showSample2.

private void showSample2() {
    setContentView(R.layout.activity_sample2);
    final CurtainView curtainView = (CurtainView) findViewById(R.id.cb1);
    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) CurtainView(org.aicaprio.curtainview.CurtainView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) CurtainView(org.aicaprio.curtainview.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 org.aicaprio.curtainview.CurtainView in project CurtainView by aicaprio.

the class MainActivity method showSample1.

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

        @Override
        public void onClick(View v) {
            if (mCurtainView.isAutoScrolling()) {
                showToast("Scrolling is not end...");
            } 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;
            rbOpened.setChecked(isOpened);
            rbClosed.setChecked(!isOpened);
        }
    });
    rgCGravity = (RadioGroup) findViewById(R.id.rgCurtainGravity);
    rgReboundMode = (RadioGroup) findViewById(R.id.rgReboundMode);
    rgCGravity.setOnCheckedChangeListener(mOnCheckedChangeListener);
    rgReboundMode.setOnCheckedChangeListener(mOnCheckedChangeListener);
    rbOpened = (RadioButton) findViewById(R.id.rbOpened);
    rbClosed = (RadioButton) findViewById(R.id.rbClosed);
}
Also used : RadioButton(android.widget.RadioButton) Button(android.widget.Button) GridView(android.widget.GridView) CurtainView(org.aicaprio.curtainview.CurtainView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) ICurtainViewBase(org.aicaprio.curtainview.ICurtainViewBase)

Aggregations

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