Example usage for android.graphics Color rgb

List of usage examples for android.graphics Color rgb

Introduction

In this page you can find the example usage for android.graphics Color rgb.

Prototype

@ColorInt
public static int rgb(float red, float green, float blue) 

Source Link

Document

Return a color-int from red, green, blue float components in the range \([0..1]\).

Usage

From source file:com.suan.weclient.fragment.RightFragment.java

private void popFeedback() {

    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View dialogView = inflater.inflate(R.layout.dialog_feedback_layout, null);
    popTitleTextView = (TextView) dialogView.findViewById(R.id.dialog_feedback_text_title);

    popContentEditText = (EditText) dialogView.findViewById(R.id.dialog_feedback_edit_text);
    popSureButton = (Button) dialogView.findViewById(R.id.dialog_feedback_button_sure);
    popCancelButton = (Button) dialogView.findViewById(R.id.dialog_feedback_button_cancel);

    popTextAmountTextView = (TextView) dialogView.findViewById(R.id.dialog_feedback_text_num);
    popTextAmountTextView.setOnClickListener(new OnClickListener() {

        @Override/*  w  w w  .j av  a  2 s  .  c o  m*/
        public void onClick(View v) {
            // TODO Auto-generated method stub
            popContentEditText.setText("");

        }
    });

    popContentEditText.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO Auto-generated method stub
            popTextAmountTextView.setTextColor(Color.rgb(0, 0, 0));
            popTextAmountTextView.setText(popContentEditText.getText().length() + " x");

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

        }
    });

    popTitleTextView.setText("??");
    popSureButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            String content = popContentEditText.getEditableText().toString();
            defaultConversation.addUserReply(content);

            mDataManager.doLoadingStart("????...", WechatManager.DIALOG_POP_CANCELABLE);

            sync();
        }
    });
    popCancelButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            popDialog.cancel();

        }
    });

    popDialog = new Dialog(getActivity(), R.style.dialog);

    popDialog.setContentView(dialogView);
    popDialog.show();

}

From source file:ca.liquidlabs.android.speedtestvisualizer.fragments.GraphViewMasterFragment.java

/**
 * {@inheritDoc} <br/>/*from w  w  w .j  a  v  a  2  s. c  om*/
 * 
 * @see OnDataProcessorListener
 */
@Override
public void onComplete(final GraphViewDataInterface[]... dataSets) {
    // Check after all processing done, if this fragment is still visible.
    if (this.isRemoving() || this.isDetached()) {
        Tracer.debug(LOG_TAG, "onComplete() >> Fragment is removing or already detached.");
        // do nothing, view is already gone.
        return;
    }

    // first - hide the progress indicator
    hideProgressIndicator();
    Tracer.debug(LOG_TAG, "onComplete (multi): " + dataSets);

    Tracer.debug(LOG_TAG, "onComplete (multi) > data available? - " + dataSets.length);

    GraphViewDataInterface[][] availableDataSets = dataSets;

    /*
     * For single series graph, use BAR chart. Usually used for single
     * dimension graph. Eg. Download VS Date, Upload VS Date and so on.
     */
    if (availableDataSets.length == 1) {
        addSingleSeriesGraph(availableDataSets[0]);
        return;
    }

    // graph with dynamically genereated horizontal and vertical labels
    LineGraphView graphView;
    graphView = new LineGraphView(getActivity().getApplicationContext(), mGraphType.getGraphTitle());

    for (int index = 0; index < availableDataSets.length; index++) {
        /*
         * Since we have limited type of multi series data, hardcode the
         * type for now. FIXME: Fix this in next release and generalize the
         * return type after data is processed.
         */
        if (index == 0) {
            // DONWLOAD data - FIXME: Hardcoded value - must be fixed!!!!!!!
            GraphViewSeries seriesData = new GraphViewSeries("Download",
                    new GraphViewSeriesStyle(Color.rgb(200, 50, 00), 3), availableDataSets[index]);
            graphView.addSeries(seriesData);

        } else if (index == 1) {
            // UPLOAD data - FIXME: Hardcoded value - must be fixed!!!!!!!
            GraphViewSeries seriesData = new GraphViewSeries("Upload",
                    new GraphViewSeriesStyle(Color.rgb(90, 250, 00), 3), availableDataSets[index]);
            graphView.addSeries(seriesData);

        } else {
            GraphViewSeries seriesData = new GraphViewSeries("Data: " + index,
                    new GraphViewSeriesStyle(Color.rgb(200, 50, 00), 5), availableDataSets[index]);
            // add data
            graphView.addSeries(seriesData);
        }
    }
    // set legend
    graphView.setShowLegend(true);
    graphView.getGraphViewStyle().setHorizontalLabelsColor(Color.GRAY);
    graphView.getGraphViewStyle().setVerticalLabelsColor(Color.GRAY);
    graphView.setCustomLabelFormatter(mGraphDateLabelFormatter);
    // set view port, start=2, size=40
    // graphView.setViewPort(2, 40);
    // graphView.setScrollable(true);

    // add graph to the view
    mGraphViewContainer.addView(graphView);
}

