Search in sources :

Example 1 with DiscreteScrollView

use of com.yarolegovich.discretescrollview.DiscreteScrollView in project DiscreteScrollView by yarolegovich.

the class GalleryActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gallery);
    evaluator = new ArgbEvaluator();
    currentOverlayColor = ContextCompat.getColor(this, R.color.galleryCurrentItemOverlay);
    overlayColor = ContextCompat.getColor(this, R.color.galleryItemOverlay);
    Gallery gallery = Gallery.get();
    List<Image> data = gallery.getData();
    DiscreteScrollView itemPicker = (DiscreteScrollView) findViewById(R.id.item_picker);
    itemPicker.setAdapter(new GalleryAdapter(data));
    itemPicker.setScrollListener(this);
    itemPicker.setOnItemChangedListener(this);
    itemPicker.scrollToPosition(1);
    findViewById(R.id.home).setOnClickListener(this);
    findViewById(R.id.fab_share).setOnClickListener(this);
}
Also used : ArgbEvaluator(android.animation.ArgbEvaluator) DiscreteScrollView(com.yarolegovich.discretescrollview.DiscreteScrollView)

Example 2 with DiscreteScrollView

use of com.yarolegovich.discretescrollview.DiscreteScrollView in project DiscreteScrollView by yarolegovich.

the class DiscreteScrollViewOptions method configureTransitionTime.

public static void configureTransitionTime(DiscreteScrollView scrollView) {
    final BottomSheetDialog bsd = new BottomSheetDialog(scrollView.getContext());
    final TransitionTimeChangeListener timeChangeListener = new TransitionTimeChangeListener(scrollView);
    bsd.setContentView(R.layout.dialog_transition_time);
    defaultPrefs().registerOnSharedPreferenceChangeListener(timeChangeListener);
    bsd.setOnDismissListener(new DialogInterface.OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            defaultPrefs().unregisterOnSharedPreferenceChangeListener(timeChangeListener);
        }
    });
    bsd.findViewById(R.id.dialog_btn_dismiss).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            bsd.dismiss();
        }
    });
    bsd.show();
}
Also used : BottomSheetDialog(android.support.design.widget.BottomSheetDialog) DialogInterface(android.content.DialogInterface) DiscreteScrollView(com.yarolegovich.discretescrollview.DiscreteScrollView) View(android.view.View)

Aggregations

DiscreteScrollView (com.yarolegovich.discretescrollview.DiscreteScrollView)2 ArgbEvaluator (android.animation.ArgbEvaluator)1 DialogInterface (android.content.DialogInterface)1 BottomSheetDialog (android.support.design.widget.BottomSheetDialog)1 View (android.view.View)1