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:com.jaredrummler.android.colorpicker.ColorPickerDialog.java

View createPickerView() {
    View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_color_picker, null);
    colorPicker = (ColorPickerView) contentView.findViewById(R.id.cpv_color_picker_view);
    ColorPanelView oldColorPanel = (ColorPanelView) contentView.findViewById(R.id.cpv_color_panel_old);
    newColorPanel = (ColorPanelView) contentView.findViewById(R.id.cpv_color_panel_new);
    ImageView arrowRight = (ImageView) contentView.findViewById(R.id.cpv_arrow_right);
    hexEditText = (EditText) contentView.findViewById(R.id.cpv_hex);

    try {//  ww  w .  j  av  a  2 s.com
        final TypedValue value = new TypedValue();
        TypedArray typedArray = getActivity().obtainStyledAttributes(value.data,
                new int[] { android.R.attr.textColorPrimary });
        int arrowColor = typedArray.getColor(0, Color.BLACK);
        typedArray.recycle();
        arrowRight.setColorFilter(arrowColor);
    } catch (Exception ignored) {
    }

    colorPicker.setAlphaSliderVisible(showAlphaSlider);
    oldColorPanel.setColor(getArguments().getInt(ARG_COLOR));
    colorPicker.setColor(color, true);
    newColorPanel.setColor(color);
    setHex(color);

    if (!showAlphaSlider) {
        hexEditText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(6) });
    }

    newColorPanel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (newColorPanel.getColor() == color) {
                colorPickerDialogListener.onColorSelected(dialogId, color);
                dismiss();
            }
        }
    });

    contentView.setOnTouchListener(this);
    colorPicker.setOnColorChangedListener(this);
    hexEditText.addTextChangedListener(this);

    hexEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                InputMethodManager imm = (InputMethodManager) getActivity()
                        .getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.showSoftInput(hexEditText, InputMethodManager.SHOW_IMPLICIT);
            }
        }
    });

    return contentView;
}

From source file:arc.noaa.weather.activities.MainActivity.java

private void aboutDialog() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle("Forecastie");
    final WebView webView = new WebView(this);
    String about = "<p>A lightweight, opensource weather app.</p>"
            + "<p>Developed by <a href='mailto:t.martykan@gmail.com'>Tomas Martykan</a></p>"
            + "<p>Data provided by <a href='http://openweathermap.org/'>OpenWeatherMap</a>, under the <a href='http://creativecommons.org/licenses/by-sa/2.0/'>Creative Commons license</a>"
            + "<p>Icons are <a href='https://erikflowers.github.io/weather-icons/'>Weather Icons</a>, by <a href='http://www.twitter.com/artill'>Lukas Bischoff</a> and <a href='http://www.twitter.com/Erik_UX'>Erik Flowers</a>, under the <a href='http://scripts.sil.org/OFL'>SIL OFL 1.1</a> licence.";
    TypedArray ta = obtainStyledAttributes(new int[] { android.R.attr.textColorPrimary, R.attr.colorAccent });
    String textColor = String.format("#%06X", (0xFFFFFF & ta.getColor(0, Color.BLACK)));
    String accentColor = String.format("#%06X", (0xFFFFFF & ta.getColor(1, Color.BLUE)));
    ta.recycle();//from  w w w  . ja va2s  . c  o m
    about = "<style media=\"screen\" type=\"text/css\">" + "body {\n" + "    color:" + textColor + ";\n" + "}\n"
            + "a:link {color:" + accentColor + "}\n" + "</style>" + about;
    webView.setBackgroundColor(Color.TRANSPARENT);
    webView.loadData(about, "text/html", "UTF-8");
    alert.setView(webView, 32, 0, 32, 0);
    alert.setPositiveButton(R.string.dialog_ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {

        }
    });
    alert.show();
}

From source file:com.numenta.taurus.instance.InstanceListActivity.java

