Java Code Examples for androidx.transition.AutoTransition#setDuration()

The following examples show how to use androidx.transition.AutoTransition#setDuration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UCropFragment.java    From EasyPhotos with Apache License 2.0 5 votes vote down vote up
public void setupViews(View view, Bundle args) {
    mActiveWidgetColor = args.getInt(UCrop.Options.EXTRA_UCROP_COLOR_WIDGET_ACTIVE, ContextCompat.getColor(getContext(), R.color.ucrop_color_widget_background));
    mActiveControlsWidgetColor = args.getInt(UCrop.Options.EXTRA_UCROP_COLOR_WIDGET_ACTIVE, ContextCompat.getColor(getContext(), R.color.ucrop_color_widget_active));
    mLogoColor = args.getInt(UCrop.Options.EXTRA_UCROP_LOGO_COLOR, ContextCompat.getColor(getContext(), R.color.ucrop_color_default_logo));
    mShowBottomControls = !args.getBoolean(UCrop.Options.EXTRA_HIDE_BOTTOM_CONTROLS, false);
    mRootViewBackgroundColor = args.getInt(UCrop.Options.EXTRA_UCROP_ROOT_VIEW_BACKGROUND_COLOR, ContextCompat.getColor(getContext(), R.color.ucrop_color_crop_background));

    initiateRootViews(view);
    callback.loadingProgress(true);

    if (mShowBottomControls) {

        ViewGroup wrapper = view.findViewById(R.id.controls_wrapper);
        wrapper.setVisibility(View.VISIBLE);
        wrapper.setBackgroundColor(mRootViewBackgroundColor);
        LayoutInflater.from(getContext()).inflate(R.layout.ucrop_controls, wrapper, true);

        mControlsTransition = new AutoTransition();
        mControlsTransition.setDuration(CONTROLS_ANIMATION_DURATION);

        mWrapperStateAspectRatio = view.findViewById(R.id.state_aspect_ratio);
        mWrapperStateAspectRatio.setOnClickListener(mStateClickListener);
        mWrapperStateRotate = view.findViewById(R.id.state_rotate);
        mWrapperStateRotate.setOnClickListener(mStateClickListener);
        mWrapperStateScale = view.findViewById(R.id.state_scale);
        mWrapperStateScale.setOnClickListener(mStateClickListener);

        mLayoutAspectRatio = view.findViewById(R.id.layout_aspect_ratio);
        mLayoutRotate = view.findViewById(R.id.layout_rotate_wheel);
        mLayoutScale = view.findViewById(R.id.layout_scale_wheel);

        setupAspectRatioWidget(args, view);
        setupRotateWidget(view);
        setupScaleWidget(view);
        setupStatesWrapper(view);
    }
}
 
Example 2
Source File: BottomNavigationMenuView.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
public BottomNavigationMenuView(Context context, AttributeSet attrs) {
  super(context, attrs);
  final Resources res = getResources();
  inactiveItemMaxWidth =
      res.getDimensionPixelSize(R.dimen.design_bottom_navigation_item_max_width);
  inactiveItemMinWidth =
      res.getDimensionPixelSize(R.dimen.design_bottom_navigation_item_min_width);
  activeItemMaxWidth =
      res.getDimensionPixelSize(R.dimen.design_bottom_navigation_active_item_max_width);
  activeItemMinWidth =
      res.getDimensionPixelSize(R.dimen.design_bottom_navigation_active_item_min_width);
  itemHeight = res.getDimensionPixelSize(R.dimen.design_bottom_navigation_height);
  itemTextColorDefault = createDefaultColorStateList(android.R.attr.textColorSecondary);

  set = new AutoTransition();
  set.setOrdering(TransitionSet.ORDERING_TOGETHER);
  set.setDuration(ACTIVE_ANIMATION_DURATION_MS);
  set.setInterpolator(new FastOutSlowInInterpolator());
  set.addTransition(new TextScale());

  onClickListener =
      new OnClickListener() {
        @Override
        public void onClick(View v) {
          final BottomNavigationItemView itemView = (BottomNavigationItemView) v;
          MenuItem item = itemView.getItemData();
          if (!menu.performItemAction(item, presenter, 0)) {
            item.setChecked(true);
          }
        }
      };
  tempChildWidths = new int[BottomNavigationMenu.MAX_ITEM_COUNT];

  ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
 
Example 3
Source File: UCropActivity.java    From EasyPhotos with Apache License 2.0 4 votes vote down vote up
private void setupViews(@NonNull Intent intent) {
    mStatusBarColor = intent.getIntExtra(UCrop.Options.EXTRA_STATUS_BAR_COLOR, ContextCompat.getColor(this, R.color.ucrop_color_statusbar));
    mToolbarColor = intent.getIntExtra(UCrop.Options.EXTRA_TOOL_BAR_COLOR, ContextCompat.getColor(this, R.color.ucrop_color_toolbar));
    mActiveWidgetColor = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_COLOR_WIDGET_ACTIVE, ContextCompat.getColor(this, R.color.ucrop_color_widget_background));
    mActiveControlsWidgetColor = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_COLOR_CONTROLS_WIDGET_ACTIVE, ContextCompat.getColor(this, R.color.ucrop_color_active_controls_color));

    mToolbarWidgetColor = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_WIDGET_COLOR_TOOLBAR, ContextCompat.getColor(this, R.color.ucrop_color_toolbar_widget));
    mToolbarCancelDrawable = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_WIDGET_CANCEL_DRAWABLE, R.drawable.ucrop_ic_cross);
    mToolbarCropDrawable = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_WIDGET_CROP_DRAWABLE, R.drawable.ucrop_ic_done);
    mToolbarTitle = intent.getStringExtra(UCrop.Options.EXTRA_UCROP_TITLE_TEXT_TOOLBAR);
    mToolbarTitle = mToolbarTitle != null ? mToolbarTitle : getResources().getString(R.string.ucrop_label_edit_photo);
    mLogoColor = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_LOGO_COLOR, ContextCompat.getColor(this, R.color.ucrop_color_default_logo));
    mShowBottomControls = !intent.getBooleanExtra(UCrop.Options.EXTRA_HIDE_BOTTOM_CONTROLS, false);
    mRootViewBackgroundColor = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_ROOT_VIEW_BACKGROUND_COLOR, ContextCompat.getColor(this, R.color.ucrop_color_crop_background));

    setupAppBar();
    initiateRootViews();

    if (mShowBottomControls) {

        ViewGroup viewGroup = findViewById(R.id.ucrop_photobox);
        ViewGroup wrapper = viewGroup.findViewById(R.id.controls_wrapper);
        wrapper.setVisibility(View.VISIBLE);
        wrapper.setBackgroundColor(mRootViewBackgroundColor);
        LayoutInflater.from(this).inflate(R.layout.ucrop_controls, wrapper, true);

        mControlsTransition = new AutoTransition();
        mControlsTransition.setDuration(CONTROLS_ANIMATION_DURATION);

        mWrapperStateAspectRatio = findViewById(R.id.state_aspect_ratio);
        mWrapperStateAspectRatio.setOnClickListener(mStateClickListener);
        mWrapperStateRotate = findViewById(R.id.state_rotate);
        mWrapperStateRotate.setOnClickListener(mStateClickListener);
        mWrapperStateScale = findViewById(R.id.state_scale);
        mWrapperStateScale.setOnClickListener(mStateClickListener);

        mLayoutAspectRatio = findViewById(R.id.layout_aspect_ratio);
        mLayoutRotate = findViewById(R.id.layout_rotate_wheel);
        mLayoutScale = findViewById(R.id.layout_scale_wheel);

        setupAspectRatioWidget(intent);
        setupRotateWidget();
        setupScaleWidget();
        setupStatesWrapper();
    }
}
 
