Example usage for android.support.v4.content ContextCompat getDrawable

List of usage examples for android.support.v4.content ContextCompat getDrawable

Introduction

In this page you can find the example usage for android.support.v4.content ContextCompat getDrawable.

Prototype

public static final Drawable getDrawable(Context context, int i) 

Source Link

Usage

From source file:com.amazon.android.tv.tenfoot.ui.fragments.ContentDetailsFragment.java

private void setupDetailsOverviewRow() {

    Log.d(TAG, "doInBackground");
    if (Helpers.DEBUG) {
        Log.d(TAG, "Selected content is: " + mSelectedContent.toString());
    }/*from   w w w .  j  av a  2 s.  c  om*/
    final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedContent);
    row.setActionsAdapter(new ArrayObjectAdapter(new TenFootActionPresenterSelector()));
    row.setImageDrawable(ContextCompat.getDrawable(getActivity(), android.R.color.transparent));
    int width = Helpers.convertDpToPixel(getActivity().getApplicationContext(), DETAIL_THUMB_WIDTH);
    int height = Helpers.convertDpToPixel(getActivity().getApplicationContext(), DETAIL_THUMB_HEIGHT);
    Glide.with(getActivity()).load(mSelectedContent.getCardImageUrl()).asBitmap()
            .listener(new Helpers.LoggingListener<>()).centerCrop().error(android.R.color.transparent)
            .into(new SimpleTarget<Bitmap>(width, height) {
                @Override
                public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {

                    Log.d(TAG,
                            "content_details_activity_layout overview card image url " + "ready: " + resource);
                    row.setImageBitmap(getActivity(), Helpers.roundCornerImage(getActivity(), resource,
                            getResources().getInteger(R.integer.details_overview_image_corner_radius)));

                    mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());
                }
            });

    updateActions();
    row.setActionsAdapter(mActionAdapter);

    mAdapter.add(row);
}

From source file:com.jun.elephant.ui.topic.details.TopicDetailsActivity.java

private void setDrawableLeft(TextView textView, int resId) {
    Drawable drawable = ContextCompat.getDrawable(this, resId);
    drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
    textView.setCompoundDrawables(drawable, null, null, null);
}

From source file:com.amazon.android.ui.fragments.ErrorDialogFragment.java

/**
 * Creates the action button./*from   ww  w. j  av a  2s.c om*/
 *
 * @param actionLabel The text to be displayed on the action button.
 * @return The instantiated button.
 */
private Button createActionButton(String actionLabel) {

    Button button = new Button(getActivity());
    button.setBackground(ContextCompat.getDrawable(getActivity(), R.drawable.action_button_background));
    button.setText(actionLabel);
    CalligraphyUtils.applyFontToTextView(getActivity(), button, ConfigurationManager.getInstance(getActivity())
            .getTypefacePath(ConfigurationConstants.REGULAR_FONT));

    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    int margin = (int) getResources().getDimension(R.dimen.error_button_side_margin);
    params.setMargins(margin, 0, margin, 0);
    button.setLayoutParams(params);

    button.setTextColor(
            ContextCompat.getColorStateList(getActivity(), R.color.action_button_text_color_selector));
    button.setFocusable(true);
    button.setFocusableInTouchMode(true);
    button.setNextFocusDownId(button.getId());
    button.setNextFocusUpId(button.getId());

    button.setBackground(ContextCompat.getDrawable(getActivity(), R.drawable.action_button_background));

    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            mListener.doButtonClick(ErrorDialogFragment.this,
                    ErrorUtils.getErrorButtonType(ErrorDialogFragment.this.getActivity(),
                            (((TextView) v).getText()).toString()),
                    (ErrorUtils.ERROR_CATEGORY) getArguments().get(ARG_ERROR_CATEGORY));
        }
    });

    return button;
}

From source file:com.github.topbottomsnackbar.TBSnackbar.java

public TBSnackbar setIconRight(@DrawableRes int drawableRes, float sizeDp) {
    final TextView tv = mView.getMessageView();
    Drawable drawable = ContextCompat.getDrawable(mContext, drawableRes);
    if (drawable != null) {
        drawable = fitDrawable(drawable, (int) convertDpToPixel(sizeDp, mContext));
    } else {/*  w ww.java 2 s .c  om*/
        throw new IllegalArgumentException("resource_id is not a valid drawable!");
    }
    final Drawable[] compoundDrawables = tv.getCompoundDrawables();
    tv.setCompoundDrawables(compoundDrawables[0], compoundDrawables[1], drawable, compoundDrawables[3]);
    return this;
}

