Example usage for android.content.res Resources getColor

List of usage examples for android.content.res Resources getColor

Introduction

In this page you can find the example usage for android.content.res Resources getColor.

Prototype

@ColorInt
@Deprecated
public int getColor(@ColorRes int id) throws NotFoundException 

Source Link

Document

Returns a color integer associated with a particular resource ID.

Usage

From source file:com.hippo.ehviewer.ui.scene.GalleryDetailScene.java

@SuppressWarnings("deprecation")
private void bindTags(GalleryTagGroup[] tagGroups) {
    Context context = getContext2();
    LayoutInflater inflater = getLayoutInflater2();
    Resources resources = getResources2();
    if (null == context || null == inflater || null == resources || null == mTags || null == mNoTags) {
        return;//  w w w. j  av a  2s.  c om
    }

    mTags.removeViews(1, mTags.getChildCount() - 1);
    if (tagGroups == null || tagGroups.length == 0) {
        mNoTags.setVisibility(View.VISIBLE);
        return;
    } else {
        mNoTags.setVisibility(View.GONE);
    }

    int colorTag = resources.getColor(R.color.colorPrimary);
    int colorName = resources.getColor(R.color.purple_a400);
    for (GalleryTagGroup tg : tagGroups) {
        LinearLayout ll = (LinearLayout) inflater.inflate(R.layout.gallery_tag_group, mTags, false);
        ll.setOrientation(LinearLayout.HORIZONTAL);
        mTags.addView(ll);

        TextView tgName = (TextView) inflater.inflate(R.layout.item_gallery_tag, ll, false);
        ll.addView(tgName);
        tgName.setText(tg.groupName);
        tgName.setBackgroundDrawable(new RoundSideRectDrawable(colorName));

        AutoWrapLayout awl = new AutoWrapLayout(context);
        ll.addView(awl, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        for (int j = 0, z = tg.size(); j < z; j++) {
            TextView tag = (TextView) inflater.inflate(R.layout.item_gallery_tag, awl, false);
            awl.addView(tag);
            String tagStr = tg.getTagAt(j);
            tag.setText(tagStr);
            tag.setBackgroundDrawable(new RoundSideRectDrawable(colorTag));
            tag.setTag(R.id.tag, tg.groupName + ":" + tagStr);
            tag.setOnClickListener(this);
            tag.setOnLongClickListener(this);
        }
    }
}

From source file:com.luseen.spacenavigation.SpaceNavigationView.java

/**
 * Init custom attributes/*from   w ww . ja  va2  s . co m*/
 *
 * @param attrs attributes
 */
private void init(AttributeSet attrs) {
    if (attrs != null) {
        Resources resources = getResources();

        TypedArray typedArray = context.obtainStyledAttributes(attrs,
                com.luseen.spacenavigation.R.styleable.SpaceNavigationView);
        spaceItemIconSize = typedArray.getDimensionPixelSize(
                com.luseen.spacenavigation.R.styleable.SpaceNavigationView_space_item_icon_size,
                resources.getDimensionPixelSize(
                        com.luseen.spacenavigation.R.dimen.space_item_icon_default_size));
        spaceItemIconOnlySize = typedArray.getDimensionPixelSize(
                com.luseen.spacenavigation.R.styleable.SpaceNavigationView_space_item_icon_only_size,
                resources.getDimensionPixelSize(com.luseen.spacenavigation.R.dimen.space_item_icon_only_size));
        spaceItemTextSize = typedArray.getDimensionPixelSize(
                com.luseen.spacenavigation.R.styleable.SpaceNavigationView_space_item_text_size,
                resources.getDimensionPixelSize(
                        com.luseen.spacenavigation.R.dimen.space_item_text_default_size));
        spaceItemIconOnlySize = typedArray.getDimensionPixelSize(
                com.luseen.spacenavigation.R.styleable.SpaceNavigationView_space_item_icon_only_size,
                resources.getDimensionPixelSize(com.luseen.spacenavigation.R.dimen.space_item_icon_only_size));
        spaceBackgroundColor = typedArray.getColor(
                com.luseen.spacenavigation.R.styleable.SpaceNavigationView_space_background_color,
                resources.getColor(com.luseen.spacenavigation.R.color.default_color));
        centreButtonColor = typedArray.getColor(
                com.luseen.spacenavigation.R.styleable.SpaceNavigationView_centre_button_color,
                resources.getColor(com.luseen.spacenavigation.R.color.centre_button_color));
        activeSpaceItemColor = typedArray.getColor(
                com.luseen.spacenavigation.R.styleable.SpaceNavigationView_active_item_color,
                resources.getColor(com.luseen.spacenavigation.R.color.white));
        inActiveSpaceItemColor = typedArray.getColor(
                com.luseen.spacenavigation.R.styleable.SpaceNavigationView_inactive_item_color,
                resources.getColor(com.luseen.spacenavigation.R.color.default_inactive_item_color));

        typedArray.recycle();
    }
}

From source file:com.android.mail.browse.ConversationItemView.java

private static synchronized void getItemViewResources(Context context) {
    if (sConfigurationChangedReceiver == null) {
        sConfigurationChangedReceiver = new BroadcastReceiver() {
            @Override/*from  w w w  .  j a v  a2  s  .  c o  m*/
            public void onReceive(Context context, Intent intent) {
                STAR_OFF = null;
                getItemViewResources(context);
            }
        };
        context.registerReceiver(sConfigurationChangedReceiver,
                new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED));
    }
    if (STAR_OFF == null) {
        final Resources res = context.getResources();
        // Initialize static bitmaps.
        STAR_OFF = BitmapFactory.decodeResource(res, R.drawable.ic_star_outline_20dp);
        STAR_ON = BitmapFactory.decodeResource(res, R.drawable.ic_star_20dp);
        ATTACHMENT = BitmapFactory.decodeResource(res, R.drawable.ic_attach_file_18dp);
        ONLY_TO_ME = BitmapFactory.decodeResource(res, R.drawable.ic_email_caret_double);
        TO_ME_AND_OTHERS = BitmapFactory.decodeResource(res, R.drawable.ic_email_caret_single);
        IMPORTANT_ONLY_TO_ME = BitmapFactory.decodeResource(res,
                R.drawable.ic_email_caret_double_important_unread);
        IMPORTANT_TO_ME_AND_OTHERS = BitmapFactory.decodeResource(res,
                R.drawable.ic_email_caret_single_important_unread);
        IMPORTANT = BitmapFactory.decodeResource(res, R.drawable.ic_email_caret_none_important_unread);
        STATE_REPLIED = BitmapFactory.decodeResource(res, R.drawable.ic_badge_reply_holo_light);
        STATE_FORWARDED = BitmapFactory.decodeResource(res, R.drawable.ic_badge_forward_holo_light);
        STATE_REPLIED_AND_FORWARDED = BitmapFactory.decodeResource(res,
                R.drawable.ic_badge_reply_forward_holo_light);
        STATE_CALENDAR_INVITE = BitmapFactory.decodeResource(res, R.drawable.ic_badge_invite_holo_light);
        FOCUSED_CONVERSATION_HIGHLIGHT = res.getDrawable(R.drawable.visible_conversation_highlight);

        // Initialize colors.
        sActivatedTextSpan = CharacterStyle
                .wrap(new ForegroundColorSpan(res.getColor(R.color.senders_text_color)));
        sSendersTextColor = res.getColor(R.color.senders_text_color);
        sSubjectTextUnreadSpan = new TextAppearanceSpan(context, R.style.SubjectAppearanceUnreadStyle);
        sSubjectTextReadSpan = new TextAppearanceSpan(context, R.style.SubjectAppearanceReadStyle);

        sBadgeTextSpan = new TextAppearanceSpan(context, R.style.BadgeTextStyle);
        sBadgeBackgroundSpan = new BackgroundColorSpan(res.getColor(R.color.badge_background_color));
        sDateTextColorRead = res.getColor(R.color.date_text_color_read);
        sDateTextColorUnread = res.getColor(R.color.date_text_color_unread);
        sStarTouchSlop = res.getDimensionPixelSize(R.dimen.star_touch_slop);
        sSenderImageTouchSlop = res.getDimensionPixelSize(R.dimen.sender_image_touch_slop);
        sShrinkAnimationDuration = res.getInteger(R.integer.shrink_animation_duration);
        sSlideAnimationDuration = res.getInteger(R.integer.slide_animation_duration);
        // Initialize static color.
        sSendersSplitToken = res.getString(R.string.senders_split_token);
        sElidedPaddingToken = res.getString(R.string.elided_padding_token);
        sScrollSlop = res.getInteger(R.integer.swipeScrollSlop);
        sFoldersMaxCount = res.getInteger(R.integer.conversation_list_max_folder_count);
        sCabAnimationDuration = res.getInteger(R.integer.conv_item_view_cab_anim_duration);
        sBadgePaddingExtraWidth = res.getDimensionPixelSize(R.dimen.badge_padding_extra_width);
        sBadgeRoundedCornerRadius = res.getDimensionPixelSize(R.dimen.badge_rounded_corner_radius);
        sDividerPaint.setColor(res.getColor(R.color.divider_color));
        sDividerHeight = res.getDimensionPixelSize(R.dimen.divider_height);
    }
}

