List of usage examples for android.graphics.drawable.shapes OvalShape OvalShape
public OvalShape()
From source file:com.appeaser.sublimepickerlibrary.utilities.SUtils.java
private static Drawable createImageViewShape(int color) { OvalShape ovalShape = new OvalShape(); ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape); shapeDrawable.getPaint().setColor(color); return shapeDrawable; }
From source file:com.saulmm.cui.OrderDialogFragment.java
private Drawable createProductImageDrawable(Product product) { final ShapeDrawable background = new ShapeDrawable(); background.setShape(new OvalShape()); background.getPaint().setColor(ContextCompat.getColor(getContext(), product.color)); final BitmapDrawable bitmapDrawable = new BitmapDrawable(getResources(), BitmapFactory.decodeResource(getResources(), product.image)); final LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] { background, bitmapDrawable }); final int padding = (int) getResources().getDimension(R.dimen.spacing_huge); layerDrawable.setLayerInset(1, padding, padding, padding, padding); return layerDrawable; }
From source file:com.tiancaicc.springfloatingactionmenu.SpringFloatingActionMenu.java
private ArrayList<ImageButton> generateFollowCircles() { int diameter = mFAB.getType() == FloatingActionButton.TYPE_NORMAL ? Utils.getDimension(mContext, R.dimen.fab_size_normal) - 2 : Utils.getDimension(mContext, R.dimen.fab_size_mini); ArrayList<ImageButton> circles = new ArrayList<>(mMenuItems.size()); for (MenuItem item : mMenuItems) { ImageButton circle = new ImageButton(mContext); circle.setScaleType(ImageView.ScaleType.FIT_CENTER); OvalShape ovalShape = new OvalShape(); ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape); shapeDrawable.getPaint().setColor(getResources().getColor(item.getBgColor())); circle.setBackgroundDrawable(shapeDrawable); if (TextUtils.isEmpty(item.getIconFilePath())) { circle.setImageResource(item.getIcon()); } else {//from w ww .ja v a2 s .c om circle.setImageURI(Uri.fromFile(new File(item.getIconFilePath()))); } LayoutParams lp = new LayoutParams(diameter, diameter); circle.setLayoutParams(lp); circles.add(circle); } return circles; }
From source file:ticwear.design.widget.FloatingActionButton.java
Drawable createShapeDrawable() { ShapeDrawable d = new ShapeDrawable(); d.setShape(new OvalShape()); d.getPaint().setColor(Color.WHITE); return d; }
From source file:com.tafayor.selfcamerashot.taflib.helpers.GraphicsHelper.java
public static Drawable createRGradient(int shape, final int[] colors, final float[] positions) { ShapeDrawable shapeDrawable;//from ww w.j a va 2 s. com if (shape == SHAPE_RECT) { shapeDrawable = new ShapeDrawable(new RectShape()); } else { shapeDrawable = new ShapeDrawable(new OvalShape()); } ShapeDrawable.ShaderFactory shaderFactory = new ShapeDrawable.ShaderFactory() { @Override public Shader resize(int width, int height) { float gradRadius = Math.max(width, height) / 2; RadialGradient rg = new RadialGradient(width / 2, height / 2, gradRadius, colors, positions, Shader.TileMode.CLAMP); return rg; } }; shapeDrawable.setShaderFactory(shaderFactory); return shapeDrawable; }
From source file:com.tafayor.selfcamerashot.taflib.helpers.GraphicsHelper.java
public static Drawable createLGradient(int shape, final int[] colors, final float[] positions) { ShapeDrawable shapeDrawable;// w w w . ja v a 2 s. c om if (shape == SHAPE_RECT) { shapeDrawable = new ShapeDrawable(new RectShape()); } else { shapeDrawable = new ShapeDrawable(new OvalShape()); } ShapeDrawable.ShaderFactory shaderFactory = new ShapeDrawable.ShaderFactory() { @Override public Shader resize(int width, int height) { LinearGradient rg = new LinearGradient(0, 0, 0, height, colors, positions, Shader.TileMode.CLAMP); return rg; } }; shapeDrawable.setShaderFactory(shaderFactory); return shapeDrawable; }
From source file:com.tiancaicc.springfloatingactionmenu.SpringFloatingActionMenu.java
private View generateRevealCircle() { int diameter = mFAB.getType() == FloatingActionButton.TYPE_NORMAL ? Utils.getDimension(mContext, R.dimen.fab_size_normal) : Utils.getDimension(mContext, R.dimen.fab_size_mini); View view = new View(mContext); OvalShape ovalShape = new OvalShape(); ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape); shapeDrawable.getPaint().setColor(ContextCompat.getColor(mContext, mRevealColor)); view.setBackgroundDrawable(shapeDrawable); LayoutParams lp = new LayoutParams(diameter, diameter); view.setLayoutParams(lp);/*from ww w . j a va 2 s . co m*/ // Make view clickable to avoid clicks on any view located behind the menu view.setClickable(true); // note it is invisible, but will be visible while animating view.setVisibility(View.GONE); return view; }
From source file:cl.gisred.android.StandardActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LicenseResult licenseResult = ArcGISRuntime.setClientId(CLIENT_ID); LicenseLevel licenseLevel = ArcGISRuntime.License.getLicenseLevel(); if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.BASIC) { //Toast.makeText(getApplicationContext(), "Licencia bsica vlida", Toast.LENGTH_SHORT).show(); } else if (licenseResult == LicenseResult.VALID && licenseLevel == LicenseLevel.STANDARD) { //Toast.makeText(getApplicationContext(), "Licencia standard vlida", Toast.LENGTH_SHORT).show(); }/*from ww w . j a v a2 s. com*/ setContentView(R.layout.activity_standard); Toolbar toolbar = (Toolbar) findViewById(R.id.apptool); setSupportActionBar(toolbar); /*Get Credenciales String*/ Bundle bundle = getIntent().getExtras(); usuar = bundle.getString("usuario"); passw = bundle.getString("password"); modulo = bundle.getString("modulo"); empresa = bundle.getString("empresa"); //Set Credenciales setCredenciales(usuar, passw); //Set Mapa setMap(R.id.map, 0xffffff, 0xffffff, 10, 10, false, true); choices = 0; if (Build.VERSION.SDK_INT >= 23) verifPermisos(); else initGeoposition(); setLayersURL(this.getResources().getString(R.string.url_Mapabase), "MAPABASE"); setLayersURL(this.getResources().getString(R.string.url_token), "TOKENSRV"); setLayersURL(this.getResources().getString(R.string.url_EquiposLinea), "EQUIPOS_LINEA"); setLayersURL(this.getResources().getString(R.string.url_TRAMOS), "TRAMOS"); setLayersURL(this.getResources().getString(R.string.url_EquiposPTO), "EQUIPOS_PTO"); setLayersURL(this.getResources().getString(R.string.url_Nodos), "NODOS"); setLayersURL(this.getResources().getString(R.string.url_Luminarias), "LUMINARIAS"); setLayersURL(this.getResources().getString(R.string.url_Clientes), "CLIENTES"); setLayersURL(this.getResources().getString(R.string.url_Concesiones), "CONCESIONES"); setLayersURL(this.getResources().getString(R.string.url_Direcciones), "DIRECCIONES"); setLayersURL(this.getResources().getString(R.string.url_medidores), "MEDIDORES"); setLayersURL(this.getResources().getString(R.string.url_Stx), "STX"); setLayersURL(this.getResources().getString(R.string.url_ECSE_varios), "ECSE"); setLayersURL(this.getResources().getString(R.string.url_Electrodependientes), "ELECTRODEP"); //Agrega layers dinmicos. addLayersToMap(credenciales, "DYNAMIC", "MAPABASECHQ", din_urlMapaBase, null, true); addLayersToMap(credenciales, "DYNAMIC", "SED", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "SSEE", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "SALIDAALIM", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDMT", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDBT", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDAP", din_urlTramos, null, false); addLayersToMap(credenciales, "DYNAMIC", "POSTES", din_urlNodos, null, false); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_LINEA", din_urlEquiposLinea, null, false); addLayersToMap(credenciales, "DYNAMIC", "EQUIPOS_PTO", din_urlEquiposPunto, null, false); addLayersToMap(credenciales, "DYNAMIC", "LUMINARIAS", din_urlLuminarias, null, false); addLayersToMap(credenciales, "DYNAMIC", "CLIENTES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "MEDIDORES", din_urlMedidores, null, false); addLayersToMap(credenciales, "DYNAMIC", "CONCESIONES", din_urlConcesiones, null, false); addLayersToMap(credenciales, "DYNAMIC", "DIRECCIONES", din_urlDirecciones, null, false); addLayersToMap(credenciales, "DYNAMIC", "EMPALMES", din_urlClientes, null, false); addLayersToMap(credenciales, "DYNAMIC", "REDSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "TORRESSTX", din_urlStx, null, false); addLayersToMap(credenciales, "DYNAMIC", "ENCUESTADO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "REEMPLAZO", din_urlECSE, null, false); addLayersToMap(credenciales, "DYNAMIC", "ELECTRODEP", din_urlElectroDep, null, false); //Aade Layer al Mapa myMapView.addLayer(mRoadBaseMaps, 0); myMapView.addLayer(LySED, 1); myMapView.addLayer(LySSEE, 2); myMapView.addLayer(LySALIDAALIM, 3); myMapView.addLayer(LyPOSTES, 4); myMapView.addLayer(LyREDMT, 5); myMapView.addLayer(LyREDBT, 6); myMapView.addLayer(LyREDAP, 7); myMapView.addLayer(LyEQUIPOSLINEA, 8); myMapView.addLayer(LyEQUIPOSPTO, 9); myMapView.addLayer(LyLUMINARIAS, 10); myMapView.addLayer(LyCLIENTES, 11); myMapView.addLayer(LyMEDIDORES, 12); myMapView.addLayer(LyCONCESIONES, 13); myMapView.addLayer(LyDIRECCIONES, 14); myMapView.addLayer(LyEMPALMES, 15); myMapView.addLayer(LyREDSTX, 16); myMapView.addLayer(LyTORRESSTX, 17); myMapView.addLayer(LyENCUESTA, 18); myMapView.addLayer(LyREEMPLAZO, 19); myMapView.addLayer(LyELECTRODEP, 20); final FloatingActionButton btnGps = (FloatingActionButton) findViewById(R.id.action_gps); btnGps.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { alertNoGps(); } toogleGps(v); } }); btnGps.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Funcin Gps", Toast.LENGTH_SHORT).show(); return true; } }); final FloatingActionButton btnVerData = (FloatingActionButton) findViewById(R.id.action_ver_data); btnVerData.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toogleData(v); } }); btnVerData.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ver Datos", Toast.LENGTH_SHORT).show(); return true; } }); drawOk = new ShapeDrawable(new OvalShape()); drawOk.getPaint().setColor(getResources().getColor(R.color.colorPrimary)); drawNo = new ShapeDrawable(new OvalShape()); drawNo.getPaint().setColor(getResources().getColor(R.color.black_overlay)); menuMultipleActions = (FloatingActionsMenu) findViewById(R.id.multiple_actions); fabShowDialog = (FloatingActionButton) findViewById(R.id.action_show_dialog); if (fabShowDialog != null) fabShowDialog.setVisibility(View.GONE); fabNavRoute = (FloatingActionButton) findViewById(R.id.action_nav_route); if (fabNavRoute != null) { fabNavRoute.setVisibility(View.GONE); fabNavRoute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (myMapView != null && myMapView.getCallout().isShowing()) { Point p = (Point) GeometryEngine.project(myMapView.getCallout().getCoordinates(), wm, egs); Util.QueryNavigation(StandardActivity.this, p); } } }); fabNavRoute.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { Toast.makeText(getApplicationContext(), "Ir a Ruta", Toast.LENGTH_SHORT).show(); return true; } }); } }
From source file:de.mrapp.android.view.FloatingActionButton.java
/** * Creates and returns a drawable with a specific color, which can be used as the floating * action button's background./*from w w w. j a va 2s . com*/ * * @param color * The color of the background as an {@link Integer} value * @return The drawable, which has been created, as an instance of the class {@link Drawable} */ private Drawable createBackgroundDrawable(@ColorInt final int color) { OvalShape shape = new OvalShape(); ShapeDrawable drawable = new ShapeDrawable(shape); drawable.getPaint().setColor(color); return drawable; }
From source file:com.taobao.weex.ui.view.refresh.circlebar.CircleProgressBar.java
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); final float density = getContext().getResources().getDisplayMetrics().density; mDiameter = Math.min(getMeasuredWidth(), getMeasuredHeight()); if (mDiameter <= 0) { mDiameter = (int) density * DEFAULT_CIRCLE_DIAMETER; }/* w w w. j av a 2 s.c o m*/ if (getBackground() == null && mCircleBackgroundEnabled) { final int shadowYOffset = (int) (density * Y_OFFSET); final int shadowXOffset = (int) (density * X_OFFSET); mShadowRadius = (int) (density * SHADOW_RADIUS); if (elevationSupported()) { mBgCircle = new ShapeDrawable(new OvalShape()); ViewCompat.setElevation(this, SHADOW_ELEVATION * density); } else { OvalShape oval = new OvalShadow(mShadowRadius, mDiameter - mShadowRadius * 2); mBgCircle = new ShapeDrawable(oval); ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, mBgCircle.getPaint()); mBgCircle.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR); final int padding = (int) mShadowRadius; // set padding so the inner image sits correctly within the shadow. setPadding(padding, padding, padding, padding); } mBgCircle.getPaint().setColor(mBackGroundColor); setBackgroundDrawable(mBgCircle); } mProgressDrawable.setBackgroundColor(mBackGroundColor); mProgressDrawable.setColorSchemeColors(mColors); if (isShowArrow()) { mProgressDrawable.setArrowScale(1f); mProgressDrawable.showArrow(true); } super.setImageDrawable(null); super.setImageDrawable(mProgressDrawable); mProgressDrawable.setAlpha(255); if (getVisibility() == VISIBLE) { mProgressDrawable.setStartEndTrim(0, (float) 0.8); } }