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.kncwallet.wallet.util.ViewPagerTabs.java

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

    final int viewWidth = getWidth();
    final int viewHalfWidth = viewWidth / 2;
    final int viewBottom = getHeight();

    final float density = getResources().getDisplayMetrics().density;
    final float spacing = 32 * density;

    path.reset();//  w  ww.  ja v  a2  s.c om
    path.moveTo(viewHalfWidth, viewBottom - 5 * density);
    path.lineTo(viewHalfWidth + 5 * density, viewBottom);
    path.lineTo(viewHalfWidth - 5 * density, viewBottom);
    path.close();

    paint.setColor(Color.TRANSPARENT);
    canvas.drawPath(path, paint);

    paint.setTypeface(Typeface.DEFAULT_BOLD);
    final float y = getPaddingTop() + -paint.getFontMetrics().top;

    for (int i = 0; i < labels.size(); i++) {
        final String label = labels.get(i);

        paint.setTypeface(i == pagePosition ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
        paint.setColor(i == pagePosition ? Color.WHITE : Color.WHITE);

        final float x = viewHalfWidth + (maxWidth + spacing) * (i - pageOffset);
        final float labelWidth = paint.measureText(label);
        final float labelHalfWidth = labelWidth / 2;

        final float labelLeft = x - labelHalfWidth;
        final float labelVisibleLeft = labelLeft >= 0 ? 1f : 1f - (-labelLeft / labelWidth);

        final float labelRight = x + labelHalfWidth;
        final float labelVisibleRight = labelRight < viewWidth ? 1f
                : 1f - ((labelRight - viewWidth) / labelWidth);

        final float labelVisible = Math.min(labelVisibleLeft, labelVisibleRight);

        paint.setAlpha((int) (labelVisible * 255));

        canvas.drawText(label, labelLeft, y, paint);
    }
}

From source file:com.linkedin.android.eventsapp.ProfileActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profile);

    Bundle extras = getIntent() != null ? getIntent().getExtras() : new Bundle();
    final Person person = extras.getParcelable("person");
    final Activity currentActivity = this;
    final ActionBar bar = getActionBar();
    View viewActionBar = getLayoutInflater().inflate(R.layout.layout_action_bar, null);

    ImageView backView = (ImageView) viewActionBar.findViewById(R.id.actionbar_left);
    backView.setImageResource(R.drawable.arrow_left);
    backView.setVisibility(View.VISIBLE);
    backView.setClickable(true);/*from  w  ww  .ja  va 2s.  com*/
    backView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            currentActivity.finish();
        }
    });

    ActionBar.LayoutParams params = new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT,
            ActionBar.LayoutParams.MATCH_PARENT);
    bar.setCustomView(viewActionBar, params);
    bar.setDisplayShowCustomEnabled(true);
    bar.setDisplayShowTitleEnabled(false);
    bar.setIcon(new ColorDrawable(Color.TRANSPARENT));
    bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#F15153")));

    TextView attendeeNameView = (TextView) findViewById(R.id.attendeeName);
    attendeeNameView.setText(person.getFirstName() + " " + person.getLastName());

    final ImageView attendeeImageView = (ImageView) findViewById(R.id.attendeeImage);
    final TextView attendeeHeadlineView = (TextView) findViewById(R.id.attendeeHeadline);
    final TextView attendeeLocationView = (TextView) findViewById(R.id.attendeeLocation);

    boolean isAccessTokenValid = LISessionManager.getInstance(currentActivity).getSession().isValid();
    if (isAccessTokenValid) {
        String url = Constants.personByIdBaseUrl + person.getLinkedinId() + Constants.personProjection;
        APIHelper.getInstance(currentActivity).getRequest(currentActivity, url, new ApiListener() {
            @Override
            public void onApiSuccess(ApiResponse apiResponse) {
                try {
                    JSONObject s = apiResponse.getResponseDataAsJson();
                    String headline = s.has("headline") ? s.getString("headline") : "";
                    String pictureUrl = s.has("pictureUrl") ? s.getString("pictureUrl") : null;
                    JSONObject location = s.getJSONObject("location");
                    String locationName = location != null && location.has("name") ? location.getString("name")
                            : "";

                    attendeeHeadlineView.setText(headline);
                    attendeeLocationView.setText(locationName);
                    if (pictureUrl != null) {
                        new FetchImageTask(attendeeImageView).execute(pictureUrl);
                    } else {
                        attendeeImageView.setImageResource(R.drawable.ghost_person);
                    }
                } catch (JSONException e) {

                }

            }

            @Override
            public void onApiError(LIApiError apiError) {

            }
        });

        ViewStub viewOnLIStub = (ViewStub) findViewById(R.id.viewOnLIStub);
        View viewOnLI = viewOnLIStub.inflate();
        Button viewOnLIButton = (Button) viewOnLI.findViewById(R.id.viewOnLinkedInButton);
        viewOnLIButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DeepLinkHelper.getInstance().openOtherProfile(currentActivity, person.getLinkedinId(),
                        new DeepLinkListener() {
                            @Override
                            public void onDeepLinkSuccess() {

                            }

                            @Override
                            public void onDeepLinkError(LIDeepLinkError error) {

                            }
                        });
            }
        });
    } else {
        attendeeImageView.setImageResource(R.drawable.ghost_person);
    }
}

