Example usage for android.widget RelativeLayout getContext

List of usage examples for android.widget RelativeLayout getContext

Introduction

In this page you can find the example usage for android.widget RelativeLayout getContext.

Prototype

@ViewDebug.CapturedViewProperty
public final Context getContext() 

Source Link

Document

Returns the context the view is running in, through which it can access the current theme, resources, etc.

Usage

From source file:com.webianks.library.ShowHideAnimation.java

public void animateOut(final RelativeLayout view) {
    Animation anim = AnimationUtils.loadAnimation(view.getContext(), R.anim.pop_out);
    anim.setInterpolator(INTERPOLATOR_OUT);
    anim.setDuration(250L);/*w  ww.  j  a  v a 2 s  . co  m*/
    anim.setAnimationListener(new Animation.AnimationListener() {
        public void onAnimationStart(Animation animation) {
            //ScrollAwareFABBehavior.this.mIsAnimatingOut = true;
        }

        public void onAnimationEnd(Animation animation) {
            //ScrollAwareFABBehavior.this.mIsAnimatingOut = false;
            view.setVisibility(View.GONE);
        }

        @Override
        public void onAnimationRepeat(final Animation animation) {
        }
    });
    view.startAnimation(anim);

}

From source file:com.webianks.library.ShowHideAnimation.java

public void animateIn(RelativeLayout view) {
    view.setVisibility(View.VISIBLE);
    Animation anim = AnimationUtils.loadAnimation(view.getContext(), R.anim.pop_in);
    anim.setDuration(300L);//from   www.j  ava2s.  c  om
    anim.setInterpolator(INTERPOLATOR);
    view.startAnimation(anim);
}

From source file:com.ogunwale.android.app.yaps.ui.PhotosSimpleCursorAdapter.java

private void setLayoutBackground(Context context, RelativeLayout v, byte[] value) {
    Bitmap bitmap = BitmapFactory.decodeByteArray(value, 0, value.length);
    v.setBackground(new BitmapDrawable(v.getContext().getResources(), bitmap));
}

From source file:com.microsoft.office.sfb.healthcare.SkypeCallFragment.java

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mPreviewVideoTextureView = (TextureView) mRootView.findViewById(R.id.selfParticipantVideoView);
    RelativeLayout participantVideoLayout = (RelativeLayout) mRootView
            .findViewById(R.id.participantVideoLayoutId);
    mParticipantVideoSurfaceView = new MMVRSurfaceView(participantVideoLayout.getContext());
    participantVideoLayout.addView(this.mParticipantVideoSurfaceView);
    mListener.onFragmentInteraction(mRootView, getActivity().getString(R.string.callFragmentInflated));
    tryStartVideo();/*from   w  ww.j  a v a2  s .  c o  m*/

}

From source file:org.openhab.habdroid.ui.OpenHABWidgetArrayAdapter.java

private TextView getValueTextView(RelativeLayout widgetView, OpenHABWidget openHABWidget) {
    // Get TextView for widget value and set it's color
    Integer valueColor = openHABWidget.getValueColor();
    TextView valueTextView = (TextView) widgetView.findViewById(R.id.widgetvalue);

    if (valueColor != null && valueTextView != null) {
        Log.d(HABApplication.getLogTag(), String.format("Setting value color to %d", valueColor));
        valueTextView.setTextColor(valueColor);
    } else if (valueTextView != null) {
        TextView defaultTextView = new TextView(widgetView.getContext());
        valueTextView.setTextColor(defaultTextView.getTextColors().getDefaultColor());
    }/*w ww. j  av a2 s. c om*/

    return valueTextView;
}

From source file:org.openhab.habdroid.ui.OpenHABWidgetArrayAdapter.java

private TextView getLabelTextView(RelativeLayout widgetView, OpenHABWidget openHABWidget) {
    // Get TextView for widget label and set it's color
    Integer labelColor = openHABWidget.getLabelColor();
    TextView labelTextView = (TextView) widgetView.findViewById(R.id.widgetlabel);

    if (labelColor != null && labelTextView != null) {
        Log.d(HABApplication.getLogTag(), String.format("Setting label color to %d", labelColor));
        labelTextView.setTextColor(labelColor);
    } else if (labelTextView != null) {
        TextView defaultTextView = new TextView(widgetView.getContext());
        labelTextView.setTextColor(defaultTextView.getTextColors().getDefaultColor());
    }/* w w w .  j  a va 2 s.c  o  m*/

    return labelTextView;
}

From source file:com.sim2dial.dialer.ChatFragment.java

private void displayMessage(final int id, final String message, final String time, final boolean isIncoming,
        final LinphoneChatMessage.State status, final RelativeLayout layout) {
    mHandler.post(new Runnable() {
        @Override//from w  w w . j  a  v a 2s  . c o m
        public void run() {
            BubbleChat bubble = new BubbleChat(layout.getContext(), id, message, null, time, isIncoming, status,
                    previousMessageID);
            if (!isIncoming) {
                lastSentMessageBubble = bubble;
            }
            previousMessageID = id;
            layout.addView(bubble.getView());
            registerForContextMenu(bubble.getView());
        }
    });
}

From source file:com.sim2dial.dialer.ChatFragment.java

private void displayImageMessage(final int id, final Bitmap image, final String time, final boolean isIncoming,
        final LinphoneChatMessage.State status, final RelativeLayout layout) {
    mHandler.post(new Runnable() {
        @Override//from   ww w. j a  v  a 2s  . c o  m
        public void run() {
            BubbleChat bubble = new BubbleChat(layout.getContext(), id, null, image, time, isIncoming, status,
                    previousMessageID);
            if (!isIncoming) {
                lastSentMessageBubble = bubble;
            }
            previousMessageID = id;
            layout.addView(bubble.getView());
            registerForContextMenu(bubble.getView());
        }
    });
}

From source file:com.landenlabs.all_devtool.ConsoleFragment.java

private TextView addTextView(RelativeLayout relLayout, int belowId, int rightId, int widthDp, int heightDp,
        int padLeft) {
    float scale = Resources.getSystem().getDisplayMetrics().density;

    int widthParam = (widthDp != 0) ? dpToPx(widthDp) : RelativeLayout.LayoutParams.WRAP_CONTENT;
    int heightParam = (heightDp != 0) ? dpToPx(heightDp) : RelativeLayout.LayoutParams.WRAP_CONTENT;
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(widthParam, heightParam);

    // params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    if (belowId != 0)
        params.addRule(RelativeLayout.BELOW, belowId);
    if (rightId != 0) {
        if (rightId > 0)
            params.addRule(RelativeLayout.ALIGN_RIGHT, rightId);
        else/* ww  w.j  a va2s. c  o m*/
            params.addRule(RelativeLayout.RIGHT_OF, -rightId);
    }

    // relLayout.setPadding(padLeft,  0,  0,  0);
    params.setMargins(padLeft, 0, 0, 0);

    TextView textView = new TextView(relLayout.getContext());
    textView.setLines(1);
    if (widthDp > 0)
        textView.setMaxWidth(dpToPx(widthDp));

    if (Build.VERSION.SDK_INT >= 17) {
        textView.setId(View.generateViewId());
    } else {
        textView.setId(sNextId++);
    }

    relLayout.addView(textView, params);
    return textView;
}