From source file:com.ab.view.sliding.AbSlidingTabView_fix.java

/**
 * Inits the view./*from w w  w . j  ava2s .c  o  m*/
 */
public void initView() {
    this.setOrientation(LinearLayout.VERTICAL);
    this.setBackgroundColor(Color.rgb(255, 255, 255));

    mTabScrollView = new HorizontalScrollView(context);
    mTabScrollView.setHorizontalScrollBarEnabled(false);
    mTabScrollView.setSmoothScrollingEnabled(true);

    mTabLayout = new LinearLayout(context);
    mTabLayout.setOrientation(LinearLayout.HORIZONTAL);
    mTabLayout.setGravity(Gravity.CENTER);

    // mTabLayout
    mTabScrollView.addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    this.addView(mTabScrollView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    // View?
    mViewPager = new AbViewPager(context);
    // ViewPager,setId()id
    mViewPager.setId(1985);
    pagerItemList = new ArrayList<Fragment>();
    // Tab?
    tabItemList = new ArrayList<TextView>();
    tabItemTextList = new ArrayList<String>();
    tabItemDrawableList = new ArrayList<Drawable>();

    // ?FragmentActivity
    if (!(this.context instanceof FragmentActivity)) {
        AbLogUtil.e(AbSlidingTabView_fix.class,
                "AbSlidingTabView?context,FragmentActivity");
    }
}

From source file:info.rti.tabsswipe.TemperatureFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mItems = new ArrayList<String>();
    mSeries = new HashMap<String, TimeSeries>();
    mDataset = new XYMultipleSeriesDataset();
    mRenderer = new XYMultipleSeriesRenderer();

    mRenderer.setAxisTitleTextSize(24);//  w w  w .j  a  va 2  s.  c om
    mRenderer.setChartTitleTextSize(28);
    mRenderer.setLabelsTextSize(22);
    mRenderer.setLegendTextSize(22);
    mRenderer.setPointSize(8f);
    mYAxisPadding = 9;
    mRenderer.setXLabelsAlign(Align.CENTER);
    mRenderer.setYLabelsAlign(Align.CENTER);

    DecimalFormat newFormat = new DecimalFormat("#.###");
    double mAltitude_t = Double.valueOf(newFormat.format(BMP_pressureSubscriber.mAltitude));

    mRenderer.setChartTitle("Live Temperature from RaspberryPi (" + BMP_pressureSubscriber.mId
            + ") Barometric Sensor (BMP085) " + "\n" + "at Pressure " + BMP_pressureSubscriber.mPressure
            + "kPa and Altitude " + mAltitude_t + " meter");

    mRenderer.setXTitle("In Real Time...");
    mRenderer.setYTitle("Temperature (degree Celsius)");
    mRenderer.setLabelsColor(Color.LTGRAY);
    mRenderer.setAxesColor(Color.LTGRAY);
    mRenderer.setGridColor(Color.rgb(136, 136, 136));
    mRenderer.setBackgroundColor(Color.BLACK);

    mRenderer.setApplyBackgroundColor(true);

    mRenderer.setMargins(new int[] { 60, 60, 60, 60 });

    mRenderer.setFitLegend(true);
    mRenderer.setShowGrid(true);

    mRenderer.setZoomButtonsVisible(false);
    mRenderer.setZoomEnabled(true);
    mRenderer.setExternalZoomEnabled(true);

    mRenderer.setAntialiasing(true);
    mRenderer.setInScroll(true);

    mThresholds = new TimeSeries[3];
    mThresholdRenderers = new XYSeriesRenderer[3];

    for (int i = 0; i < THRESHOLD_COLORS.length; i++) {
        mThresholdRenderers[i] = new XYSeriesRenderer();
        mThresholdRenderers[i].setColor(THRESHOLD_COLORS[i]);
        mThresholdRenderers[i].setLineWidth(3);

        mThresholds[i] = new TimeSeries(THRESHOLD_LABELS[i]);
        final long now = new Date().getTime();
        mThresholds[i].add(new Date(now - 1000 * 60 * 10), THRESHOLD_VALUES[i]);
        mThresholds[i].add(new Date(now + 1000 * 60 * 10), THRESHOLD_VALUES[i]);

        mDataset.addSeries(mThresholds[i]);
        mRenderer.addSeriesRenderer(mThresholdRenderers[i]);
    }
}