From source file:com.example.aitor2.myapplication.DrawerArrowSample.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.home_view);//from ww  w  . j a v a  2  s .c  o m
    final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    final ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator);
    final Resources resources = getResources();
    drawer_adapter adapter = new drawer_adapter(this, icons, titles);
    ListView lv = (ListView) findViewById(R.id.drawer_listview);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            drawer.closeDrawer(START);
            if (position == 0) {
                Intent intent = new Intent(DrawerArrowSample.this, DrawerArrowSample.class);
                startActivity(intent);
                finish();
            } else if (position == 1) {
                Intent intent = new Intent(DrawerArrowSample.this, misReservas.class);
                startActivity(intent);
                finish();
            }
        }
    });
    findViewById(R.id.pink_icon).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(DrawerArrowSample.this, "Clicked pink Floating Action Button", Toast.LENGTH_SHORT)
                    .show();
        }
    });
    actionB = (FloatingActionButton) findViewById(R.id.pink_icon);
    actionB.setStrokeVisible(true);

    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.activity_main_swipe_refresh_layout);
    swipeRefreshLayout.setOnRefreshListener(onRefreshListener);
    swipeRefreshLayout.setColorSchemeColors(Color.BLACK, Color.GREEN, Color.BLACK, Color.GREEN);

    drawerArrowDrawable = new DrawerArrowDrawable(resources);
    drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray));

    imageView.setImageDrawable(drawerArrowDrawable);

    drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {

        @Override
        public void onDrawerSlide(View drawerView, float slideOffset) {

            offset = slideOffset;

            // Sometimes slideOffset ends up so close to but not quite 1 or 0.
            if (slideOffset >= .995) {
                flipped = true;
                drawerArrowDrawable.setFlip(flipped);
            } else if (slideOffset <= .005) {
                flipped = false;
                drawerArrowDrawable.setFlip(flipped);
            }

            drawerArrowDrawable.setParameter(offset);
        }
    });

    imageView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            if (drawer.isDrawerVisible(START)) {
                drawer.closeDrawer(START);
            } else {
                drawer.openDrawer(START);
            }
        }
    });

    final TextView styleButton = (TextView) findViewById(R.id.indicator_style);
    styleButton.setOnClickListener(new View.OnClickListener() {

        boolean rounded = false;

        @Override
        public void onClick(View v) {

            styleButton.setText(rounded //
                    ? resources.getString(R.string.rounded) //
                    : resources.getString(R.string.squared));

            rounded = !rounded;

            drawerArrowDrawable = new DrawerArrowDrawable(resources, rounded);
            drawerArrowDrawable.setParameter(offset);
            drawerArrowDrawable.setFlip(flipped);
            drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray));

            imageView.setImageDrawable(drawerArrowDrawable);
        }
    });

    /////////////////////create expandable listview
    new expandable().execute();
    ////////////////////calendario

    // Pop up Date picker on pressing the editText

}