From source file:com.amsterdam.marktbureau.makkelijkemarkt.DagvergunningFragment.java

/**
 * Initialize the layout and it's view elements
 * @return the fragments view//from  w w  w . j  a  va 2s .c o  m
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // get the dagvergunning fragment
    View view = inflater.inflate(R.layout.dagvergunning_fragment, container, false);

    // bind the elements to the view
    ButterKnife.bind(this, view);

    // create the tabs in the tablayout
    mTabLayout.addTab(mTabLayout.newTab().setText(getString(R.string.koopman)));
    mTabLayout.addTab(mTabLayout.newTab().setText(getString(R.string.product)));
    mTabLayout.addTab(mTabLayout.newTab().setText(getString(R.string.overzicht)));
    mTabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
        /**
         * When selecting a tab change the related fragment in the viewpager
         * @param tab the selected tab
         */
        @Override
        public void onTabSelected(TabLayout.Tab tab) {

            // switch to the new tab
            switchTab(tab.getPosition());

            // prevent the keyboard from popping up on pager fragment load
            Utility.hideKeyboard(getActivity());
        }

        @Override
        public void onTabUnselected(TabLayout.Tab tab) {
        }

        @Override
        public void onTabReselected(TabLayout.Tab tab) {
        }
    });

    // create progress dialog for loading the sollicitaties
    mGetSollicitatiesProcessDialog = new ProgressDialog(getContext());
    mGetSollicitatiesProcessDialog.setIndeterminate(true);
    mGetSollicitatiesProcessDialog
            .setIndeterminateDrawable(ContextCompat.getDrawable(getContext(), R.drawable.progressbar_circle));
    mGetSollicitatiesProcessDialog.setMessage(getString(R.string.notice_sollicitaties_loading) + "...");
    mGetSollicitatiesProcessDialog.setCancelable(false);

    // create progress dialog for loading the vervangers
    mGetVervangersProcessDialog = new ProgressDialog(getContext());
    mGetVervangersProcessDialog.setIndeterminate(true);
    mGetVervangersProcessDialog
            .setIndeterminateDrawable(ContextCompat.getDrawable(getContext(), R.drawable.progressbar_circle));
    mGetVervangersProcessDialog.setMessage(getString(R.string.notice_vervangers_loading) + "...");
    mGetVervangersProcessDialog.setCancelable(false);

    // create new viewpager fragments or restore them from saved state
    if (savedInstanceState == null) {
        mKoopmanFragment = new DagvergunningFragmentKoopman();
        mProductFragment = new DagvergunningFragmentProduct();
        mOverzichtFragment = new DagvergunningFragmentOverzicht();
    } else {
        mCurrentTab = savedInstanceState.getInt(CURRENT_TAB);
        mKoopmanFragment = (DagvergunningFragmentKoopman) getChildFragmentManager()
                .getFragment(savedInstanceState, KOOPMAN_FRAGMENT_TAG);
        mProductFragment = (DagvergunningFragmentProduct) getChildFragmentManager()
                .getFragment(savedInstanceState, PRODUCT_FRAGMENT_TAG);
        mOverzichtFragment = (DagvergunningFragmentOverzicht) getChildFragmentManager()
                .getFragment(savedInstanceState, OVERZICHT_FRAGMENT_TAG);
    }

    // create the fragment pager adapter
    DagvergunningFragmentPagerAdapter pagerAdapter = new DagvergunningFragmentPagerAdapter(
            getChildFragmentManager(), mTabLayout.getTabCount(), mKoopmanFragment, mProductFragment,
            mOverzichtFragment);

    // set the fragment pager adapter and add a pagechange listener to update the tab selection
    // important: set the offscreenpagelimit to the amount of fragments we are using minus 1 (the
    // currently active fragment) this makes sure all fragments in the viewpager are attached to
    // the fragmentmanager and can be referenced
    mViewPager.setOffscreenPageLimit(pagerAdapter.getCount() - 1);
    mViewPager.setAdapter(pagerAdapter);
    mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabLayout));

    // disable upper-casing the wizard menu buttons
    mWizardPreviousButton.setTransformationMethod(null);
    mWizardNextButton.setTransformationMethod(null);

    // create the save progress dialog
    mProgressDialog = new ProgressDialog(getContext());
    mProgressDialog.setIndeterminate(true);
    mProgressDialog
            .setIndeterminateDrawable(ContextCompat.getDrawable(getContext(), R.drawable.progressbar_circle));
    mProgressDialog.setMessage(getString(R.string.notice_dagvergunning_saving) + "...");
    mProgressDialog.setCancelable(false);

    return view;
}

