Example usage for android.view Gravity END

List of usage examples for android.view Gravity END

Introduction

In this page you can find the example usage for android.view Gravity END.

Prototype

int END

To view the source code for android.view Gravity END.

Click Source Link

Document

Push object to x-axis position at the end of its container, not changing its size.

Usage

From source file:com.rbware.github.androidcouchpotato.app.GuidedStepFragment.java

/**
 * Called by Constructor to provide fragment transitions.  The default implementation assigns
 * transitions based on {@link #getUiStyle()}:
 * <ul>/*www  . j av  a2s .c  o  m*/
 * <li> {@link #UI_STYLE_REPLACE} Slide from/to end(right) for enter transition, slide from/to
 * start(left) for exit transition, shared element enter transition is set to ChangeBounds.
 * <li> {@link #UI_STYLE_ENTRANCE} Enter transition is set to slide from both sides, exit
 * transition is same as {@link #UI_STYLE_REPLACE}, no shared element enter transition.
 * <li> {@link #UI_STYLE_ACTIVITY_ROOT} Enter transition is set to null and app should rely on
 * activity transition, exit transition is same as {@link #UI_STYLE_REPLACE}, no shared element
 * enter transition.
 * </ul>
 * <p>
 * The default implementation heavily relies on {@link GuidedActionsStylist} and
 * {@link GuidanceStylist} layout, app may override this method when modifying the default
 * layout of {@link GuidedActionsStylist} or {@link GuidanceStylist}.
 * <p>
 * TIP: because the fragment view is removed during fragment transition, in general app cannot
 * use two Visibility transition together. Workaround is to create your own Visibility
 * transition that controls multiple animators (e.g. slide and fade animation in one Transition
 * class).
 */
protected void onProvideFragmentTransitions() {
    if (Build.VERSION.SDK_INT >= 21) {
        final int uiStyle = getUiStyle();
        if (uiStyle == UI_STYLE_REPLACE) {
            Object enterTransition = TransitionHelper.createFadeAndShortSlide(Gravity.END);
            TransitionHelper.exclude(enterTransition, R.id.guidedstep_background, true);
            TransitionHelper.exclude(enterTransition, R.id.guidedactions_sub_list_background, true);
            TransitionHelper.setEnterTransition(this, enterTransition);

            Object fade = TransitionHelper
                    .createFadeTransition(TransitionHelper.FADE_IN | TransitionHelper.FADE_OUT);
            TransitionHelper.include(fade, R.id.guidedactions_sub_list_background);
            Object changeBounds = TransitionHelper.createChangeBounds(false);
            Object sharedElementTransition = TransitionHelper.createTransitionSet(false);
            TransitionHelper.addTransition(sharedElementTransition, fade);
            TransitionHelper.addTransition(sharedElementTransition, changeBounds);
            TransitionHelper.setSharedElementEnterTransition(this, sharedElementTransition);
        } else if (uiStyle == UI_STYLE_ENTRANCE) {
            if (entranceTransitionType == SLIDE_FROM_SIDE) {
                Object fade = TransitionHelper
                        .createFadeTransition(TransitionHelper.FADE_IN | TransitionHelper.FADE_OUT);
                TransitionHelper.include(fade, R.id.guidedstep_background);
                Object slideFromSide = TransitionHelper.createFadeAndShortSlide(Gravity.END | Gravity.START);
                TransitionHelper.include(slideFromSide, R.id.content_fragment);
                TransitionHelper.include(slideFromSide, R.id.action_fragment_root);
                Object enterTransition = TransitionHelper.createTransitionSet(false);
                TransitionHelper.addTransition(enterTransition, fade);
                TransitionHelper.addTransition(enterTransition, slideFromSide);
                TransitionHelper.setEnterTransition(this, enterTransition);
            } else {
                Object slideFromBottom = TransitionHelper.createFadeAndShortSlide(Gravity.BOTTOM);
                TransitionHelper.include(slideFromBottom, R.id.guidedstep_background_view_root);
                Object enterTransition = TransitionHelper.createTransitionSet(false);
                TransitionHelper.addTransition(enterTransition, slideFromBottom);
                TransitionHelper.setEnterTransition(this, enterTransition);
            }
            // No shared element transition
            TransitionHelper.setSharedElementEnterTransition(this, null);
        } else if (uiStyle == UI_STYLE_ACTIVITY_ROOT) {
            // for Activity root, we don't need enter transition, use activity transition
            TransitionHelper.setEnterTransition(this, null);
            // No shared element transition
            TransitionHelper.setSharedElementEnterTransition(this, null);
        }
        // exitTransition is same for all style
        Object exitTransition = TransitionHelper.createFadeAndShortSlide(Gravity.START);
        TransitionHelper.exclude(exitTransition, R.id.guidedstep_background, true);
        TransitionHelper.exclude(exitTransition, R.id.guidedactions_sub_list_background, true);
        TransitionHelper.setExitTransition(this, exitTransition);
    }
}

From source file:android.support.v17.leanback.app.GuidedStepFragment.java

/**
 * Called by Constructor to provide fragment transitions.  The default implementation assigns
 * transitions based on {@link #getUiStyle()}:
 * <ul>/*from   ww w. j  a  v  a 2s.c  om*/
 * <li> {@link #UI_STYLE_REPLACE} Slide from/to end(right) for enter transition, slide from/to
 * start(left) for exit transition, shared element enter transition is set to ChangeBounds.
 * <li> {@link #UI_STYLE_ENTRANCE} Enter transition is set to slide from both sides, exit
 * transition is same as {@link #UI_STYLE_REPLACE}, no shared element enter transition.
 * <li> {@link #UI_STYLE_ACTIVITY_ROOT} Enter transition is set to null and app should rely on
 * activity transition, exit transition is same as {@link #UI_STYLE_REPLACE}, no shared element
 * enter transition.
 * </ul>
 * <p>
 * The default implementation heavily relies on {@link GuidedActionsStylist} and
 * {@link GuidanceStylist} layout, app may override this method when modifying the default
 * layout of {@link GuidedActionsStylist} or {@link GuidanceStylist}.
 * <p>
 * TIP: because the fragment view is removed during fragment transition, in general app cannot
 * use two Visibility transition together. Workaround is to create your own Visibility
 * transition that controls multiple animators (e.g. slide and fade animation in one Transition
 * class).
 */
protected void onProvideFragmentTransitions() {
    if (Build.VERSION.SDK_INT >= 21) {
        final int uiStyle = getUiStyle();
        if (uiStyle == UI_STYLE_REPLACE) {
            Object enterTransition = TransitionHelper.createFadeAndShortSlide(Gravity.END);
            TransitionHelper.exclude(enterTransition, R.id.guidedstep_background, true);
            TransitionHelper.setEnterTransition(this, enterTransition);

            Object changeBounds = TransitionHelper.createChangeBounds(false);
            TransitionHelper.setSharedElementEnterTransition(this, changeBounds);
        } else if (uiStyle == UI_STYLE_ENTRANCE) {
            if (entranceTransitionType == SLIDE_FROM_SIDE) {
                Object fade = TransitionHelper
                        .createFadeTransition(TransitionHelper.FADE_IN | TransitionHelper.FADE_OUT);
                TransitionHelper.include(fade, R.id.guidedstep_background);
                Object slideFromSide = TransitionHelper.createFadeAndShortSlide(Gravity.END | Gravity.START);
                TransitionHelper.include(slideFromSide, R.id.content_fragment);
                TransitionHelper.include(slideFromSide, R.id.action_fragment_root);
                Object enterTransition = TransitionHelper.createTransitionSet(false);
                TransitionHelper.addTransition(enterTransition, fade);
                TransitionHelper.addTransition(enterTransition, slideFromSide);
                TransitionHelper.setEnterTransition(this, enterTransition);
            } else {
                Object slideFromBottom = TransitionHelper.createFadeAndShortSlide(Gravity.BOTTOM);
                TransitionHelper.include(slideFromBottom, R.id.guidedstep_background_view_root);
                Object enterTransition = TransitionHelper.createTransitionSet(false);
                TransitionHelper.addTransition(enterTransition, slideFromBottom);
                TransitionHelper.setEnterTransition(this, enterTransition);
            }
            // No shared element transition
            TransitionHelper.setSharedElementEnterTransition(this, null);
        } else if (uiStyle == UI_STYLE_ACTIVITY_ROOT) {
            // for Activity root, we dont need enter transition, use activity transition
            TransitionHelper.setEnterTransition(this, null);
            // No shared element transition
            TransitionHelper.setSharedElementEnterTransition(this, null);
        }
        // exitTransition is same for all style
        Object exitTransition = TransitionHelper.createFadeAndShortSlide(Gravity.START);
        TransitionHelper.exclude(exitTransition, R.id.guidedstep_background, true);
        TransitionHelper.setExitTransition(this, exitTransition);
    }
}

From source file:com.maskyn.fileeditorpro.activity.MainActivity.java

public void OpenSettings(View view) {
    mDrawerLayout.closeDrawer(Gravity.START);
    mDrawerLayout.openDrawer(Gravity.END);
}

From source file:com.mishiranu.dashchan.ui.navigator.DrawerForm.java

private View makeHeader(ViewGroup parent, boolean button, float density) {
    if (C.API_LOLLIPOP) {
        LinearLayout linearLayout = new LinearLayout(context);
        linearLayout.setOrientation(LinearLayout.VERTICAL);
        View divider = makeSimpleDivider();
        int paddingTop = divider.getPaddingBottom();
        divider.setPadding(divider.getPaddingLeft(), divider.getPaddingTop(), divider.getPaddingRight(), 0);
        linearLayout.addView(divider, LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        LinearLayout linearLayout2 = new LinearLayout(context);
        linearLayout2.setOrientation(LinearLayout.HORIZONTAL);
        linearLayout.addView(linearLayout2, LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        TextView textView = makeCommonTextView(true);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(0, (int) (32f * density), 1);
        layoutParams.setMargins((int) (16f * density), paddingTop, (int) (16f * density), (int) (8f * density));
        linearLayout2.addView(textView, layoutParams);
        ViewHolder holder = new ViewHolder();
        holder.text = textView;/*w w w. j  a  v a2s  .  c o m*/
        if (button) {
            ImageView imageView = new ImageView(context);
            imageView.setScaleType(ImageView.ScaleType.CENTER);
            imageView.setBackgroundResource(ResourceUtils.getResourceId(context,
                    android.R.attr.borderlessButtonStyle, android.R.attr.background, 0));
            imageView.setOnClickListener(headerButtonListener);
            imageView.setImageAlpha(0x5e);
            int size = (int) (48f * density);
            layoutParams = new LinearLayout.LayoutParams(size, size);
            layoutParams.rightMargin = (int) (4f * density);
            linearLayout2.addView(imageView, layoutParams);
            holder.extra = imageView;
            holder.icon = imageView;
        }
        linearLayout.setTag(holder);
        return linearLayout;
    } else {
        View view = LayoutInflater.from(context)
                .inflate(ResourceUtils.getResourceId(context, android.R.attr.preferenceCategoryStyle,
                        android.R.attr.layout, android.R.layout.preference_category), parent, false);
        ViewHolder holder = new ViewHolder();
        holder.text = (TextView) view.findViewById(android.R.id.title);
        if (button) {
            int measureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
            view.measure(measureSpec, measureSpec);
            int size = view.getMeasuredHeight();
            if (size == 0) {
                size = (int) (32f * density);
            }
            FrameLayout frameLayout = new FrameLayout(context);
            frameLayout.addView(view);
            view = frameLayout;
            ImageView imageView = new ImageView(context);
            imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
            int padding = (int) (4f * density);
            imageView.setPadding(padding, padding, padding, padding);
            frameLayout.addView(imageView,
                    new FrameLayout.LayoutParams((int) (48f * density), size, Gravity.END));
            View buttonView = new View(context);
            buttonView.setBackgroundResource(
                    ResourceUtils.getResourceId(context, android.R.attr.selectableItemBackground, 0));
            buttonView.setOnClickListener(headerButtonListener);
            frameLayout.addView(buttonView, FrameLayout.LayoutParams.MATCH_PARENT,
                    FrameLayout.LayoutParams.MATCH_PARENT);
            holder.extra = buttonView;
            holder.icon = imageView;
        }
        view.setTag(holder);
        return view;
    }
}