Example usage for android.graphics.drawable BitmapDrawable BitmapDrawable

List of usage examples for android.graphics.drawable BitmapDrawable BitmapDrawable

Introduction

In this page you can find the example usage for android.graphics.drawable BitmapDrawable BitmapDrawable.

Prototype

private BitmapDrawable(BitmapState state, Resources res) 

Source Link

Usage

From source file:com.appbase.androidquery.callback.BitmapAjaxCallback.java

private static Drawable makeDrawable(ImageView iv, Bitmap bm, float ratio, float anchor) {

    BitmapDrawable bd = null;/* ww w .ja v  a2  s  . c o m*/

    if (ratio > 0) {
        bd = new RatioDrawable(iv.getResources(), bm, iv, ratio, anchor);
    } else {
        bd = new BitmapDrawable(iv.getResources(), bm);
    }

    return bd;

}

From source file:illab.nabal.NabalSimpleDemoActivity.java

/**
 * Set UI corresponding to the selected SNS.
 *///  www. ja va  2s  .c om
private void populateUi(SocialNetwork snsId) {

    String profileName = null;
    String profileStatus = null;
    Bitmap profilePhoto = null;
    String statusLink = null;
    Bitmap bgBitmap = null;

    if (snsId == SocialNetwork.FACEBOOK) {
        profileName = mFbProfileName;
        profileStatus = mFbProfileStatus;
        profilePhoto = mFbProfilePhoto;
        statusLink = mFbStatusLink;
        bgBitmap = mFbBgBitmap;
    } else if (snsId == SocialNetwork.TWITTER) {
        profileName = mTwProfileName;
        profileStatus = mTwProfileStatus;
        profilePhoto = mTwProfilePhoto;
        statusLink = mTwStatusLink;
        bgBitmap = mTwBgBitmap;
    } else if (snsId == SocialNetwork.WEIBO) {
        profileName = mWeProfileName;
        profileStatus = mWeProfileStatus;
        profilePhoto = mWeProfilePhoto;
        statusLink = mWeStatusLink;
        bgBitmap = mWeBgBitmap;
    }

    mEditText3.setText(profileName);
    mEditText2.setText(profileStatus);
    mImgBtn1.setImageBitmap(profilePhoto);

    // if a link exists
    if (StringHelper.isEmpty(statusLink) == false) {
        mImgBtn8.setVisibility(View.VISIBLE);
    } else {
        mImgBtn8.setVisibility(View.INVISIBLE);
    }
    // set background
    if (bgBitmap != null) {
        mBackground.setBackgroundDrawable(new BitmapDrawable(getResources(), bgBitmap));
        mBackground.getBackground().setAlpha(STATUS_THUMBNAIL_BG_ALPHA);
    } else {
        mBackground.setBackgroundDrawable(new BitmapDrawable(getResources(), profilePhoto));
        mBackground.getBackground().setAlpha(DEFAULT_BG_ALPHA);
    }
}

From source file:com.ccz.viewimages.displayingbitmaps.util.ImageWorker.java

private void setImageDrawable(ImageView imageView, Drawable drawable, Bitmap transbitmap) {
    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final drawable
        final TransitionDrawable td = new TransitionDrawable(new Drawable[] {
                new ColorDrawable(mResources.getColor(android.R.color.transparent)), drawable });
        // Set background to loading bitmap
        if (null != transbitmap) {
            imageView.setBackgroundDrawable(new BitmapDrawable(mResources, transbitmap));
        }/*  w ww.j a v  a 2s  .co m*/

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(drawable);
    }
}

From source file:com.luke.lukef.lukeapp.fragments.MapViewFragment.java

/**
 * Handles showing the Calendar pop up, fetching the selected date, calling to fetch
 * submissions again/*from   www.ja v a 2  s  .  c  o m*/
 */