private void configureSearchView(@NonNull final SearchView searchView) {
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    // Assumes current activity is the searchable activity
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    // Handle query events
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override//  w w w  .ja  v  a 2 s  .co  m
        public boolean onQueryTextSubmit(String query) {
            // Hide Keyboard on submit
            InputMethodManager imm = (InputMethodManager) searchView.getContext()
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            if (imm != null) {
                imm.hideSoftInputFromWindow(searchView.getWindowToken(), 0);
            }

            return true;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            // Filter list as the user types
            _listFragment.applyFilter(newText);
            return true;
        }
    });

    // FIXME: Android does not support styling the search view across all versions.
    // For now, "peek" into internal API to make the appropriate changes to the SearchView.
    // In the future we should use the official android API to customize the SearchView widget.
    // See android.R.layout.search_view for the layout we are "peeking". It is no guarantee it
    // will work on all public android versions and/or OEM customizations.
    // This HACK is only valid for the POC phase. We should find a better solution before releasing
    Resources resources = searchView.getResources();

    // Style search box and text
    int searchPlateId = resources.getIdentifier("android:id/search_plate", null, null);
    View searchPlate = searchView.findViewById(searchPlateId);
    if (searchPlate != null) {
        int searchTextId = resources.getIdentifier("android:id/search_src_text", null, null);
        TextView searchText = (TextView) searchPlate.findViewById(searchTextId);
        if (searchText != null) {
            searchPlate.setBackgroundResource(android.R.drawable.editbox_background);
            searchText.setPadding(5, 0, 0, 0);
            searchText.setTextColor(Color.BLACK);
            searchText.setHintTextColor(Color.LTGRAY);
        }
    }
}

From source file:com.nextgis.maplib.map.VectorLayer.java

protected void setDefaultRenderer() {
    switch (mGeometryType) {
    case GTPoint:
    case GTMultiPoint:
        mRenderer = new SimpleFeatureRenderer(this,
                new SimpleMarkerStyle(Color.RED, Color.BLACK, 6, SimpleMarkerStyle.MarkerStyleCircle));
        break;/*from  www .ja va  2 s.  c om*/
    case GTLineString:
    case GTMultiLineString:
        mRenderer = new SimpleFeatureRenderer(this, new SimpleLineStyle(Color.GREEN));
        break;
    case GTPolygon:
    case GTMultiPolygon:
    default:
        mRenderer = null;
    }
}

From source file:com.fivetrue.workout.timer.view.PagerSlidingTabStrip.java

private void addTextTab(final int position, String title) {

    HoverTextView tab = new HoverTextView(getContext());
    tab.setText(title);//from w ww.j ava2  s.co  m
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    if (textOutline) {
        tab.setShadowLayer(5, 0, 0, Color.BLACK);
    }

    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
            pager.setTag("click");
        }
    });
    tab.setSelected(currentPosition == position);
    tabsContainer.addView(tab);
}

From source file:com.jrummyapps.android.colorpicker.ColorPickerDialog.java

View createPickerView() {
    View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_color_picker, null);
    colorPicker = contentView.findViewById(R.id.cpv_color_picker_view);
    ColorPanelView oldColorPanel = contentView.findViewById(R.id.cpv_color_panel_old);
    newColorPanel = contentView.findViewById(R.id.cpv_color_panel_new);
    ImageView arrowRight = contentView.findViewById(R.id.cpv_arrow_right);
    hexEditText = contentView.findViewById(R.id.cpv_hex);

    try {//from w ww .j av a2s  .  co m
        final TypedValue value = new TypedValue();
        TypedArray typedArray = getActivity().obtainStyledAttributes(value.data,
                new int[] { android.R.attr.textColorPrimary });
        int arrowColor = typedArray.getColor(0, Color.BLACK);
        typedArray.recycle();
        arrowRight.setColorFilter(arrowColor);
    } catch (Exception ignored) {
    }

    colorPicker.setAlphaSliderVisible(showAlphaSlider);
    oldColorPanel.setColor(getArguments().getInt(ARG_COLOR));
    colorPicker.setColor(color, true);
    newColorPanel.setColor(color);
    setHex(color);

    if (!showAlphaSlider) {
        hexEditText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(6) });
    }

    newColorPanel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (newColorPanel.getColor() == color) {
                colorPickerDialogListener.onColorSelected(dialogId, color);
                dismiss();
            }
        }
    });

    contentView.setOnTouchListener(this);
    colorPicker.setOnColorChangedListener(this);
    hexEditText.addTextChangedListener(this);

    hexEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                InputMethodManager imm = (InputMethodManager) getActivity()
                        .getSystemService(Context.INPUT_METHOD_SERVICE);
                if (imm != null)
                    imm.showSoftInput(hexEditText, InputMethodManager.SHOW_IMPLICIT);
            }
        }
    });

    return contentView;
}