From source file:com.tct.mail.browse.MessageHeaderView.java

public MessageHeaderView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    context = context;/* www .j  a va  2  s  . co  m*/
    mIsSnappy = false;
    mEmailCopyMenu = new EmailCopyContextMenu(getContext());
    mInflater = LayoutInflater.from(context);
    mMyName = context.getString(R.string.me_object_pronoun);

    final Resources res = getResources();
    mContactPhotoWidth = res.getDimensionPixelSize(R.dimen.contact_image_width);
    mContactPhotoHeight = res.getDimensionPixelSize(R.dimen.contact_image_height);
    mTitleContainerMarginEnd = res.getDimensionPixelSize(R.dimen.conversation_view_margin_side);
    mLinkColorBlue = res.getColor(R.color.conversation_view_text_color_link_blue); // AM: Kexue.Geng 2015-03-04 EMAIL BUGFIX_938279
}

From source file:com.harry.refresh.SwipyRefreshLayout.java

/**
     * Set the color resources used in the progress animation from color resources.
     * The first color will also be the color of the bar that grows in response
     * to a user swipe gesture./*from  ww w .j a va2s .  com*/
     *
     * @param colorResIds
     */
    public void setColorSchemeResources(int... colorResIds) {
        final Resources res = getResources();
        int[] colorRes = new int[colorResIds.length];
        for (int i = 0; i < colorResIds.length; i++) {
            colorRes[i] = res.getColor(colorResIds[i]);
        }
        setColorSchemeColors(colorRes);
    }

