Example usage for android.graphics Color TRANSPARENT

List of usage examples for android.graphics Color TRANSPARENT

Introduction

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

Prototype

int TRANSPARENT

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

Click Source Link

Usage

From source file:com.sonaive.v2ex.ui.BaseActivity.java

/**
 * Sets up the navigation drawer as appropriate. Note that the nav drawer will be
 * different depending on whether the attendee indicated that they are attending the
 * event on-site vs. attending remotely.
 *//*from   www.j  a v a  2s  . com*/
private void setupNavDrawer() {
    // What nav drawer item should be selected?
    int selfItem = getSelfNavDrawerItem();

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    ScrollView navContent = (ScrollView) findViewById(R.id.navdrawer);
    if (mDrawerLayout == null || navContent == null) {
        return;
    }
    FrameLayout mainContent = (FrameLayout) findViewById(R.id.main_content);

    // set static navigation drawer
    if (mainContent != null
            && ((ViewGroup.MarginLayoutParams) mainContent.getLayoutParams()).leftMargin == (int) getResources()
                    .getDimension(R.dimen.navdrawer_width)) {
        mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN, navContent);
        mDrawerLayout.setScrimColor(Color.TRANSPARENT);
    }

    mDrawerLayout.setStatusBarBackgroundColor(getResources().getColor(R.color.theme_primary_dark));
    ScrimInsetsScrollView navDrawer = (ScrimInsetsScrollView) mDrawerLayout.findViewById(R.id.navdrawer);
    if (selfItem == NAVDRAWER_ITEM_INVALID) {
        // do not show a nav drawer
        if (navDrawer != null) {
            ((ViewGroup) navDrawer.getParent()).removeView(navDrawer);
        }
        mDrawerLayout = null;
        return;
    }

    if (navDrawer != null) {
        final View chosenAccountContentView = findViewById(R.id.chosen_account_content_view);
        final View chosenAccountView = findViewById(R.id.chosen_account_view);
        final int navDrawerChosenAccountHeight = getResources()
                .getDimensionPixelSize(R.dimen.navdrawer_chosen_account_height);
        navDrawer.setOnInsetsCallback(new ScrimInsetsScrollView.OnInsetsCallback() {
            @Override
            public void onInsetsChanged(Rect insets) {
                ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) chosenAccountContentView
                        .getLayoutParams();
                lp.topMargin = insets.top;
                chosenAccountContentView.setLayoutParams(lp);

                ViewGroup.LayoutParams lp2 = chosenAccountView.getLayoutParams();
                lp2.height = navDrawerChosenAccountHeight + insets.top;
                chosenAccountView.setLayoutParams(lp2);
            }
        });
    }

    if (mActionBarToolbar != null) {
        mActionBarToolbar.setNavigationIcon(R.drawable.ic_drawer);
        mActionBarToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mDrawerLayout.openDrawer(Gravity.START);
            }
        });
    }

    mDrawerLayout.setDrawerListener(new DrawerLayout.DrawerListener() {
        @Override
        public void onDrawerClosed(View drawerView) {
            // run deferred action, if we have one
            if (mDeferredOnDrawerClosedRunnable != null) {
                mDeferredOnDrawerClosedRunnable.run();
                mDeferredOnDrawerClosedRunnable = null;
            }
            if (mAccountBoxExpanded) {
                mAccountBoxExpanded = false;
                setupAccountBoxToggle();
            }
            onNavDrawerStateChanged(false, false);
        }

        @Override
        public void onDrawerOpened(View drawerView) {
            onNavDrawerStateChanged(true, false);
        }

        @Override
        public void onDrawerStateChanged(int newState) {
            onNavDrawerStateChanged(isNavDrawerOpen(), newState != DrawerLayout.STATE_IDLE);
        }

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

    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START);

    // populate the nav drawer with the correct items
    populateNavDrawer();
}

