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:ccv.checkhelzio.nuevaagendacucsh.transitions.FabTransition.java
/** * Create a {@link FabTransition} from the supplied {@code activity} extras and set as its * shared element enter/return transition. *//*ww w .j a v a 2 s. com*/ public static boolean setup(@NonNull Activity activity, @Nullable View target) { final Intent intent = activity.getIntent(); if (!intent.hasExtra(EXTRA_FAB_COLOR) || !intent.hasExtra(EXTRA_FAB_ICON_RES_ID)) { return false; } final int color = intent.getIntExtra(EXTRA_FAB_COLOR, Color.TRANSPARENT); final int icon = intent.getIntExtra(EXTRA_FAB_ICON_RES_ID, -1); final FabTransition sharedEnter = new FabTransition(color, icon); if (target != null) { sharedEnter.addTarget(target); } activity.getWindow().setSharedElementEnterTransition(sharedEnter); return true; }
From source file:com.bilibili.magicasakura.utils.GradientDrawableUtils.java
@Override protected 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 = getAttrDimensionPixelSize(context, attrs, android.R.attr.width); final int height = 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 = getAttrBoolean(context, attrs, android.R.attr.useLevel, false); gradientDrawable.setUseLevel(useLevel); final int gradientType = getAttrInt(context, attrs, android.R.attr.type, 0); gradientDrawable.setGradientType(gradientType); final int startColor = getAttrColor(context, attrs, android.R.attr.startColor, Color.TRANSPARENT); final int centerColor = getAttrColor(context, attrs, android.R.attr.centerColor, Color.TRANSPARENT); final int endColor = getAttrColor(context, attrs, android.R.attr.endColor, Color.TRANSPARENT); if (!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) 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 = getAttrColor(context, attrs, android.R.attr.color, Color.TRANSPARENT); gradientDrawable .setColor(getAlphaColor(color, getAttrFloat(context, attrs, android.R.attr.alpha, 1.0f))); } else if (name.equals("stroke")) { final float alphaMod = getAttrFloat(context, attrs, android.R.attr.alpha, 1.0f); final int strokeColor = getAttrColor(context, attrs, android.R.attr.color, Color.TRANSPARENT); final int strokeWidth = getAttrDimensionPixelSize(context, attrs, android.R.attr.width); final float dashWidth = getAttrDimension(context, attrs, android.R.attr.dashWidth); if (dashWidth != 0.0f) { final float dashGap = 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 = getAttrDimensionPixelSize(context, attrs, android.R.attr.radius); gradientDrawable.setCornerRadius(radius); final int topLeftRadius = getAttrDimensionPixelSize(context, attrs, android.R.attr.topLeftRadius, radius); final int topRightRadius = getAttrDimensionPixelSize(context, attrs, android.R.attr.topRightRadius, radius); final int bottomLeftRadius = getAttrDimensionPixelSize(context, attrs, android.R.attr.bottomLeftRadius, radius); final int bottomRightRadius = 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 = getAttrDimensionPixelOffset(context, attrs, android.R.attr.left); final int paddingTop = getAttrDimensionPixelOffset(context, attrs, android.R.attr.top); final int paddingRight = getAttrDimensionPixelOffset(context, attrs, android.R.attr.right); final int paddingBottom = 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.hacktx.android.activities.CheckInActivity.java
private void setupStatusBar() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { setTranslucentStatusFlag(true);/*from w w w .j a v a 2 s .c om*/ } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setTranslucentStatusFlag(false); getWindow().setStatusBarColor(Color.TRANSPARENT); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { final View scrollView = findViewById(R.id.scrollView); final int bigMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()); ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) scrollView.getLayoutParams(); p.setMargins(0, bigMargin, 0, 0); scrollView.requestLayout(); } }
From source file:com.hybris.mobile.app.commerce.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Allow the system loading spinner icon requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.setContentView(mContentViewId); // Main menu drawer createMainMenuDrawer();//from w w w . j a v a2 s . co m // Action bar getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayShowTitleEnabled(false); // Cart menu drawer mCartDrawer = (DrawerPushLayout) findViewById(R.id.cart_menu_drawer); if (mCartDrawer != null) { mCartDrawer.setScrimColor(Color.TRANSPARENT); mCartDrawer.setDrawerPushLayoutListener(new DrawerPushLayoutListener() { @Override public void onDrawerOpened() { // When the cart is open, we disable the opening by swipe on the main menu mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); UIUtils.hideKeyboard(MainActivity.this); } @Override public void onDrawerClosed() { // When the drawer is closed, we enable opening by swipe on the main menu if the opening by swipe is enabled if (mIsMainMenuSwipeEnabled) { mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); } UIUtils.hideKeyboard(MainActivity.this); } }); } }
From source file:com.alusorstroke.jjvm.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (useTabletMenu()) { setContentView(R.layout.activity_main_tablet); Helper.setStatusBarColor(MainActivity.this, ContextCompat.getColor(this, R.color.myPrimaryDarkColor)); } else if (Config.USE_NEW_DRAWER == true) { setContentView(R.layout.activity_main_alternate); } else {//from www. j a va2 s . c om setContentView(R.layout.activity_main); Helper.setStatusBarColor(MainActivity.this, ContextCompat.getColor(this, R.color.myPrimaryDarkColor)); } mToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); setSupportActionBar(mToolbar); if (!useTabletMenu()) getSupportActionBar().setDisplayShowHomeEnabled(true); else { getSupportActionBar().setDisplayShowHomeEnabled(false); } mNavigationDrawerFragment = (NavDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id.fragment_drawer); if (Config.USE_NEW_DRAWER == true && !useTabletMenu()) { mNavigationDrawerFragment.setup(R.id.scrimInsetsFrameLayout, (DrawerLayout) findViewById(R.id.drawer), mToolbar); mNavigationDrawerFragment.getDrawerLayout() .setStatusBarBackgroundColor(ContextCompat.getColor(this, R.color.myPrimaryDarkColor)); findViewById(R.id.scrimInsetsFrameLayout).getLayoutParams().width = getDrawerWidth(); } else { mNavigationDrawerFragment.setup(R.id.fragment_drawer, (DrawerLayout) findViewById(R.id.drawer), mToolbar); DrawerLayout.LayoutParams params = (android.support.v4.widget.DrawerLayout.LayoutParams) mNavigationDrawerFragment .getView().getLayoutParams(); params.width = getDrawerWidth(); mNavigationDrawerFragment.getView().setLayoutParams(params); } if (useTabletMenu()) { mNavigationDrawerFragment.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN); mNavigationDrawerFragment.getDrawerLayout().setScrimColor(Color.TRANSPARENT); } else { mNavigationDrawerFragment.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); } Helper.admobLoader(this, getResources(), findViewById(R.id.adView)); prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); // setting push enabled String push = getString(R.string.rss_push_url); if (null != push && !push.equals("")) { // Create object of SharedPreferences. boolean firstStart = prefs.getBoolean("firstStart", true); if (firstStart) { final ServiceStarter alarm = new ServiceStarter(); SharedPreferences.Editor editor = prefs.edit(); alarm.setAlarm(this); // now, just to be sure, where going to set a value to check if // notifications is really enabled editor.putBoolean("firstStart", false); // commits your edits editor.commit(); } } // Check if we should open a fragment based on the arguments we have boolean loadedFragment = false; if (getIntent().getExtras() != null && getIntent().getExtras().containsKey(FRAGMENT_CLASS)) { try { Class<? extends Fragment> fragmentClass = (Class<? extends Fragment>) getIntent().getExtras() .getSerializable(FRAGMENT_CLASS); if (fragmentClass != null) { String[] extra = getIntent().getExtras().getStringArray(FRAGMENT_DATA); Fragment fragment = fragmentClass.newInstance(); showFragment(fragment, extra, getTitle().toString()); loadedFragment = true; } } catch (Exception e) { //If we come across any errors, just continue and open the default fragment Log.printStackTrace(e); } } //If we haven't already loaded an item (or came from rotation and there was already an item) //Load the first item if (savedInstanceState == null && !loadedFragment) { mNavigationDrawerFragment.loadInitialItem(); } // Checking if the user would prefer to show the menu on start boolean checkBox = prefs.getBoolean("menuOpenOnStart", false); if (checkBox == true && !useTabletMenu()) { mNavigationDrawerFragment.openDrawer(); } }
From source file:com.example.android.displayingbitmaps.imageloader.ImageWorker.java
/** * Load an image specified by the data parameter into an ImageView (override * {@link ImageWorker#processBitmap(Object)} to define the processing logic). A memory and * disk cache will be used if an {@link ImageCache} has been added using * {@link ImageWorker#addImageCache(android.support.v4.app.FragmentManager, ImageCache.ImageCacheParams)}. If the * image is found in the memory cache, it is set immediately, otherwise an {@link AsyncTask} * will be created to asynchronously load the bitmap. * * @param data The URI of the image.//from w w w .ja v a 2s . co m * @param imageView The ImageView to bind the downloaded image to. */ public void loadImage(Object data, ImageView imageView) { if (data == null) { return; } BitmapDrawable value = null; if (mImageCache != null) { value = mImageCache.getBitmapFromMemCache(String.valueOf(data)); } if (value != null) { // Bitmap found in memory cache imageView.setImageDrawable(value); imageView.setBackgroundColor(Color.TRANSPARENT); } else if (cancelPotentialWork(data, imageView)) { //BEGIN_INCLUDE(execute_background_task) final BitmapWorkerTask task = new BitmapWorkerTask(data, imageView); final AsyncDrawable asyncDrawable = new AsyncDrawable(mResources, mLoadingBitmap, task); imageView.setImageDrawable(asyncDrawable); // NOTE: This uses a custom version of AsyncTask that has been pulled from the // framework and slightly modified. Refer to the docs at the top of the class // for more info on what was changed. task.executeOnExecutor(AsyncTask.DUAL_THREAD_EXECUTOR); //END_INCLUDE(execute_background_task) } }
From source file:de.madvertise.android.sdk.MadvertiseMraidView.java
public MadvertiseMraidView(Context context) { super(context); setVerticalScrollBarEnabled(false);//w w w . ja v a 2 s .com setHorizontalScrollBarEnabled(false); setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); setBackgroundColor(Color.TRANSPARENT); WebSettings settings = getSettings(); settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); settings.setJavaScriptEnabled(true); //settings.setPluginsEnabled(true); // Initialize the default expand properties. DisplayMetrics metrics = getContext().getResources().getDisplayMetrics(); mExpandProperties = new ExpandProperties(metrics.widthPixels, metrics.heightPixels); MadvertiseUtil.logMessage(null, Log.INFO, "Setting default expandProperties : " + mExpandProperties.toJson().toString()); // This bridge stays available until this view is destroyed, hence no // reloading when displaying new ads is necessary. addJavascriptInterface(mBridge, "mraid_bridge"); setWebViewClient(new WebViewClient() { private boolean mError = false; @Override public boolean shouldOverrideUrlLoading(WebView view, final String url) { post(new Runnable() { @Override public void run() { if (mListener != null) { mListener.onAdClicked(); } final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url), getContext().getApplicationContext(), MadvertiseActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(intent); } }); return true; } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); if (!url.endsWith("mraid.js") && !mError) { MadvertiseUtil.logMessage(null, Log.DEBUG, "Setting mraid to default"); checkReady(); // Close button in default size for interstitial ads if (mPlacementType == MadvertiseUtil.PLACEMENT_TYPE_INTERSTITIAL) { mCloseButton = addCloseButtonToViewGroup(((ViewGroup) getParent())); mCloseButton.setImageResource(android.R.drawable.ic_menu_close_clear_cancel); } } } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { super.onReceivedError(view, errorCode, description, failingUrl); mError = true; } }); // Comment this in to enable video tag-capability. this.setWebChromeClient(new WebChromeClient() { @Override public void onShowCustomView(View view, CustomViewCallback callback) { MadvertiseUtil.logMessage(null, Log.INFO, "showing VideoView"); super.onShowCustomView(view, callback); if (view instanceof FrameLayout) { FrameLayout frame = (FrameLayout) view; if (frame.getFocusedChild() instanceof VideoView) { mVideo = (VideoView) ((FrameLayout) view).getFocusedChild(); frame.removeView(mVideo); ((ViewGroup) getParent()).addView(mVideo); // Will also be called onError mVideo.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer player) { player.stop(); } }); mVideo.setOnErrorListener(new OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { MadvertiseUtil.logMessage(null, Log.WARN, "Error while playing video"); if (mListener != null) { mListener.onError(new IOException("Error while playing video")); } // We return false in order to call // onCompletion() return false; } }); mVideo.start(); } } } @Override public void onHideCustomView() { if (mVideo != null) { ((ViewGroup) getParent()).removeView(mVideo); if (mVideo.isPlaying()) { mVideo.stopPlayback(); } } } }); }
From source file:com.maxwen.wallpaper.board.fragments.WallpaperSearchFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_wallpaper_search, menu); MenuItem search = menu.findItem(R.id.menu_search); int color = ColorHelper.getAttributeColor(getActivity(), R.attr.toolbar_icon); search.setIcon(DrawableHelper.getTintedDrawable(getActivity(), R.drawable.ic_toolbar_search, color)); mSearchView = (SearchView) MenuItemCompat.getActionView(search); mSearchView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_SEARCH); mSearchView.setQueryHint(getActivity().getResources().getString(R.string.menu_search)); mSearchView.setMaxWidth(Integer.MAX_VALUE); MenuItemCompat.expandActionView(search); mSearchView.setIconifiedByDefault(false); mSearchView.clearFocus();//from w w w.j a va 2 s. c o m ViewHelper.changeSearchViewTextColor(mSearchView, color, ColorHelper.setColorAlpha(color, 0.6f)); View view = mSearchView.findViewById(android.support.v7.appcompat.R.id.search_plate); if (view != null) view.setBackgroundColor(Color.TRANSPARENT); ImageView closeIcon = (ImageView) mSearchView .findViewById(android.support.v7.appcompat.R.id.search_close_btn); if (closeIcon != null) closeIcon.setImageResource(R.drawable.ic_toolbar_close); ImageView searchIcon = (ImageView) mSearchView .findViewById(android.support.v7.appcompat.R.id.search_mag_icon); ViewHelper.removeSearchViewSearchIcon(searchIcon); mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String string) { filterSearch(string); return true; } @Override public boolean onQueryTextSubmit(String string) { mSearchView.clearFocus(); return true; } }); }
From source file:com.abcs.haiwaigou.yyg.view.ReadMoreTextView.java
private void setText() { super.setText(getDisplayableText(), bufferType); setMovementMethod(LinkMovementMethod.getInstance()); setHighlightColor(Color.TRANSPARENT); }
From source file:com.jxlc.tajiproject.ui.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFormat(PixelFormat.RGBX_8888); mUnityPlayer = new UnityPlayer(this); setContentView(R.layout.activity_main); contentFragment = ContentFragment.newInstance(curLayout); contentFragment.setUnityPlayer(mUnityPlayer); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, contentFragment).commit(); mainLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mainLayout.setScrimColor(Color.TRANSPARENT); menuItemsContainer = (LinearLayout) findViewById(R.id.left_drawer); menuItemsContainer.setOnClickListener(new View.OnClickListener() { @Override/*from w w w .j a v a 2 s . c o m*/ public void onClick(View v) { mainLayout.closeDrawers(); } }); initValues(); setActionBar(); createMenuList(); }