From source file:org.lol.reddit.reddit.prepared.RedditPreparedComment.java

private void rebuildHeader(final Context context) {

    final BetterSSB sb = new BetterSSB();

    final int pointsCol;
    int score = src.ups - src.downs;

    if (Boolean.TRUE.equals(src.likes))
        score--;/*from ww w.  ja  va  2 s.c  o  m*/
    if (Boolean.FALSE.equals(src.likes))
        score++;

    if (isUpvoted()) {
        pointsCol = rrPostSubtitleUpvoteCol;
        score++;
    } else if (isDownvoted()) {
        pointsCol = rrPostSubtitleDownvoteCol;
        score--;
    } else {
        pointsCol = rrCommentHeaderBoldCol;
    }

    if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AUTHOR)) {
        if (parentPost != null && src.author.equalsIgnoreCase(parentPost.src.author)
                && !src.author.equals("[deleted]")) {
            sb.append(" " + src.author + " ",
                    BetterSSB.BACKGROUND_COLOR | BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, Color.WHITE,
                    Color.rgb(0, 126, 168), 1f); // TODO color
        } else {
            sb.append(src.author, BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, rrCommentHeaderAuthorCol, 0, 1f);
        }
    }

    if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.FLAIR) && flair != null
            && flair.length() > 0) {

        if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AUTHOR)) {
            sb.append("  ", 0);
        }

        sb.append(" " + flair + " ", BetterSSB.FOREGROUND_COLOR | BetterSSB.BACKGROUND_COLOR, rrFlairTextCol,
                rrFlairBackCol, 1f);
    }

    if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AUTHOR)
            || headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.FLAIR)) {
        sb.append("   ", 0);
    }

    if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.SCORE)) {

        if (!Boolean.TRUE.equals(src.score_hidden)) {
            sb.append(String.valueOf(score), BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, pointsCol, 0, 1f);
        } else {
            sb.append("??", BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, pointsCol, 0, 1f);
        }

        sb.append(" " + context.getString(R.string.subtitle_points) + " ", 0);
    }

    if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.GOLD)) {

        if (src.gilded > 0) {

            sb.append(" ", 0);

            sb.append(" " + context.getString(R.string.gold) + " x" + src.gilded + " ",
                    BetterSSB.FOREGROUND_COLOR | BetterSSB.BACKGROUND_COLOR, rrGoldTextCol, rrGoldBackCol, 1f);

            sb.append("  ", 0);
        }
    }

    if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AGE)) {
        sb.append(RRTime.formatDurationFrom(context, src.created_utc * 1000L),
                BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, rrCommentHeaderBoldCol, 0, 1f);

        if (src.edited != null && src.edited instanceof Long) {
            sb.append("*", BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, rrCommentHeaderBoldCol, 0, 1f);
        }
    }

    header = sb.get();
}

From source file:github.daneren2005.dsub.util.ImageLoader.java

private Bitmap createUnknownImage(int size, int primaryColor, String topText, String bottomText) {
    Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);

    Paint color = new Paint();
    color.setColor(primaryColor);//  w ww  . j  a v  a  2 s  .  c  o  m
    canvas.drawRect(0, 0, size, size * 2.0f / 3.0f, color);

    color.setShader(new LinearGradient(0, 0, 0, size / 3.0f, Color.rgb(82, 82, 82), Color.BLACK,
            Shader.TileMode.MIRROR));
    canvas.drawRect(0, size * 2.0f / 3.0f, size, size, color);

    if (topText != null || bottomText != null) {
        Paint font = new Paint();
        font.setFlags(Paint.ANTI_ALIAS_FLAG);
        font.setColor(Color.WHITE);
        font.setTextSize(3.0f + size * 0.07f);

        if (topText != null) {
            canvas.drawText(topText, size * 0.05f, size * 0.6f, font);
        }

        if (bottomText != null) {
            canvas.drawText(bottomText, size * 0.05f, size * 0.8f, font);
        }
    }

    return bitmap;
}

From source file:com.ofalvai.bpinfo.util.UiUtils.java