From source file:com.rowland.movies.ui.fragments.DetailFragment.java

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

    // Check which instance we are dealing with
    if (getActivity() instanceof DetailActivity) {
        // Set the ToolBar
        ((DetailActivity) getActivity()).setToolbar(mToolbar, true, false, R.drawable.ic_logo_48px);
    }//from www .j  a v  a2s . c o  m
    // Check for minimum api as Lollipop
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // Set up  the systemUi flags
        getActivity().getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        // Set the status bar tobe transparent
        getActivity().getWindow().setStatusBarColor(Color.TRANSPARENT);
    }
    /*// Check for minimum api as Kitkat
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
    // Set translucent to be true
    getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }*/
    // Check for null
    if (mMovie != null) {
        // Initialize the Loader
        getLoaderManager().initLoader(0, null, mReviewLoaderCallBack);
        getLoaderManager().initLoader(1, null, mTrailerLoaderCallBack);
        // Create an Animation
        Animation simpleGrowAnimation = AnimationUtils.loadAnimation(mFavoriteFab.getContext(),
                R.anim.grow_bigger);
        // Animate the Floating action button
        mFavoriteFab.startAnimation(simpleGrowAnimation);
    }
}

From source file:com.facebook.react.views.scroll.ReactHorizontalScrollView.java

@Override
public void draw(Canvas canvas) {
    if (mEndFillColor != Color.TRANSPARENT) {
        final View content = getChildAt(0);
        if (mEndBackground != null && content != null && content.getRight() < getWidth()) {
            mEndBackground.setBounds(content.getRight(), 0, getWidth(), getHeight());
            mEndBackground.draw(canvas);
        }//from   ww  w  . j  ava 2s  . c o  m
    }
    super.draw(canvas);
}

From source file:com.mk4droid.IMC_Activities.FActivity_TabHost.java

private LinearLayout make_Active_Tab(String text, Drawable dr) {

    LinearLayout ll = new LinearLayout(this);
    ll.setPadding(0, 0, 2, 1);//from   w ww  . j  av a2s .  com
    ll.setBackgroundColor(Color.GRAY);

    ll.setTag("ll");
    ll.setOrientation(LinearLayout.VERTICAL);
    ll.setLayoutParams(
            new LinearLayout.LayoutParams(0, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT, 1));

    //------ Text 
    TextView tv = new TextView(this);
    tv.setBackgroundColor(Color.TRANSPARENT);
    tv.setTag("tv");
    ll.addView(tv);

    // ------ hbar
    View hbar = new View(this);
    hbar.setTag("hbar");
    hbar.setLayoutParams(
            new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.FILL_PARENT, 10));

    ll.addView(hbar);

    ////////////////////////////////////////
    return ActivateColorize(ll, text, dr);
}

From source file:com.facebook.widget.LikeView.java

private void initialize(Context context) {
    edgePadding = getResources().getDimensionPixelSize(R.dimen.com_facebook_likeview_edge_padding);
    internalPadding = getResources().getDimensionPixelSize(R.dimen.com_facebook_likeview_internal_padding);
    if (foregroundColor == NO_FOREGROUND_COLOR) {
        foregroundColor = getResources().getColor(R.color.com_facebook_likeview_text_color);
    }/*from   ww w  .ja  v a2s .c om*/

    setBackgroundColor(Color.TRANSPARENT);

    containerView = new LinearLayout(context);
    LayoutParams containerViewLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);
    containerView.setLayoutParams(containerViewLayoutParams);

    initializeLikeButton(context);
    initializeSocialSentenceView(context);
    initializeLikeCountView(context);

    containerView.addView(likeButton);
    containerView.addView(socialSentenceView);
    containerView.addView(likeBoxCountView);

    addView(containerView);

    setObjectIdForced(this.objectId);
    updateLikeStateAndLayout();
}

From source file:com.bluros.music.fragments.AlbumDetailFragment.java

@Override
public void onResume() {
    super.onResume();
    toolbar.setBackgroundColor(Color.TRANSPARENT);
    if (primaryColor != -1 && getActivity() != null) {
        collapsingToolbarLayout.setContentScrimColor(primaryColor);
        ATEUtils.setFabBackgroundTint(fab, primaryColor);
        String ateKey = Helpers.getATEKey(getActivity());
        ATEUtils.setStatusBarColor(getActivity(), ateKey, primaryColor);
    }//from w w  w .j  a  va 2 s.  c o  m

}

From source file:uf.edu.encDetailActivity.java