Example 4
Source File: UCropActivity.java    From PictureSelector with Apache License 2.0 4 votes vote down vote up
protected void setupViews(@NonNull Intent intent) {
    mStatusBarColor = intent.getIntExtra(UCrop.Options.EXTRA_STATUS_BAR_COLOR, ContextCompat.getColor(this, R.color.ucrop_color_statusbar));
    mToolbarColor = intent.getIntExtra(UCrop.Options.EXTRA_TOOL_BAR_COLOR, ContextCompat.getColor(this, R.color.ucrop_color_toolbar));
    mActiveWidgetColor = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_COLOR_WIDGET_ACTIVE, ContextCompat.getColor(this, R.color.ucrop_color_widget_background));
    mActiveControlsWidgetColor = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_COLOR_CONTROLS_WIDGET_ACTIVE, ContextCompat.getColor(this, R.color.ucrop_color_active_controls_color));

    mToolbarWidgetColor = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_WIDGET_COLOR_TOOLBAR, ContextCompat.getColor(this, R.color.ucrop_color_toolbar_widget));
    mToolbarCancelDrawable = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_WIDGET_CANCEL_DRAWABLE, R.drawable.ucrop_ic_cross);
    mToolbarCropDrawable = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_WIDGET_CROP_DRAWABLE, R.drawable.ucrop_ic_done);
    mToolbarTitle = intent.getStringExtra(UCrop.Options.EXTRA_UCROP_TITLE_TEXT_TOOLBAR);
    mToolbarTitle = mToolbarTitle != null ? mToolbarTitle : getResources().getString(R.string.ucrop_label_edit_photo);
    mLogoColor = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_LOGO_COLOR, ContextCompat.getColor(this, R.color.ucrop_color_default_logo));
    mShowBottomControls = !intent.getBooleanExtra(UCrop.Options.EXTRA_HIDE_BOTTOM_CONTROLS, false);
    mRootViewBackgroundColor = intent.getIntExtra(UCrop.Options.EXTRA_UCROP_ROOT_VIEW_BACKGROUND_COLOR, ContextCompat.getColor(this, R.color.ucrop_color_crop_background));

    setupAppBar();
    initiateRootViews();

    if (mShowBottomControls) {

        ViewGroup viewGroup = findViewById(R.id.ucrop_photobox);
        ViewGroup wrapper = viewGroup.findViewById(R.id.controls_wrapper);
        wrapper.setVisibility(View.VISIBLE);
        wrapper.setBackgroundColor(mRootViewBackgroundColor);
        LayoutInflater.from(this).inflate(R.layout.ucrop_controls, wrapper, true);

        mControlsTransition = new AutoTransition();
        mControlsTransition.setDuration(CONTROLS_ANIMATION_DURATION);

        mWrapperStateAspectRatio = findViewById(R.id.state_aspect_ratio);
        mWrapperStateAspectRatio.setOnClickListener(mStateClickListener);
        mWrapperStateRotate = findViewById(R.id.state_rotate);
        mWrapperStateRotate.setOnClickListener(mStateClickListener);
        mWrapperStateScale = findViewById(R.id.state_scale);
        mWrapperStateScale.setOnClickListener(mStateClickListener);

        mLayoutAspectRatio = findViewById(R.id.layout_aspect_ratio);
        mLayoutRotate = findViewById(R.id.layout_rotate_wheel);
        mLayoutScale = findViewById(R.id.layout_scale_wheel);

        setupAspectRatioWidget(intent);
        setupRotateWidget();
        setupScaleWidget();
        setupStatesWrapper();
    }
}