/**
 * Adds a rectangular icon for the affected route.
 *
 * First it creates a TextView, then sets the style properties of the view.
 * The custom colored rounded background is achieved by a Drawable and a ColorFilter on top of that.
 *//*from  w  ww.j a  v  a  2 s  . c  om*/
public static void addRouteIcon(Context context, @NonNull ViewGroup root, @NonNull Route route) {
    ContextThemeWrapper iconContextTheme = new ContextThemeWrapper(context, R.style.RouteIcon);
    TextView iconView = new TextView(iconContextTheme);

    iconView.setText(route.getShortName());
    iconView.setTextColor(route.getTextColor());
    iconView.setContentDescription(Utils.getContentDescriptionForRoute(context, route));
    root.addView(iconView);

    // Layout attributes defined in R.style.RouteIcon were ignored before attaching the view to
    // a parent, so we need to manually set them
    ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) iconView.getLayoutParams();
    params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
    int margin = (int) context.getResources().getDimension(R.dimen.route_icon_margin);
    params.rightMargin = margin;
    params.topMargin = margin;
    // A requestLayout() call is not necessary here because the setBackground() method below
    // will call that anyway.
    //iconView.requestLayout();

    // Setting a custom colored rounded background drawable as background
    Drawable iconBackground = context.getResources().getDrawable(R.drawable.rounded_corner_5dp);
    if (iconBackground != null) {
        ColorFilter colorFilter = new LightingColorFilter(Color.rgb(1, 1, 1), route.getColor());
        iconBackground.mutate().setColorFilter(colorFilter);
        iconView.setBackground(iconBackground);
    }
}

From source file:com.hxsn.witwork.ui.ViewfinderView.java

@Override
public void onDraw(Canvas canvas) {
    // ??????CameraManager?
    if (CameraManager.get() == null) {
        return;//from   ww w. j a va 2s. c  o m
    }
    Rect frame = CameraManager.get().getFramingRect();
    if (frame == null) {
        return;
    }

    // ?
    if (!isFirst) {
        isFirst = true;
        slideTop = frame.top;
        slideBottom = frame.bottom;
    }

    // ??
    int width = canvas.getWidth();
    int height = canvas.getHeight();

    paint.setColor(resultBitmap != null ? resultColor : maskColor);

    // ?????????????
    // ?????????
    canvas.drawRect(0, 0, width, frame.top + 15, paint);
    canvas.drawRect(0, frame.top + 15, frame.left + 15, frame.bottom - 14, paint);
    canvas.drawRect(frame.right - 14, frame.top + 15, width, frame.bottom - 14, paint);
    canvas.drawRect(0, frame.bottom - 14, width, height, paint);

    if (resultBitmap != null) {
        // Draw the opaque result bitmap over the scanning rectangle
        paint.setAlpha(OPAQUE);
        canvas.drawBitmap(resultBitmap, frame.left, frame.top, paint);
    } else {

        // ??8
        paint.setColor(Color.rgb(139, 193, 17));
        canvas.drawRect(frame.left, frame.top, frame.left + ScreenRate, frame.top + CORNER_WIDTH, paint);
        canvas.drawRect(frame.left, frame.top, frame.left + CORNER_WIDTH, frame.top + ScreenRate, paint);
        canvas.drawRect(frame.right - ScreenRate, frame.top, frame.right, frame.top + CORNER_WIDTH, paint);
        canvas.drawRect(frame.right - CORNER_WIDTH, frame.top, frame.right, frame.top + ScreenRate, paint);
        canvas.drawRect(frame.left, frame.bottom - CORNER_WIDTH, frame.left + ScreenRate, frame.bottom, paint);
        canvas.drawRect(frame.left, frame.bottom - ScreenRate, frame.left + CORNER_WIDTH, frame.bottom, paint);
        canvas.drawRect(frame.right - ScreenRate, frame.bottom - CORNER_WIDTH, frame.right, frame.bottom,
                paint);
        canvas.drawRect(frame.right - CORNER_WIDTH, frame.bottom - ScreenRate, frame.right, frame.bottom,
                paint);

        // ,??SPEEN_DISTANCE
        slideTop += SPEEN_DISTANCE;
        if (slideTop >= frame.bottom) {
            slideTop = frame.top;
        }
        // canvas.drawRect(frame.left + MIDDLE_LINE_PADDING, slideTop -
        // MIDDLE_LINE_WIDTH/2, frame.right - MIDDLE_LINE_PADDING,slideTop +
        // MIDDLE_LINE_WIDTH/2, paint);
        Rect lineRect = new Rect();

        lineRect.left = frame.left;
        lineRect.right = frame.right;
        lineRect.top = slideTop;
        lineRect.bottom = slideTop + 18;
        canvas.drawBitmap(((BitmapDrawable) (getResources().getDrawable(R.drawable.fgx))).getBitmap(), null,
                lineRect, paint);

        // ???
        paint.setColor(Color.WHITE);
        paint.setTextSize(TEXT_SIZE * density);
        // paint.setAlpha(0x40);
        // paint.setTypeface(Typeface.create("System", Typeface.BOLD));

        canvas.drawText("?/??????", frame.left,
                (float) (frame.bottom + (float) TEXT_PADDING_TOP * density), paint);
        canvas.drawText("??" + num + "", frame.left,
                (float) (frame.bottom + (float) TEXT_PADDING_TOP * density + 50), paint);

        int max = 7;
        if (name.size() < max) {
            max = name.size();
            for (int i = 0; i < max; i++) {
                canvas.drawText(name.get(i), frame.left,
                        (float) (frame.bottom + (float) TEXT_PADDING_TOP * density + 100 + 50 * i), paint);
            }
        } else {
            for (int i = 6; i >= 0; i--) {
                canvas.drawText(name.get((name.size() - 1) - (6 - i)), frame.left,
                        (float) (frame.bottom + (float) TEXT_PADDING_TOP * density + 100 + 50 * i), paint);
            }
        }

        paint.setStyle(Style.STROKE);
        canvas.drawRect(frame.left + 15, frame.top + 15, frame.right - 15, frame.bottom - 15, paint);
        setViewY(frame.bottom);
        paint.setStyle(Style.FILL);

        Collection<ResultPoint> currentPossible = possibleResultPoints;
        Collection<ResultPoint> currentLast = lastPossibleResultPoints;
        if (currentPossible.isEmpty()) {
            lastPossibleResultPoints = null;
        } else {
            possibleResultPoints = new HashSet<ResultPoint>(5);
            lastPossibleResultPoints = currentPossible;
            paint.setAlpha(OPAQUE);
            paint.setColor(resultPointColor);
            for (ResultPoint point : currentPossible) {
                canvas.drawCircle(frame.left + point.getX(), frame.top + point.getY(), 6.0f, paint);
            }
        }
        if (currentLast != null) {
            paint.setAlpha(OPAQUE / 2);
            paint.setColor(resultPointColor);
            for (ResultPoint point : currentLast) {
                canvas.drawCircle(frame.left + point.getX(), frame.top + point.getY(), 3.0f, paint);
            }
        }

        // ????
        postInvalidate();
        // postInvalidateDelayed(ANIMATION_DELAY, frame.left, frame.top,
        // frame.right, frame.bottom);

    }
}