From source file:com.andfchat.frontend.activities.ChatScreen.java

private void setupActionBar() {
    actionBar = new QuickActionBar(this, R.layout.qa_dialog_custom);
    actionBar.setAlignment(PopUpAlignment.BOTTOM);

    ///*from  w  ww . java  2 s . c om*/
    // Show description
    //
    ActionItem showDescription = new ActionItem(getString(R.string.channel_description),
            ContextCompat.getDrawable(this, R.drawable.ic_description));
    showDescription.setQuickActionClickListener(new QuickActionOnClickListener() {

        @Override
        public void onClick(ActionItem item, View view) {
            showDescription();
        }
    });

    showDescription.setQuickActionOnOpenListener(new QuickActionOnOpenListener() {

        @Override
        public void onOpen(ActionItem item) {
            Chatroom chat = chatroomManager.getActiveChat();

            if (chat.isPrivateChat() || chat.isSystemChat()) {
                item.setVisibility(View.GONE);
            } else {
                item.setVisibility(View.VISIBLE);
            }
        }
    });
    actionBar.addActionItem(showDescription);

    //
    // Export active chatFragment
    //
    ActionItem exportActiveChat = new ActionItem(getString(R.string.export_text),
            ContextCompat.getDrawable(this, R.drawable.ic_export));
    exportActiveChat.setQuickActionClickListener(new QuickActionOnClickListener() {

        @Override
        public void onClick(ActionItem item, View view) {
            exportChat();
        }
    });

    exportActiveChat.setQuickActionOnOpenListener(new QuickActionOnOpenListener() {

        @Override
        public void onOpen(ActionItem item) {
            Chatroom chat = chatroomManager.getActiveChat();
            item.setEnabled(chat.isSystemChat() == false);
        }
    });
    actionBar.addActionItem(exportActiveChat);

    actionButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Chatroom chat = chatroomManager.getActiveChat();

            if (!chat.isSystemChat()) {
                actionBar.show(actionButton);
            }
        }
    });

    //
    // Post Ad
    //
    ActionItem postAd = new ActionItem(getString(R.string.post_ad_text),
            ContextCompat.getDrawable(this, R.drawable.ic_post_ad));
    postAd.setQuickActionClickListener(new QuickActionOnClickListener() {

        @Override
        public void onClick(ActionItem item, View view) {
            inputFragment.sendTextAsAd();
        }
    });

    postAd.setQuickActionOnOpenListener(new QuickActionOnOpenListener() {

        @Override
        public void onOpen(ActionItem item) {
            Chatroom chat = chatroomManager.getActiveChat();
            if (chat.isChannel()) {
                item.setVisibility(View.VISIBLE);
            } else {
                item.setVisibility(View.GONE);
            }
        }
    });
    actionBar.addActionItem(postAd);

    //
    // Post Ad
    //
    ActionItem showProfile = new ActionItem(getString(R.string.show_profile),
            ContextCompat.getDrawable(this, R.drawable.ic_info)); //was getResources.getDrawable
    showProfile.setQuickActionClickListener(new QuickActionOnClickListener() {

        @Override
        public void onClick(ActionItem item, View view) {
            Chatroom chat = chatroomManager.getActiveChat();
            Intent browserIntent = new Intent(Intent.ACTION_VIEW,
                    Uri.parse("http://www.f-list.net/c/" + chat.getCharacters().get(0).getName())); //was https
            startActivity(browserIntent);
        }
    });

    //
    // Show Profile
    //
    showProfile.setQuickActionOnOpenListener(new QuickActionOnOpenListener() {

        @Override
        public void onOpen(ActionItem item) {
            Chatroom chat = chatroomManager.getActiveChat();
            if (chat.isPrivateChat()) {
                item.setVisibility(View.VISIBLE);
            } else {
                item.setVisibility(View.GONE);
            }
        }
    });
    actionBar.addActionItem(showProfile);

    //
    // Leave active chatFragment
    //
    final ActionItem leaveActiveChat = new ActionItem(getString(R.string.leave_channel),
            ContextCompat.getDrawable(this, R.drawable.ic_leave));
    leaveActiveChat.setQuickActionClickListener(new QuickActionOnClickListener() {

        @Override
        public void onClick(ActionItem item, View view) {
            leaveActiveChat();
        }
    });

    leaveActiveChat.setQuickActionOnOpenListener(new QuickActionOnOpenListener() {

        @Override
        public void onOpen(ActionItem item) {
            Chatroom chat = chatroomManager.getActiveChat();
            if (chat.isCloseable()) {
                item.setVisibility(View.VISIBLE);
            } else {
                item.setVisibility(View.GONE);
            }
        }
    });
    actionBar.addActionItem(leaveActiveChat);

    //
    // Leave active chatFragment
    //
    final CheckActionItem showAdTexts = new CheckActionItem(getString(R.string.show_ads),
            ContextCompat.getDrawable(this, R.drawable.ic_post_ad));
    showAdTexts.setQuickActionClickListener(new QuickActionOnClickListener() {

        @Override
        public void onClick(ActionItem item, View view) {
            Chatroom chat = chatroomManager.getActiveChat();
            boolean value = !chat.getShowAdText();
            chat.setShowAdText(value);
            // Refresh Chat
            chatFragment.onEvent(chat, ChatroomEventType.ACTIVE);
        }
    });

    showAdTexts.setQuickActionOnOpenListener(new QuickActionOnOpenListener() {

        @Override
        public void onOpen(ActionItem item) {
            Chatroom chat = chatroomManager.getActiveChat();
            // Show only in channel
            if (chat.isChannel() && chat.isSystemChat() == false) {
                item.setVisibility(View.VISIBLE);
            } else {
                item.setVisibility(View.GONE);
            }

            if (chat.getShowAdText()) {
                showAdTexts.setSelected(true);
            } else {
                showAdTexts.setSelected(false);
            }
        }
    });
    actionBar.addActionItem(showAdTexts);

    //
    // Leave active chatFragment
    // TODO Convert to being long-press action, rather than QuickActionBar item
    //
    final CheckActionItem showProfilePic = new CheckActionItem(getString(R.string.show_avatar),
            ContextCompat.getDrawable(this, R.drawable.avatar));
    showProfilePic.setQuickActionClickListener(new QuickActionOnClickListener() {

        @Override
        public void onClick(ActionItem item, View view) {
            Chatroom chat = chatroomManager.getActiveChat();
            boolean value = !chat.getShowAvatar();
            chat.setShowAvatar(value);
            // Refresh Chat
            channelList.onEvent(chat, ChatroomEventType.ACTIVE);
        }
    });

    showProfilePic.setQuickActionOnOpenListener(new QuickActionOnOpenListener() {

        @Override
        public void onOpen(ActionItem item) {
            Chatroom chat = chatroomManager.getActiveChat();
            // Show only in channel
            if (chat.isPrivateChat()) {
                item.setVisibility(View.VISIBLE);
            } else {
                item.setVisibility(View.GONE);
            }

            if (chat.getShowAvatar()) {
                showProfilePic.setSelected(true);
            } else {
                showProfilePic.setSelected(false);
            }
        }
    });
    actionBar.addActionItem(showProfilePic);
}