From source file:com.actionbarsherlock.sample.hcgallery.ContentFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContentView = inflater.inflate(R.layout.content_welcome, null);
    final ImageView imageView = (ImageView) mContentView.findViewById(R.id.image);
    mContentView.setDrawingCacheEnabled(false);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mContentView.setOnDragListener(new View.OnDragListener() {
            public boolean onDrag(View v, DragEvent event) {
                switch (event.getAction()) {
                case DragEvent.ACTION_DRAG_ENTERED:
                    mContentView.setBackgroundColor(getResources().getColor(R.color.drag_active_color));
                    break;

                case DragEvent.ACTION_DRAG_EXITED:
                    mContentView.setBackgroundColor(Color.TRANSPARENT);
                    break;

                case DragEvent.ACTION_DRAG_STARTED:
                    return processDragStarted(event);

                case DragEvent.ACTION_DROP:
                    mContentView.setBackgroundColor(Color.TRANSPARENT);
                    return processDrop(event, imageView);
                }//  w ww.  ja v a  2  s .  com
                return false;
            }
        });

        // Keep the action bar visibility in sync with the system status bar. That is, when entering
        // 'lights out mode,' hide the action bar, and when exiting this mode, show the action bar.

        final Activity activity = getActivity();
        mContentView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
            public void onSystemUiVisibilityChange(int visibility) {
                ActionBar actionBar = activity.getActionBar();
                if (actionBar != null) {
                    mContentView.setSystemUiVisibility(visibility);
                    if (visibility == View.STATUS_BAR_VISIBLE) {
                        actionBar.show();
                    } else {
                        actionBar.hide();
                    }
                }
            }
        });

        // Show/hide the system status bar when single-clicking a photo. This is also called
        // 'lights out mode.' Activating and deactivating this mode also invokes the listener
        // defined above, which will show or hide the action bar accordingly.

        mContentView.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (mContentView.getSystemUiVisibility() == View.STATUS_BAR_VISIBLE) {
                    mContentView.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
                } else {
                    mContentView.setSystemUiVisibility(View.STATUS_BAR_VISIBLE);
                }
            }
        });
    }

    // When long-pressing a photo, activate the action mode for selection, showing the
    // contextual action bar (CAB).

    mContentView.setOnLongClickListener(new View.OnLongClickListener() {
        public boolean onLongClick(View view) {
            if (mCurrentActionMode != null) {
                return false;
            }

            mCurrentActionMode = getActivity().startActionMode(mContentSelectionActionModeCallback);
            mContentView.setSelected(true);
            return true;
        }
    });

    return mContentView;
}