public Intent barchartIntent(ArrayList<Integer> timeStamp, String mac, String macname) {
    int time;//  w  w w  .  j  a va 2 s  .  c o  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.saulcintero.moveon.fragments.Summary3.java

private XYMultipleSeriesRenderer getRenderer_type1() {
    XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(2);

    XYSeriesRenderer r = new XYSeriesRenderer();
    r.setLineWidth(2f);/*from  w  ww  . j a  v a 2s  . c om*/
    r.setColor(Color.rgb(0, 0, 188));
    r.setFillBelowLine(true);
    r.setFillPoints(true);
    renderer.addSeriesRenderer(r);

    TypedValue outValue1 = new TypedValue();
    TypedValue outValue2 = new TypedValue();
    TypedValue outValue3 = new TypedValue();
    TypedValue outValue4 = new TypedValue();
    mContext.getResources().getValue(R.dimen.xy_chart_text_size_value, outValue1, true);
    mContext.getResources().getValue(R.dimen.xy_labels_text_size_value, outValue2, true);
    mContext.getResources().getValue(R.dimen.xy_axis_title_text_size_value, outValue3, true);
    mContext.getResources().getValue(R.dimen.xy_legend_text_size_value, outValue4, true);
    float xyChartTextSizeValue = outValue1.getFloat();
    float xyLabelsTextSizeValue = outValue1.getFloat();
    float xyAxisTitleTextSizeValue = outValue1.getFloat();
    float xyLegendTextSizeValue = outValue1.getFloat();

    r = new XYSeriesRenderer();
    r.setColor(Color.rgb(255, 124, 0));
    r.setFillPoints(true);
    r.setLineWidth(2.5f);
    r.setDisplayChartValues(false);
    r.setChartValuesTextSize(xyChartTextSizeValue);

    renderer.addSeriesRenderer(r);
    renderer.setAxesColor(Color.WHITE);
    renderer.setLabelsColor(Color.LTGRAY);
    renderer.setBackgroundColor(Color.TRANSPARENT);
    renderer.setTextTypeface("sans_serif", Typeface.BOLD);

    renderer.setLabelsTextSize(xyLabelsTextSizeValue);
    renderer.setAxisTitleTextSize(xyAxisTitleTextSizeValue);
    renderer.setLegendTextSize(xyLegendTextSizeValue);

    renderer.setXTitle(FunctionUtils.capitalizeFirtsLetter(getString(R.string.minutes)));
    renderer.setYTitle(
            isMetric ? getString(R.string.long_unit1_detail_7) : getString(R.string.long_unit2_detail_7));
    renderer.setYTitle(FunctionUtils.capitalizeFirtsLetter(
            isMetric ? getString(R.string.long_unit1_detail_10) : getString(R.string.long_unit2_detail_10)), 1);
    renderer.setYAxisAlign(Align.RIGHT, 1);
    renderer.setYLabelsAlign(Align.RIGHT, 1);
    renderer.setYAxisMin(min_altitude, 1);
    renderer.setYAxisMax(max_altitude);

    renderer.setXLabels(20);
    renderer.setYLabels(20);
    renderer.setYLabelsAlign(Align.LEFT);
    renderer.setShowGrid(false);

    float smallest = 0;
    if (0 > min_altitude)
        smallest = min_altitude;

    float highest = max_speed;
    if (max_speed < max_altitude)
        highest = max_altitude;

    renderer.setXAxisMin(0);
    renderer.setXAxisMax((float) ((float) timeList.get(timeList.size() - 1) / 60));
    renderer.setYAxisMin(smallest);
    renderer.setYAxisMax(highest);

    return renderer;
}

From source file:ac.robinson.ticqr.TicQRActivity.java

private void verifyBoxes() {
    // scans the list comparing with the actual tick box positions (some could be outside the image)
    int maximumBoxDistance = Math.round(mBoxSize * 0.75f);
    int maximumQRCodeDistance = Math.round(mBoxSize * 0.4f);
    int maximumQRCodeDistanceSquared = maximumQRCodeDistance * maximumQRCodeDistance;

    Log.d(TAG, "Searching for codes at max distance: " + maximumBoxDistance + " (QR dist: "
            + maximumQRCodeDistance + ")");

    // update the server boxes with their position on the image
    for (TickBoxHolder tickBox : mServerTickBoxes) {
        tickBox.setImagePosition(QRImageParser.getImagePosition(mImageParameters, tickBox.location));
    }//w w  w .  j a  va 2  s.  c  om

    // first pass - match ticked boxes on the image with ticked boxes from the server
    for (PointF p : mImageTickBoxes) {

        // check that we're not too close to a QR code
        boolean qrBox = false;
        for (int q = 0, qn = Math.min(mCodeParameters.mIdPoints.length,
                mCodeParameters.mAlignmentPoints.length); q < qn; q++) {
            PointF idP = mCodeParameters.mIdPoints[q];
            PointF alignP = mCodeParameters.mAlignmentPoints[q];
            double pX1 = (idP.x - p.x);
            double pY1 = (idP.y - p.y);
            double pX2 = (alignP.x - p.x);
            double pY2 = (alignP.y - p.y);
            if (((pX1 * pX1) + (pY1 * pY1)) < maximumQRCodeDistanceSquared
                    || ((pX2 * pX2) + (pY2 * pY2)) < maximumQRCodeDistanceSquared) {
                qrBox = true;
                break;
            }
        }
        if (qrBox) {
            // Log.d(TAG, "Box seems to be a QR point - ignoring");
            continue;
        }

        float minDistance = Float.MAX_VALUE;
        TickBoxHolder assignedBox = null;
        for (TickBoxHolder tickBox : mServerTickBoxes) {
            if (tickBox.foundOnImage) {
                continue;
            }

            PointF pos = tickBox.imagePosition;
            float boxDistance = (float) Math.sqrt(Math.pow(p.x - pos.x, 2) + Math.pow(p.y - pos.y, 2));
            if (boxDistance < maximumBoxDistance && boxDistance < minDistance) {
                assignedBox = tickBox;
                minDistance = boxDistance;
            }
        }
        if (assignedBox != null) {
            Log.d(TAG, "Found closest box (" + assignedBox.description + ") at " + minDistance + " distance");
            assignedBox.foundOnImage = true;
            assignedBox.ticked = false;
        } else {
            Log.d(TAG, "Couldn't find actual box for detected box at " + minDistance + " distance");
        }
    }

    // second pass - un-tick any boxes that are still marked as ticked, but are actually outside the image,
    // then add an animated tick box on those that remain
    boolean tickedBoxes = false;
    for (TickBoxHolder tickBox : mServerTickBoxes) {
        if (tickBox.ticked) {
            PointF imagePosition = tickBox.imagePosition;
            try {
                if (mBitmap.getPixel((int) imagePosition.x, (int) imagePosition.y) == Color.TRANSPARENT) {
                    tickBox.ticked = false;
                    Log.d(TAG, "Un-ticking box outside the image (" + tickBox.description + " " + "at "
                            + imagePosition.x + "," + imagePosition.y + ")");
                }
            } catch (IllegalArgumentException e) {
                tickBox.ticked = false;
                Log.d(TAG, "Un-ticking box with invalid image coordinate (" + tickBox.description + ") at "
                        + imagePosition.x + "," + imagePosition.y);
            }

            if (tickBox.ticked) {
                Log.d(TAG, "Ticked box (" + tickBox.description + ") found at " + imagePosition.x + ","
                        + +imagePosition.y);

                // add a tick overlay on each ticked box, and allow clicking to tick/un-tick any box
                addTickHighlight(tickBox);
                tickedBoxes = true;
            }
        }
    }

    findViewById(R.id.parse_progress).setVisibility(View.GONE);

    getSupportActionBar().setTitle(R.string.title_activity_order);
    mEmailContents = getEmailMessage();
    supportInvalidateOptionsMenu(); // to show the place order button (if required) & rescan option
    Toast.makeText(TicQRActivity.this, tickedBoxes ? R.string.hint_send_order : R.string.hint_no_boxes_found,
            Toast.LENGTH_SHORT).show();
}

From source file:com.bonsai.btcreceive.ReceiveFragment.java

private Bitmap createBitmap(String content, final int size) {
    final Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
    hints.put(EncodeHintType.MARGIN, 0);
    hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
    BitMatrix result;/* ww  w .j av a2s. c  om*/
    try {
        result = sQRCodeWriter.encode(content, BarcodeFormat.QR_CODE, size, size, hints);
    } catch (WriterException ex) {
        mLogger.warn("qr encoder failed: " + ex.toString());
        return null;
    }

    final int width = result.getWidth();
    final int height = result.getHeight();
    final int[] pixels = new int[width * height];

    for (int y = 0; y < height; y++) {
        final int offset = y * width;
        for (int x = 0; x < width; x++) {
            pixels[offset + x] = result.get(x, y) ? Color.BLACK : Color.TRANSPARENT;
        }
    }

    final Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    bitmap.setPixels(pixels, 0, width, 0, 0, width, height);

    return bitmap;
}