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:eu.operando.operandoapp.OperandoProxyStatus.java
private void updateStatusView() { OperandoProxyStatus proxyStatus = OperandoProxyStatus.STOPPED; OperandoProxyLink proxyLink = OperandoProxyLink.INVALID; boolean isProxyRunning = MainUtil.isServiceRunning(mainContext.getContext(), ProxyService.class); boolean isProxyPaused = MainUtil.isProxyPaused(mainContext); if (isProxyRunning) { if (isProxyPaused) { proxyStatus = OperandoProxyStatus.PAUSED; } else {//from w w w . jav a2 s . co m proxyStatus = OperandoProxyStatus.ACTIVE; } } try { Proxy proxy = APL.getCurrentHttpProxyConfiguration(); InetSocketAddress proxyAddress = (InetSocketAddress) proxy.address(); if (proxyAddress != null) { //TODO: THIS SHOULD BE DYNAMIC String proxyHost = proxyAddress.getHostName(); int proxyPort = proxyAddress.getPort(); if (proxyHost.equals("127.0.0.1") && proxyPort == 8899) { proxyLink = OperandoProxyLink.VALID; } } } catch (Exception e) { e.printStackTrace(); } String info = ""; try { InputStream is = getResources().openRawResource(R.raw.info_template); info = IOUtils.toString(is); IOUtils.closeQuietly(is); } catch (IOException e) { e.printStackTrace(); } info = info.replace("@@status@@", proxyStatus.name()); info = info.replace("@@link@@", proxyLink.name()); webView.loadDataWithBaseURL("", info, "text/html", "UTF-8", ""); webView.setBackgroundColor(Color.TRANSPARENT); //TRANSPARENT }
From source file:com.dwdesign.tweetings.fragment.UserProfileFragment.java
@Override public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { if (intent == null) return;/* w w w .j av a 2 s . co m*/ switch (requestCode) { case REQUEST_TAKE_PHOTO: { if (resultCode == Activity.RESULT_OK) { final String path = mImageUri.getPath(); final File file = path != null ? new File(path) : null; if (file != null && file.exists()) { mService.updateProfileImage(mUser.getId(), mImageUri, true); } } break; } case REQUEST_BANNER_TAKE_PHOTO: { if (resultCode == Activity.RESULT_OK) { final String path = mImageUri.getPath(); final File file = path != null ? new File(path) : null; if (file != null && file.exists()) { mService.updateBannerImage(mUser.getId(), mImageUri, true); } } break; } case REQUEST_PICK_IMAGE: { if (resultCode == Activity.RESULT_OK && intent != null) { final Uri uri = intent.getData(); final String image_path = getImagePathFromUri(getActivity(), uri); final File file = image_path != null ? new File(image_path) : null; if (file != null && file.exists()) { mService.updateProfileImage(mUser.getId(), Uri.fromFile(file), false); } } break; } case REQUEST_BANNER_PICK_IMAGE: { if (resultCode == Activity.RESULT_OK && intent != null) { final Uri uri = intent.getData(); final String image_path = getImagePathFromUri(getActivity(), uri); final File file = image_path != null ? new File(image_path) : null; if (file != null && file.exists()) { mService.updateBannerImage(mUser.getId(), Uri.fromFile(file), false); } } break; } case REQUEST_SET_COLOR: { if (resultCode == Activity.RESULT_OK && intent != null) { final int color = intent.getIntExtra(Accounts.USER_COLOR, Color.TRANSPARENT); setUserColor(getActivity(), mUserId, color); updateUserColor(); } break; } } }
From source file:com.saphion.stencilweather.activities.MainActivity.java
@Override public void onClick(final View view) { initiateActions(true);//from w w w . ja v a 2s . c om new Handler().postDelayed(new Runnable() { @Override public void run() { switch (view.getId()) { case R.id.fab_graph: slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED); materialMenu.animateIconState(MaterialMenuDrawable.IconState.X); toolbar.getMenu().clear(); actionBarContent(false); toolbar.setTitle(navAdapter.getItem(navSpinner.getSelectedItemPosition())); break; case R.id.fab_map: Intent mapIntent = new Intent(MainActivity.this, MapActivity.class); mapIntent.putExtra("position", navSpinner.getSelectedItemPosition()); startActivity(mapIntent); finish(); break; case R.id.fab_share: AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this); View mView = LayoutInflater.from(MainActivity.this).inflate(R.layout.share_weather_layout, null); mBuilder.setView(mView); shareContainer = mView.findViewById(R.id.shareableContainer); final List<Drawable> packageIcons = new ArrayList<>(); final List<String> appNames = new ArrayList<>(); final List<String> packageNames = new ArrayList<>(); final List<String> classNames = new ArrayList<>(); final RecyclerView shareRecyclerView = (RecyclerView) mView.findViewById(R.id.rvWeatherShare); final View flShareableApps = mView.findViewById(R.id.flShareableApps); flShareableApps.setAlpha(0); shareRecyclerView.setVisibility(View.VISIBLE); new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... voids) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.setType("image/jpeg"); List<ResolveInfo> resolveInfoList = getPackageManager() .queryIntentActivities(sendIntent, 0); Collections.sort(resolveInfoList, new ResolveInfo.DisplayNameComparator(getPackageManager())); for (ResolveInfo resolveInfo : resolveInfoList) { Drawable icon = resolveInfo.loadIcon(getPackageManager()); String name = resolveInfo.loadLabel(getPackageManager()).toString(); packageIcons.add(icon); appNames.add(name); packageNames.add(resolveInfo.activityInfo.packageName); classNames.add(resolveInfo.activityInfo.name); } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); ShareItemViewAdapter shareAdapter = new ShareItemViewAdapter(MainActivity.this, packageIcons, appNames, packageNames, classNames); LinearLayoutManager layoutManager = new LinearLayoutManager(MainActivity.this); layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); shareRecyclerView.setLayoutManager(layoutManager); shareRecyclerView.setAdapter(shareAdapter); YoYo.with(Techniques.SlideInDown).duration(500).interpolate(new OvershootInterpolator()) .playOn(flShareableApps); } }.execute(); mShareDialog = mBuilder.create(); mShareDialog.getWindow().setWindowAnimations(R.style.DialogAnimation); mShareDialog.getWindow() .setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); mShareDialog.show(); break; } } }, 200); }
From source file:com.dngames.mobilewebcam.PhotoSettings.java
@Override public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { if (key == "cam_refresh") { int new_refresh = getEditInt(mContext, prefs, "cam_refresh", 60); String msg = "Camera refresh set to " + new_refresh + " seconds!"; if (MobileWebCam.gIsRunning) { if (!mNoToasts && new_refresh != mRefreshDuration) { try { Toast.makeText(mContext.getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); } catch (RuntimeException e) { e.printStackTrace(); }//from w w w . jav a 2 s .c om } } else if (new_refresh != mRefreshDuration) { MobileWebCam.LogI(msg); } } // get all preferences for (Field f : getClass().getFields()) { { BooleanPref bp = f.getAnnotation(BooleanPref.class); if (bp != null) { try { f.setBoolean(this, prefs.getBoolean(bp.key(), bp.val())); } catch (Exception e) { Log.e("MobileWebCam", "Exception: " + bp.key() + " <- " + bp.val()); e.printStackTrace(); } } } { EditIntPref ip = f.getAnnotation(EditIntPref.class); if (ip != null) { try { int eval = getEditInt(mContext, prefs, ip.key(), ip.val()) * ip.factor(); if (ip.max() != Integer.MAX_VALUE) eval = Math.min(eval, ip.max()); if (ip.min() != Integer.MIN_VALUE) eval = Math.max(eval, ip.min()); f.setInt(this, eval); } catch (Exception e) { e.printStackTrace(); } } } { IntPref ip = f.getAnnotation(IntPref.class); if (ip != null) { try { int eval = prefs.getInt(ip.key(), ip.val()) * ip.factor(); if (ip.max() != Integer.MAX_VALUE) eval = Math.min(eval, ip.max()); if (ip.min() != Integer.MIN_VALUE) eval = Math.max(eval, ip.min()); f.setInt(this, eval); } catch (Exception e) { // handle wrong set class e.printStackTrace(); Editor edit = prefs.edit(); edit.remove(ip.key()); edit.putInt(ip.key(), ip.val()); edit.commit(); try { f.setInt(this, ip.val()); } catch (IllegalArgumentException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } } } } { EditFloatPref fp = f.getAnnotation(EditFloatPref.class); if (fp != null) { try { float eval = getEditFloat(mContext, prefs, fp.key(), fp.val()); if (fp.max() != Float.MAX_VALUE) eval = Math.min(eval, fp.max()); if (fp.min() != Float.MIN_VALUE) eval = Math.max(eval, fp.min()); f.setFloat(this, eval); } catch (Exception e) { e.printStackTrace(); } } } { StringPref sp = f.getAnnotation(StringPref.class); if (sp != null) { try { f.set(this, prefs.getString(sp.key(), getDefaultString(mContext, sp))); } catch (Exception e) { e.printStackTrace(); } } } } mCustomImageScale = Enum.valueOf(ImageScaleMode.class, prefs.getString("custompicscale", "CROP")); mAutoStart = prefs.getBoolean("autostart", false); mCameraStartupEnabled = prefs.getBoolean("cam_autostart", true); mShutterSound = prefs.getBoolean("shutter", true); mDateTimeColor = GetPrefColor(prefs, "datetime_color", "#FFFFFFFF", Color.WHITE); mDateTimeShadowColor = GetPrefColor(prefs, "datetime_shadowcolor", "#FF000000", Color.BLACK); mDateTimeBackgroundColor = GetPrefColor(prefs, "datetime_backcolor", "#80FF0000", Color.argb(0x80, 0xFF, 0x00, 0x00)); mDateTimeBackgroundLine = prefs.getBoolean("datetime_fillline", true); mDateTimeX = prefs.getInt("datetime_x", 98); mDateTimeY = prefs.getInt("datetime_y", 98); mDateTimeAlign = Paint.Align.valueOf(prefs.getString("datetime_imprintalign", "RIGHT")); mDateTimeFontScale = (float) prefs.getInt("datetime_fontsize", 6); mTextColor = GetPrefColor(prefs, "text_color", "#FFFFFFFF", Color.WHITE); mTextShadowColor = GetPrefColor(prefs, "text_shadowcolor", "#FF000000", Color.BLACK); mTextBackgroundColor = GetPrefColor(prefs, "text_backcolor", "#80FF0000", Color.argb(0x80, 0xFF, 0x00, 0x00)); mTextBackgroundLine = prefs.getBoolean("text_fillline", true); mTextX = prefs.getInt("text_x", 2); mTextY = prefs.getInt("text_y", 2); mTextAlign = Paint.Align.valueOf(prefs.getString("text_imprintalign", "LEFT")); mTextFontScale = (float) prefs.getInt("infotext_fontsize", 6); mTextFontname = prefs.getString("infotext_fonttypeface", ""); mStatusInfoColor = GetPrefColor(prefs, "statusinfo_color", "#FFFFFFFF", Color.WHITE); mStatusInfoShadowColor = GetPrefColor(prefs, "statusinfo_shadowcolor", "#FF000000", Color.BLACK); mStatusInfoX = prefs.getInt("statusinfo_x", 2); mStatusInfoY = prefs.getInt("statusinfo_y", 98); mStatusInfoAlign = Paint.Align.valueOf(prefs.getString("statusinfo_imprintalign", "LEFT")); mStatusInfoBackgroundColor = GetPrefColor(prefs, "statusinfo_backcolor", "#00000000", Color.TRANSPARENT); mStatusInfoFontScale = (float) prefs.getInt("statusinfo_fontsize", 6); mStatusInfoBackgroundLine = prefs.getBoolean("statusinfo_fillline", false); mGPSColor = GetPrefColor(prefs, "gps_color", "#FFFFFFFF", Color.WHITE); mGPSShadowColor = GetPrefColor(prefs, "gps_shadowcolor", "#FF000000", Color.BLACK); mGPSX = prefs.getInt("gps_x", 98); mGPSY = prefs.getInt("gps_y", 2); mGPSAlign = Paint.Align.valueOf(prefs.getString("gps_imprintalign", "RIGHT")); mGPSBackgroundColor = GetPrefColor(prefs, "gps_backcolor", "#00000000", Color.TRANSPARENT); mGPSFontScale = (float) prefs.getInt("gps_fontsize", 6); mGPSBackgroundLine = prefs.getBoolean("gps_fillline", false); mImprintPictureX = prefs.getInt("imprint_picture_x", 0); mImprintPictureY = prefs.getInt("imprint_picture_y", 0); mNightAutoConfigEnabled = prefs.getBoolean("night_auto_enabled", false); mSetNightConfiguration = prefs.getBoolean("cam_nightconfiguration", false); // override night camera parameters (read again with postfix) getCurrentNightSettings(); mFilterPicture = false; //***prefs.getBoolean("filter_picture", false); mFilterType = getEditInt(mContext, prefs, "filter_sel", 0); if (mImprintPicture) { if (mImprintPictureURL.length() == 0) { // sdcard image File path = new File(Environment.getExternalStorageDirectory() + "/MobileWebCam/"); if (path.exists()) { synchronized (gImprintBitmapLock) { if (gImprintBitmap != null) gImprintBitmap.recycle(); gImprintBitmap = null; File file = new File(path, "imprint.png"); try { FileInputStream in = new FileInputStream(file); gImprintBitmap = BitmapFactory.decodeStream(in); in.close(); } catch (IOException e) { Toast.makeText(mContext, "Error: unable to read imprint bitmap " + file.getName() + "!", Toast.LENGTH_SHORT).show(); gImprintBitmap = null; } catch (OutOfMemoryError e) { Toast.makeText(mContext, "Error: imprint bitmap " + file.getName() + " too large!", Toast.LENGTH_LONG).show(); gImprintBitmap = null; } } } } else { DownloadImprintBitmap(); } synchronized (gImprintBitmapLock) { if (gImprintBitmap == null) { // last resort: resource default try { gImprintBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.imprint); } catch (OutOfMemoryError e) { Toast.makeText(mContext, "Error: default imprint bitmap too large!", Toast.LENGTH_LONG) .show(); gImprintBitmap = null; } } } } mNoToasts = prefs.getBoolean("no_messages", false); mFullWakeLock = prefs.getBoolean("full_wakelock", true); switch (getEditInt(mContext, prefs, "camera_mode", 1)) { case 0: mMode = Mode.MANUAL; break; case 2: mMode = Mode.HIDDEN; break; case 3: mMode = Mode.BACKGROUND; break; case 1: default: mMode = Mode.NORMAL; break; } }
From source file:edu.mum.ml.group7.guessasketch.android.EasyPaint.java
@Override public boolean onOptionsItemSelected(MenuItem item) { mPaint.setXfermode(null);/*from w w w.j a v a2 s.c o m*/ mPaint.setAlpha(0xFF); switch (item.getItemId()) { case R.id.normal_brush_menu: mPaint.setShader(null); mPaint.setMaskFilter(null); return true; case R.id.color_menu: new ColorPickerDialog(this, this, mPaint.getColor()).show(); return true; case R.id.size_menu: { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.brush, (ViewGroup) findViewById(R.id.root)); AlertDialog.Builder builder = new AlertDialog.Builder(this).setView(layout); builder.setTitle(R.string.choose_width); final AlertDialog alertDialog = builder.create(); alertDialog.show(); SeekBar sb = (SeekBar) layout.findViewById(R.id.brushSizeSeekBar); sb.setProgress(getStrokeSize()); final TextView txt = (TextView) layout.findViewById(R.id.sizeValueTextView); txt.setText( String.format(getResources().getString(R.string.your_selected_size_is), getStrokeSize() + 1)); sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { public void onProgressChanged(SeekBar seekBar, final int progress, boolean fromUser) { // Do something here with new value mPaint.setStrokeWidth(progress); txt.setText( String.format(getResources().getString(R.string.your_selected_size_is), progress + 1)); } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } }); return true; } case R.id.erase_menu: { LayoutInflater inflater_e = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout_e = inflater_e.inflate(R.layout.brush, (ViewGroup) findViewById(R.id.root)); AlertDialog.Builder builder_e = new AlertDialog.Builder(this).setView(layout_e); builder_e.setTitle(R.string.choose_width); final AlertDialog alertDialog_e = builder_e.create(); alertDialog_e.show(); SeekBar sb_e = (SeekBar) layout_e.findViewById(R.id.brushSizeSeekBar); sb_e.setProgress(getStrokeSize()); final TextView txt_e = (TextView) layout_e.findViewById(R.id.sizeValueTextView); txt_e.setText( String.format(getResources().getString(R.string.your_selected_size_is), getStrokeSize() + 1)); sb_e.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { public void onProgressChanged(SeekBar seekBar, final int progress, boolean fromUser) { // Do something here with new value mPaint.setStrokeWidth(progress); txt_e.setText( String.format(getResources().getString(R.string.your_selected_size_is), progress + 1)); } public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } }); mPaint.setShader(null); mPaint.setXfermode(new PorterDuffXfermode(Mode.CLEAR)); return true; } case R.id.clear_all_menu: { contentView.mBitmap.eraseColor(Color.TRANSPARENT); if (predictions != null) { resetPredictionsView(predictions, true); } return true; } case R.id.save_menu: sendScreenshot(false, ApiCallType.GUESS_IMAGE, ""); break; case R.id.about_menu: startActivity(new Intent(this, AboutActivity.class)); break; } return super.onOptionsItemSelected(item); }
From source file:com.astir_trotter.atcustom.ui.iconics.core.IconicsDrawable.java
/** * Ensures the tint filter is consistent with the current tint color and * mode./*from ww w.j a v a 2 s .c o m*/ */ private PorterDuffColorFilter updateTintFilter(ColorStateList tint, PorterDuff.Mode tintMode) { if (tint == null || tintMode == null) { return null; } // setMode, setColor of PorterDuffColorFilter are not public method in SDK v7. (Thanks @Google still not accessible in API v24) // Therefore we create a new one all the time here. Don't expect this is called often. final int color = tint.getColorForState(getState(), Color.TRANSPARENT); return new PorterDuffColorFilter(color, tintMode); }
From source file:android.support.v17.leanback.app.PlaybackSupportFragment.java
private void updateBackground() { if (mBackgroundView != null) { int color = mBgDarkColor; switch (mBackgroundType) { case BG_DARK: break; case BG_LIGHT: color = mBgLightColor;/*from w w w . j a va 2 s . c o m*/ break; case BG_NONE: color = Color.TRANSPARENT; break; } mBackgroundView.setBackground(new ColorDrawable(color)); setBgAlpha(mBgAlpha); } }
From source file:com.mylikes.likes.etchasketch.Slate.java
public Bitmap copyBitmap(boolean withBackground) { Bitmap newb = null;/*from w w w .ja va 2 s. c o m*/ Bitmap b = getBitmap(); if (b != null) { newb = Bitmap.createBitmap(b.getWidth(), b.getHeight(), b.getConfig()); } if (newb != null) { Canvas newc = new Canvas(newb); if (mBackgroundColor != Color.TRANSPARENT && withBackground) { newc.drawColor(mBackgroundColor); } newc.drawBitmap(b, 0, 0, null); } return newb; }
From source file:com.rks.musicx.ui.activities.MainActivity.java
private void colorMode(int color) { playToggle.setBackgroundTintList(ColorStateList.valueOf(color)); songProgress.setProgressColor(color); songProgress.setDefaultProgressBackgroundColor(Color.TRANSPARENT); }
From source file:com.example.search.car.pools.welcome.java
private void showSearchDialog() { promptsView = new Dialog(this); promptsView.requestWindowFeature(Window.FEATURE_NO_TITLE); promptsView.setContentView(R.layout.search); promptsView.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); RelativeLayout rl = (RelativeLayout) promptsView.findViewById(R.id.RelativeLayout1); rl.setBackgroundColor(Color.parseColor("#00000000")); l_1 = (LinearLayout) promptsView.findViewById(R.id.dgdf); l_2 = (LinearLayout) promptsView.findViewById(R.id.ddf); l_3 = (LinearLayout) promptsView.findViewById(R.id.gdf); et_from = (EditText) promptsView.findViewById(R.id.et_search_from); et_to = (EditText) promptsView.findViewById(R.id.et_search_to); sp_city = (TextView) promptsView.findViewById(R.id.sp_sec_city); sp_category = (TextView) promptsView.findViewById(R.id.sp_category); sp_search_for = (TextView) promptsView.findViewById(R.id.sp_search_for); b_search = (Button) promptsView.findViewById(R.id.b_search); close = (RelativeLayout) promptsView.findViewById(R.id.iv_close); close.setVisibility(View.VISIBLE); close.setOnClickListener(this); b_search.setOnClickListener(this); sp_city.setOnClickListener(this); sp_category.setOnClickListener(this); sp_search_for.setOnClickListener(this); l_1.setOnClickListener(this); l_2.setOnClickListener(this); l_3.setOnClickListener(this); Typeface tf = Typeface.createFromAsset(welcome.this.getAssets(), "AvenirLTStd_Book.otf"); et_from.setTypeface(tf);/*w ww .j a va 2s.c om*/ b_search.setTypeface(tf); et_to.setTypeface(tf); sp_category.setTypeface(tf); sp_city.setTypeface(tf); sp_search_for.setTypeface(tf); promptsView.show(); }