From source file:com.artitk.licensefragment.example.MainActivity.java

@Override
public void onNavigationDrawerItemSelected(int position) {
    //        if (true) return;
    FragmentManager fragmentManager = getFragmentManager();
    Fragment fragment;/*from  ww  w.  j a  va2s.  c  om*/

    ArrayList<Integer> licenseIds = new ArrayList<>();
    licenseIds.add(LicenseID.GSON);
    licenseIds.add(LicenseID.RETROFIT);

    switch (position) {
    case 0:
        if (fragmentManager.findFragmentById(R.id.container) instanceof ScrollViewLicenseFragment)
            return;
        fragment = ScrollViewLicenseFragment.newInstance(licenseIds); // Call newInstance() using parameter ArrayList<Integer>
        break;
    case 1:
        if (fragmentManager.findFragmentById(R.id.container) instanceof ListViewLicenseFragment)
            return;
        fragment = ListViewLicenseFragment.newInstance(new int[] { LicenseID.PICASSO }) // Call newInstance() using parameter array
                .withLicenseChain(false); // Disable license chain
        break;
    case 2:
        if (fragmentManager.findFragmentById(R.id.container) instanceof RecyclerViewLicenseFragment)
            return;
        ArrayList<License> licenses = new ArrayList<>();
        licenses.add(new License(this, "Test Library 1", LicenseType.MIT_LICENSE, "2000-2001", "Test Owner 1"));
        licenses.add(new License(this, "Test Library 2", LicenseType.GPL_30, "2002", "Test Owner 2"));
        licenses.add(new License(this, "Test Library 3", LicenseType.EPL_10, "2003", "Test Owner 3"));
        licenses.add(new License(this, "Custom License 1", R.raw.wtfpl, "2004", "Test Owner 3"));
        licenses.add(new License(this, "Custom License 2", R.raw.x11, "2005", "Test Owner 4"));
        fragment = RecyclerViewLicenseFragment.newInstance() // Call newInstance() using without parameter
                .setLog(true) // Enable Log
                .withLicenseChain(true) // Enable license chain (default)
                .addLicense(new int[] { LicenseID.PICASSO }) // Add array (same call newInstance)
                .addLicense(licenseIds) // Add ArrayList<Integer> (same call newInstance)
                .addCustomLicense(licenses) // Add Custom License
                .setCustomUI(new CustomUI() // Set Custom UI
                        .setTitleBackgroundColor(Color.parseColor("#7fff7f"))
                        .setTitleTextColor(getResources().getColor(android.R.color.holo_green_dark))
                        .setLicenseBackgroundColor(Color.rgb(127, 223, 127)).setLicenseTextColor(Color.DKGRAY));
        break;
    default:
        return;
    }

    //        ((LicenseFragmentBase) fragment).setLog(true);

    // update the main content by replacing fragments
    fragmentManager.beginTransaction().replace(R.id.container, fragment).commit();

    fragmentId = position + 1;
}

