Example usage for android.graphics Color BLACK

List of usage examples for android.graphics Color BLACK

Introduction

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

Prototype

int BLACK

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

Click Source Link

Usage

From source file:fr.cph.chicago.activity.BusBoundActivity.java

private void drawPattern(final BusPattern pattern) {
    if (mGooMap != null) {
        final List<Marker> markers = new ArrayList<Marker>();
        PolylineOptions poly = new PolylineOptions();
        poly.geodesic(true).color(Color.BLACK);
        poly.width(7f);//from w w  w . java2 s . c om
        Marker marker;
        for (PatternPoint patternPoint : pattern.getPoints()) {
            LatLng point = new LatLng(patternPoint.getPosition().getLatitude(),
                    patternPoint.getPosition().getLongitude());
            poly.add(point);
            if (patternPoint.getStopId() != null) {
                marker = mGooMap.addMarker(new MarkerOptions().position(point).title(patternPoint.getStopName())
                        .snippet(String.valueOf(patternPoint.getSequence())));
                // .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
                markers.add(marker);
                marker.setVisible(false);
            }
        }
        mGooMap.addPolyline(poly);

        mGooMap.setOnCameraChangeListener(new OnCameraChangeListener() {
            private float currentZoom = -1;

            @Override
            public void onCameraChange(CameraPosition pos) {
                if (pos.zoom != currentZoom) {
                    currentZoom = pos.zoom;
                    if (currentZoom >= 14) {
                        for (Marker marker : markers) {
                            marker.setVisible(true);
                        }
                    } else {
                        for (Marker marker : markers) {
                            marker.setVisible(false);
                        }
                    }
                }
            }
        });
    }
}

From source file:com.astuetz.PagerSlidingTabStripPlus.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        for (int k = 0; k < ((LinearLayout) tabsContainer.getChildAt(i)).getChildCount(); k++) {

            View v = ((LinearLayout) tabsContainer.getChildAt(i)).getChildAt(k);

            v.setBackgroundResource(tabBackgroundResId);

            if (v instanceof TextView) {

                TextView tab = (TextView) v;
                tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
                tab.setTypeface(tabTypeface, tabTypefaceStyle);

                // Setting color of textView
                if (textColorTab != null) {
                    tab.setTextColor(textColorTab);
                } else {
                    tab.setTextColor(Color.BLACK);
                }/*from   ww  w  . jav a  2s . c o  m*/

                // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
                // pre-ICS-build
                if (textAllCaps) {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                        tab.setAllCaps(true);
                    } else {
                        tab.setText(tab.getText().toString().toUpperCase(locale));
                    }
                }
            }
        }
    }
}

From source file:com.learn.mobile.customview.DSwipeRefreshLayout.java

private void createProgressView() {
    mCircleView = new DCircleImageView(getContext(), CIRCLE_BG_LIGHT, CIRCLE_DIAMETER / 2);
    mProgress = new DMaterialProgressDrawable(getContext(), this);
    mProgress.setBackgroundColor(CIRCLE_BG_LIGHT);
    mCircleView.setImageDrawable(mProgress);
    mCircleView.setVisibility(View.GONE);
    addView(mCircleView);/*from  w  w  w.ja  v a 2s. c o m*/

    // TODO Create backdrop
    backDrop = new ImageView(getContext());

    backDrop.setVisibility(View.GONE);
    backDrop.bringToFront();
    backDrop.setBackgroundColor(Color.WHITE);
    addView(backDrop);

    // TODO Custom Swipe Refresh Layout
    mLoadMoreCircleView = new DCircleImageView(getContext(), CIRCLE_BG_LIGHT, CIRCLE_DIAMETER / 2);
    mLoadMoreProgress = new DMaterialProgressDrawable(getContext(), mLoadMoreCircleView);
    mLoadMoreProgress.setBackgroundColor(CIRCLE_BG_LIGHT);
    mLoadMoreProgress.setColorSchemeColors(Color.BLUE, Color.RED, Color.GREEN, Color.WHITE, Color.BLACK);

    mLoadMoreCircleView.setImageDrawable(mLoadMoreProgress);

    mLoadMoreCircleView.setVisibility(View.GONE);

    addView(mLoadMoreCircleView);

    mLoadMoreProgress.setAlpha(MAX_ALPHA);

}

