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.mk4droid.IMC_Activities.FActivity_TabHost.java

private LinearLayout make_Inactive_Tab(String text, Drawable dr) {

    LinearLayout ll = new LinearLayout(this);

    ll.setPadding(0, 0, 2, 1);// w  w w . jav  a  2s  .  c  om

    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 InActivateColorize(ll, text, dr);
}

From source file:com.miz.utils.ViewUtils.java

public static void setupWindowFlagsForStatusbarOverlay(Window window, boolean setBackgroundResource) {

    if (MizLib.isKitKat()) {
        // If we're running on KitKat, we want to enable
        // the translucent status bar
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }//  www .j a v a2s  .c o m

    if (MizLib.hasKitKat()) {
        // If we're running on KitKat or above, we want to show
        // the background image beneath the status bar as well.
        window.getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
    }

    // Make the status bar color transparent to begin with
    if (MizLib.hasLollipop())
        window.setStatusBarColor(Color.TRANSPARENT);

    // If requested, set a background resource on the Window object
    if (setBackgroundResource)
        window.setBackgroundDrawableResource(R.drawable.bg);
}

From source file:com.android.messaging.datamodel.ParticipantRefresh.java

/**
 * Ensure that there is a self participant corresponding to every active SIM. Also, ensure
 * that any other older SIM self participants are marked as inactive.
 *//*from   w w  w.  java2 s.  co  m*/
private static void refreshSelfParticipantList() {
    if (!OsUtil.isAtLeastL_MR1()) {
        return;
    }

    final DatabaseWrapper db = DataModel.get().getDatabase();

    final List<SubscriptionInfo> subInfoRecords = PhoneUtils.getDefault().toLMr1()
            .getActiveSubscriptionInfoList();
    final ArrayMap<Integer, SubscriptionInfo> activeSubscriptionIdToRecordMap = new ArrayMap<Integer, SubscriptionInfo>();
    db.beginTransaction();
    final Set<Integer> existingSubIds = getExistingSubIds();

    try {
        if (subInfoRecords != null) {
            for (final SubscriptionInfo subInfoRecord : subInfoRecords) {
                final int subId = subInfoRecord.getSubscriptionId();
                // If its a new subscription, add it to the database.
                if (!existingSubIds.contains(subId)) {
                    db.execSQL(DatabaseHelper.getCreateSelfParticipantSql(subId));
                    // Add it to the local set to guard against duplicated entries returned
                    // by subscription manager.
                    existingSubIds.add(subId);
                }
                activeSubscriptionIdToRecordMap.put(subId, subInfoRecord);

                if (subId == PhoneUtils.getDefault().getDefaultSmsSubscriptionId()) {
                    // This is the system default subscription, so update the default self.
                    activeSubscriptionIdToRecordMap.put(ParticipantData.DEFAULT_SELF_SUB_ID, subInfoRecord);
                }
            }
        }

        // For subscriptions already in the database, refresh ParticipantColumns.SIM_SLOT_ID.
        for (final Integer subId : activeSubscriptionIdToRecordMap.keySet()) {
            final SubscriptionInfo record = activeSubscriptionIdToRecordMap.get(subId);
            final String displayName = DatabaseUtils.sqlEscapeString(record.getDisplayName().toString());
            db.execSQL(getUpdateSelfParticipantSubscriptionInfoSql(record.getSimSlotIndex(),
                    record.getIconTint(), displayName, ParticipantColumns.SUB_ID + " = " + subId));
        }
        db.execSQL(getUpdateSelfParticipantSubscriptionInfoSql(ParticipantData.INVALID_SLOT_ID,
                Color.TRANSPARENT, "''", ParticipantColumns.SUB_ID + " NOT IN ("
                        + Joiner.on(", ").join(activeSubscriptionIdToRecordMap.keySet()) + ")"));
        db.setTransactionSuccessful();
    } finally {
        db.endTransaction();
    }
    // Fix up conversation self ids by reverting to default self for conversations whose self
    // ids are no longer active.
    refreshConversationSelfIds();
}

