Example usage for android.graphics Color LTGRAY

List of usage examples for android.graphics Color LTGRAY

Introduction

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

Prototype

int LTGRAY

To view the source code for android.graphics Color LTGRAY.

Click Source Link

Usage

From source file:com.secbro.qark.filebrowser.FileBrowserFragment.java

private void initializeFileListView() {
    ListView lView = (ListView) getView().findViewById(R.id.fileListView);
    lView.setBackgroundColor(Color.LTGRAY);
    LinearLayout.LayoutParams lParam = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT);
    lParam.setMargins(15, 5, 15, 5);/*from  w  w  w.  j  a v  a2  s  .  c  o  m*/
    lView.setAdapter(this.adapter);
    lView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            chosenFile = fileList.get(position).file;
            File sel = new File(path + "/" + chosenFile);
            Log.d(LOGTAG, "Clicked:" + chosenFile);
            if (sel.isDirectory()) {
                if (sel.canRead()) {
                    // Adds chosen directory to list
                    pathDirsList.add(chosenFile);
                    path = new File(sel + "");
                    Log.d(LOGTAG, "Just reloading the list");
                    loadFileList();
                    adapter.notifyDataSetChanged();
                    updateCurrentDirectoryTextView();
                    Log.d(LOGTAG, path.getAbsolutePath());
                } else {// if(sel.canRead()) {
                    showToast("Path does not exist or cannot be read");
                } // } else {//if(sel.canRead()) {
            } // if (sel.isDirectory()) {
              // File picked or an empty directory message clicked
            else {// if (sel.isDirectory()) {
                Log.d(LOGTAG, "item clicked");
                if (!directoryShownIsEmpty) {
                    Log.d(LOGTAG, "File selected:" + chosenFile);
                    returnFileFinishActivity(sel.getAbsolutePath());
                }
            } // else {//if (sel.isDirectory()) {
        }// public void onClick(DialogInterface dialog, int which) {
    });// lView.setOnClickListener(
}

From source file:com.joker.graphs.JokerStatisticsJokePost.java

/**
 * /*  www . j a  va2s.c o m*/
 */
protected void setChartStyle() {
    // 
    int[] colors = new int[count];
    PointStyle[] styles = new PointStyle[count];
    for (int i = 0; i < count; i++) {
        colors[i] = COLORS[i % COLORS.length];
        styles[i] = STYLES[i % STYLES.length];
    }
    // 
    mRenderer = buildRenderer(colors, styles, false);
    setChartSettings(mRenderer, "", "Month", "JokeCounts", 1, 12, 0, max_value, Color.LTGRAY,
            Color.LTGRAY);

    // 
    int length = mRenderer.getSeriesRendererCount();
    for (int i = 0; i < length; i++) {
        ((XYSeriesRenderer) mRenderer.getSeriesRendererAt(i)).setFillPoints(true);
    }
}

From source file:android_network.hetnet.vpn_service.AdapterRule.java

public AdapterRule(Activity context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);

    this.context = context;
    this.inflater = LayoutInflater.from(context);

    if (prefs.getBoolean("dark_theme", false))
        colorChanged = Color.argb(128, Color.red(Color.DKGRAY), Color.green(Color.DKGRAY),
                Color.blue(Color.DKGRAY));
    else/* w w w  .  ja  va  2  s. c  o  m*/
        colorChanged = Color.argb(128, Color.red(Color.LTGRAY), Color.green(Color.LTGRAY),
                Color.blue(Color.LTGRAY));

    TypedArray ta = context.getTheme().obtainStyledAttributes(new int[] { android.R.attr.textColorPrimary });
    try {
        colorText = ta.getColor(0, 0);
    } finally {
        ta.recycle();
    }

    TypedValue tv = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.colorOn, tv, true);
    colorOn = tv.data;
    context.getTheme().resolveAttribute(R.attr.colorOff, tv, true);
    colorOff = tv.data;

    colorGrayed = ContextCompat.getColor(context, R.color.colorGrayed);

    iconSize = Util.dips2pixels(48, context);
}

From source file:eu.faircode.netguard.AdapterRule.java