From source file:com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPushIntentService.java

private void generateNotification(Context context, String ticker, String title, String msg, int icon,
        Intent intent, String sound, int notificationId, MFPInternalPushMessage message) {

    int androidSDKVersion = Build.VERSION.SDK_INT;
    long when = System.currentTimeMillis();
    Notification notification = null;
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this);

    if (message.getGcmStyle() != null && androidSDKVersion > 21) {
        NotificationCompat.Builder mBuilder = null;
        NotificationManager notificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);

        try {/* ww w. j  a va 2s.c  o m*/
            JSONObject gcmStyleObject = new JSONObject(message.getGcmStyle());
            String type = gcmStyleObject.getString(TYPE);

            if (type != null && type.equalsIgnoreCase(PICTURE_NOTIFICATION)) {
                Bitmap remote_picture = null;
                NotificationCompat.BigPictureStyle notificationStyle = new NotificationCompat.BigPictureStyle();
                notificationStyle.setBigContentTitle(ticker);
                notificationStyle.setSummaryText(gcmStyleObject.getString(TITLE));

                try {
                    remote_picture = new getBitMapBigPictureNotification()
                            .execute(gcmStyleObject.getString(URL)).get();
                } catch (Exception e) {
                    logger.error(
                            "MFPPushIntentService:generateNotification() - Error while fetching image file.");
                }
                if (remote_picture != null) {
                    notificationStyle.bigPicture(remote_picture);
                }

                mBuilder = new NotificationCompat.Builder(context);
                notification = mBuilder.setSmallIcon(icon).setLargeIcon(remote_picture).setAutoCancel(true)
                        .setContentTitle(title)
                        .setContentIntent(PendingIntent.getActivity(context, notificationId, intent,
                                PendingIntent.FLAG_UPDATE_CURRENT))
                        .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
                        .setContentText(msg).setStyle(notificationStyle).build();

            } else if (type != null && type.equalsIgnoreCase(BIGTEXT_NOTIFICATION)) {
                NotificationCompat.BigTextStyle notificationStyle = new NotificationCompat.BigTextStyle();
                notificationStyle.setBigContentTitle(ticker);
                notificationStyle.setSummaryText(gcmStyleObject.getString(TITLE));
                notificationStyle.bigText(gcmStyleObject.getString(TEXT));

                mBuilder = new NotificationCompat.Builder(context);
                notification = mBuilder.setSmallIcon(icon).setAutoCancel(true).setContentTitle(title)
                        .setContentIntent(PendingIntent.getActivity(context, notificationId, intent,
                                PendingIntent.FLAG_UPDATE_CURRENT))
                        .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
                        .setContentText(msg).setStyle(notificationStyle).build();
            } else if (type != null && type.equalsIgnoreCase(INBOX_NOTIFICATION)) {
                NotificationCompat.InboxStyle notificationStyle = new NotificationCompat.InboxStyle();
                notificationStyle.setBigContentTitle(ticker);
                notificationStyle.setSummaryText(gcmStyleObject.getString(TITLE));

                String lines = gcmStyleObject.getString(LINES).replaceAll("\\[", "").replaceAll("\\]", "");
                String[] lineArray = lines.split(",");

                for (String line : lineArray) {
                    notificationStyle.addLine(line);
                }

                mBuilder = new NotificationCompat.Builder(context);
                notification = mBuilder.setSmallIcon(icon).setAutoCancel(true).setContentTitle(title)
                        .setContentIntent(PendingIntent.getActivity(context, notificationId, intent,
                                PendingIntent.FLAG_UPDATE_CURRENT))
                        .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
                        .setContentText(msg).setStyle(notificationStyle).build();
            }

            notification.flags = Notification.FLAG_AUTO_CANCEL;
            notificationManager.notify(notificationId, notification);
        } catch (JSONException e) {
            logger.error("MFPPushIntentService:generateNotification() - Error while parsing JSON.");
        }

    } else {
        if (androidSDKVersion > 10) {
            builder.setContentIntent(PendingIntent.getActivity(context, notificationId, intent,
                    PendingIntent.FLAG_UPDATE_CURRENT)).setSmallIcon(icon).setTicker(ticker).setWhen(when)
                    .setAutoCancel(true).setContentTitle(title).setContentText(msg)
                    .setSound(getNotificationSoundUri(context, sound));

            if (androidSDKVersion > 15) {
                int priority = getPriorityOfMessage(message);
                builder.setPriority(priority);
                notification = builder.build();
            }

            if (androidSDKVersion > 19) {
                //As new material theme is very light, the icon is not shown clearly
                //hence setting the background of icon to black
                builder.setColor(Color.BLACK);
                Boolean isBridgeSet = message.getBridge();
                if (!isBridgeSet) {
                    // show notification only on current device.
                    builder.setLocalOnly(true);
                }

                notification = builder.build();
                int receivedVisibility = 1;
                String visibility = message.getVisibility();
                if (visibility != null && visibility.equalsIgnoreCase(MFPPushConstants.VISIBILITY_PRIVATE)) {
                    receivedVisibility = 0;
                }
                if (receivedVisibility == Notification.VISIBILITY_PRIVATE && message.getRedact() != null) {
                    builder.setContentIntent(PendingIntent.getActivity(context, notificationId, intent,
                            PendingIntent.FLAG_UPDATE_CURRENT)).setSmallIcon(icon).setTicker(ticker)
                            .setWhen(when).setAutoCancel(true).setContentTitle(title)
                            .setContentText(message.getRedact())
                            .setSound(getNotificationSoundUri(context, sound));

                    notification.publicVersion = builder.build();
                }
            }

            if (androidSDKVersion > 21) {
                String setPriority = message.getPriority();
                if (setPriority != null && setPriority.equalsIgnoreCase(MFPPushConstants.PRIORITY_MAX)) {
                    //heads-up notification
                    builder.setContentText(msg).setFullScreenIntent(PendingIntent.getActivity(context,
                            notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT), true);
                    notification = builder.build();
                }
            }

        } else {
            notification = builder
                    .setContentIntent(
                            PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT))
                    .setSmallIcon(icon).setTicker(ticker).setWhen(when).setAutoCancel(true)
                    .setContentTitle(title).setContentText(msg)
                    .setSound(getNotificationSoundUri(context, sound)).build();
        }

        NotificationManager notificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);

        notificationManager.notify(notificationId, notification);
    }
}