From source file:ac.robinson.mediaphone.MediaPhoneActivity.java

protected void exportContent(final String narrativeId, final boolean isTemplate) {
    if (MediaPhone.DIRECTORY_TEMP == null) {
        UIUtilities.showToast(MediaPhoneActivity.this, R.string.export_missing_directory, true);
        return;/*from w w  w . j  a  va 2  s.  co  m*/
    }
    if (IOUtilities.isInternalPath(MediaPhone.DIRECTORY_TEMP.getAbsolutePath())) {
        UIUtilities.showToast(MediaPhoneActivity.this, R.string.export_potential_problem, true);
    }

    // important to keep awake to export because we only have one chance to display the export options
    // after creating mov or smil file (will be cancelled on screen unlock; Android is weird)
    // TODO: move to a better (e.g. notification bar) method of exporting?
    UIUtilities.acquireKeepScreenOn(getWindow());

    final CharSequence[] items = { getString(R.string.export_mov), getString(R.string.export_html),
            getString(R.string.export_smil, getString(R.string.app_name)) };

    AlertDialog.Builder builder = new AlertDialog.Builder(MediaPhoneActivity.this);
    builder.setTitle(R.string.export_narrative_title);
    // builder.setMessage(R.string.send_narrative_hint); //breaks dialog
    builder.setIcon(android.R.drawable.ic_dialog_info);
    builder.setNegativeButton(android.R.string.cancel, null);
    builder.setItems(items, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int item) {
            ContentResolver contentResolver = getContentResolver();

            NarrativeItem thisNarrative;
            if (isTemplate) {
                thisNarrative = NarrativesManager.findTemplateByInternalId(contentResolver, narrativeId);
            } else {
                thisNarrative = NarrativesManager.findNarrativeByInternalId(contentResolver, narrativeId);
            }
            final ArrayList<FrameMediaContainer> contentList = thisNarrative.getContentList(contentResolver);

            // random name to counter repeat sending name issues
            String exportId = MediaPhoneProvider.getNewInternalId().substring(0, 8);
            final String exportName = String.format(Locale.ENGLISH, "%s-%s",
                    getString(R.string.app_name).replaceAll("[^a-zA-Z0-9]+", "-").toLowerCase(Locale.ENGLISH),
                    exportId);

            Resources res = getResources();
            final Map<Integer, Object> settings = new Hashtable<Integer, Object>();
            settings.put(MediaUtilities.KEY_AUDIO_RESOURCE_ID, R.raw.ic_audio_playback);

            // some output settings (TODO: make sure HTML version respects these)
            settings.put(MediaUtilities.KEY_BACKGROUND_COLOUR, res.getColor(R.color.export_background));
            settings.put(MediaUtilities.KEY_TEXT_COLOUR_NO_IMAGE, res.getColor(R.color.export_text_no_image));
            settings.put(MediaUtilities.KEY_TEXT_COLOUR_WITH_IMAGE,
                    res.getColor(R.color.export_text_with_image));
            settings.put(MediaUtilities.KEY_TEXT_BACKGROUND_COLOUR,
                    res.getColor(R.color.export_text_background));
            // TODO: do we want to do getDimensionPixelSize for export?
            settings.put(MediaUtilities.KEY_TEXT_SPACING,
                    res.getDimensionPixelSize(R.dimen.export_icon_text_padding));
            settings.put(MediaUtilities.KEY_TEXT_CORNER_RADIUS,
                    res.getDimensionPixelSize(R.dimen.export_icon_text_corner_radius));
            settings.put(MediaUtilities.KEY_TEXT_BACKGROUND_SPAN_WIDTH,
                    Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB);
            settings.put(MediaUtilities.KEY_MAX_TEXT_FONT_SIZE,
                    res.getDimensionPixelSize(R.dimen.export_maximum_text_size));
            settings.put(MediaUtilities.KEY_MAX_TEXT_CHARACTERS_PER_LINE,
                    res.getInteger(R.integer.export_maximum_text_characters_per_line));
            settings.put(MediaUtilities.KEY_MAX_TEXT_HEIGHT_WITH_IMAGE,
                    res.getDimensionPixelSize(R.dimen.export_maximum_text_height_with_image));

            if (contentList != null && contentList.size() > 0) {
                switch (item) {
                case 0:
                    settings.put(MediaUtilities.KEY_OUTPUT_WIDTH, res.getInteger(R.integer.export_mov_width));
                    settings.put(MediaUtilities.KEY_OUTPUT_HEIGHT, res.getInteger(R.integer.export_mov_height));
                    settings.put(MediaUtilities.KEY_IMAGE_QUALITY,
                            res.getInteger(R.integer.camera_jpeg_save_quality));

                    // all image files are compatible - we just convert to JPEG when writing the movie,
                    // but we need to check for incompatible audio that we can't convert to PCM
                    boolean incompatibleAudio = false;
                    for (FrameMediaContainer frame : contentList) {
                        for (String audioPath : frame.mAudioPaths) {
                            if (!AndroidUtilities.arrayContains(MediaUtilities.MOV_AUDIO_FILE_EXTENSIONS,
                                    IOUtilities.getFileExtension(audioPath))) {
                                incompatibleAudio = true;
                                break;
                            }
                        }
                        if (incompatibleAudio) {
                            break;
                        }
                    }

                    if (incompatibleAudio) {
                        AlertDialog.Builder builder = new AlertDialog.Builder(MediaPhoneActivity.this);
                        builder.setTitle(android.R.string.dialog_alert_title);
                        builder.setMessage(R.string.mov_export_mov_incompatible);
                        builder.setIcon(android.R.drawable.ic_dialog_alert);
                        builder.setNegativeButton(android.R.string.cancel, null);
                        builder.setPositiveButton(R.string.button_continue,
                                new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int whichButton) {
                                        exportMovie(settings, exportName, contentList);
                                    }
                                });
                        AlertDialog alert = builder.create();
                        alert.show();
                    } else {
                        exportMovie(settings, exportName, contentList);
                    }
                    break;

                case 1:
                    settings.put(MediaUtilities.KEY_OUTPUT_WIDTH, res.getInteger(R.integer.export_html_width));
                    settings.put(MediaUtilities.KEY_OUTPUT_HEIGHT,
                            res.getInteger(R.integer.export_html_height));
                    runExportNarrativesTask(new BackgroundRunnable() {
                        private int mTaskResult = 0;

                        @Override
                        public int getTaskId() {
                            return mTaskResult;
                        }

                        @Override
                        public boolean getShowDialog() {
                            return true;
                        }

                        @Override
                        public void run() {
                            ArrayList<Uri> filesToSend = HTMLUtilities.generateNarrativeHTML(getResources(),
                                    new File(MediaPhone.DIRECTORY_TEMP,
                                            exportName + MediaUtilities.HTML_FILE_EXTENSION),
                                    contentList, settings);

                            if (filesToSend == null || filesToSend.size() <= 0) {
                                mTaskResult = R.id.export_creation_failed;
                            } else {
                                sendFiles(filesToSend);
                            }
                        }
                    });
                    break;

                case 2:
                    settings.put(MediaUtilities.KEY_OUTPUT_WIDTH, res.getInteger(R.integer.export_smil_width));
                    settings.put(MediaUtilities.KEY_OUTPUT_HEIGHT,
                            res.getInteger(R.integer.export_smil_height));
                    settings.put(MediaUtilities.KEY_PLAYER_BAR_ADJUSTMENT,
                            res.getInteger(R.integer.export_smil_player_bar_adjustment));
                    runExportNarrativesTask(new BackgroundRunnable() {
                        private int mTaskResult = 0;

                        @Override
                        public int getTaskId() {
                            return mTaskResult;
                        }

                        @Override
                        public boolean getShowDialog() {
                            return true;
                        }

                        @Override
                        public void run() {
                            ArrayList<Uri> filesToSend = SMILUtilities.generateNarrativeSMIL(getResources(),
                                    new File(MediaPhone.DIRECTORY_TEMP,
                                            exportName + MediaUtilities.SMIL_FILE_EXTENSION),
                                    contentList, settings);

                            if (filesToSend == null || filesToSend.size() <= 0) {
                                mTaskResult = R.id.export_creation_failed;
                            } else {
                                sendFiles(filesToSend);
                            }
                        }
                    });
                    break;
                }
            } else {
                UIUtilities.showToast(MediaPhoneActivity.this,
                        (isTemplate ? R.string.export_template_failed : R.string.export_narrative_failed));
            }
            dialog.dismiss();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.wanikani.androidnotifier.DashboardFragment.java