public AdapterRule(Activity context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);

    this.context = context;

    if (prefs.getBoolean("dark_theme", false))
        colorChanged = Color.argb(128, Color.red(Color.DKGRAY), Color.green(Color.DKGRAY),
                Color.blue(Color.DKGRAY));
    else//from   w  ww. j a  va2 s  .c  o m
        colorChanged = Color.argb(128, Color.red(Color.LTGRAY), Color.green(Color.LTGRAY),
                Color.blue(Color.LTGRAY));

    TypedArray ta = context.getTheme().obtainStyledAttributes(new int[] { android.R.attr.textColorSecondary });
    try {
        colorText = ta.getColor(0, 0);
    } finally {
        ta.recycle();
    }

    TypedValue tv = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.colorOn, tv, true);
    colorOn = tv.data;
    context.getTheme().resolveAttribute(R.attr.colorOff, tv, true);
    colorOff = tv.data;

    colorGrayed = ContextCompat.getColor(context, R.color.colorGrayed);

    iconSize = Util.dips2pixels(48, context);
}

From source file:de.uni_weimar.mheinz.androidtouchscope.display.HandleView.java

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (mIsOn) {// www  .j a  v  a2  s .  c  o  m
        mShapeDrawable.getPaint().setStyle(Paint.Style.FILL_AND_STROKE);
        mShapeDrawable.getPaint().setColor(mColor);
        mShapeDrawable.getPaint().setShadowLayer(2, 2, 2, Color.GRAY);
        mShapeDrawable.draw(canvas);
    } else {
        /*mShapeDrawable.getPaint().setStyle(Paint.Style.FILL);
        mShapeDrawable.getPaint().setColor(Color.WHITE);
        mShapeDrawable.getPaint().setShadowLayer(2,2,2,Color.GRAY);
        mShapeDrawable.draw(canvas);
        mShapeDrawable.getPaint().setStyle(Paint.Style.STROKE);
        mShapeDrawable.getPaint().setColor(Color.BLACK);
        mShapeDrawable.draw(canvas);*/
        mShapeDrawable.getPaint().setStyle(Paint.Style.FILL_AND_STROKE);
        mShapeDrawable.getPaint().setColor(Color.LTGRAY);
        mShapeDrawable.getPaint().setShadowLayer(2, 2, 2, Color.GRAY);
        mShapeDrawable.draw(canvas);
    }

    PointF center = getCircleCenter();
    mMainTextPaint.getTextBounds(mMainText, 0, mMainText.length(), mTextBounds);
    if (mOrientation == HandleDirection.RIGHT)
        canvas.drawText(mMainText, center.x + 5, center.y + mTextBounds.height() / 2 - 1, mMainTextPaint);
    else if (mOrientation == HandleDirection.LEFT)
        canvas.drawText(mMainText, center.x - 5, center.y + mTextBounds.height() / 2 - 2, mMainTextPaint);
    else
        canvas.drawText(mMainText, center.x, center.y + mTextBounds.height() / 2, mMainTextPaint);

    if (mPressDrawable != null) {
        if (mOrientation == HandleDirection.RIGHT) {
            mPressDrawable.setBounds(2, (int) (center.y - HANDLE_BREADTH / 2), HANDLE_BREADTH - 3,
                    (int) center.y + HANDLE_BREADTH / 2);
            mPressDrawable.draw(canvas);
        } else if (mOrientation == HandleDirection.LEFT) {
            canvas.save();
            canvas.rotate(180, HANDLE_LENGTH / 2, mHandlePos);
            mPressDrawable.setBounds(1, (int) (center.y - HANDLE_BREADTH / 2), HANDLE_BREADTH - 5,
                    (int) center.y + HANDLE_BREADTH / 2);
            mPressDrawable.draw(canvas);
            canvas.restore();
        }
    }
}

From source file:com.progym.custom.fragments.CalloriesProgressYearlyLineFragment.java