From source file:com.app.laundry.tabs.lib.TabPageIndicator2.java

private void addTab(int index, CharSequence text, int iconResId) {
    final TabView tabView = new TabView(getContext());
    tabView.mIndex = index;/*from ww w. ja va  2  s . c o  m*/
    tabView.setFocusable(true);

    if (index == 0) {
        tabView.setBackgroundResource(R.drawable.tab_selected);
        old_tab = tabView;
    } else
        tabView.setBackgroundResource(R.drawable.tab_unselected);

    /*{
       tabView.setBackgroundResource(R.drawable.unselected_search);
       tabView.setBackgroundResource(R.drawable.unselected_nearby);
       tabView.setBackgroundResource(R.drawable.unselected_toprated);
       tabView.setBackgroundResource(R.drawable.unselected_favourite);
       tabView.setBackgroundResource(R.drawable.unselected_deals);
    }
               
    if(index==1)
    {
       tabView.setBackgroundResource(R.drawable.selected_nearby);
       old_tab=tabView;
    }
    else  
    {
       tabView.setBackgroundResource(R.drawable.unselected_search);
       tabView.setBackgroundResource(R.drawable.unselected_nearby);
       tabView.setBackgroundResource(R.drawable.unselected_toprated);
       tabView.setBackgroundResource(R.drawable.unselected_favourite);
       tabView.setBackgroundResource(R.drawable.unselected_deals);
    }
            
    if(index==2)
    {
       tabView.setBackgroundResource(R.drawable.selected_toprated);
       old_tab=tabView;
    }
    else  
    {
       tabView.setBackgroundResource(R.drawable.unselected_search);
       tabView.setBackgroundResource(R.drawable.unselected_nearby);
       tabView.setBackgroundResource(R.drawable.unselected_toprated);
       tabView.setBackgroundResource(R.drawable.unselected_favourite);
       tabView.setBackgroundResource(R.drawable.unselected_deals);
    }
            
            
    if(index==3)
    {
       tabView.setBackgroundResource(R.drawable.selected_favourite);
       old_tab=tabView;
    }
    else  
    {
       tabView.setBackgroundResource(R.drawable.unselected_search);
       tabView.setBackgroundResource(R.drawable.unselected_nearby);
       tabView.setBackgroundResource(R.drawable.unselected_toprated);
       tabView.setBackgroundResource(R.drawable.unselected_favourite);
       tabView.setBackgroundResource(R.drawable.unselected_deals);
    }
    if(index==4)
    {
       tabView.setBackgroundResource(R.drawable.selected_undeals);
       old_tab=tabView;
    }
    else  
    {
       tabView.setBackgroundResource(R.drawable.unselected_search);
       tabView.setBackgroundResource(R.drawable.unselected_nearby);
       tabView.setBackgroundResource(R.drawable.unselected_toprated);
       tabView.setBackgroundResource(R.drawable.unselected_favourite);
       tabView.setBackgroundResource(R.drawable.unselected_deals);
    }
    */ //old_tab=tabView;
    tabView.setTextColor(Color.BLACK);
    tabView.setOnClickListener(mTabClickListener);
    tabView.setText(text);

    if (iconResId != 0) {
        tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);
    }

    mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, MATCH_PARENT, 1));
}

From source file:com.example.firstocr.ViewfinderView.java

