List of usage examples for android.graphics Color TRANSPARENT
int TRANSPARENT
To view the source code for android.graphics Color TRANSPARENT.
Click Source Link
From source file:com.bilibili.magicasakura.utils.GradientDrawableInflateImpl.java
@Override public Drawable inflateDrawable(Context context, XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException { GradientDrawable gradientDrawable = new GradientDrawable(); inflateGradientRootElement(context, attrs, gradientDrawable); int type;/*from w w w .j a v a 2 s .c o m*/ final int innerDepth = parser.getDepth() + 1; int depth; while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && ((depth = parser.getDepth()) >= innerDepth || type != XmlPullParser.END_TAG)) { if (type != XmlPullParser.START_TAG) { continue; } if (depth > innerDepth) { continue; } String name = parser.getName(); if (name.equals("size")) { final int width = DrawableUtils.getAttrDimensionPixelSize(context, attrs, android.R.attr.width); final int height = DrawableUtils.getAttrDimensionPixelSize(context, attrs, android.R.attr.height); gradientDrawable.setSize(width, height); } else if (name.equals("gradient") && Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { final float centerX = getAttrFloatOrFraction(context, attrs, android.R.attr.centerX, 0.5f, 1.0f, 1.0f); final float centerY = getAttrFloatOrFraction(context, attrs, android.R.attr.centerY, 0.5f, 1.0f, 1.0f); gradientDrawable.setGradientCenter(centerX, centerY); final boolean useLevel = DrawableUtils.getAttrBoolean(context, attrs, android.R.attr.useLevel, false); gradientDrawable.setUseLevel(useLevel); final int gradientType = DrawableUtils.getAttrInt(context, attrs, android.R.attr.type, 0); gradientDrawable.setGradientType(gradientType); final int startColor = DrawableUtils.getAttrColor(context, attrs, android.R.attr.startColor, Color.TRANSPARENT); final int centerColor = DrawableUtils.getAttrColor(context, attrs, android.R.attr.centerColor, Color.TRANSPARENT); final int endColor = DrawableUtils.getAttrColor(context, attrs, android.R.attr.endColor, Color.TRANSPARENT); if (!DrawableUtils.getAttrHasValue(context, attrs, android.R.attr.centerColor)) { gradientDrawable.setColors(new int[] { startColor, endColor }); } else { gradientDrawable.setColors(new int[] { startColor, centerColor, endColor }); setStGradientPositions(gradientDrawable.getConstantState(), 0.0f, centerX != 0.5f ? centerX : centerY, 1f); } if (gradientType == GradientDrawable.LINEAR_GRADIENT) { int angle = (int) DrawableUtils.getAttrFloat(context, attrs, android.R.attr.angle, 0.0f); angle %= 360; if (angle % 45 != 0) { throw new XmlPullParserException( "<gradient> tag requires" + "'angle' attribute to " + "be a multiple of 45"); } setStGradientAngle(gradientDrawable.getConstantState(), angle); switch (angle) { case 0: gradientDrawable.setOrientation(GradientDrawable.Orientation.LEFT_RIGHT); break; case 45: gradientDrawable.setOrientation(GradientDrawable.Orientation.BL_TR); break; case 90: gradientDrawable.setOrientation(GradientDrawable.Orientation.BOTTOM_TOP); break; case 135: gradientDrawable.setOrientation(GradientDrawable.Orientation.BR_TL); break; case 180: gradientDrawable.setOrientation(GradientDrawable.Orientation.RIGHT_LEFT); break; case 225: gradientDrawable.setOrientation(GradientDrawable.Orientation.TR_BL); break; case 270: gradientDrawable.setOrientation(GradientDrawable.Orientation.TOP_BOTTOM); break; case 315: gradientDrawable.setOrientation(GradientDrawable.Orientation.TL_BR); break; } } else { setGradientRadius(context, attrs, gradientDrawable, gradientType); } } else if (name.equals("solid")) { int color = DrawableUtils.getAttrColor(context, attrs, android.R.attr.color, Color.TRANSPARENT); gradientDrawable.setColor(getAlphaColor(color, DrawableUtils.getAttrFloat(context, attrs, android.R.attr.alpha, 1.0f))); } else if (name.equals("stroke")) { final float alphaMod = DrawableUtils.getAttrFloat(context, attrs, android.R.attr.alpha, 1.0f); final int strokeColor = DrawableUtils.getAttrColor(context, attrs, android.R.attr.color, Color.TRANSPARENT); final int strokeWidth = DrawableUtils.getAttrDimensionPixelSize(context, attrs, android.R.attr.width); final float dashWidth = DrawableUtils.getAttrDimension(context, attrs, android.R.attr.dashWidth); if (dashWidth != 0.0f) { final float dashGap = DrawableUtils.getAttrDimension(context, attrs, android.R.attr.dashGap); gradientDrawable.setStroke(strokeWidth, getAlphaColor(strokeColor, alphaMod), dashWidth, dashGap); } else { gradientDrawable.setStroke(strokeWidth, getAlphaColor(strokeColor, alphaMod)); } } else if (name.equals("corners")) { final int radius = DrawableUtils.getAttrDimensionPixelSize(context, attrs, android.R.attr.radius); gradientDrawable.setCornerRadius(radius); final int topLeftRadius = DrawableUtils.getAttrDimensionPixelSize(context, attrs, android.R.attr.topLeftRadius, radius); final int topRightRadius = DrawableUtils.getAttrDimensionPixelSize(context, attrs, android.R.attr.topRightRadius, radius); final int bottomLeftRadius = DrawableUtils.getAttrDimensionPixelSize(context, attrs, android.R.attr.bottomLeftRadius, radius); final int bottomRightRadius = DrawableUtils.getAttrDimensionPixelSize(context, attrs, android.R.attr.bottomRightRadius, radius); if (topLeftRadius != radius || topRightRadius != radius || bottomLeftRadius != radius || bottomRightRadius != radius) { // The corner radii are specified in clockwise order (see Path.addRoundRect()) gradientDrawable.setCornerRadii( new float[] { topLeftRadius, topLeftRadius, topRightRadius, topRightRadius, bottomRightRadius, bottomRightRadius, bottomLeftRadius, bottomLeftRadius }); } } else if (name.equals("padding")) { final int paddingLeft = DrawableUtils.getAttrDimensionPixelOffset(context, attrs, android.R.attr.left); final int paddingTop = DrawableUtils.getAttrDimensionPixelOffset(context, attrs, android.R.attr.top); final int paddingRight = DrawableUtils.getAttrDimensionPixelOffset(context, attrs, android.R.attr.right); final int paddingBottom = DrawableUtils.getAttrDimensionPixelOffset(context, attrs, android.R.attr.bottom); if (paddingLeft != 0 || paddingTop != 0 || paddingRight != 0 || paddingBottom != 0) { final Rect pad = new Rect(); pad.set(paddingLeft, paddingTop, paddingRight, paddingBottom); try { if (sPaddingField == null) { sPaddingField = GradientDrawable.class.getDeclaredField("mPadding"); sPaddingField.setAccessible(true); } sPaddingField.set(gradientDrawable, pad); if (sStPaddingField == null) { sStPaddingField = Class .forName("android.graphics.drawable.GradientDrawable$GradientState") .getDeclaredField("mPadding"); sStPaddingField.setAccessible(true); } sStPaddingField.set(gradientDrawable.getConstantState(), pad); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } else { Log.w("drawable", "Bad element under <shape>: " + name); } } return gradientDrawable; }
From source file:com.pseudosudostudios.jdd.views.Grid.java
/** * Common code between the constructors/*from w ww . ja v a2s . com*/ */ public void constructorCommon() { setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { gestureDetect.onTouchEvent(event); return true; } }); for (int i = 0; i < tiles.length; i++) { for (int c = 0; c < tiles[i].length; c++) { Tile t = new Tile(getContext()); t.setId(i * 10 + c); t.setVisibility(View.INVISIBLE); tiles[i][c] = t; } } divPaint.setColor(Color.TRANSPARENT); moves = 0; }
From source file:com.gmail.at.faint545.fragments.HistoryFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { refreshHistory(); // Begin downloading getListView().setCacheColorHint(Color.TRANSPARENT); // Optimization for ListView setupListAdapter();/*from w ww .ja v a2s . co m*/ super.onActivityCreated(savedInstanceState); }
From source file:com.nextgis.ngm_clink_monitoring.dialogs.YesNoDialog.java
@NonNull @Override/*w w w . ja v a2 s .c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { // Idea from here // http://thanhcs.blogspot.ru/2014/10/android-custom-dialog-fragment.html Dialog dialog = new Dialog(getActivity()); Window window = dialog.getWindow(); window.requestFeature(Window.FEATURE_NO_TITLE); window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.setContentView(R.layout.dialog_yes_no); mIcon = (ImageView) dialog.findViewById(R.id.title_icon); mTitle = (TextView) dialog.findViewById(R.id.title_text); mDialogBodyScroll = (ScrollView) dialog.findViewById(R.id.dialog_body_scroll); mDialogBodyLayoutScrolled = (LinearLayout) dialog.findViewById(R.id.dialog_body_scrolled); mDialogBodyLayout = (LinearLayout) dialog.findViewById(R.id.dialog_body); mButtons = (TableLayout) dialog.findViewById(R.id.dialog_buttons_yn); mBtnPositive = (Button) dialog.findViewById(R.id.dialog_btn_positive_yn); mBtnNegative = (Button) dialog.findViewById(R.id.dialog_btn_negative_yn); if (null != mIconId) { mIcon.setVisibility(View.VISIBLE); mIcon.setImageResource(mIconId); } if (null != mTitleId) { mTitle.setText(mTitleId); } if (null != mTitleText) { mTitle.setText(mTitleText); } if (null != mMessageId) { setMessageView(); mMessage.setText(mMessageId); } if (null != mMessageText) { setMessageView(); mMessage.setText(mMessageText); } if (null != mView) { if (mAddScrollForView) { mDialogBodyScroll.setVisibility(View.VISIBLE); mDialogBodyLayoutScrolled.addView(mView); } else { mDialogBodyLayout.setVisibility(View.VISIBLE); mDialogBodyLayout.addView(mView); } } if (null != mPositiveTextId) { mButtons.setVisibility(View.VISIBLE); mBtnPositive.setVisibility(View.VISIBLE); mBtnPositive.setText(mPositiveTextId); } if (null != mPositiveText) { mButtons.setVisibility(View.VISIBLE); mBtnPositive.setVisibility(View.VISIBLE); mBtnPositive.setText(mPositiveText); } if (null != mNegativeTextId) { mButtons.setVisibility(View.VISIBLE); mBtnNegative.setVisibility(View.VISIBLE); mBtnNegative.setText(mNegativeTextId); } if (null != mNegativeText) { mButtons.setVisibility(View.VISIBLE); mBtnNegative.setVisibility(View.VISIBLE); mBtnNegative.setText(mNegativeText); } if (null != mOnPositiveClickedListener) { mButtons.setVisibility(View.VISIBLE); mBtnPositive.setVisibility(View.VISIBLE); mBtnPositive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != mOnPositiveClickedListener) { mOnPositiveClickedListener.onPositiveClicked(); } dismiss(); } }); } if (null != mOnNegativeClickedListener) { mButtons.setVisibility(View.VISIBLE); mBtnNegative.setVisibility(View.VISIBLE); mBtnNegative.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != mOnNegativeClickedListener) { mOnNegativeClickedListener.onNegativeClicked(); } dismiss(); } }); } return dialog; }
From source file:com.masil.android.navigationdrawer.NavigationDrawerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_navigation_drawer); mPlanetTitles = getResources().getStringArray(R.array.planets_array); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (RecyclerView) findViewById(R.id.left_drawer); // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setScrimColor(Color.TRANSPARENT); //mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // improve performance by indicating the list if fixed size. mDrawerList.setHasFixedSize(true);/*from w w w. j a va 2 s . com*/ // set up the drawer's list view with items and click listener mDrawerList.setAdapter(new PlanetAdapter(mPlanetTitles, this)); // enable ActionBar app icon to behave as ae nav drawer getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayShowTitleEnabled(false); // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle(mTitle); super.onDrawerClosed(view); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBar().setTitle(mDrawerTitle); super.onDrawerOpened(drawerView); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } }
From source file:com.dm.material.dashboard.candybar.fragments.FAQsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_search, menu); MenuItem search = menu.findItem(R.id.menu_search); int color = ColorHelper.getAttributeColor(getActivity(), R.attr.toolbar_icon); SearchView searchView = (SearchView) MenuItemCompat.getActionView(search); searchView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); searchView.setQueryHint(getActivity().getResources().getString(R.string.search_faqs)); searchView.setMaxWidth(Integer.MAX_VALUE); ViewHelper.changeSearchViewTextColor(searchView, color, ColorHelper.setColorAlpha(color, 0.6f)); View view = searchView.findViewById(android.support.v7.appcompat.R.id.search_plate); if (view != null) view.setBackgroundColor(Color.TRANSPARENT); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override/*from ww w.jav a 2 s . co m*/ public boolean onQueryTextChange(String string) { filterSearch(string); return true; } @Override public boolean onQueryTextSubmit(String string) { searchView.clearFocus(); return true; } }); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.rks.musicx.ui.adapters.FolderAdapter.java
@Override public void onBindViewHolder(FolderAdapter.Folderviewholder holder, int position) { Folder folder = getItem(position);// ww w .ja v a 2 s .co m holder.filename.setTypeface(Helper.getFont(getContext())); holder.extraParam.setTypeface(Helper.getFont(getContext())); holder.menu.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_menu)); Drawable drawable = holder.menu.getDrawable(); int accentColor = Config.accentColor(getContext(), Helper.getATEKey(getContext())); if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) { holder.filename.setTextColor(Color.WHITE); drawable.setTint(Color.WHITE); holder.extraParam.setTextColor(Color.WHITE); } else { holder.filename.setTextColor(Color.BLACK); holder.extraParam.setTextColor(Color.BLACK); drawable.setTint(ContextCompat.getColor(getContext(), R.color.MaterialGrey)); } if (folder.getFile().isDirectory()) { Glide.with(getContext()).load(R.drawable.folder).diskCacheStrategy(DiskCacheStrategy.NONE) .skipMemoryCache(true).crossFade().placeholder(R.drawable.folder).error(R.drawable.folder) .into(holder.thumbnail); holder.thumbnail.setBorderColor(Color.TRANSPARENT); holder.thumbnail.setBorderWidth(0); int count = folder.getFileCount(); if (count == 0) { holder.extraParam.setVisibility(View.GONE); } else { holder.extraParam.setText(String.valueOf(folder.getFileCount()) + " files"); } if (position == 0) { holder.filename.setText(".."); holder.menu.setVisibility(View.GONE); } else { holder.filename.setText(folder.getFile().getName()); holder.menu.setVisibility(View.VISIBLE); } } else { songList = folder.getSongList(); if (songList.size() > 0) { String currentPath = folder.getFile().getAbsolutePath(); int index = Helper.getIndex(currentPath, songList); if (index > -1) { Song song = songList.get(index); holder.filename.setText(song.getTitle()); holder.extraParam.setText(song.getArtist()); holder.extraParam.setVisibility(View.VISIBLE); ArtworkUtils.ArtworkLoader(getContext(), 300, 600, song.getAlbum(), song.getAlbumId(), new palette() { @Override public void palettework(Palette palette) { } }, holder.thumbnail); if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) { holder.itemView.setBackgroundColor(storeChecked.get(index) ? ContextCompat.getColor(getContext(), R.color.translucent_white_8p) : Color.TRANSPARENT); } else { holder.itemView.setBackgroundColor( storeChecked.get(index) ? Helper.getColorWithAplha(accentColor, 0.7f) : Color.TRANSPARENT); } } } } }
From source file:com.brianwu.view.SlidingTabLayout.java
public SlidingTabLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Disable the Scroll Bar setHorizontalScrollBarEnabled(false); // Make sure that the Tab Strips fills this View setFillViewport(true);//from w w w . jav a 2s . c om mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density); mTabStrip = new SlidingTabStrip(context); addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); setSelectedIndicatorColors(context.getResources().getColor(R.color.colorWhite)); setDividerColors(Color.TRANSPARENT); }
From source file:com.intel.xdk.display.Display.java
@JavascriptInterface public void startAR() { arView = CameraPreview.newInstance(activity.getApplicationContext()); arView.setVisibility(View.INVISIBLE); arView.height = 100;//from w ww .j a v a 2 s .c om arView.width = 100; //no way to get current background color? arView.setBackgroundColor(Color.TRANSPARENT); SurfaceHolder sfhTrackHolder = arView.getHolder(); sfhTrackHolder.setFormat(PixelFormat.TRANSPARENT); sfhTrackHolder.setKeepScreenOn(true); sfhTrackHolder.setFixedSize(100, 100); activity.runOnUiThread(new Runnable() { public void run() { //activity.addContentView(arView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, 0.0F)); //activity.addContentView(arView, new LinearLayout.LayoutParams(400, 500, 0.0F)); ViewGroup rootView = (ViewGroup) webView.getParent().getParent(); rootView.addView(arView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); rootView.bringChildToFront((View) webView.getParent()); arView.setVisibility(View.VISIBLE); arView.showCamera(); webView.bringToFront(); webView.setBackgroundColor(0x00000000); LinearLayout ll = (LinearLayout) webView.getParent(); ll.setBackgroundColor(0x00000000); View activityView = activity.getCurrentFocus(); } }); }
From source file:com.guodong.sun.guodong.activity.ZhiHuDetailActivity.java
@Override protected void initViews(Bundle savedInstanceState) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { View decorView = getWindow().getDecorView(); int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE; decorView.setSystemUiVisibility(option); getWindow().setStatusBarColor(Color.TRANSPARENT); }/*from w w w. ja v a 2s . c om*/ // mToolbar.setNavigationIcon(R.drawable.ic_arrow_back); setSupportActionBar(mToolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); ViewCompat.setTransitionName(mImageView, TRANSIT_PIC); initWebView(); initShare(); // mAlertDialog = new AlertDialog.Builder(this).create(); // mAlertDialog.setView(getLayoutInflater().inflate(R.layout.loading_layout, null)); mZhihuDetailPresenter = new ZhihuDetailPresenterImpl(this, this.bindToLifecycle()); mId = getIntent().getIntExtra(EXTRA_ID, 0); mZhihuDetailPresenter.getZhihuDetailData(mId); mFButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ShareBoardConfig config = new ShareBoardConfig(); config.setMenuItemBackgroundShape(ShareBoardConfig.BG_SHAPE_NONE); mShareAction.open(config); } }); }