From source file:com.brodev.socialapp.view.ImagePagerActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

    ColorDrawable color = new ColorDrawable(Color.TRANSPARENT);
    color.setAlpha(128);/*from w  w  w . ja  va2 s  .  c o  m*/
    getSupportActionBar().setBackgroundDrawable(color);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    setContentView(R.layout.ac_image_pager);

    File cacheDir = new File(this.getCacheDir(), "imgcachedir");
    if (!cacheDir.exists())
        cacheDir.mkdir();

    // phrase manager
    phraseManager = new PhraseManager(getApplicationContext());

    Bundle bundle = getIntent().getExtras();

    String[] imageUrls = bundle.getStringArray("image");
    String[] imagesId = bundle.getStringArray("photo_id");
    String[] HasLike = bundle.getStringArray("HasLike");
    String[] FeedisLike = bundle.getStringArray("FeedisLike");
    String[] Total_like = bundle.getStringArray("Total_like");
    String[] Total_comment = bundle.getStringArray("Total_comment");
    String[] Itemid = bundle.getStringArray("Itemid");
    String[] Type = bundle.getStringArray("Type");

    int pagerPosition = bundle.getInt("position", 0);

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(this, imageUrls, imagesId, HasLike, FeedisLike, Total_like,
            Total_comment, Itemid, Type));

    pager.setOffscreenPageLimit(2);
    pager.setCurrentItem(pagerPosition);

    this.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
}

From source file:com.lrhehe.android.common.share.ShareDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new Dialog(getActivity());
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    // may have proble to inject in a dialog fragment
    ViewUtils.inject(getActivity());/*from  w  w  w. ja  v a  2s  .c  o  m*/
    afterViewsInflate(dialog);
    return dialog;
}

From source file:com.liberorignanese.android.stepindicatorview.Step.java