@SuppressWarnings("unused")
@Override/*w  ww . jav  a 2 s  .com*/
public void onDraw(Canvas canvas) {
    Rect frame = cameraManager.getFramingRect();
    if (frame == null) {
        return;
    }
    int width = canvas.getWidth();
    int height = canvas.getHeight();

    // Draw the exterior (i.e. outside the framing rect) darkened
    paint.setColor(maskColor);
    canvas.drawRect(0, 0, width, frame.top, paint);
    canvas.drawRect(0, frame.top, frame.left, frame.bottom + 1, paint);
    canvas.drawRect(frame.right + 1, frame.top, width, frame.bottom + 1, paint);
    canvas.drawRect(0, frame.bottom + 1, width, height, paint);

    // If we have an OCR result, overlay its information on the viewfinder.
    if (resultText != null) {

        // Only draw text/bounding boxes on viewfinder if it hasn't been resized since the OCR was requested.
        Point bitmapSize = resultText.getBitmapDimensions();
        previewFrame = cameraManager.getFramingRectInPreview();
        if (bitmapSize.x == previewFrame.width() && bitmapSize.y == previewFrame.height()) {

            float scaleX = frame.width() / (float) previewFrame.width();
            float scaleY = frame.height() / (float) previewFrame.height();

            if (DRAW_REGION_BOXES) {
                regionBoundingBoxes = resultText.getRegionBoundingBoxes();
                for (int i = 0; i < regionBoundingBoxes.size(); i++) {
                    paint.setAlpha(0xA0);
                    paint.setColor(Color.MAGENTA);
                    paint.setStyle(Style.STROKE);
                    paint.setStrokeWidth(1);
                    rect = regionBoundingBoxes.get(i);
                    canvas.drawRect(frame.left + rect.left * scaleX, frame.top + rect.top * scaleY,
                            frame.left + rect.right * scaleX, frame.top + rect.bottom * scaleY, paint);
                }
            }

            if (DRAW_TEXTLINE_BOXES) {
                // Draw each textline
                textlineBoundingBoxes = resultText.getTextlineBoundingBoxes();
                paint.setAlpha(0xA0);
                paint.setColor(Color.RED);
                paint.setStyle(Style.STROKE);
                paint.setStrokeWidth(1);
                for (int i = 0; i < textlineBoundingBoxes.size(); i++) {
                    rect = textlineBoundingBoxes.get(i);
                    canvas.drawRect(frame.left + rect.left * scaleX, frame.top + rect.top * scaleY,
                            frame.left + rect.right * scaleX, frame.top + rect.bottom * scaleY, paint);
                }
            }

            if (DRAW_STRIP_BOXES) {
                stripBoundingBoxes = resultText.getStripBoundingBoxes();
                paint.setAlpha(0xFF);
                paint.setColor(Color.YELLOW);
                paint.setStyle(Style.STROKE);
                paint.setStrokeWidth(1);
                for (int i = 0; i < stripBoundingBoxes.size(); i++) {
                    rect = stripBoundingBoxes.get(i);
                    canvas.drawRect(frame.left + rect.left * scaleX, frame.top + rect.top * scaleY,
                            frame.left + rect.right * scaleX, frame.top + rect.bottom * scaleY, paint);
                }
            }

            if (DRAW_WORD_BOXES || DRAW_WORD_TEXT) {
                // Split the text into words
                wordBoundingBoxes = resultText.getWordBoundingBoxes();
                //      for (String w : words) {
                //        Log.e("ViewfinderView", "word: " + w);
                //      }
                //Log.d("ViewfinderView", "There are " + words.length + " words in the string array.");
                //Log.d("ViewfinderView", "There are " + wordBoundingBoxes.size() + " words with bounding boxes.");
            }

            if (DRAW_WORD_BOXES) {
                paint.setAlpha(0xFF);
                paint.setColor(0xFF00CCFF);
                paint.setStyle(Style.STROKE);
                paint.setStrokeWidth(1);
                for (int i = 0; i < wordBoundingBoxes.size(); i++) {
                    // Draw a bounding box around the word
                    rect = wordBoundingBoxes.get(i);
                    canvas.drawRect(frame.left + rect.left * scaleX, frame.top + rect.top * scaleY,
                            frame.left + rect.right * scaleX, frame.top + rect.bottom * scaleY, paint);
                }
            }

            if (DRAW_WORD_TEXT) {
                words = resultText.getText().replace("\n", " ").split(" ");
                int[] wordConfidences = resultText.getWordConfidences();
                for (int i = 0; i < wordBoundingBoxes.size(); i++) {
                    boolean isWordBlank = true;
                    try {
                        if (!words[i].equals("")) {
                            isWordBlank = false;
                        }
                    } catch (ArrayIndexOutOfBoundsException e) {
                        e.printStackTrace();
                    }

                    // Only draw if word has characters
                    if (!isWordBlank) {
                        // Draw a white background around each word
                        rect = wordBoundingBoxes.get(i);
                        paint.setColor(Color.WHITE);
                        paint.setStyle(Style.FILL);
                        if (DRAW_TRANSPARENT_WORD_BACKGROUNDS) {
                            // Higher confidence = more opaque, less transparent background
                            paint.setAlpha(wordConfidences[i] * 255 / 100);
                        } else {
                            paint.setAlpha(255);
                        }
                        canvas.drawRect(frame.left + rect.left * scaleX, frame.top + rect.top * scaleY,
                                frame.left + rect.right * scaleX, frame.top + rect.bottom * scaleY, paint);

                        // Draw the word in black text
                        paint.setColor(Color.BLACK);
                        paint.setAlpha(0xFF);
                        paint.setAntiAlias(true);
                        paint.setTextAlign(Align.LEFT);

                        // Adjust text size to fill rect
                        paint.setTextSize(100);
                        paint.setTextScaleX(1.0f);
                        // ask the paint for the bounding rect if it were to draw this text
                        Rect bounds = new Rect();
                        paint.getTextBounds(words[i], 0, words[i].length(), bounds);
                        // get the height that would have been produced
                        int h = bounds.bottom - bounds.top;
                        // figure out what textSize setting would create that height of text
                        float size = (((float) (rect.height()) / h) * 100f);
                        // and set it into the paint
                        paint.setTextSize(size);
                        // Now set the scale.
                        // do calculation with scale of 1.0 (no scale)
                        paint.setTextScaleX(1.0f);
                        // ask the paint for the bounding rect if it were to draw this text.
                        paint.getTextBounds(words[i], 0, words[i].length(), bounds);
                        // determine the width
                        int w = bounds.right - bounds.left;
                        // calculate the baseline to use so that the entire text is visible including the descenders
                        int text_h = bounds.bottom - bounds.top;
                        int baseline = bounds.bottom + ((rect.height() - text_h) / 2);
                        // determine how much to scale the width to fit the view
                        float xscale = ((float) (rect.width())) / w;
                        // set the scale for the text paint
                        paint.setTextScaleX(xscale);
                        canvas.drawText(words[i], frame.left + rect.left * scaleX,
                                frame.top + rect.bottom * scaleY - baseline, paint);
                    }

                }
            }

            //        if (DRAW_CHARACTER_BOXES || DRAW_CHARACTER_TEXT) {
            //          characterBoundingBoxes = resultText.getCharacterBoundingBoxes();
            //        }
            //
            //        if (DRAW_CHARACTER_BOXES) {
            //          // Draw bounding boxes around each character
            //          paint.setAlpha(0xA0);
            //          paint.setColor(0xFF00FF00);
            //          paint.setStyle(Style.STROKE);
            //          paint.setStrokeWidth(1);
            //          for (int c = 0; c < characterBoundingBoxes.size(); c++) {
            //            Rect characterRect = characterBoundingBoxes.get(c);
            //            canvas.drawRect(frame.left + characterRect.left * scaleX,
            //                frame.top + characterRect.top * scaleY, 
            //                frame.left + characterRect.right * scaleX, 
            //                frame.top + characterRect.bottom * scaleY, paint);
            //          }
            //        }
            //
            //        if (DRAW_CHARACTER_TEXT) {
            //          // Draw letters individually
            //          for (int i = 0; i < characterBoundingBoxes.size(); i++) {
            //            Rect r = characterBoundingBoxes.get(i);
            //
            //            // Draw a white background for every letter
            //            int meanConfidence = resultText.getMeanConfidence();
            //            paint.setColor(Color.WHITE);
            //            paint.setAlpha(meanConfidence * (255 / 100));
            //            paint.setStyle(Style.FILL);
            //            canvas.drawRect(frame.left + r.left * scaleX,
            //                frame.top + r.top * scaleY, 
            //                frame.left + r.right * scaleX, 
            //                frame.top + r.bottom * scaleY, paint);
            //
            //            // Draw each letter, in black
            //            paint.setColor(Color.BLACK);
            //            paint.setAlpha(0xFF);
            //            paint.setAntiAlias(true);
            //            paint.setTextAlign(Align.LEFT);
            //            String letter = "";
            //            try {
            //              char c = resultText.getText().replace("\n","").replace(" ", "").charAt(i);
            //              letter = Character.toString(c);
            //
            //              if (!letter.equals("-") && !letter.equals("_")) {
            //
            //                // Adjust text size to fill rect
            //                paint.setTextSize(100);
            //                paint.setTextScaleX(1.0f);
            //
            //                // ask the paint for the bounding rect if it were to draw this text
            //                Rect bounds = new Rect();
            //                paint.getTextBounds(letter, 0, letter.length(), bounds);
            //
            //                // get the height that would have been produced
            //                int h = bounds.bottom - bounds.top;
            //
            //                // figure out what textSize setting would create that height of text
            //                float size  = (((float)(r.height())/h)*100f);
            //
            //                // and set it into the paint
            //                paint.setTextSize(size);
            //
            //                // Draw the text as is. We don't really need to set the text scale, because the dimensions
            //                // of the Rect should already be suited for drawing our letter. 
            //                canvas.drawText(letter, frame.left + r.left * scaleX, frame.top + r.bottom * scaleY, paint);
            //              }
            //            } catch (StringIndexOutOfBoundsException e) {
            //              e.printStackTrace();
            //            } catch (Exception e) {
            //              e.printStackTrace();
            //            }
            //          }
            //        }
        }

    }
    // Draw a two pixel solid border inside the framing rect
    paint.setAlpha(0);
    paint.setStyle(Style.FILL);
    paint.setColor(frameColor);
    canvas.drawRect(frame.left, frame.top, frame.right + 1, frame.top + 2, paint);
    canvas.drawRect(frame.left, frame.top + 2, frame.left + 2, frame.bottom - 1, paint);
    canvas.drawRect(frame.right - 1, frame.top, frame.right + 1, frame.bottom - 1, paint);
    canvas.drawRect(frame.left, frame.bottom - 1, frame.right + 1, frame.bottom + 1, paint);

    // Draw the framing rect corner UI elements
    paint.setColor(cornerColor);
    canvas.drawRect(frame.left - 15, frame.top - 15, frame.left + 15, frame.top, paint);
    canvas.drawRect(frame.left - 15, frame.top, frame.left, frame.top + 15, paint);
    canvas.drawRect(frame.right - 15, frame.top - 15, frame.right + 15, frame.top, paint);
    canvas.drawRect(frame.right, frame.top - 15, frame.right + 15, frame.top + 15, paint);
    canvas.drawRect(frame.left - 15, frame.bottom, frame.left + 15, frame.bottom + 15, paint);
    canvas.drawRect(frame.left - 15, frame.bottom - 15, frame.left, frame.bottom, paint);
    canvas.drawRect(frame.right - 15, frame.bottom, frame.right + 15, frame.bottom + 15, paint);
    canvas.drawRect(frame.right, frame.bottom - 15, frame.right + 15, frame.bottom + 15, paint);

    // Request another update at the animation interval, but don't repaint the entire viewfinder mask.
    //postInvalidateDelayed(ANIMATION_DELAY, frame.left, frame.top, frame.right, frame.bottom);
}