From source file:com.glandorf1.joe.wsprnetviewer.app.WsprFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    // This is called when a new Loader needs to be created.  This
    // fragment only uses one loader, so we don't care about checking the id.

    // TODO: Filter the query to only return data from today and the previous N days.
    //        Calendar cal = Calendar.getInstance();
    //        cal.setTime(new Date());
    //        cal.add(Calendar.DATE, -7); // N= 7
    //        Date cutoffDate = cal.getTime();
    //        String startTimestamp = WsprNetContract.getDbTimestampString(cutoffDate);

    // Sort order:  Descending, by timestamp.
    String sortOrder = WsprNetContract.SignalReportEntry.COLUMN_TIMESTAMPTEXT + " DESC";
    String txCall = Utility.getFilterCallsign(getActivity(), true),
            rxCall = Utility.getFilterCallsign(getActivity(), false);
    String txGridsquare = Utility.getFilterGridsquare(getActivity(), true),
            rxGridsquare = Utility.getFilterGridsquare(getActivity(), false);
    txCall = Utility.filterCleanupForSQL(txCall);
    rxCall = Utility.filterCleanupForSQL(rxCall);
    txGridsquare = Utility.filterCleanupForSQL(txGridsquare);
    rxGridsquare = Utility.filterCleanupForSQL(rxGridsquare);
    mSelection = "";
    if (Utility.isFiltered(getActivity())) {
        // When adding filters, be sure to update onResume(), and save the preference value below, too.
        String prefAndOr = Utility.isFilterAnd(getActivity()) ? " and " : " or ";
        String sAndOr = " ";
        if (txCall.length() > 0) {
            sAndOr = (mSelection.length() > 0) ? prefAndOr : "";
            mSelection += sAndOr + "(" + WsprNetContract.SignalReportEntry.COLUMN_TX_CALLSIGN + " like '"
                    + txCall + "')";
        }//from  w ww  . j a  va 2 s .c  om
        if (rxCall.length() > 0) {
            sAndOr = (mSelection.length() > 0) ? prefAndOr : "";
            mSelection += sAndOr + "(" + WsprNetContract.SignalReportEntry.COLUMN_RX_CALLSIGN + " like '"
                    + rxCall + "')";
        }
        if (txGridsquare.length() > 0) {
            sAndOr = (mSelection.length() > 0) ? prefAndOr : "";
            mSelection += sAndOr + "(" + WsprNetContract.SignalReportEntry.COLUMN_TX_GRIDSQUARE + " like '"
                    + txGridsquare + "')";
        }
        if (rxGridsquare.length() > 0) {
            sAndOr = (mSelection.length() > 0) ? prefAndOr : "";
            mSelection += sAndOr + "(" + WsprNetContract.SignalReportEntry.COLUMN_RX_GRIDSQUARE + " like '"
                    + rxGridsquare + "')";
        }
        // Examples of resulting 'selection' clause:
        //   tx_callsign like 'D%'
        //   (tx_gridsquare like 'D%') and (rx_callsign like 'N%')
        //   (tx_gridsquare like 'D%') or (rx_callsign like 'N%')
        if (mSelection.length() > 0) {
            // Remind user that items are filtered, in case the result is not what they expect.
            Toast.makeText(getActivity(), getActivity().getString(R.string.toast_filter_items),
                    Toast.LENGTH_LONG).show();
        }
    }

    int mainDisplayPreference = Utility.getMainDisplayPreference(getActivity());
    if (mWsprAdapter.mainDisplayFormat != mainDisplayPreference) {
        // Update the gridsquare/callsign heading text based on the display layout.
        switch (mainDisplayPreference) {
        case Utility.MAIN_DISPLAY_CALLSIGN: // fit everything into 2 lines of display
            mTVGridCallHeader.setText(getActivity().getString(R.string.callsign));
            mTVGridCallHeader.setTextColor(getResources().getColor(R.color.wspr_brown));
            break;
        case Utility.MAIN_DISPLAY_GRIDCALL: // fit everything into 4 lines of display
            String g = getActivity().getString(R.string.grid);
            String c = getActivity().getString(R.string.call);
            Spannable s = new SpannableString(g + "/" + c);
            // In "Grid/Call", make "grid" black, "Call" brown, and "/" somewhere between.
            // Release: For "Grid", set the span to be 1 extra character.
            s.setSpan(new ForegroundColorSpan(Color.BLACK), 0, g.length() + 0,
                    Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            // Debug: For the "/", set the span to be 2 characters; it will won't display in the color if the span is only 1 character.
            s.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.wspr_brown2)), g.length() + 0,
                    g.length() + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            s.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.wspr_brown)), g.length() + 1,
                    s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            mTVGridCallHeader.setText(s);
            break;
        case Utility.MAIN_DISPLAY_GRIDSQUARE: // fit everything into 2 lines of display
        default:
            mTVGridCallHeader.setText(getActivity().getString(R.string.gridsquare));
            mTVGridCallHeader.setTextColor(Color.BLACK);
        }

    }

    // Save some of the preferences to detect if they've changed in onResume().
    mGridsquare = Utility.getPreferredGridsquare(getActivity());
    mWsprAdapter.mainDisplayFormat = mainDisplayPreference;
    mFilterTxCallsign = Utility.getFilterCallsign(getActivity(), true);
    mFilterRxCallsign = Utility.getFilterCallsign(getActivity(), false);
    mFilterTxGridsquare = Utility.getFilterGridsquare(getActivity(), true);
    mFilterRxGridsquare = Utility.getFilterGridsquare(getActivity(), false);
    mFilterAnd = Utility.isFilterAnd(getActivity());
    mFiltered = Utility.isFiltered(getActivity());
    Uri wsprUri;
    wsprUri = WsprNetContract.SignalReportEntry.buildWspr();

    // Create and return a CursorLoader that will take care of creating a Cursor for the data being displayed.
    return new CursorLoader(getActivity(), // context
            wsprUri, // URI
            WSPR_COLUMNS, // String[] projection
            mSelection, // String selection
            null, // String[] selectionArgs
            sortOrder // String sortOrder
    );
}