public void setYearProgressData(final Date date, final boolean isLeftIn) {

    final ProgressDialog ringProgressDialog = ProgressDialog.show(getActivity(),
            getResources().getString(R.string.please_wait), getResources().getString(R.string.populating_data),
            true);/*from   w ww . java 2 s  . com*/
    ringProgressDialog.setCancelable(true);
    new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                int yMaxAxisValue = 0;

                getActivity().runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            rlRootGraphLayout.removeView(viewChart);
                        } catch (Exception edsx) {
                            edsx.printStackTrace();
                        }
                    }
                });

                DATE = date;
                // Get amount of days in a month to find out average
                int daysInMonth = Utils.getDaysInMonth(date.getMonth(),
                        Integer.valueOf(Utils.formatDate(date, DataBaseUtils.DATE_PATTERN_YYYY)));
                // set January as first month
                date.setMonth(0);
                date.setDate(1);

                int[] x = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };

                final XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
                CategorySeries seriesCallories = new CategorySeries("Callories");

                List<Ingridient> list;
                Date dt = date; // *
                for (int element : x) {
                    list = DataBaseUtils.getAllFoodConsumedInMonth(
                            Utils.formatDate(dt, DataBaseUtils.DATE_PATTERN_YYYY_MM));

                    // init "average" data
                    int totalCallories = 0;
                    for (Ingridient ingridient : list) {
                        totalCallories += ingridient.kkal;
                    }
                    // add value to series
                    seriesCallories.add(totalCallories / daysInMonth);
                    // calculate maximum Y axis values
                    yMaxAxisValue = Math.max(yMaxAxisValue, totalCallories / daysInMonth);
                    // increment month
                    dt = DateUtils.addMonths(dt, 1);
                }

                int[] colors = new int[] { getActivity().getResources().getColor(R.color.purple) };
                final XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
                setChartSettings(renderer,
                        String.format("Callories statistic for %s year",
                                Utils.getSpecificDateValue(DATE, "yyyy")),
                        "Months", "Calories consumption", 0.7, 12.3, 0, yMaxAxisValue + 30, Color.GRAY,
                        Color.LTGRAY);

                renderer.getSeriesRendererAt(0).setDisplayChartValues(true);
                renderer.getSeriesRendererAt(0).setChartValuesTextSize(15f);
                renderer.setXLabels(0);
                renderer.setClickEnabled(false);
                renderer.setZoomEnabled(false);
                renderer.setPanEnabled(false, false);
                renderer.setZoomButtonsVisible(false);
                renderer.setPanLimits(new double[] { 1, 11 });
                renderer.setShowGrid(true);
                renderer.setShowLegend(true);
                renderer.setFitLegend(true);

                for (int i = 0; i < ActivityWaterProgress.months_short.length; i++) {
                    renderer.addXTextLabel(i + 1, ActivityWaterProgress.months_short[i]);

                }
                dataset.addSeries(seriesCallories.toXYSeries());

                getActivity().runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        viewChart = ChartFactory.getBarChartView(getActivity(), dataset, renderer,
                                Type.DEFAULT);
                        rlRootGraphLayout.addView(viewChart, 0);

                        if (isLeftIn) {
                            rightIn.setDuration(1000);
                            viewChart.startAnimation(rightIn);
                        } else {
                            leftIn.setDuration(1000);
                            viewChart.startAnimation(leftIn);
                        }
                    }
                });

            } catch (Exception e) {
            }
            ringProgressDialog.dismiss();
        }
    }).start();

}

From source file:org.wikipedia.page.shareafact.SnippetImage.java

private static void drawWordmarkFromText(@NonNull Context context, @NonNull Canvas canvas,
        boolean isArticleRTL) {
    final int maxWidth = WIDTH - DESCRIPTION_WIDTH - 2 * HORIZONTAL_PADDING;
    final float fontSize = 20.0f;
    final float scaleX = 1.06f;

    TextPaint textPaint = new TextPaint();
    textPaint.setAntiAlias(true);/*  w w  w . jav  a2  s .  c  o  m*/
    textPaint.setColor(Color.LTGRAY);
    textPaint.setTextSize(fontSize);
    textPaint.setTypeface(SERIF);
    textPaint.setTextScaleX(scaleX);

    Spanned wikipedia = StringUtil.fromHtml(context.getString(R.string.wp_stylized));
    Layout.Alignment align = L10nUtil.isDeviceRTL() ? ALIGN_OPPOSITE : ALIGN_NORMAL;
    StaticLayout wordmarkLayout = buildLayout(
            new TextLayoutParams(wikipedia, textPaint, maxWidth, 1.0f, align));
    final int width = (int) wordmarkLayout.getLineWidth(0);
    final int height = wordmarkLayout.getHeight();

    final int bottom = HEIGHT - BOTTOM_PADDING;
    final int top = bottom - height;

    int left = WIDTH - HORIZONTAL_PADDING - width;
    if (isArticleRTL) {
        left = HORIZONTAL_PADDING;
    }

    canvas.save(); // --
    canvas.translate(left, top);
    wordmarkLayout.draw(canvas);
    canvas.restore(); // --
}