protected void setProgress(Item.Type type, int guru, int unlocked, int total) {
    List<DataSet> ddsets, ldsets;
    List<ProgressPlot.Marker> markers;
    DataSet gds, ads, tds, rds;//w  w w .j  a  v a 2s .  c  o  m
    int apprentice;
    View schart;
    SubPlot splot;
    Resources res;

    switch (type) {
    case RADICAL:
        splot = radicalsProgress;
        schart = radicalsRow;
        break;

    case KANJI:
        splot = kanjiProgress;
        schart = kanjiRow;
        break;

    case VOCABULARY:
    default:
        return;
    }

    schart.setVisibility(total > 0 ? View.VISIBLE : View.GONE);
    if (total <= 0)
        return;

    res = getResources();

    ddsets = new Vector<DataSet>();
    ldsets = new Vector<DataSet>();

    apprentice = unlocked - guru;

    tds = ProgressionData.LOCKED.getDataSet(main, res, type, apprentice, guru, total);
    ads = ProgressionData.APPRENTICE.getDataSet(main, res, type, apprentice, guru, total);
    gds = ProgressionData.GURU.getDataSet(main, res, type, apprentice, guru, total);
    rds = ProgressionData.REMAINING.getDataSet(main, res, type, apprentice, guru, total);

    /* Display data set: guru, apprentice, total */
    ddsets.add(gds);
    ddsets.add(ads);
    ddsets.add(tds);

    /* Legends data set: apprentice, guru, remaining */
    ldsets.add(ads);
    gds.showAlways = true;
    ldsets.add(gds);
    if (rds.value > 0)
        ldsets.add(rds);

    markers = new Vector<ProgressPlot.Marker>();
    if (guru == 0 && apprentice < total)
        markers.add(new ProgressPlot.Marker(Integer.toString(apprentice), Color.BLACK, apprentice));
    else if (apprentice == 0)
        markers.add(new ProgressPlot.Marker(Integer.toString(guru), Color.BLACK, guru));
    else {
        markers.add(new ProgressPlot.Marker(guru + "\u2194" + apprentice, Color.BLACK, guru));
        if (rds.value > 0)
            markers.add(new ProgressPlot.Marker("*", res.getColor(R.color.guru), total * 9f / 10, true));
    }
    markers.add(new ProgressPlot.Marker(Integer.toString(total), Color.BLACK, total));

    splot.setData(ddsets, ldsets, markers);
}