From source file:com.commit451.springy.CompanionWatchFaceConfigActivity.java

private void updatePreviewView(Themes.Theme theme, ViewGroup clockContainerView) {
    if (theme == Themes.MUZEI_THEME) {
        if (mMuzeiLoadedArtwork != null) {
            ((ImageView) clockContainerView.findViewById(R.id.background_image))
                    .setImageBitmap(mMuzeiLoadedArtwork.bitmap);
        }/*from  w ww.j a va2  s  . c om*/
        clockContainerView.setBackgroundColor(Color.BLACK);
    } else {
        ((ImageView) clockContainerView.findViewById(R.id.background_image)).setImageDrawable(null);
        clockContainerView.setBackgroundColor(theme.color);
    }
}

From source file:uf.edu.encDetailActivity.java

public Intent barchartIntent(ArrayList<Integer> timeStamp, String mac, String macname) {
    int time;//from w w w. j  a va 2  s.  co m
    int HOUR = 3600;
    int DAY = HOUR * 24;
    int WEEK = DAY * 7;
    int MONTH = DAY * 30;
    int YEAR = WEEK * 52;
    int numBins;
    SimpleDateFormat format;
    String timeUnit;
    double[] set1, set2;
    int first;
    //to get the range
    int diff = timeStamp.get(timeStamp.size() - 1) - timeStamp.get(0);

    if (diff / YEAR > 1) {
        time = YEAR;
        timeUnit = "Year";
        format = new SimpleDateFormat("yyyy");
        first = (int) ((float) timeStamp.get(0) / (float) (86400.0F * (float) 365.25F))
                * (int) (86400.0F * 365.25F);
    } else if (diff / MONTH > 1) {
        time = MONTH;
        timeUnit = "Month";
        format = new SimpleDateFormat("MMM-yyyy");
        first = (int) ((float) timeStamp.get(0) / (float) (86400.0F * (float) 365.25F / 12.0F))
                * (int) (86400.0F * 365.25F / 12.0F);
    } else if (diff / WEEK > 1) {
        time = WEEK;
        timeUnit = "Week";
        format = new SimpleDateFormat("W 'Week'  MMM-yyyy");
        first = ((int) ((float) timeStamp.get(0) / (float) (86400.0F * (float) 365.25F / 52.0F)))
                * (int) (86400.0F * 365.25F / 52.0F);
    } else if (diff / DAY > 1) {
        time = DAY;
        timeUnit = "Day";
        format = new SimpleDateFormat("EEE dd-MMM-yyyy");
        first = (int) ((float) timeStamp.get(0) / (float) (86400.0F)) * (int) (86400.0F);
    } else {
        time = HOUR;
        timeUnit = "Hour";
        format = new SimpleDateFormat("HH dd-MMM-yyyy");
        first = (int) ((float) timeStamp.get(0) / (float) (3600.0F)) * (int) (3600.0F);
    }

    numBins = (timeStamp.get(timeStamp.size() - 1) - first) / time + 1;
    set1 = new double[numBins];
    set2 = new double[numBins];
    for (int i = 0; i < numBins; i++) {
        set2[i] = 0.0;
    }

    //now Iterate over the arrayList and do bining

    for (int i : timeStamp) {
        int tmp = (i - first) / time;
        set1[tmp]++;
        //Log.e(TAG,Integer.toString(i));
    }

    //find the max value to set xMax
    double yMax = 0.0;
    for (double k : set1) {
        if (k > yMax)
            yMax = k;
    }
    //increase the xmax by 10% to improve visibility
    yMax = yMax + 2;
    String[] titles = new String[] { "Encounters per " + timeUnit, " " };

    List<double[]> values = new ArrayList<double[]>();
    values.add(set1);
    values.add(set2);

    int[] colors = new int[] { Color.GREEN, Color.BLACK };
    XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
    renderer.setOrientation(Orientation.HORIZONTAL);
    renderer.setBackgroundColor(Color.TRANSPARENT);
    setChartSettings(renderer, "Previous Encounters with \n" + mac + "(" + macname + ")",
            "Time in " + timeUnit + "s", " No. of Encounters ", 0, numBins + 1, 0, yMax, Color.GRAY,
            Color.LTGRAY);
    renderer.setXLabels(0);
    renderer.setYLabels(10);
    renderer.setXLabelsAngle(35.0F);

    //depending on the unit show the labels - year should show year, month should show month
    Date date;
    String prev = null;
    for (int i = 0; i < numBins; i++) {
        date = new Date((long) (first + time * (i + 1)) * 1000);
        renderer.addXTextLabel(i + 0.75, format.format(date));
        //dirty hack :(
        if (prev != null && prev.compareTo(format.format(date)) == 0) {
            renderer.addXTextLabel(i + 0.75 - 1,
                    format.format(new Date((long) (first + (i - 1) * time) * 1000)));
        }

        prev = format.format(date);
    }

    int length = renderer.getSeriesRendererCount();
    for (int i = 0; i < length; i++) {
        SimpleSeriesRenderer seriesRenderer = renderer.getSeriesRendererAt(i);
        seriesRenderer.setDisplayChartValues(true);
    }
    return ChartFactory.getBarChartIntent(this, buildBarDataset(titles, values), renderer, Type.DEFAULT);
}