private void showCalendarPicker() {
    // Inflate the popup_layout.xml
    ConstraintLayout viewGroup = (ConstraintLayout) getMainActivity().findViewById(R.id.popup_calendar_root);
    LayoutInflater layoutInflater = (LayoutInflater) getMainActivity()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View layout = layoutInflater.inflate(R.layout.popup_calendar, viewGroup);
    // Some offset to align the popup a bit to the right, and a bit down, relative to button's position.
    //or if popup is on edge display it to the left of the circle
    Display display = getMainActivity().getWindowManager().getDefaultDisplay();
    Point size = new Point(0, 0);
    display.getSize(size);

    int OFFSET_X = 25;
    int OFFSET_Y = 25;

    final DatePicker dP = (DatePicker) layout.findViewById(R.id.popup_calendar_datepicker);

    // Creating the PopupWindow
    final PopupWindow popup = new PopupWindow(getMainActivity());
    popup.setAnimationStyle(android.R.style.Animation_Dialog);
    popup.setContentView(layout);

    popup.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    popup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

    popup.setFocusable(true);
    //gets rid of default background
    popup.setBackgroundDrawable(new BitmapDrawable(getMainActivity().getResources(), (Bitmap) null));
    //popup.setBackgroundDrawable(new BitmapDrawable(getMainActivity().getResources(), (Bitmap) nu));

    // Displaying the popup at the specified location, + offsets.
    popup.showAtLocation(layout, Gravity.NO_GRAVITY, 200 + OFFSET_X, 300 + OFFSET_Y);
    Calendar minDate;
    minDate = Calendar.getInstance();
    this.tempY = minDate.get(Calendar.YEAR);
    this.tempM = minDate.get(Calendar.MONTH);
    this.tempD = minDate.get(Calendar.DAY_OF_MONTH);
    dP.init(minDate.get(Calendar.YEAR), minDate.get(Calendar.MONTH), minDate.get(Calendar.DAY_OF_MONTH),
            new DatePicker.OnDateChangedListener() {
                @Override
                // Months start from 0, so January is month 0
                public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                    tempY = year;
                    tempM = monthOfYear;
                    tempD = dayOfMonth;
                    Log.e(TAG, "onDateChanged: selected " + tempD + " " + tempM + " " + tempY);
                }
            });
    ImageButton okButton = (ImageButton) layout.findViewById(R.id.popup_calendar_accept);
    ImageButton cancelButton = (ImageButton) layout.findViewById(R.id.popup_calendar_cancel);
    okButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Calendar calendar = Calendar.getInstance();
            calendar.set(tempY, tempM, tempD, 1, 0);
            Log.e(TAG, "onClick: calendar time in ms " + calendar.getTimeInMillis());
            // clear items from clustermanager and submissionMarkerList, as all new submissions
            // need to be fetched based on the selected date
            clusterManager.clearItems();
            submissionMarkerIdList.clear();
            addAdminMarkersToMap();
            setMinDateInMs(calendar.getTimeInMillis());
            popup.dismiss();
        }
    });

    cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            setMinDateInMs(0);
            popup.dismiss();

        }
    });
}

From source file:com.mobicage.rogerthat.plugins.friends.ServiceActionMenuActivity.java