From source file:com.progym.custom.fragments.FoodProgressYearlyLineFragment.java

public void setYearProgressData(final Date date, final boolean isLeftIn) {

    final ProgressDialog ringProgressDialog = ProgressDialog.show(getActivity(),
            getResources().getString(R.string.please_wait), getResources().getString(R.string.populating_data),
            true);//  w w  w.java  2 s .  c  o m
    ringProgressDialog.setCancelable(true);
    new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                int yMaxAxisValue = 0;

                getActivity().runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            rlRootGraphLayout.removeView(viewChart);
                        } catch (Exception edsx) {
                            edsx.printStackTrace();
                        }

                    }
                });

                DATE = date;
                // Get amount of days in a month to find out average
                int daysInMonth = Utils.getDaysInMonth(date.getMonth(),
                        Integer.valueOf(Utils.formatDate(date, DataBaseUtils.DATE_PATTERN_YYYY)));
                // set January as first month
                date.setMonth(0);
                date.setDate(1);

                int[] x = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };

                final XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
                CategorySeries seriesProtein = new CategorySeries("Protein");
                CategorySeries seriesFat = new CategorySeries("Fat");
                CategorySeries seriesCarbs = new CategorySeries("Carbs");

                List<Ingridient> list;
                Date dt = date;
                for (int element : x) {
                    list = DataBaseUtils.getAllFoodConsumedInMonth(
                            Utils.formatDate(dt, DataBaseUtils.DATE_PATTERN_YYYY_MM));

                    // init "average" data
                    double totalProtein = 0, totalFat = 0, totalCarbs = 0, totalCallories = 0;
                    for (Ingridient ingridient : list) {
                        totalProtein += ingridient.protein;
                        totalFat += ingridient.fat;
                        totalCarbs += ingridient.carbohydrates;
                        totalCallories += ingridient.kkal;
                    }

                    seriesProtein.add((double) Math.round(totalProtein * 100) / 100);
                    seriesFat.add((double) Math.round(totalFat * 100) / 100);
                    seriesCarbs.add((double) Math.round(totalCarbs * 100) / 100);

                    // calculate maximum Y axis values
                    yMaxAxisValue = Math.max(yMaxAxisValue, (int) totalProtein);
                    yMaxAxisValue = Math.max(yMaxAxisValue, (int) totalFat);
                    yMaxAxisValue = Math.max(yMaxAxisValue, (int) totalCarbs);

                    // increment month
                    dt = DateUtils.addMonths(dt, 1);
                }

                int[] colors = new int[] { getActivity().getResources().getColor(R.color.green),
                        getActivity().getResources().getColor(R.color.orange),
                        getActivity().getResources().getColor(R.color.purple) };
                final XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
                setChartSettings(renderer,
                        String.format("Protein/Carbohydrates/Fat statistic for %s year",
                                Utils.getSpecificDateValue(DATE, "yyyy")),
                        "Months", "Amount (g)           ", 0.7, 12.3, 0, yMaxAxisValue + 30, Color.GRAY,
                        Color.LTGRAY);

                renderer.getSeriesRendererAt(0).setDisplayChartValues(true);
                renderer.getSeriesRendererAt(1).setDisplayChartValues(true);
                renderer.getSeriesRendererAt(2).setDisplayChartValues(true);

                renderer.getSeriesRendererAt(0).setChartValuesTextSize(15f);
                renderer.getSeriesRendererAt(1).setChartValuesTextSize(15f);
                renderer.getSeriesRendererAt(2).setChartValuesTextSize(15f);

                // renderer.getSeriesRendererAt(0).setChartValuesTextAlign(Align.CENTER);
                // renderer.getSeriesRendererAt(1).setChartValuesTextAlign(Align.LEFT);
                // renderer.getSeriesRendererAt(2).setChartValuesTextAlign(Align.RIGHT);

                renderer.setXLabels(0);
                // renderer.setYLabels(10);
                // renderer.setXLabelsAlign(Align.LEFT);
                // renderer.setYLabelsAlign(Align.LEFT);
                // renderer.setPanEnabled(true, false);
                renderer.setClickEnabled(false);
                renderer.setZoomEnabled(false);
                renderer.setPanEnabled(false, false);
                renderer.setZoomButtonsVisible(false);
                renderer.setPanLimits(new double[] { 1, 11 });
                // renderer.setZoomEnabled(false);
                // renderer.setZoomRate(1.1f);
                renderer.setShowGrid(true);
                renderer.setShowLegend(true);
                renderer.setFitLegend(true);

                for (int i = 0; i < ActivityWaterProgress.months_short.length; i++) {
                    renderer.addXTextLabel(i + 1, ActivityWaterProgress.months_short[i]);

                }

                dataset.addSeries(seriesProtein.toXYSeries());
                dataset.addSeries(seriesFat.toXYSeries());
                dataset.addSeries(seriesCarbs.toXYSeries());

                getActivity().runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            viewChart = ChartFactory.getLineChartView(getActivity(), dataset,
                                    renderer/* , Type.STACKED */);
                            rlRootGraphLayout.addView(viewChart, 0);
                            if (isLeftIn) {
                                rightIn.setDuration(1000);
                                viewChart.startAnimation(rightIn);
                            } else {
                                leftIn.setDuration(1000);
                                viewChart.startAnimation(leftIn);
                            }
                        } catch (Exception edsx) {
                            edsx.printStackTrace();
                        }

                    }
                });

            } catch (Exception e) {
                e.printStackTrace();
            }
            ringProgressDialog.dismiss();
        }
    }).start();

}