From source file:com.bvhloc.numpicker.widget.NumberPicker.java

public NumberPicker(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs);

    mStart = DEFAULT_START;/*from   w ww . j a v a2s . c  om*/
    mEnd = DEFAULT_END;
    mCurrent = mStart;

    boolean vertical = true;
    int displayedValues = 0;

    if (attrs != null && !isInEditMode()) {
        // this crashes in edit mode (?!)
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.NumberPicker);

        mStart = a.getInt(R.styleable.NumberPicker_rangeStart, DEFAULT_START);
        mEnd = a.getInt(R.styleable.NumberPicker_rangeEnd, DEFAULT_END);
        mSpeed = a.getInt(R.styleable.NumberPicker_speed, (int) mSpeed);
        mSpeedUp = mSpeed;
        mCurrent = a.getInt(R.styleable.NumberPicker_current, mCurrent);

        mNumColor = a.getColor(R.styleable.NumberPicker_numColor,
                ContextCompat.getColor(context, android.R.color.primary_text_light));
        mNumBackground = a.getDrawable(R.styleable.NumberPicker_numBackground);
        mNumSize = a.getDimension(R.styleable.NumberPicker_numSize, mNumSize);
        mNumHorizontalPadding = (int) a.getDimension(R.styleable.NumberPicker_numHorizontalPadding, mNumSize);
        mNumHorizontalPadding = (int) a.getDimension(R.styleable.NumberPicker_numVeticalPadding, mNumSize);
        mIncrementDrawable = a.getDrawable(R.styleable.NumberPicker_incrementDrawable);
        mDecrementDrawable = a.getDrawable(R.styleable.NumberPicker_decrementDrawable);
        mKeyboardInput = a.getBoolean(R.styleable.NumberPicker_keyboardInput, mKeyboardInput);

        String orientation = a.getString(R.styleable.NumberPicker_android_orientation);
        displayedValues = a.getResourceId(R.styleable.NumberPicker_displayedValues, 0);

        if (orientation != null) {
            vertical = !"0".equals(orientation);
        }

        a.recycle();
    } else if (attrs != null && isInEditMode()) {
        // fix orientation attribute for editor
        String orientation = attrs.getAttributeValue("http://schemas.android.com/apk/res/android",
                "orientation");

        if (orientation != null) {
            vertical = !"horizontal".equals(orientation);
        }
    }
    // set a wrong orientation so our own orientation method will perform changes
    super.setOrientation(!vertical ? VERTICAL : HORIZONTAL);
    setOrientation(vertical ? VERTICAL : HORIZONTAL);

    mChangeHandler = new Handler();
    InputFilter inputFilter = new NumberPickerInputFilter();
    mNumberInputFilter = new NumberRangeKeyListener();
    mIncrementButton = (NumberPickerButton) findViewById(R.id.increment);
    mIncrementButton.setOnClickListener(this);
    mIncrementButton.setOnLongClickListener(this);
    mIncrementButton.setNumberPicker(this);
    mDecrementButton = (NumberPickerButton) findViewById(R.id.decrement);
    mDecrementButton.setOnClickListener(this);
    mDecrementButton.setOnLongClickListener(this);
    mDecrementButton.setNumberPicker(this);

    mIncrementButton.setBackground(null);
    mDecrementButton.setBackground(null);
    mIncrementButton.setScaleType(ImageView.ScaleType.FIT_CENTER);
    mDecrementButton.setScaleType(ImageView.ScaleType.FIT_CENTER);

    if (mIncrementDrawable != null) {
        mIncrementButton.setImageDrawable(mIncrementDrawable);
    }
    if (mDecrementDrawable != null) {
        mDecrementButton.setImageDrawable(mDecrementDrawable);
    }

    mText = (EditText) findViewById(R.id.timepicker_input);
    mText.setOnFocusChangeListener(this);
    mText.setFilters(new InputFilter[] { inputFilter });
    mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
    LayoutParams params = (LayoutParams) mText.getLayoutParams();
    params.weight = 1;
    mText.setLayoutParams(params);

    mText.setPadding(mNumHorizontalPadding, mNumVerticalPadding, mNumHorizontalPadding, mNumVerticalPadding);
    mText.setTextSize(mNumSize);
    if (mNumBackground != null) {
        mText.setBackground(mNumBackground);
    } else {
        mText.setBackground(ContextCompat.getDrawable(context, android.R.drawable.edit_text));
    }
    if (!mKeyboardInput) {
        mText.setEnabled(false);
    }
    mText.setTextColor(mNumColor);

    if (!isEnabled()) {
        setEnabled(false);
    }

    if (displayedValues != 0) {
        setDisplayedRange(mStart, displayedValues);
    } else {
        setRange(mStart, mEnd);
    }
}