public void setUpView(View stepView, Step previous, Step next, int orientation, boolean useSecondaryStepColor) {
    ImageView iconView = (ImageView) stepView.findViewById(R.id.icon_step_layout);
    ImageView lineStartView = (ImageView) stepView.findViewById(R.id.linestart_step_layout);
    ImageView lineEndView = (ImageView) stepView.findViewById(R.id.lineend_step_layout);
    TextView textView = (TextView) stepView.findViewById(R.id.text_step_layout);

    int line_completed = orientation == LinearLayout.HORIZONTAL
            ? (useSecondaryStepColor ? R.drawable.line_completed_horizontal_secondary
                    : R.drawable.line_completed_horizontal)
            : (useSecondaryStepColor ? R.drawable.line_completed_vertical_secondary
                    : R.drawable.line_completed_vertical);
    int line_uncompleted = orientation == LinearLayout.HORIZONTAL
            ? (useSecondaryStepColor ? R.drawable.line_uncompleted_horizontal_secondary
                    : R.drawable.line_uncompleted_horizontal)
            : (useSecondaryStepColor ? R.drawable.line_uncompleted_vertical_secondary
                    : R.drawable.line_uncompleted_vertical);
    int icon_completed = useSecondaryStepColor ? R.drawable.icon_check_secondary : R.drawable.icon_check;
    int icon_uncompleted = useSecondaryStepColor ? R.drawable.icon_circle_secondary : R.drawable.icon_circle;
    int icon_completed_current = useSecondaryStepColor ? R.drawable.icon_check_secondary_current
            : R.drawable.icon_check_current;
    int step_backgroundcolor = Color.TRANSPARENT;
    int step_textcolor = useSecondaryStepColor ? R.color.stepviewindicator_maincolor_secondary
            : R.color.stepviewindicator_maincolor;
    int step_iscurrent_backgroundcolor = useSecondaryStepColor ? R.color.stepviewindicator_maincolor_secondary
            : R.color.stepviewindicator_maincolor;
    int step_iscurrent_textcolor = useSecondaryStepColor ? R.color.stepviewindicator_checkcolor_secondary
            : R.color.stepviewindicator_checkcolor;

    /*//from w  w  w .  ja  v a 2  s.  c  o  m
            if(useSecondaryStepColor){
            
            }
    */

    if (previous == null) {
        lineStartView.setVisibility(View.INVISIBLE);
    } else {
        lineStartView.setVisibility(View.VISIBLE);
        if (previous.isCompleted()) {
            lineStartView.setImageResource(line_completed);
            lineStartView.setImageAlpha(255);
        } else {
            lineStartView.setImageResource(line_uncompleted);
            lineStartView.setImageAlpha(alpha);
        }
    }
    if (next == null) {
        lineEndView.setVisibility(View.INVISIBLE);
    } else {
        lineEndView.setVisibility(View.VISIBLE);
        if (isCompleted()) {
            lineEndView.setImageResource(line_completed);
            lineEndView.setImageAlpha(255);
        } else {
            lineEndView.setImageResource(line_uncompleted);
            lineEndView.setImageAlpha(alpha);
        }
    }
    textView.setText(getText());
    if (isCompleted()) {
        iconView.setImageResource(current ? icon_completed_current : icon_completed);
        iconView.setImageAlpha(255);
    } else {
        iconView.setImageResource(icon_uncompleted);
        if (isCurrent()) {
            iconView.setImageAlpha(255);
        } else {
            iconView.setImageAlpha(alpha);
        }
    }

    if (isCurrent()) {
        textView.setTypeface(null, Typeface.BOLD);
        textView.setTextColor(ContextCompat.getColor(stepView.getContext(), step_iscurrent_textcolor));
        textView.setBackgroundColor(
                ContextCompat.getColor(stepView.getContext(), step_iscurrent_backgroundcolor));
    } else {
        textView.setTypeface(null, Typeface.NORMAL);
        textView.setTextColor(ContextCompat.getColor(stepView.getContext(), step_textcolor));
        textView.setBackgroundColor(step_backgroundcolor);
    }
    /*
            if(useSecondaryStepColor){
    textView.setTextColor(ContextCompat.getColor(stepView.getContext(), R.color.stepviewindicator_maincolor_secondary));
            }else{
    textView.setTextColor(ContextCompat.getColor(stepView.getContext(), R.color.stepviewindicator_maincolor));
            }
    */
    stepView.setOnClickListener(onClickListener);

}

From source file:com.csipsimple.ui.filters.AccountFiltersListFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ListView lv = getListView();//from   w  w  w  .  j a v a 2s.c  om

    //getListView().setSelector(R.drawable.transparent);
    lv.setCacheColorHint(Color.TRANSPARENT);

    // View management
    View detailsFrame = getActivity().findViewById(R.id.details);
    dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE;

    if (savedInstanceState != null) {
        // Restore last state for checked position.
        curCheckFilterId = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID);
        //curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD);
    }
    setListShown(false);
    if (mAdapter == null) {
        if (mHeaderView != null) {
            lv.addHeaderView(mHeaderView, null, true);
        }
        mAdapter = new AccountFiltersListAdapter(getActivity(), null);
        //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container));
        //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE);
        setListAdapter(mAdapter);
        registerForContextMenu(lv);

        lv.setVerticalFadingEdgeEnabled(true);
    }

    if (dualPane) {
        // In dual-pane mode, the list view highlights the selected item.
        Log.d("lp", "dual pane mode");
        lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        //lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT);
        lv.setVerticalScrollBarEnabled(false);
        lv.setFadingEdgeLength(50);

        updateCheckedItem();
        // Make sure our UI is in the correct state.
        //showDetails(curCheckPosition, curCheckWizard);
    } else {
        //getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT);
        lv.setVerticalScrollBarEnabled(true);
        lv.setFadingEdgeLength(100);
    }
}