From source file:com.saulcintero.moveon.fragments.Summary4.java

private void pieChartView() {
    int sumTime = hr_zones_time[0] + hr_zones_time[1] + hr_zones_time[2] + hr_zones_time[3] + hr_zones_time[4]
            + hr_zones_time[5];/* ww  w  .  j  a v a2s  .c  o  m*/
    double[] distribution = new double[6];
    distribution[0] = (hr_zones_time[0] * 100) / sumTime;
    distribution[1] = (hr_zones_time[1] * 100) / sumTime;
    distribution[2] = (hr_zones_time[2] * 100) / sumTime;
    distribution[3] = (hr_zones_time[3] * 100) / sumTime;
    distribution[4] = (hr_zones_time[4] * 100) / sumTime;
    distribution[5] = (hr_zones_time[5] * 100) / sumTime;

    final String[] status = new String[] {
            getString(R.string.hr_resting).toUpperCase(Locale.getDefault()) + " (" + (int) distribution[0]
                    + "%)",
            getString(R.string.hr_level1).toUpperCase(Locale.getDefault()) + " (" + (int) distribution[1]
                    + "%)",
            getString(R.string.hr_level2).toUpperCase(Locale.getDefault()) + " (" + (int) distribution[2]
                    + "%)",
            getString(R.string.hr_level3).toUpperCase(Locale.getDefault()) + " (" + (int) distribution[3]
                    + "%)",
            getString(R.string.hr_level4).toUpperCase(Locale.getDefault()) + " (" + (int) distribution[4]
                    + "%)",
            getString(R.string.hr_maximum).toUpperCase(Locale.getDefault()) + " (" + (int) distribution[5]
                    + "%)" };

    int[] colors = { Color.LTGRAY, Color.rgb(111, 183, 217), Color.rgb(54, 165, 54), Color.rgb(234, 206, 74),
            Color.rgb(246, 164, 83), Color.rgb(246, 103, 88) };

    TypedValue outValue1 = new TypedValue();
    TypedValue outValue2 = new TypedValue();
    mContext.getResources().getValue(R.dimen.pie_legend_text_size_value, outValue1, true);
    mContext.getResources().getValue(R.dimen.pie_labels_text_size_value, outValue2, true);
    float pieLegendTextSizeValue = outValue1.getFloat();
    float pieLabelTextSizeValue = outValue2.getFloat();

    final CategorySeries distributionSeries = new CategorySeries("");
    for (int i = 0; i < distribution.length; i++) {
        distributionSeries.add(status[i], distribution[i]);
    }

    final DefaultRenderer defaultRenderer = new DefaultRenderer();
    defaultRenderer.setShowLabels(true);
    defaultRenderer.setLegendTextSize(pieLegendTextSizeValue);
    defaultRenderer.setLabelsTextSize(pieLabelTextSizeValue);
    defaultRenderer.setZoomButtonsVisible(true);
    defaultRenderer.setStartAngle(180);
    defaultRenderer.setDisplayValues(false);
    defaultRenderer.setClickEnabled(true);
    defaultRenderer.setInScroll(true);
    for (int i = 0; i < distribution.length; i++) {
        SimpleSeriesRenderer seriesRenderer = new SimpleSeriesRenderer();
        seriesRenderer.setColor(colors[i]);
        seriesRenderer.setDisplayChartValues(true);
        seriesRenderer.setHighlighted(false);

        defaultRenderer.addSeriesRenderer(seriesRenderer);
    }

    mChartView = ChartFactory.getPieChartView(mContext, distributionSeries, defaultRenderer);

    mChartView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();

            if (seriesSelection == null) {
                for (int i = 0; i < distributionSeries.getItemCount(); i++) {
                    defaultRenderer.getSeriesRendererAt(i).setHighlighted(false);
                }
                mChartView.repaint();
            } else {
                for (int i = 0; i < distributionSeries.getItemCount(); i++) {
                    defaultRenderer.getSeriesRendererAt(i).setHighlighted(i == seriesSelection.getPointIndex());
                }
                mChartView.repaint();

                int selectedSerie = (int) seriesSelection.getPointIndex();
                String sZone = " " + getString(R.string.of_time) + " (";
                switch (selectedSerie) {
                case 0:
                    if (time < 3600)
                        sZone = sZone + FunctionUtils.shortFormatTime(hr_zones_time[0]);
                    else
                        sZone = sZone + FunctionUtils.longFormatTime(hr_zones_time[0]);

                    sZone = sZone + ") " + getString(R.string.in_restring);
                    break;
                case 1:
                    if (time < 3600)
                        sZone = sZone + FunctionUtils.shortFormatTime(hr_zones_time[1]);
                    else
                        sZone = sZone + FunctionUtils.longFormatTime(hr_zones_time[1]);

                    sZone = sZone + ") " + getString(R.string.in_hr_range1);
                    break;
                case 2:
                    if (time < 3600)
                        sZone = sZone + FunctionUtils.shortFormatTime(hr_zones_time[2]);
                    else
                        sZone = sZone + FunctionUtils.longFormatTime(hr_zones_time[2]);

                    sZone = sZone + ") " + getString(R.string.in_hr_range2);
                    break;
                case 3:
                    if (time < 3600)
                        sZone = sZone + FunctionUtils.shortFormatTime(hr_zones_time[3]);
                    else
                        sZone = sZone + FunctionUtils.longFormatTime(hr_zones_time[3]);

                    sZone = sZone + ") " + getString(R.string.in_hr_range3);
                    break;
                case 4:
                    if (time < 3600)
                        sZone = sZone + FunctionUtils.shortFormatTime(hr_zones_time[4]);
                    else
                        sZone = sZone + FunctionUtils.longFormatTime(hr_zones_time[4]);

                    sZone = sZone + ") " + getString(R.string.in_hr_range4);
                    break;
                case 5:
                    if (time < 3600)
                        sZone = sZone + FunctionUtils.shortFormatTime(hr_zones_time[5]);
                    else
                        sZone = sZone + FunctionUtils.longFormatTime(hr_zones_time[5]);

                    sZone = sZone + ") " + getString(R.string.in_maximum_effort);
                    break;
                }

                UIFunctionUtils.showMessage(mContext, true, (int) seriesSelection.getValue() + "%" + sZone);
            }
        }
    });

    layout.addView(mChartView);
}