private void populateScreen(final ServiceMenu menu) {
    menuBrandingHash = menu.branding;// w w w .  j  av  a 2s.  c o m
    final FriendsPlugin friendsPlugin = mService.getPlugin(FriendsPlugin.class);
    final MessagingPlugin messagingPlugin = mService.getPlugin(MessagingPlugin.class);
    final FriendStore store = friendsPlugin.getStore();

    List<Cell> usedCells = new ArrayList<Cell>();
    if (page == 0) {
        addAboutHandler(usedCells, menu.aboutLabel);
        addHistoryHandler(usedCells, store, menu.messagesLabel);
        addCallHandler(menu, usedCells, menu.callLabel);
        if (CloudConstants.isYSAAA()) {
            addScanHandler(menu, usedCells, null);
        } else {
            addShareHandler(menu, usedCells, menu.shareLabel);
        }
    }
    boolean[] rows = new boolean[] { false, false, false };
    if (page == 0)
        rows[0] = true;
    for (final ServiceMenuItem item : menu.itemList) {
        rows[(int) item.coords[1]] = true;
        final Cell cell = cells[(int) item.coords[0]][(int) item.coords[1]];
        View.OnClickListener onClickListener = new SafeViewOnClickListener() {
            @Override
            public void safeOnClick(View v) {
                pressMenuItem(menu, messagingPlugin, store, item);
            }
        };
        ((View) cell.icon.getParent()).setOnClickListener(onClickListener);
        cell.icon.setImageBitmap(BitmapFactory.decodeByteArray(item.icon, 0, item.icon.length));
        cell.icon.setVisibility(View.VISIBLE);
        cell.label.setText(item.label);
        cell.label.setVisibility(View.VISIBLE);
        usedCells.add(cell);
    }
    for (int i = 2; i >= 0; i--) {
        if (rows[i])
            break;
        tableRows[i].setVisibility(View.GONE);
    }
    boolean showBranded = false;
    boolean useDarkScheme = false;
    Integer menuItemColor = null;
    if (menu.branding != null) {
        try {
            BrandingMgr brandingMgr = messagingPlugin.getBrandingMgr();
            Friend friend = store.getExistingFriend(email);
            if (brandingMgr.isBrandingAvailable(menu.branding)) {
                BrandingResult br = brandingMgr.prepareBranding(menu.branding, friend, false);
                WebSettings settings = branding.getSettings();
                settings.setJavaScriptEnabled(false);
                settings.setBlockNetworkImage(false);
                branding.setVisibility(View.VISIBLE);
                branding.setVerticalScrollBarEnabled(false);

                final int displayWidth = UIUtils.getDisplayWidth(this);
                final int calculatedHeight = BrandingMgr.calculateHeight(br, displayWidth);
                final long start = System.currentTimeMillis();
                branding.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {
                    @Override
                    public boolean onPreDraw() {
                        int height = branding.getMeasuredHeight();
                        if (height > calculatedHeight * 90 / 100 || System.currentTimeMillis() - start > 3000) {
                            if (calculatedHeight > 0) {
                                setBrandingHeight(height);
                            } else {
                                mService.postDelayedOnUIHandler(new SafeRunnable() {
                                    @Override
                                    protected void safeRun() throws Exception {
                                        setBrandingHeight(branding.getMeasuredHeight());
                                    }
                                }, 100);
                            }
                            branding.getViewTreeObserver().removeOnPreDrawListener(this);
                        }
                        return false;
                    }
                });
                branding.loadUrl("file://" + br.file.getAbsolutePath());

                if (br.color != null) {
                    branding.setBackgroundColor(br.color);
                    activity.setBackgroundColor(br.color);
                }
                if (br.scheme == ColorScheme.dark) {
                    for (Cell cell : usedCells) {
                        cell.label.setTextColor(darkSchemeTextColor);
                        cell.label.setShadowLayer(2, 1, 1, Color.BLACK);
                    }
                    useDarkScheme = true;
                }
                menuItemColor = br.menuItemColor;

                final ImageView watermarkView = (ImageView) findViewById(R.id.watermark);
                if (br.watermark != null) {
                    BitmapDrawable watermark = new BitmapDrawable(getResources(),
                            BitmapFactory.decodeFile(br.watermark.getAbsolutePath()));
                    watermark.setGravity(Gravity.BOTTOM | Gravity.RIGHT);

                    watermarkView.setImageDrawable(watermark);
                    final LayoutParams layoutParams = watermarkView.getLayoutParams();
                    layoutParams.width = layoutParams.height = displayWidth;
                } else {
                    watermarkView.setImageDrawable(null);
                }

                showBranded = true;
            } else {
                friend.actionMenu = menu;
                friend.actionMenu.items = menu.itemList.toArray(new ServiceMenuItemTO[] {});
                brandingMgr.queue(friend);
            }
        } catch (BrandingFailureException e) {
            L.bug("Could not display service action menu with branding.", e);
        }
    }
    if (!showBranded) {
        setNavigationBarVisible(AppConstants.SHOW_NAV_HEADER);
        setNavigationBarTitle(menu.name);
        title.setVisibility(View.GONE);
        title.setText(menu.name);
    }

    for (final Cell cell : usedCells) {
        final View p = (View) cell.icon.getParent();
        final Drawable d = getResources().getDrawable(
                useDarkScheme ? R.drawable.mc_smi_background_light : R.drawable.mc_smi_background_dark);
        p.setBackgroundDrawable(d);
    }

    if (menuItemColor == null)
        menuItemColor = Color.parseColor("#646464");

    for (Cell cell : new Cell[] { cells[0][0], cells[1][0], cells[2][0], cells[3][0] })
        cell.faIcon.setTextColor(menuItemColor);

    if (menu.maxPage > 0) {
        for (int i = 0; i <= menu.maxPage; i++) {
            ImageView bolleke = (ImageView) getLayoutInflater().inflate(R.layout.page, pages, false);
            if (page == i) {
                if (useDarkScheme) {
                    bolleke.setImageResource(R.drawable.current_page_dark);
                } else {
                    bolleke.setImageResource(R.drawable.current_page_light);
                }
            } else {
                if (useDarkScheme) {
                    bolleke.setImageResource(R.drawable.other_page_dark);
                } else {
                    bolleke.setImageResource(R.drawable.other_page_light);
                }
            }
            pages.addView(bolleke);
        }
        pages.setVisibility(View.VISIBLE);
    }
    final int leftPage = page - 1;
    final int rightPage = page + 1;
    final String service = email;
    Slider instance = new Slider(this, this, page == menu.maxPage ? null : new Slider.Swiper() {
        @Override
        public Intent onSwipe() {
            return new Intent(ServiceActionMenuActivity.this, ServiceActionMenuActivity.class)
                    .putExtra(SERVICE_EMAIL, service).putExtra(MENU_PAGE, rightPage);
        }
    }, page == 0 ? null : new Slider.Swiper() {
        @Override
        public Intent onSwipe() {
            return new Intent(ServiceActionMenuActivity.this, ServiceActionMenuActivity.class)
                    .putExtra(SERVICE_EMAIL, service).putExtra(MENU_PAGE, leftPage);
        }
    });
    mGestureScanner = new GestureDetector(this, instance);
}