From source file:com.deliciousdroid.fragment.ViewBookmarkFragment.java

@Override
public void onResume() {
    super.onResume();
    readView.setBackgroundColor(Integer.parseInt(base.readingBackground));
    readTitle.setBackgroundColor(Integer.parseInt(base.readingBackground));

    if (Integer.parseInt(base.readingBackground) == Color.BLACK) {
        readView.setTextColor(Color.parseColor("#999999"));
        readTitle.setTextColor(Color.parseColor("#999999"));
    } else {//from  w w w .j av a  2s . co  m
        readView.setTextColor(Color.parseColor("#222222"));
        readTitle.setTextColor(Color.parseColor("#222222"));
    }

    readView.setPadding(Integer.parseInt(base.readingMargins), 15, Integer.parseInt(base.readingMargins), 15);

    Typeface tf = Typeface.createFromAsset(base.getAssets(), "fonts/" + base.readingFont + ".ttf");
    readView.setTypeface(tf);

    readView.setTextSize(Float.parseFloat(base.readingFontSize));
    readView.setLineSpacing(Float.parseFloat(base.readingLineSpace), 1);

}

From source file:com.appeaser.sublimepickerlibrary.timepicker.RadialTimePickerView.java

private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    Context context = getContext();

    // Pull disabled alpha from theme.
    final TypedValue outValue = new TypedValue();
    context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, outValue, true);
    mDisabledAlpha = outValue.getFloat();

    // process style attributes
    final Resources res = getResources();
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RadialTimePickerView, defStyleAttr,
            defStyleRes);/* w w w  .j a v a2s.c o  m*/

    mTypeface = Typeface.create("sans-serif", Typeface.NORMAL);

    // Initialize all alpha values to opaque.
    for (int i = 0; i < mAlpha.length; i++) {
        mAlpha[i] = new IntHolder(ALPHA_OPAQUE);
    }

    mTextColor[HOURS] = a.getColorStateList(R.styleable.RadialTimePickerView_spNumbersTextColor);
    mTextColor[HOURS_INNER] = a.getColorStateList(R.styleable.RadialTimePickerView_spNumbersInnerTextColor);
    mTextColor[MINUTES] = mTextColor[HOURS];

    mPaint[HOURS] = new Paint();
    mPaint[HOURS].setAntiAlias(true);
    mPaint[HOURS].setTextAlign(Paint.Align.CENTER);

    mPaint[MINUTES] = new Paint();
    mPaint[MINUTES].setAntiAlias(true);
    mPaint[MINUTES].setTextAlign(Paint.Align.CENTER);

    final ColorStateList selectorColors = a
            .getColorStateList(R.styleable.RadialTimePickerView_spNumbersSelectorColor);

    int selectorActivatedColor = Color.BLACK;
    if (selectorColors != null) {
        selectorActivatedColor = selectorColors
                .getColorForState(SUtils.resolveStateSet(SUtils.STATE_ENABLED | SUtils.STATE_ACTIVATED), 0);
    }

    mPaintCenter.setColor(selectorActivatedColor);
    mPaintCenter.setAntiAlias(true);

    final int[] activatedStateSet = SUtils.resolveStateSet(SUtils.STATE_ENABLED | SUtils.STATE_ACTIVATED);

    mSelectorColor = selectorActivatedColor;
    mSelectorDotColor = mTextColor[HOURS].getColorForState(activatedStateSet, 0);

    mPaintSelector[HOURS][SELECTOR_CIRCLE] = new Paint();
    mPaintSelector[HOURS][SELECTOR_CIRCLE].setAntiAlias(true);

    mPaintSelector[HOURS][SELECTOR_DOT] = new Paint();
    mPaintSelector[HOURS][SELECTOR_DOT].setAntiAlias(true);

    mPaintSelector[HOURS][SELECTOR_LINE] = new Paint();
    mPaintSelector[HOURS][SELECTOR_LINE].setAntiAlias(true);
    mPaintSelector[HOURS][SELECTOR_LINE].setStrokeWidth(2);

    mPaintSelector[MINUTES][SELECTOR_CIRCLE] = new Paint();
    mPaintSelector[MINUTES][SELECTOR_CIRCLE].setAntiAlias(true);

    mPaintSelector[MINUTES][SELECTOR_DOT] = new Paint();
    mPaintSelector[MINUTES][SELECTOR_DOT].setAntiAlias(true);

    mPaintSelector[MINUTES][SELECTOR_LINE] = new Paint();
    mPaintSelector[MINUTES][SELECTOR_LINE].setAntiAlias(true);
    mPaintSelector[MINUTES][SELECTOR_LINE].setStrokeWidth(2);

    mPaintBackground.setColor(a.getColor(R.styleable.RadialTimePickerView_spNumbersBackgroundColor,
            ContextCompat.getColor(context, R.color.timepicker_default_numbers_background_color_material)));
    mPaintBackground.setAntiAlias(true);

    mSelectorRadius = res.getDimensionPixelSize(R.dimen.sp_timepicker_selector_radius);
    mSelectorStroke = res.getDimensionPixelSize(R.dimen.sp_timepicker_selector_stroke);
    mSelectorDotRadius = res.getDimensionPixelSize(R.dimen.sp_timepicker_selector_dot_radius);
    mCenterDotRadius = res.getDimensionPixelSize(R.dimen.sp_timepicker_center_dot_radius);

    mTextSize[HOURS] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_size_normal);
    mTextSize[MINUTES] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_size_normal);
    mTextSize[HOURS_INNER] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_size_inner);

    mTextInset[HOURS] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_inset_normal);
    mTextInset[MINUTES] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_inset_normal);
    mTextInset[HOURS_INNER] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_inset_inner);

    mShowHours = true;
    mIs24HourMode = false;
    mAmOrPm = AM;

    // Set up accessibility components.
    mTouchHelper = new RadialPickerTouchHelper();
    ViewCompat.setAccessibilityDelegate(this, mTouchHelper);

    if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }

    initHoursAndMinutesText();
    initData();

    a.recycle();

    // Initial values
    final Calendar calendar = Calendar.getInstance(Locale.getDefault());
    final int currentHour = calendar.get(Calendar.HOUR_OF_DAY);
    final int currentMinute = calendar.get(Calendar.MINUTE);

    setCurrentHourInternal(currentHour, false, false);
    setCurrentMinuteInternal(currentMinute, false);

    setHapticFeedbackEnabled(true);
}