From source file:com.ezartech.ezar.videooverlay.ezAR.java

private void startPreview(final CameraDirection cameraDir, final double zoom,
        final CallbackContext callbackContext) {

    Log.d(TAG, "start Preview");

    if (activity == null || activity.isFinishing()) {
        return;/*from w ww .  j a  v  a 2s .c  om*/
    }

    if (isPreviewing()) {
        if (cameraId != getCameraId(cameraDir)) {
            stopPreview(null, false);
        }
    }

    matrix = new Matrix();
    cameraId = getCameraId(cameraDir);
    cameraDirection = cameraDir;

    if (cameraId != UNDEFINED) {
        camera = Camera.open(cameraId);
    }

    if (camera == null) {
        if (callbackContext != null)
            callbackContext.error("No camera available");
        return;
    }

    initCamera(camera);

    cordova.getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            try {
                setIsPreviewing(true);
                updateCameraDisplayOrientation();

                //configure scaled CVG size & preview matrix
                updateCordovaViewContainerSize();
                camera.startPreview();
                webViewView.setBackgroundColor(Color.TRANSPARENT);

                setZoom(zoom, null);

                sendFlashlightEvent(STARTED, cameraDirection, cameraId, camera);
                sendFaceDetectorEvent(STARTED, cameraDirection, cameraId, camera);

                if (callbackContext != null) {
                    callbackContext.success();
                }

            } catch (Exception e) {
                Log.e(TAG, "Error during preview create", e);
                if (callbackContext != null)
                    callbackContext.error(TAG + ": " + e.getMessage());
            }

        }

    });
}

From source file:com.mixiaoxiao.support.widget.SmoothSwitch.java

private GradientDrawable makeTrackDrawable(int color, int thumbWidth, int thumbHeight, float radius,
        int padding) {
    GradientDrawable trackDrawable = new GradientDrawable();
    if (padding > 0) {
        trackDrawable.setStroke(padding, Color.TRANSPARENT);
    }/*from w  w  w .  j  a v a2  s.  c o  m*/
    trackDrawable.setCornerRadius(radius);
    trackDrawable.setSize((int) (thumbWidth * Default.DEFAULT_MEASURE_FACTOR), thumbHeight);
    trackDrawable.setColor(getTrackColor(color));
    return trackDrawable;
}

From source file:com.googlecode.eyesfree.widget.RadialMenuView.java

@Override
public void invalidate() {
    super.invalidate();

    final SurfaceHolder holder = mHolder;
    if (holder == null) {
        return;//  ww w .ja  v  a  2  s  . c om
    }

    final Canvas canvas = holder.lockCanvas();
    if (canvas == null) {
        return;
    }

    // Clear the canvas.
    canvas.drawColor(Color.TRANSPARENT, Mode.CLEAR);

    if (getVisibility() != View.VISIBLE) {
        holder.unlockCanvasAndPost(canvas);
        return;
    }

    final int width = getWidth();
    final int height = getHeight();

    if (!mDisplayWedges) {
        mCenter.x = (width / 2.0f);
        mCenter.y = (height / 2.0f);
    }

    // Draw the pretty gradient background.
    mGradientBackground.setGradientCenter((mCenter.x / width), (mCenter.y / height));
    mGradientBackground.setBounds(0, 0, width, height);
    mGradientBackground.draw(canvas);

    final RadialMenu menu = (mSubMenu != null) ? mSubMenu : mRootMenu;
    final float center = mExtremeRadius;

    if (mDisplayWedges) {
        final int wedges = menu.size();
        final float degrees = 360.0f / wedges;

        // Refresh cached wedge shapes if necessary.
        if (mCachedMenuSize != menu.size()) {
            invalidateCachedWedgeShapes();
        }

        // Draw the cancel dot.
        drawCancel(canvas, width, height, center);

        // Draw wedges.
        for (int i = 0; i < wedges; i++) {
            drawWedge(canvas, width, height, center, i, menu, degrees);
        }
    } else {
        // Draw the center dot.
        drawCenterDot(canvas, width, height);
    }

    // Draw corners.
    for (int i = 0; i < 4; i++) {
        drawCorner(canvas, width, height, center, i);
    }

    holder.unlockCanvasAndPost(canvas);
}