From source file:cn.com.wo.bitmap.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be 
 * set on the ImageView.//from w w  w .  j a  v  a  2  s  .c o  m
 *
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(ImageView imageView, Drawable drawable, boolean isBackground) {
    if (mFadeInBitmap && !isBackground) {
        // Transition drawable with a transparent drawable and the final drawable
        final TransitionDrawable td = new TransitionDrawable(
                new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable });
        // Set background to loading bitmap
        int index = 0;
        if (imageView.getTag() != null)
            index = (Integer) imageView.getTag();
        imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap[index]));
        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
        if (ImageFetcher.isDebug)
            Log.i(ImageFetcher.TAG, "setImageDrawable src");
    } else {
        if (isBackground) {
            if (ImageFetcher.isDebug)
                Log.i(ImageFetcher.TAG, "setImageDrawable isBackground");
            imageView.setBackgroundDrawable(null);
            imageView.setBackgroundDrawable(drawable);
        } else {
            if (ImageFetcher.isDebug)
                Log.i(ImageFetcher.TAG, "setImageDrawable src");
            imageView.setImageDrawable(drawable);
        }
    }
}

From source file:com.ifeng.util.imagecache.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be
 * set on the ImageView./*  w  ww. jav a 2s.  c om*/
 * 
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(ImageView imageView, Drawable drawable) {
    // Bug fix by XuWei 2013-09-09
    // Drawable?bug?ViewDrawable??Drawable
    Drawable copyDrawable = new BitmapDrawable(mResources, ((BitmapDrawable) drawable).getBitmap());

    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final
        // drawable
        final TransitionDrawable td = new TransitionDrawable(
                new Drawable[] { new ColorDrawable(android.R.color.transparent), copyDrawable });
        // Set background to loading bitmap
        imageView.setImageDrawable(new BitmapDrawable(mResources, mLoadingBitmap));

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(copyDrawable);
    }
}