From source file:com.esri.arcgisruntime.sample.editfeatureattachments.MainActivity.java

/**
 * Create a Layout for callout//from ww  w . jav a  2  s. co  m
 */
private void createCallout() {

    // create content text view for the callout
    mCalloutLayout = new RelativeLayout(getApplicationContext());
    TextView calloutContent = new TextView(getApplicationContext());
    calloutContent.setId(R.id.calloutTextView);
    calloutContent.setTextColor(Color.BLACK);
    calloutContent.setTextSize(18);

    RelativeLayout.LayoutParams relativeParamsBelow = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    relativeParamsBelow.addRule(RelativeLayout.BELOW, calloutContent.getId());

    // create attachment text view for the callout
    TextView calloutAttachment = new TextView(getApplicationContext());
    calloutAttachment.setId(R.id.attchTV);
    calloutAttachment.setTextColor(Color.BLACK);
    calloutAttachment.setTextSize(13);
    calloutContent.setPadding(0, 20, 20, 0);
    calloutAttachment.setLayoutParams(relativeParamsBelow);

    RelativeLayout.LayoutParams relativeParamsRightOf = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    relativeParamsRightOf.addRule(RelativeLayout.RIGHT_OF, calloutAttachment.getId());

    // create image view for the callout
    ImageView imageView = new ImageView(getApplicationContext());
    imageView.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_info));
    imageView.setLayoutParams(relativeParamsRightOf);
    imageView.setOnClickListener(new ImageViewOnclickListener());

    mCalloutLayout.addView(calloutContent);
    mCalloutLayout.addView(imageView);
    mCalloutLayout.addView(calloutAttachment);

}