From source file:com.nononsenseapps.feeder.ui.BaseActivity.java

protected void onActionBarAutoShowOrHide(boolean shown) {
    if (mStatusBarColorAnimator != null) {
        mStatusBarColorAnimator.cancel();
    }//from   ww  w  . j  a  v  a2  s  . c o m
    mStatusBarColorAnimator = ObjectAnimator
            .ofInt(mLPreviewUtils, "statusBarColor", shown ? mThemedStatusBarColor : Color.BLACK)
            .setDuration(250);
    mStatusBarColorAnimator.setEvaluator(ARGB_EVALUATOR);
    mStatusBarColorAnimator.start();

    for (View view : mHideableHeaderViews) {
        if (shown) {
            view.animate().translationY(0).alpha(1).setDuration(HEADER_HIDE_ANIM_DURATION)
                    .setInterpolator(new DecelerateInterpolator());
        } else {
            view.animate().translationY(-view.getBottom()).alpha(0).setDuration(HEADER_HIDE_ANIM_DURATION)
                    .setInterpolator(new DecelerateInterpolator());
        }
    }
    for (View view : mHideableFooterViews) {
        if (shown) {
            view.animate().translationY(0).alpha(1).setDuration(HEADER_HIDE_ANIM_DURATION)
                    .setInterpolator(new DecelerateInterpolator());
        } else {
            view.animate().translationY(view.getHeight()).alpha(0).setDuration(HEADER_HIDE_ANIM_DURATION)
                    .setInterpolator(new DecelerateInterpolator());
        }
    }
}