From source file:com.htc.dotdesign.ToolBoxService.java

private void initBrushColor() {
    Resources res = getResources();

    final int size = 4 * 3;
    int[] btn_id = new int[size];
    btn_id[0] = R.id.btn_color_11;/*from  w  w w  . j  ava 2 s. c o m*/
    btn_id[1] = R.id.btn_color_12;
    btn_id[2] = R.id.btn_color_13;
    btn_id[3] = R.id.btn_color_14;
    btn_id[4] = R.id.btn_color_21;
    btn_id[5] = R.id.btn_color_22;
    btn_id[6] = R.id.btn_color_23;
    btn_id[7] = R.id.btn_color_24;
    btn_id[8] = R.id.btn_color_31;
    btn_id[9] = R.id.btn_color_32;
    btn_id[10] = R.id.btn_color_33;
    btn_id[11] = R.id.btn_color_34;

    int[] color_id = new int[size];
    color_id[0] = R.color.palette_color_11;
    color_id[1] = R.color.palette_color_12;
    color_id[2] = R.color.palette_color_13;
    color_id[3] = R.color.palette_color_14;
    color_id[4] = R.color.palette_color_21;
    color_id[5] = R.color.palette_color_22;
    color_id[6] = R.color.palette_color_23;
    color_id[7] = R.color.palette_color_24;
    color_id[8] = R.color.palette_color_31;
    color_id[9] = R.color.palette_color_32;
    color_id[10] = R.color.palette_color_33;
    color_id[11] = R.color.palette_color_34;

    if (res != null) {
        ImageView button = null;
        GradientDrawable drawable = null;
        for (int i = 0; i < size; i++) {
            button = (ImageView) mPalette.findViewById(btn_id[i]);
            if (button != null) {
                drawable = (GradientDrawable) button.getDrawable();
                drawable.setColor(res.getColor(color_id[i]));
                mBtnColor.put(btn_id[i], res.getColor(color_id[i]));
                button.setOnClickListener(mButtonListener);

                if (i == 0) {
                    mCurrBrushColorView = button;
                    mCurrBrushColor = res.getColor(color_id[i]);
                    setSelectedColor(mCurrBrushColorView);
                }
            }
        }
    }
}