From source file:com.esri.arcgisruntime.sample.findroute.MainActivity.java

/**
 * Set up the Source, Destination and mRouteSymbol graphics symbol
 *///from ww w  .ja v a2  s .  co  m
private void setupSymbols() {

    mGraphicsOverlay = new GraphicsOverlay();

    //add the overlay to the map view
    mMapView.getGraphicsOverlays().add(mGraphicsOverlay);

    //[DocRef: Name=Picture Marker Symbol Drawable-android, Category=Fundamentals, Topic=Symbols and Renderers]
    //Create a picture marker symbol from an app resource
    BitmapDrawable startDrawable = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.ic_source);
    final PictureMarkerSymbol pinSourceSymbol = new PictureMarkerSymbol(startDrawable);
    pinSourceSymbol.loadAsync();
    //[DocRef: END]
    pinSourceSymbol.addDoneLoadingListener(new Runnable() {
        @Override
        public void run() {
            //add a new graphic as start point
            mSourcePoint = new Point(-117.15083257944445, 32.741123367963446, SpatialReferences.getWgs84());
            Graphic pinSourceGraphic = new Graphic(mSourcePoint, pinSourceSymbol);
            mGraphicsOverlay.getGraphics().add(pinSourceGraphic);
        }
    });
    pinSourceSymbol.setOffsetY(20);
    BitmapDrawable endDrawable = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.ic_destination);
    final PictureMarkerSymbol pinDestinationSymbol = new PictureMarkerSymbol(endDrawable);
    pinDestinationSymbol.loadAsync();
    //[DocRef: END]
    pinDestinationSymbol.addDoneLoadingListener(new Runnable() {
        @Override
        public void run() {
            //add a new graphic as end point
            mDestinationPoint = new Point(-117.15557279683529, 32.703360305883045,
                    SpatialReferences.getWgs84());
            Graphic destinationGraphic = new Graphic(mDestinationPoint, pinDestinationSymbol);
            mGraphicsOverlay.getGraphics().add(destinationGraphic);
        }
    });
    pinDestinationSymbol.setOffsetY(20);

    mRouteSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 5);
}

From source file:com.andremion.floatingnavigationview.FloatingNavigationView.java

private void startCloseAnimations() {

    // Icon/*w  w  w .  j  a v  a 2s. c om*/
    AnimatedVectorDrawable closeIcon = (AnimatedVectorDrawable) ContextCompat.getDrawable(getContext(),
            R.drawable.ic_close_animated);
    mFabView.setImageDrawable(closeIcon);
    closeIcon.start();

    // Unreveal
    int centerX = mFabRect.centerX();
    int centerY = mFabRect.centerY();
    float startRadius = getMaxRadius();
    float endRadius = getMinRadius();
    Animator reveal = ViewAnimationUtils.createCircularReveal(mNavigationView, centerX, centerY, startRadius,
            endRadius);
    reveal.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            detachNavigationView();
        }
    });

    // Fade out
    Animator fade = ObjectAnimator.ofFloat(mNavigationMenuView, View.ALPHA, 1, 0);

    // Animations
    AnimatorSet set = new AnimatorSet();
    set.playTogether(fade, reveal);
    set.start();
}