From source file:com.androzic.waypoint.WaypointDetails.java

@SuppressLint("NewApi")
private void updateWaypointDetails(double lat, double lon) {
    Androzic application = Androzic.getApplication();
    AppCompatActivity activity = (AppCompatActivity) getActivity();

    activity.getSupportActionBar().setTitle(waypoint.name);

    View view = getView();//  w  ww .ja  v a 2  s  .c o  m

    final TextView coordsView = (TextView) view.findViewById(R.id.coordinates);
    coordsView.requestFocus();
    coordsView.setTag(Integer.valueOf(StringFormatter.coordinateFormat));
    coordsView.setText(StringFormatter.coordinates(" ", waypoint.latitude, waypoint.longitude));
    coordsView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            int format = ((Integer) coordsView.getTag()).intValue() + 1;
            if (format == 5)
                format = 0;
            coordsView.setText(StringFormatter.coordinates(format, " ", waypoint.latitude, waypoint.longitude));
            coordsView.setTag(Integer.valueOf(format));
        }
    });

    if (waypoint.altitude != Integer.MIN_VALUE) {
        ((TextView) view.findViewById(R.id.altitude))
                .setText("\u2336 " + StringFormatter.elevationH(waypoint.altitude));
        view.findViewById(R.id.altitude).setVisibility(View.VISIBLE);
    } else {
        view.findViewById(R.id.altitude).setVisibility(View.GONE);
    }

    if (waypoint.proximity > 0) {
        ((TextView) view.findViewById(R.id.proximity))
                .setText("~ " + StringFormatter.distanceH(waypoint.proximity));
        view.findViewById(R.id.proximity).setVisibility(View.VISIBLE);
    } else {
        view.findViewById(R.id.proximity).setVisibility(View.GONE);
    }

    double dist = Geo.distance(lat, lon, waypoint.latitude, waypoint.longitude);
    double bearing = Geo.bearing(lat, lon, waypoint.latitude, waypoint.longitude);
    bearing = application.fixDeclination(bearing);
    String distance = StringFormatter.distanceH(dist) + " " + StringFormatter.angleH(bearing);
    ((TextView) view.findViewById(R.id.distance)).setText(distance);

    ((TextView) view.findViewById(R.id.waypointset)).setText(waypoint.set.name);

    if (waypoint.date != null) {
        view.findViewById(R.id.date_row).setVisibility(View.VISIBLE);
        ((TextView) view.findViewById(R.id.date))
                .setText(DateFormat.getDateFormat(activity).format(waypoint.date) + " "
                        + DateFormat.getTimeFormat(activity).format(waypoint.date));
    } else {
        view.findViewById(R.id.date_row).setVisibility(View.GONE);
    }

    if ("".equals(waypoint.description)) {
        view.findViewById(R.id.description_row).setVisibility(View.GONE);
    } else {
        WebView description = (WebView) view.findViewById(R.id.description);
        String descriptionHtml;
        try {
            TypedValue tv = new TypedValue();
            Theme theme = activity.getTheme();
            Resources resources = getResources();
            theme.resolveAttribute(android.R.attr.textColorPrimary, tv, true);
            int secondaryColor = resources.getColor(tv.resourceId);
            String css = String.format(
                    "<style type=\"text/css\">html,body{margin:0;background:transparent} *{color:#%06X}</style>\n",
                    (secondaryColor & 0x00FFFFFF));
            descriptionHtml = css + waypoint.description;
            description.setWebViewClient(new WebViewClient() {
                @SuppressLint("NewApi")
                @Override
                public void onPageFinished(WebView view, String url) {
                    view.setBackgroundColor(Color.TRANSPARENT);
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
                        view.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
                }
            });
            description.setBackgroundColor(Color.TRANSPARENT);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
                description.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
        } catch (Resources.NotFoundException e) {
            description.setBackgroundColor(Color.LTGRAY);
            descriptionHtml = waypoint.description;
        }

        WebSettings settings = description.getSettings();
        settings.setDefaultTextEncodingName("utf-8");
        settings.setAllowFileAccess(true);
        Uri baseUrl = Uri.fromFile(new File(application.dataPath));
        description.loadDataWithBaseURL(baseUrl.toString() + "/", descriptionHtml, "text/html", "utf-8", null);
        view.findViewById(R.id.description_row).setVisibility(View.VISIBLE);
    }
}