From source file:com.github.andrewlord1990.materialandroidsample.components.lists.ListAdapter.java

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    if (getItemViewType(position) == TYPE_ITEM) {
        if (shouldHighlightItem(position)) {
            int color = ContextCompat.getColor(context, R.color.alternate_list_item_background);
            holder.itemView.setBackgroundColor(color);
        } else {/*from w  ww. j  a  v  a2 s  .c  o m*/
            holder.itemView.setBackgroundColor(Color.TRANSPARENT);
        }
    }
}

From source file:com.dwdesign.tweetings.activity.SetColorActivity.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.set_color);/*from w  w  w .java2  s .  c  o m*/
    mColorsGrid = (GridView) findViewById(R.id.colors_grid);

    final Bundle bundle = savedInstanceState != null ? savedInstanceState : getIntent().getExtras();

    mCustomizedColor = bundle != null ? bundle.getInt(Accounts.USER_COLOR, Color.WHITE) : Color.WHITE;

    final Resources res = getResources();
    mColors.add(res.getColor(R.color.holo_red_dark));
    mColors.add(res.getColor(R.color.holo_red_light));
    mColors.add(res.getColor(R.color.holo_orange_dark));
    mColors.add(res.getColor(R.color.holo_orange_light));
    mColors.add(res.getColor(R.color.holo_green_light));
    mColors.add(res.getColor(R.color.holo_green_dark));
    mColors.add(res.getColor(R.color.holo_blue_bright));
    mColors.add(res.getColor(R.color.holo_blue_light));
    mColors.add(res.getColor(R.color.holo_blue_dark));
    mColors.add(res.getColor(R.color.holo_purple));
    mColors.add(res.getColor(android.R.color.white));
    mColors.add(Color.TRANSPARENT);
    if (mColors.contains(mCustomizedColor)) {

    }
    mColorsGrid.setAdapter(new ColorsAdapter(this, mColors));
    mColorsGrid.setOnItemClickListener(this);

}

From source file:com.sakisds.icymonitor.fragments.graph.GraphFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRootView = inflater.inflate(R.layout.fragment_graph, container, false);
    mSettings = getActivity().getSharedPreferences(MainViewActivity.SHAREDPREFS_FILE, 0);

    if (savedInstanceState != null) {
        onRestoreInstanceState(savedInstanceState);
    } else {//from   w  w w .  jav  a2 s . c o  m
        mRenderer = new XYMultipleSeriesRenderer();
        mDataset = new XYMultipleSeriesDataset();

        mRenderer.setXTitle("");
        mRenderer.setYTitle("");
        mRenderer.setXAxisMin(-5);
        mRenderer.setXAxisMax(80);
        mRenderer.setMargins(new int[] { 0, 25, 0, 0 });
        mRenderer.setApplyBackgroundColor(true);
        mRenderer.setMarginsColor(Color.argb(0x00, 0x01, 0x01, 0x01));
        mRenderer.setBackgroundColor(Color.TRANSPARENT);
        mRenderer.setShowGridX(mSettings.getBoolean(getString(R.string.key_grid_x), false));
        mRenderer.setShowGridY(mSettings.getBoolean(getString(R.string.key_grid_y), false));
        mRenderer.setYLabels(5);
        mRenderer.setYLabelsAlign(Paint.Align.CENTER);
        mRenderer.setYLabelsPadding(15.0f);
        mRenderer.setYLabelsColor(0, getResources().getColor(android.R.color.secondary_text_light));
        mRenderer.setGridColor(getResources().getColor(android.R.color.darker_gray));
        mRenderer.setShowLegend(false);
        mRenderer.setZoomEnabled(false, false);
        mRenderer.setPanEnabled(false, false);

        mLineWidth = Float.valueOf(mSettings.getString(getString(R.string.key_line_width), "2"));
    }

    return mRootView;
}