From source file:com.android.screenspeak.contextmenu.RadialMenuView.java

@Override
public void invalidate() {
    super.invalidate();

    final SurfaceHolder holder = mHolder;
    if (holder == null) {
        return;/*from   w  w w  .j  a  v  a2s. co m*/
    }

    final Canvas canvas = holder.lockCanvas();
    if (canvas == null) {
        return;
    }

    // Clear the canvas.
    canvas.drawColor(Color.TRANSPARENT, Mode.CLEAR);

    if (getVisibility() != View.VISIBLE) {
        holder.unlockCanvasAndPost(canvas);
        return;
    }

    final int width = getWidth();
    final int height = getHeight();

    if (!mDisplayWedges) {
        mCenter.x = (width / 2.0f);
        mCenter.y = (height / 2.0f);
    }

    // Draw the pretty gradient background.
    mGradientBackground.setGradientCenter((mCenter.x / width), (mCenter.y / height));
    mGradientBackground.setBounds(0, 0, width, height);
    mGradientBackground.draw(canvas);

    final RadialMenu menu = (mSubMenu != null) ? mSubMenu : mRootMenu;
    final float center = mExtremeRadius;

    if (mDisplayWedges) {
        final int wedges = menu.size();
        final float degrees = 360.0f / wedges;

        // Refresh cached wedge shapes if necessary.
        if (0 != menu.size()) {
            invalidateCachedWedgeShapes();
        }

        // Draw the cancel dot.
        drawCancel(canvas);

        // Draw wedges.
        for (int i = 0; i < wedges; i++) {
            drawWedge(canvas, center, i, menu, degrees);
        }
    } else {
        // Draw the center dot.
        drawCenterDot(canvas, width, height);
    }

    // Draw corners.
    for (int i = 0; i < 4; i++) {
        drawCorner(canvas, width, height, center, i);
    }

    holder.unlockCanvasAndPost(canvas);
}

From source file:com.mixiaoxiao.support.widget.SmoothSwitch.java

private GradientDrawable makeThumbDrawable(int color, int thumbWidth, int thumbHeight, float radius,
        int padding) {
    GradientDrawable thumbDrawable = new GradientDrawable();
    if (padding > 0) {
        thumbDrawable.setStroke(padding, Color.TRANSPARENT);//make a transparent stroke ,just like padding
    }//from w w w .jav a 2  s . c o  m
    thumbDrawable.setCornerRadius(radius);
    thumbDrawable.setSize(thumbWidth, thumbHeight);
    thumbDrawable.setColor(color);
    return thumbDrawable;
}

From source file:com.hannesdorfmann.search.SearchActivity.java