From source file:com.devbrackets.android.recyclerext.decoration.ReorderDecoration.java

/**
 * Generates the Bitmap that will be used to represent the view being dragged across the screen
 *
 * @param view The view to create the drag bitmap from
 * @return The bitmap representing the drag view
 */// www  .  j  a v a2s  .com
private BitmapDrawable createDragBitmap(View view) {
    floatingItemStartingBounds = new Rect(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
    floatingItemBounds = new Rect(floatingItemStartingBounds);

    Bitmap bitmap = Bitmap.createBitmap(floatingItemStartingBounds.width(), floatingItemStartingBounds.height(),
            Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    view.draw(canvas);

    BitmapDrawable retDrawable = new BitmapDrawable(view.getResources(), bitmap);
    retDrawable.setBounds(floatingItemBounds);

    return retDrawable;
}

From source file:biz.bokhorst.xprivacy.ActivityMain.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    int userId = Util.getUserId(Process.myUid());
    boolean mounted = Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
    boolean updates = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingUpdates, false);

    menu.findItem(R.id.menu_export).setEnabled(mounted);
    menu.findItem(R.id.menu_import).setEnabled(mounted);

    menu.findItem(R.id.menu_submit).setEnabled(Util.hasValidFingerPrint(this));

    menu.findItem(R.id.menu_pro).setVisible(!Util.isProEnabled() && Util.hasProLicense(this) == null);

    menu.findItem(R.id.menu_dump).setVisible(Util.isDebuggable(this));

    menu.findItem(R.id.menu_update).setVisible(updates);
    menu.findItem(R.id.menu_update).setEnabled(mounted);

    // Update filter count

    // Get settings
    boolean fUsed = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFUsed, false);
    boolean fInternet = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFInternet, false);
    boolean fRestriction = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFRestriction, false);
    boolean fPermission = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFPermission, true);
    boolean fOnDemand = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFOnDemand, false);
    boolean fUser = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFUser, true);
    boolean fSystem = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFSystem, false);

    // Count number of active filters
    int numberOfFilters = 0;
    if (fUsed)//from w  w  w .  j a va  2s  .c o  m
        numberOfFilters++;
    if (fInternet)
        numberOfFilters++;
    if (fRestriction)
        numberOfFilters++;
    if (fPermission)
        numberOfFilters++;
    if (fOnDemand)
        numberOfFilters++;
    if (fUser)
        numberOfFilters++;
    if (fSystem)
        numberOfFilters++;

    if (numberOfFilters > 0) {
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon_filter)
                .copy(Bitmap.Config.ARGB_8888, true);

        Paint paint = new Paint();
        paint.setStyle(Style.FILL);
        paint.setColor(Color.GRAY);
        paint.setTextSize(bitmap.getWidth() / 3);
        paint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));

        String text = Integer.toString(numberOfFilters);

        Canvas canvas = new Canvas(bitmap);
        canvas.drawText(text, bitmap.getWidth() - paint.measureText(text), bitmap.getHeight(), paint);

        MenuItem fMenu = menu.findItem(R.id.menu_filter);
        fMenu.setIcon(new BitmapDrawable(getResources(), bitmap));
    }

    return super.onPrepareOptionsMenu(menu);
}

From source file:au.org.intersect.faims.android.ui.activity.ShowModuleActivity.java