From source file:info.rti.tabsswipe.PressureFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mItems = new ArrayList<String>();
    mSeries = new HashMap<String, TimeSeries>();
    mDataset = new XYMultipleSeriesDataset();
    mRenderer = new XYMultipleSeriesRenderer();

    mRenderer.setAxisTitleTextSize(24);/*from ww w .  j  a v a  2  s  .c  o  m*/
    mRenderer.setChartTitleTextSize(28);
    mRenderer.setLabelsTextSize(22);
    mRenderer.setLegendTextSize(22);
    mRenderer.setPointSize(8f);
    mYAxisPadding = 9;
    mRenderer.setXLabelsAlign(Align.CENTER);
    mRenderer.setYLabelsAlign(Align.CENTER);

    DecimalFormat newFormat = new DecimalFormat("#.###");
    double mAltitude_t = Double.valueOf(newFormat.format(BMP_pressureSubscriber.mAltitude));

    mRenderer.setChartTitle("Live Pressure from RaspberryPi (" + BMP_pressureSubscriber.mId
            + ") Barometric Sensor (BMP085)" + "\nat Temperature " + BMP_pressureSubscriber.mTemperature
            + " Celsius and Altitude " + mAltitude_t + " meter");

    mRenderer.setXTitle("In Real Time...");
    mRenderer.setYTitle("Atmospheric Pressure (kPa)");
    mRenderer.setLabelsColor(Color.LTGRAY);
    mRenderer.setAxesColor(Color.LTGRAY);
    mRenderer.setGridColor(Color.rgb(136, 136, 136));
    mRenderer.setBackgroundColor(Color.BLACK);

    mRenderer.setApplyBackgroundColor(true);

    mRenderer.setMargins(new int[] { 60, 60, 60, 60 });

    mRenderer.setFitLegend(true);
    mRenderer.setShowGrid(true);

    mRenderer.setZoomButtonsVisible(false);
    mRenderer.setZoomEnabled(true);
    mRenderer.setExternalZoomEnabled(true);

    mRenderer.setAntialiasing(true);
    mRenderer.setInScroll(true);

    mLastItemChange = new Date().getTime();
    mItemIndex = 5;// Math.abs(RAND.nextInt(ITEMS.length));

    mThresholds = new TimeSeries[3];
    mThresholdRenderers = new XYSeriesRenderer[3];

    int THRESHOLD_VALUES_t[] = { BMP_pressureSubscriber.mPressure_high, 100,
            BMP_pressureSubscriber.mPressure_low };

    for (int i = 0; i < THRESHOLD_COLORS.length; i++) {
        mThresholdRenderers[i] = new XYSeriesRenderer();
        mThresholdRenderers[i].setColor(THRESHOLD_COLORS[i]);
        mThresholdRenderers[i].setLineWidth(3);

        mThresholds[i] = new TimeSeries(THRESHOLD_LABELS[i]);
        final long now = new Date().getTime();

        mThresholds[i].add(new Date(now - 1000 * 60 * 10), THRESHOLD_VALUES_t[i]);
        mThresholds[i].add(new Date(now + 1000 * 60 * 10), THRESHOLD_VALUES_t[i]);

        mDataset.addSeries(mThresholds[i]);
        mRenderer.addSeriesRenderer(mThresholdRenderers[i]);
    }
}