@OnClick(R.id.fab)
  protected void save() {
      // show the save confirmation bubble
      fab.setVisibility(View.INVISIBLE);
      confirmSaveContainer.setVisibility(View.VISIBLE);
      resultsScrim.setVisibility(View.VISIBLE);

      // expand it once it's been measured and show a scrim over the search results
      confirmSaveContainer.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
          @Override//from  ww w. j  av  a 2  s .com
          public boolean onPreDraw() {
              // expand the confirmation
              confirmSaveContainer.getViewTreeObserver().removeOnPreDrawListener(this);
              Animator reveal = ViewAnimationUtils.createCircularReveal(confirmSaveContainer,
                      confirmSaveContainer.getWidth() / 2, confirmSaveContainer.getHeight() / 2,
                      fab.getWidth() / 2, confirmSaveContainer.getWidth() / 2);
              reveal.setDuration(250L);
              reveal.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                      android.R.interpolator.fast_out_slow_in));
              reveal.start();

              // show the scrim
              int centerX = (fab.getLeft() + fab.getRight()) / 2;
              int centerY = (fab.getTop() + fab.getBottom()) / 2;
              Animator revealScrim = ViewAnimationUtils.createCircularReveal(resultsScrim, centerX, centerY, 0,
                      (float) Math.hypot(centerX, centerY));
              revealScrim.setDuration(400L);
              revealScrim.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                      android.R.interpolator.linear_out_slow_in));
              revealScrim.start();
              ObjectAnimator fadeInScrim = ObjectAnimator.ofArgb(resultsScrim, ViewUtils.BACKGROUND_COLOR,
                      Color.TRANSPARENT, ContextCompat.getColor(SearchActivity.this, R.color.scrim));
              fadeInScrim.setDuration(800L);
              fadeInScrim.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                      android.R.interpolator.linear_out_slow_in));
              fadeInScrim.start();

              // ease in the checkboxes
              saveDribbble.setAlpha(0.6f);
              saveDribbble.setTranslationY(saveDribbble.getHeight() * 0.4f);
              saveDribbble.animate().alpha(1f).translationY(0f).setDuration(200L).setInterpolator(AnimationUtils
                      .loadInterpolator(SearchActivity.this, android.R.interpolator.linear_out_slow_in));
              saveDesignerNews.setAlpha(0.6f);
              saveDesignerNews.setTranslationY(saveDesignerNews.getHeight() * 0.5f);
              saveDesignerNews.animate().alpha(1f).translationY(0f).setDuration(200L)
                      .setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                              android.R.interpolator.linear_out_slow_in));
              return false;
          }
      });
  }

From source file:com.albedinsky.android.support.ui.widget.BaseProgressBar.java

/**
 * Creates a new instance of BaseProgressBar within the given <var>context</var>.
 *
 * @param context      Context in which will be this view presented.
 * @param attrs        Set of Xml attributes used to configure the new instance of this view.
 * @param defStyleAttr An attribute which contains a reference to a default style resource for
 *                     this view within a theme of the given context.
 *///from  w  w  w.j  a  va  2  s  . co m
public BaseProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.mResources = context.getResources();
    this.mUiThreadId = Thread.currentThread().getId();

    onAttachDrawable();
    if (mDrawable == null) {
        throw new IllegalArgumentException("No progress drawable has been attached.");
    }

    /**
     * Process attributes.
     */
    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.Ui_Widget_ProgressBar,
            defStyleAttr, 0);
    if (typedArray != null) {
        this.processTintValues(context, typedArray);

        final int n = typedArray.getIndexCount();
        for (int i = 0; i < n; i++) {
            final int index = typedArray.getIndex(i);
            if (index == R.styleable.Ui_Widget_ProgressBar_uiColorProgress) {
                mDrawable.setColor(typedArray.getColor(index, mDrawable.getColor()));
            } else if (index == R.styleable.Ui_Widget_ProgressBar_uiColorsProgress) {
                final int colorsResId = typedArray.getResourceId(index, -1);
                if (colorsResId > 0) {
                    mDrawable.setColors(mResources.getIntArray(colorsResId));
                }
            } else if (index == R.styleable.Ui_Widget_ProgressBar_uiMultiColored) {
                mDrawable.setMultiColored(typedArray.getBoolean(index, mDrawable.isMultiColored()));
            } else if (index == R.styleable.Ui_Widget_ProgressBar_uiColorProgressBackground) {
                mDrawable.setBackgroundColor(typedArray.getInt(index, Color.TRANSPARENT));
            } else if (index == R.styleable.Ui_Widget_ProgressBar_android_thickness) {
                mDrawable.setThickness(typedArray.getDimensionPixelSize(index, 0));
            } else if (index == R.styleable.Ui_Widget_ProgressBar_uiRounded) {
                mDrawable.setRounded(typedArray.getBoolean(index, false));
            } else if (index == R.styleable.Ui_Widget_ProgressBar_uiIndeterminateSpeed) {
                mDrawable.setIndeterminateSpeed(typedArray.getFloat(index, 1));
            }
        }
    }

    this.applyProgressTint();
    this.applyIndeterminateTint();
    this.applyProgressBackgroundTint();
}