public boolean onPrepareOptionsMenu(Menu menu) {
    // gps status
    menu.findItem(R.id.action_gps_inactive).setVisible(false);
    menu.findItem(R.id.action_gps_active_has_signal).setVisible(false);
    menu.findItem(R.id.action_gps_active_no_signal).setVisible(false);
    if (gpsDataManager.isExternalGPSStarted() || gpsDataManager.isInternalGPSStarted()) {
        if (gpsDataManager.hasValidExternalGPSSignal() || gpsDataManager.hasValidInternalGPSSignal()) {
            menu.findItem(R.id.action_gps_active_has_signal).setVisible(true);
        } else {/* w  w w.  j  a v  a 2 s .  com*/
            menu.findItem(R.id.action_gps_active_no_signal).setVisible(true);
        }
    } else {
        menu.findItem(R.id.action_gps_inactive).setVisible(true);
    }

    // tracker status
    menu.findItem(R.id.action_tracker_active_no_gps).setVisible(false);
    menu.findItem(R.id.action_tracker_active_has_gps).setVisible(false);
    menu.findItem(R.id.action_tracker_inactive).setVisible(false);
    if (gpsDataManager.isTrackingStarted()) {
        if (gpsDataManager.hasValidExternalGPSSignal() || gpsDataManager.hasValidInternalGPSSignal()) {
            menu.findItem(R.id.action_tracker_active_has_gps).setVisible(true);
        } else {
            menu.findItem(R.id.action_tracker_active_no_gps).setVisible(true);
        }
    } else {
        menu.findItem(R.id.action_tracker_inactive).setVisible(true);
    }

    // sync status
    menu.findItem(R.id.action_sync).setVisible(false);
    menu.findItem(R.id.action_sync_active).setVisible(false);
    menu.findItem(R.id.action_sync_error).setVisible(false);
    menu.findItem(R.id.action_sync_has_changes).setVisible(false);
    menu.findItem(R.id.action_sync_inactive).setVisible(false);

    syncAnimImage.clearAnimation();

    switch (syncStatus) {
    case ACTIVE_SYNCING:
        MenuItem syncItem = menu.findItem(R.id.action_sync_active).setVisible(true);

        syncAnimImage.startAnimation(rotation);

        syncItem.setActionView(syncAnimImage);

        break;
    case ERROR:
        menu.findItem(R.id.action_sync_error).setVisible(true);
        break;
    case ACTIVE_NO_CHANGES:
        menu.findItem(R.id.action_sync).setVisible(true);
        break;
    case ACTIVE_HAS_CHANGES:
        menu.findItem(R.id.action_sync_has_changes).setVisible(true);
        break;
    default:
        menu.findItem(R.id.action_sync_inactive).setVisible(true);
        break;
    }

    // follow status
    MenuItem distance_text = menu.findItem(R.id.distance_text);
    distance_text.setVisible(pathIndicatorVisible);
    String distanceInfo = pathIndex < 0 ? "" : " to point (" + pathIndex + "/" + pathLength + ")";
    if (pathDistance > 1000) {
        distance_text.setTitle(
                MeasurementUtil.displayAsKiloMeters(pathDistance / 1000, "###,###,###,###.0") + distanceInfo);
    } else {
        distance_text.setTitle(MeasurementUtil.displayAsMeters(pathDistance, "###,###,###,###") + distanceInfo);
    }

    MenuItem direction_text = menu.findItem(R.id.direction_text);
    direction_text.setVisible(pathIndicatorVisible);
    direction_text.setTitle(MeasurementUtil.displayAsDegrees(pathBearing, "###"));

    MenuItem direction_indicator = menu.findItem(R.id.direction_indicator);
    direction_indicator.setVisible(pathIndicatorVisible);
    if (pathHeading != null) {
        if (tempBitmap != null) {
            tempBitmap.recycle();
        }
        if (whiteArrow == null) {
            whiteArrow = new BitmapDrawable(getResources(), UnscaledBitmapLoader.decodeResource(getResources(),
                    au.org.intersect.faims.android.R.drawable.white_arrow));
        }
        if (greyArrow == null) {
            greyArrow = new BitmapDrawable(getResources(), UnscaledBitmapLoader.decodeResource(getResources(),
                    au.org.intersect.faims.android.R.drawable.grey_arrow));
        }

        this.tempBitmap = BitmapUtil.rotateBitmap(pathValid ? whiteArrow.getBitmap() : greyArrow.getBitmap(),
                pathBearing - pathHeading);
        direction_indicator.setIcon(new BitmapDrawable(getResources(), tempBitmap));
    } else {
        direction_indicator.setVisible(false);
    }

    return true;
}