From source file:mp.paschalis.RegisterActivity.java

/**
 * @param input Enable all fields from input and below, that are correct
 *//*from  w  ww  . j a  v  a2 s.  com*/
private void enableRegisterFields(RegisterFields input) {
    switch (input) {
    case username:
        if (registerUsername.getText().length() >= 4) {
            registerPassword.setFocusable(true);
            registerPassword.setFocusableInTouchMode(true);
            registerPassword.setEnabled(true);
        } else {
            disableRegisterFields(RegisterFields.username);
            registerPassword.setText("");
            break;
        }
    case password:
        if (registerPassword.getText().length() > 0) {
            registerConfirmPassword.setEnabled(true);
            registerConfirmPassword.setFocusable(true);
            registerConfirmPassword.setFocusableInTouchMode(true);
        } else {
            disableRegisterFields(RegisterFields.password);
            registerConfirmPassword.setText("");
            break;
        }
    case confirmPassword:
        // If password size >=0
        if (registerPassword.getText().length() > 0) {
            // If passwords match
            if (registerConfirmPassword.getText().toString().equals(registerPassword.getText().toString())) {
                registerName.setEnabled(true);
                registerName.setFocusable(true);
                registerName.setFocusableInTouchMode(true);
                registerConfirmPassword.setTextColor(Color.BLUE);
            } else {

                registerConfirmPassword.setTextColor(Color.RED);
                disableRegisterFields(RegisterFields.confirmPassword);
                break;
            }
        } else {
            registerConfirmPassword.setTextColor(Color.BLACK);
            break;

        }
    case name:
        if (registerName.getText().length() > 0) {
            registerSurname.setEnabled(true);
            registerSurname.setFocusable(true);
            registerSurname.setFocusableInTouchMode(true);
        } else {
            disableRegisterFields(RegisterFields.name);
            break;
        }
    case surname:
        if (registerSurname.getText().length() > 0) {
            registerEmail.setEnabled(true);
            registerEmail.setFocusable(true);
            registerEmail.setFocusableInTouchMode(true);
        } else {
            disableRegisterFields(RegisterFields.surname);
            break;
        }
    case email:
        // If email address is correct, enable Phone
        if (isEmailCorrect(registerEmail.getText().toString())) {
            registerPhone.setEnabled(true);
            registerPhone.setFocusable(true);
            registerPhone.setFocusableInTouchMode(true);
            registerEmail.setTextColor(Color.BLUE);
        } else {
            registerEmail.setTextColor(Color.RED);
            disableRegisterFields(RegisterFields.email);
            break;
        }
    case phone:
        if (registerPhone.getText().length() > 0) {
            if (isPhoneNumberCorrect(registerPhone.getText().toString())) {
                buttonRegister.setEnabled(true);
                registerPhone.setTextColor(Color.BLUE);
            } else {
                disableRegisterFields(RegisterFields.phone);
                registerPhone.setTextColor(Color.RED);
                break;
            }
        }
    default:

        break;
    }

}

From source file:com.esri.arcgisruntime.sample.findaddress.MainActivity.java

/**
 * Shows the Graphic's attributes as a Callout.
 *
 * @param graphic containing attributes//from  ww w  .  jav  a  2  s.co m
 */
private void showCallout(final Graphic graphic) {
    // create a TextView for the Callout
    TextView calloutContent = new TextView(getApplicationContext());
    calloutContent.setTextColor(Color.BLACK);
    // set the text of the Callout to graphic's attributes
    calloutContent.setText(graphic.getAttributes().get("PlaceName").toString() + "\n"
            + graphic.getAttributes().get("StAddr").toString());
    // get Callout
    mCallout = mMapView.getCallout();
    // set Callout options: animateCallout: true, recenterMap: false, animateRecenter: false
    mCallout.setShowOptions(new Callout.ShowOptions(true, false, false));
    mCallout.setContent(calloutContent);
    // set the leader position and show the callout
    // set the leader position and show the callout
    Point calloutLocation = graphic.computeCalloutLocation(graphic.getGeometry().getExtent().getCenter(),
            mMapView);
    mCallout.setGeoElement(graphic, calloutLocation);
    mCallout.show();
}