List of usage examples for android.graphics Color WHITE
int WHITE
To view the source code for android.graphics Color WHITE.
Click Source Link
From source file:com.coincide.alphafitness.ui.Fragment_Main.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case R.id.action_split_count: Dialog_Split.getDialog(getActivity(), total_start + Math.max(todayOffset + since_boot, 0)).show(); return true; case R.id.action_pause: SensorManager sm = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE); Drawable d;/*ww w . j av a 2 s .c om*/ if (getActivity().getSharedPreferences("pedometer", Context.MODE_PRIVATE).contains("pauseCount")) { // currently paused -> now resumed sm.registerListener(this, sm.getDefaultSensor(Sensor.TYPE_STEP_COUNTER), SensorManager.SENSOR_DELAY_UI, 0); item.setTitle(R.string.pause); d = getResources().getDrawable(R.drawable.ic_pause); } else { sm.unregisterListener(this); item.setTitle(R.string.resume); d = getResources().getDrawable(R.drawable.ic_resume); } d.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP); item.setIcon(d); getActivity().startService(new Intent(getActivity(), SensorListener.class).putExtra("action", SensorListener.ACTION_PAUSE)); return true; default: return ((Activity_Main) getActivity()).optionsItemSelected(item); } }
From source file:com.anysoftkeyboard.keyboards.views.AnyKeyboardViewBase.java
protected boolean setValueFromTheme(TypedArray remoteTypedArray, final int[] padding, final int localAttrId, final int remoteTypedArrayIndex) { try {/* w ww. j a v a2 s . c o m*/ switch (localAttrId) { case android.R.attr.background: Drawable keyboardBackground = remoteTypedArray.getDrawable(remoteTypedArrayIndex); if (keyboardBackground == null) return false; CompatUtils.setViewBackgroundDrawable(this, keyboardBackground); break; case android.R.attr.paddingLeft: padding[0] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (padding[0] == -1) return false; break; case android.R.attr.paddingTop: padding[1] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (padding[1] == -1) return false; break; case android.R.attr.paddingRight: padding[2] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (padding[2] == -1) return false; break; case android.R.attr.paddingBottom: padding[3] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (padding[3] == -1) return false; break; case R.attr.keyBackground: mKeyBackground = remoteTypedArray.getDrawable(remoteTypedArrayIndex); if (mKeyBackground == null) return false; break; case R.attr.keyHysteresisDistance: mKeyHysteresisDistance = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (mKeyHysteresisDistance == -1) return false; break; case R.attr.verticalCorrection: mOriginalVerticalCorrection = mVerticalCorrection = remoteTypedArray .getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (mOriginalVerticalCorrection == -1) return false; break; case R.attr.keyTextSize: mKeyTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (mKeyTextSize == -1) return false; // you might ask yourself "why did Menny sqrt root the factor?" // I'll tell you; the factor is mostly for the height, not the // font size, // but I also factorize the font size because I want the text to // be a little like // the key size. // the whole factor maybe too much, so I ease that a bit. if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mKeyTextSize = (float) (mKeyTextSize * Math.sqrt(AnyApplication.getConfig().getKeysHeightFactorInLandscape())); else mKeyTextSize = (float) (mKeyTextSize * Math.sqrt(AnyApplication.getConfig().getKeysHeightFactorInPortrait())); Logger.d(TAG, "AnySoftKeyboardTheme_keyTextSize " + mKeyTextSize); break; case R.attr.keyTextColor: mKeyTextColor = remoteTypedArray.getColorStateList(remoteTypedArrayIndex); if (mKeyTextColor == null) { mKeyTextColor = new ColorStateList(new int[][] { { 0 } }, new int[] { remoteTypedArray.getColor(remoteTypedArrayIndex, 0xFF000000) }); } break; case R.attr.labelTextSize: mLabelTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (mLabelTextSize == -1) return false; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mLabelTextSize = mLabelTextSize * AnyApplication.getConfig().getKeysHeightFactorInLandscape(); else mLabelTextSize = mLabelTextSize * AnyApplication.getConfig().getKeysHeightFactorInPortrait(); break; case R.attr.keyboardNameTextSize: mKeyboardNameTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (mKeyboardNameTextSize == -1) return false; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mKeyboardNameTextSize = mKeyboardNameTextSize * AnyApplication.getConfig().getKeysHeightFactorInLandscape(); else mKeyboardNameTextSize = mKeyboardNameTextSize * AnyApplication.getConfig().getKeysHeightFactorInPortrait(); break; case R.attr.keyboardNameTextColor: mKeyboardNameTextColor = remoteTypedArray.getColor(remoteTypedArrayIndex, Color.WHITE); break; case R.attr.shadowColor: mShadowColor = remoteTypedArray.getColor(remoteTypedArrayIndex, 0); break; case R.attr.shadowRadius: mShadowRadius = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); break; case R.attr.shadowOffsetX: mShadowOffsetX = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); break; case R.attr.shadowOffsetY: mShadowOffsetY = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); break; case R.attr.backgroundDimAmount: mBackgroundDimAmount = remoteTypedArray.getFloat(remoteTypedArrayIndex, -1f); if (mBackgroundDimAmount == -1f) return false; break; case R.attr.keyPreviewBackground: Drawable keyPreviewBackground = remoteTypedArray.getDrawable(remoteTypedArrayIndex); if (keyPreviewBackground == null) return false; mPreviewPopupTheme.setPreviewKeyBackground(keyPreviewBackground); break; case R.attr.keyPreviewTextColor: mPreviewPopupTheme.setPreviewKeyTextColor(remoteTypedArray.getColor(remoteTypedArrayIndex, 0xFFF)); break; case R.attr.keyPreviewTextSize: mPreviewPopupTheme .setPreviewKeyTextSize(remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 0)); break; case R.attr.keyPreviewLabelTextSize: mPreviewPopupTheme .setPreviewLabelTextSize(remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 0)); break; case R.attr.keyPreviewOffset: mPreviewPopupTheme .setVerticalOffset(remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0)); break; case R.attr.previewAnimationType: int previewAnimationType = remoteTypedArray.getInteger(remoteTypedArrayIndex, -1); if (previewAnimationType == -1) return false; mPreviewPopupTheme.setPreviewAnimationType(previewAnimationType); break; case R.attr.keyTextStyle: int textStyle = remoteTypedArray.getInt(remoteTypedArrayIndex, 0); switch (textStyle) { case 0: mKeyTextStyle = Typeface.DEFAULT; break; case 1: mKeyTextStyle = Typeface.DEFAULT_BOLD; break; case 2: mKeyTextStyle = Typeface.defaultFromStyle(Typeface.ITALIC); break; default: mKeyTextStyle = Typeface.defaultFromStyle(textStyle); break; } mPreviewPopupTheme.setKeyStyle(mKeyTextStyle); break; case R.attr.keyHorizontalGap: float themeHorizontalKeyGap = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (themeHorizontalKeyGap == -1) return false; mKeyboardDimens.setHorizontalKeyGap(themeHorizontalKeyGap); break; case R.attr.keyVerticalGap: float themeVerticalRowGap = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (themeVerticalRowGap == -1) return false; mKeyboardDimens.setVerticalRowGap(themeVerticalRowGap); break; case R.attr.keyNormalHeight: int themeNormalKeyHeight = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (themeNormalKeyHeight == -1) return false; mKeyboardDimens.setNormalKeyHeight(themeNormalKeyHeight); break; case R.attr.keyLargeHeight: int themeLargeKeyHeight = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (themeLargeKeyHeight == -1) return false; mKeyboardDimens.setLargeKeyHeight(themeLargeKeyHeight); break; case R.attr.keySmallHeight: int themeSmallKeyHeight = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (themeSmallKeyHeight == -1) return false; mKeyboardDimens.setSmallKeyHeight(themeSmallKeyHeight); break; case R.attr.hintTextSize: mHintTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (mHintTextSize == -1) return false; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mHintTextSize = mHintTextSize * AnyApplication.getConfig().getKeysHeightFactorInLandscape(); else mHintTextSize = mHintTextSize * AnyApplication.getConfig().getKeysHeightFactorInPortrait(); break; case R.attr.hintTextColor: mHintTextColor = remoteTypedArray.getColorStateList(remoteTypedArrayIndex); if (mHintTextColor == null) { mHintTextColor = new ColorStateList(new int[][] { { 0 } }, new int[] { remoteTypedArray.getColor(remoteTypedArrayIndex, 0xFF000000) }); } break; case R.attr.hintLabelVAlign: mHintLabelVAlign = remoteTypedArray.getInt(remoteTypedArrayIndex, Gravity.BOTTOM); break; case R.attr.hintLabelAlign: mHintLabelAlign = remoteTypedArray.getInt(remoteTypedArrayIndex, Gravity.RIGHT); break; case R.attr.hintOverflowLabel: mHintOverflowLabel = remoteTypedArray.getString(remoteTypedArrayIndex); break; } return true; } catch (Exception e) { // on API changes, so the incompatible themes wont crash me.. e.printStackTrace(); return false; } }
From source file:com.dynamixsoftware.printingsample.PrintServiceFragment.java
@Override public void onClick(View v) { final Context appContext = requireContext().getApplicationContext(); switch (v.getId()) { case R.id.set_license: printingSdk.setLicense("YOUR_LICENSE_HERE", new ISetLicenseCallback.Stub() { @Override// w ww. j a va 2 s .c o m public void start() { Toast.makeText(appContext, "set license start", Toast.LENGTH_SHORT).show(); } @Override public void serverCheck() { Toast.makeText(appContext, "set license check server", Toast.LENGTH_SHORT).show(); } @Override public void finish(Result result) { Toast.makeText(appContext, "set license finish " + (result == Result.OK ? "ok" : "error"), Toast.LENGTH_SHORT).show(); } }); break; case R.id.init_current_and_recent_printers: try { printingSdk.initRecentPrinters(new ISetupPrinterListener.Stub() { @Override public void start() { toastInMainThread(appContext, "ISetupPrinterListener start"); } @Override public void libraryPackInstallationProcess(int arg0) { toastInMainThread(appContext, "ISetupPrinterListener libraryPackInstallationProcess " + arg0 + " %"); } @Override public void finish(Result arg0) { toastInMainThread(appContext, "ISetupPrinterListener finish " + arg0.name()); if (arg0.getType().equals(ResultType.ERROR_LIBRARY_PACK_NOT_INSTALLED)) { // printingSdk.setup should be called with forceInstall = true to download required drivers } } }); } catch (RemoteException e) { e.printStackTrace(); } break; case R.id.get_current_printer: try { Printer currentPrinter = printingSdk.getCurrentPrinter(); showDialog(getString(R.string.success), "Current printer:\n" + (currentPrinter != null ? currentPrinter.getName() : "null")); } catch (RemoteException e) { e.printStackTrace(); } break; case R.id.get_recent_printers: try { List<Printer> recentPrinters = printingSdk.getRecentPrintersList(); String message = ""; for (Printer printer : recentPrinters) message += printer.getName() + "\n"; if (message.length() == 0) message = "No recent printers"; showDialog(getString(R.string.success), message); } catch (RemoteException e) { e.printStackTrace(); } break; case R.id.discover_wifi: try { printingSdk.startDiscoverWiFi(new IDiscoverListener.Stub() { @Override public void start() { toastInMainThread(appContext, "IDiscoverListener start"); } @Override public void printerFound(List<Printer> arg0) { toastInMainThread(appContext, "IDiscoverListener printerFound"); discoveredPrinters.clear(); discoveredPrinters.addAll(arg0); } @Override public void finish(Result arg0) { toastInMainThread(appContext, "IDiscoverListener finish " + arg0.name()); } }); } catch (RemoteException e) { e.printStackTrace(); } break; case R.id.discover_bluetooth: try { printingSdk.startDiscoverBluetooth(new IDiscoverListener.Stub() { @Override public void start() { toastInMainThread(appContext, "IDiscoverListener start"); } @Override public void printerFound(List<Printer> arg0) { toastInMainThread(appContext, "IDiscoverListener printerFound"); discoveredPrinters.clear(); discoveredPrinters.addAll(arg0); } @Override public void finish(Result arg0) { toastInMainThread(appContext, "IDiscoverListener finish " + arg0.name()); } }); } catch (RemoteException e) { e.printStackTrace(); } break; case R.id.discover_google_cloud: try { printingSdk.startDiscoverCloud("YOUR_GOOGLE_ACCOUNT_NAME", new IDiscoverCloudListener.Stub() { @Override public void start() { toastInMainThread(appContext, "IDiscoverCloudListener start"); } @Override public void showAuthorization(Intent arg0) { // Launch Intent arg0 to show authorization activity } @Override public void printerFound(List<Printer> arg0) { toastInMainThread(appContext, "IDiscoverCloudListener printerFound"); discoveredPrinters.clear(); discoveredPrinters.addAll(arg0); } @Override public void finish(Result arg0) { toastInMainThread(appContext, "IDiscoverCloudListener finish " + arg0.name()); } }); } catch (RemoteException e) { e.printStackTrace(); } break; case R.id.discover_smb: try { discoverSmb = printingSdk.startDiscoverSmb(new IDiscoverSmbListener.Stub() { @Override public void start() { toastInMainThread(appContext, "IDiscoverSmbListener start"); } @Override public void smbFilesFound(List<SmbFile> arg0) { // Show list of SMB files. This listener is used for navigation. // You should call discoverSmbControl.move(arg0) to change location. } @Override public void showAuthorization() { // You have to ask user for authorization credentials and call discoverSmbControl.login(arg0, arg1); } @Override public void printerFound(List<Printer> arg0) { toastInMainThread(appContext, "IDiscoverSmbListener printerFound"); discoveredPrinters.clear(); discoveredPrinters.addAll(arg0); } @Override public void finish(Result arg0) { toastInMainThread(appContext, "IDiscoverSmbListener finish " + arg0.name()); } }); } catch (RemoteException e) { e.printStackTrace(); } break; case R.id.discover_usb: try { printingSdk.startDiscoverUSB(new IDiscoverListener.Stub() { @Override public void start() { toastInMainThread(appContext, "IDiscoverListener start"); } @Override public void printerFound(List<Printer> arg0) { toastInMainThread(appContext, "IDiscoverListener printerFound"); discoveredPrinters.clear(); discoveredPrinters.addAll(arg0); } @Override public void finish(Result arg0) { toastInMainThread(appContext, "IDiscoverListener finish " + arg0.name()); } }); } catch (RemoteException e) { e.printStackTrace(); } break; case R.id.find_driver: if (!discoveredPrinters.isEmpty()) { Printer printer = discoveredPrinters.get(0); try { printingSdk.findDrivers(printer, new IFindDriversListener.Stub() { @Override public void start() { toastInMainThread(appContext, "IFindDriversListener start"); } @Override public void finish(List<DriversSearchEntry> arg0) { toastInMainThread(appContext, "IFindDriversListener finish; Found " + arg0.size() + " drivers entries;" + ((arg0.size() == 0) ? "" : "")); driversSearchEntries.clear(); driversSearchEntries.addAll(arg0); } }); } catch (RemoteException e) { e.printStackTrace(); } } else showDialog(getString(R.string.error), "Discover printers first"); break; case R.id.get_drivers: if (!discoveredPrinters.isEmpty()) { Printer printer = discoveredPrinters.get(0); TransportType transportType = printer.getTransportTypes().get(0); if (transportType != null) { try { printingSdk.getDriversList(printer, transportType, new IGetDriversListener.Stub() { @Override public void start() { toastInMainThread(appContext, "IGetDriversListener start"); } @Override public void finish(List<DriverHandleEntry> arg0) { toastInMainThread(appContext, "IGetDriversListener finish"); driverHandleEntries.clear(); driverHandleEntries.addAll(arg0); } }); } catch (RemoteException e) { e.printStackTrace(); } } } else showDialog(getString(R.string.error), "Discover printers first"); break; case R.id.setup_recent_printer: try { List<Printer> printerList = printingSdk.getRecentPrintersList(); if (!printerList.isEmpty()) printingSdk.setup(printerList.get(0), true, new ISetupPrinterListener.Stub() { @Override public void start() { toastInMainThread(appContext, "ISetupPrinterListener start"); } @Override public void libraryPackInstallationProcess(int arg0) { toastInMainThread(appContext, "ISetupPrinterListener libraryPackInstallationProcess " + arg0 + " %"); } @Override public void finish(Result arg0) { toastInMainThread(appContext, "ISetupPrinterListener finish " + arg0.name()); if (arg0.getType().equals(ResultType.ERROR_LIBRARY_PACK_NOT_INSTALLED)) { // printingSdk.setup should be called with forceInstall = true to download required drivers } } }); else showDialog(getString(R.string.error), "No recent printers"); } catch (RemoteException e) { e.printStackTrace(); } break; case R.id.setup_discovered_printer: if (!discoveredPrinters.isEmpty()) { if (!driversSearchEntries.isEmpty()) { Printer printer = discoveredPrinters.get(0); DriversSearchEntry driversSearchEntry = driversSearchEntries.get(0); try { printingSdk.setup(printer, driversSearchEntry.getDriverHandlesList().get(0), driversSearchEntry.getTransportType(), false, new ISetupPrinterListener.Stub() { @Override public void start() { toastInMainThread(appContext, "ISetupPrinterListener start"); } @Override public void libraryPackInstallationProcess(int arg0) { toastInMainThread(appContext, "ISetupPrinterListener libraryPackInstallationProcess " + arg0 + " %"); } @Override public void finish(Result arg0) { toastInMainThread(appContext, "ISetupPrinterListener finish " + arg0.name()); if (arg0.getType().equals(ResultType.ERROR_LIBRARY_PACK_NOT_INSTALLED)) { // printingSdk.setup should be called with forceInstall = true to download required drivers } } }); } catch (RemoteException e) { e.printStackTrace(); } } else showDialog(getString(R.string.error), "Find driver first"); } else showDialog(getString(R.string.error), "Discover printers first"); break; case R.id.change_options: try { Printer currentPrinter = printingSdk.getCurrentPrinter(); if (currentPrinter != null) { List<PrinterOption> options = currentPrinter.getOptions(); if (options.size() > 0) { Random random = new Random(); PrinterOption option = options.get(random.nextInt(options.size())); PrinterOptionValue currentValue = option.getOptionValue(); List<PrinterOptionValue> valuesList = option.getOptionValueList(); PrinterOptionValue newValue = valuesList.get(random.nextInt(valuesList.size())); printingSdk.setCurrentPrinterOptionValue(option, newValue); Toast.makeText(requireContext().getApplicationContext(), "option " + option.getName() + " changed from " + currentValue + " to " + newValue, Toast.LENGTH_LONG).show(); } } else showDialog(getString(R.string.error), "Setup printer first"); } catch (RemoteException e) { e.printStackTrace(); } break; case R.id.print_image: try { if (printingSdk.getCurrentPrinter() != null) { List<IPage> pages = new ArrayList<>(); pages.add(new IPage() { @Override public Bitmap getBitmapFragment(Rect fragment) { Printer printer = null; try { printer = printingSdk.getCurrentPrinter(); } catch (RemoteException e) { e.printStackTrace(); } if (printer != null) { Bitmap bitmap = Bitmap.createBitmap(fragment.width(), fragment.height(), Bitmap.Config.ARGB_8888); for (int i = 0; i < 3; i++) try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ARGB_8888; options.inDither = false; if (i > 0) { options.inSampleSize = 1 << i; } Bitmap imageBMP = BitmapFactory.decodeStream(new FileInputStream( FilesUtils.getFilePath(requireContext(), FilesUtils.FILE_PNG)), null, options); Paint p = new Paint(); int imageWidth = 0; int imageHeight = 0; if (imageBMP != null) { imageWidth = imageBMP.getWidth(); imageHeight = imageBMP.getHeight(); } int xDpi = printer.getContext().getHResolution(); int yDpi = printer.getContext().getVResolution(); // in dots int paperWidth = printer.getContext().getPaperWidth() * xDpi / 72; int paperHeight = printer.getContext().getPaperHeight() * yDpi / 72; float aspectH = (float) imageHeight / (float) paperHeight; float aspectW = (float) imageWidth / (float) paperWidth; RectF dst = new RectF(0, 0, fragment.width() * aspectW, fragment.height() * aspectH); float sLeft = 0; float sTop = fragment.top * aspectH; float sRight = imageWidth; float sBottom = fragment.top * aspectH + fragment.bottom * aspectH; RectF source = new RectF(sLeft, sTop, sRight, sBottom); Canvas canvas = new Canvas(bitmap); canvas.drawColor(Color.WHITE); // move image to actual printing area dst.offsetTo(dst.left - fragment.left, dst.top - fragment.top); Matrix matrix = new Matrix(); matrix.setRectToRect(source, dst, Matrix.ScaleToFit.FILL); canvas.drawBitmap(imageBMP, matrix, p); break; } catch (IOException ex) { ex.printStackTrace(); break; } catch (OutOfMemoryError ex) { if (bitmap != null) { bitmap.recycle(); bitmap = null; } continue; } return bitmap; } else return null; } }); try { printingSdk.print(pages, 1, new IPrintListener.Stub() { @Override public void startingPrintJob() { toastInMainThread(appContext, "IPrintListener startingPrintJob"); } @Override public void start() { toastInMainThread(appContext, "IPrintListener start"); } @Override public void sendingPage(int arg0, int arg1) { toastInMainThread(appContext, "IPrintListener sendingPage " + arg0 + "; progress " + arg1 + "%"); } @Override public void preparePage(int arg0) { toastInMainThread(appContext, "IPrintListener preparePage " + arg0); } @Override public boolean needCancel() { toastInMainThread(appContext, "IPrintListener needCancel"); // Return false if cancel needed. return false; } @Override public void finishingPrintJob() { toastInMainThread(appContext, "IPrintListener finishingPrintJob"); } @Override public void finish(Result arg0, int arg1, int arg2) { toastInMainThread(appContext, "IPrintListener finish Result " + arg0 + "; Result type " + arg0.getType() + "; Total pages " + arg1 + "; Pages sent " + arg2); } }); } catch (RemoteException e) { e.printStackTrace(); } } else showDialog(getString(R.string.error), "You must setup printer before print"); } catch (RemoteException e) { e.printStackTrace(); } break; } }
From source file:com.netcompss.ffmpeg4android_client.BaseVideo.java
private Bitmap ProcessingBitmapTwo(Bitmap bm1, Bitmap bm2) { Bitmap newBitmap = null;// ww w . j ava2s . c om int w; if (bm1.getWidth() >= bm2.getWidth()) { w = bm1.getWidth(); } else { w = bm2.getWidth(); } int h; if (bm1.getHeight() >= bm2.getHeight()) { h = bm1.getHeight(); } else { h = bm2.getHeight(); } Config config = bm1.getConfig(); if (config == null) { config = Bitmap.Config.ARGB_4444; } newBitmap = Bitmap.createBitmap(w, h, config); Canvas newCanvas = new Canvas(newBitmap); newCanvas.drawColor(Color.WHITE); if (bm2.getWidth() == bm2.getHeight()) { newCanvas.drawBitmap(bm2, (w - bm2.getWidth()) / 2, (h - bm2.getHeight()) / 2, null); } else { newCanvas.drawBitmap(bm2, (w / 2) - (bm2.getWidth() / 2), (h / 2) - (bm2.getHeight() / 2), null); } return newBitmap; }
From source file:com.lepin.activity.MyOrderDetailActivity.java
private void showBtnState() { /* ?? *///from w w w . j a v a 2s .c o m if (mBookState.equals(Book.STATE_CANCEL)) { setBtnTextAndColor(R.string.has_been_cancel, Color.WHITE, false, View.VISIBLE); } else if (mBookState.equals(Book.STATE_NEW)) {// ?????? if (!isDriverOfMe) {// ?? mCancelAndOkLayout.setVisibility(View.VISIBLE); operateType = CANCEL_ORDER; } else { // ?? setBtnTextAndColor(R.string.order_operate_cancle, Color.WHITE, true, View.VISIBLE); } } else if (mBookState.equals(Book.STATE_PAYMENT)) {// ?? if (!isDriverOfMe) { // ? mCancelAndOkLayout.setVisibility(View.VISIBLE); mTwoPayOrInBtn.setText(getResources().getString(R.string.order_operate_in)); isCanCancleOrder(true); operateType = COMFIRM_IN; } else { // ?? setBtnTextAndColor(R.string.order_operate_driver_cancle, Color.RED, true, View.VISIBLE); } } else if (mBookState.equals(Book.STATE_COMPLETE)) {// ?? setBtnTextAndColor(R.string.order_state_complete, Color.WHITE, false, View.VISIBLE); } }
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. j a v 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:com.rainmakerlabs.bleepsample.BleepService.java
public void imgShow(Bitmap bitmap, String strImgMsg) { MainActivity.adlib.put(strImgMsg, bitmap); Log.d("Portal", "Added an image. Size is now " + MainActivity.adlib.size()); Log.i("Portal", "Image added for key " + strImgMsg); if (MainActivity.myGallery == null) return;/*www . j av a 2 s. c o m*/ if (MainActivity.gal_size < MainActivity.adlib.size()) { //new image has been added and the layout is initialized LinearLayout superLL = (LinearLayout) MainActivity.myGallery.getParent().getParent(); if (MainActivity.gal_size < 1) { ImageView imgSplash = (ImageView) superLL.findViewById(R.id.imgSplash); imgSplash.setVisibility(View.INVISIBLE); } LinearLayout layout = new LinearLayout(getApplicationContext()); layout.setOrientation(LinearLayout.VERTICAL); layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); layout.setGravity(Gravity.CENTER); ImageView imageview = new ImageView(getApplicationContext()); imageview.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 1000)); imageview.setScaleType(ImageView.ScaleType.CENTER_CROP); imageview.setImageBitmap(bitmap); //Add a button to go with it Button btnBuy = new Button(getApplicationContext()); LinearLayout.LayoutParams btnParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); btnParams.setMargins(-10, -10, -10, -10); btnBuy.setLayoutParams(btnParams); btnBuy.setText("Buy Now (" + strImgMsg + ")"); btnBuy.setBackgroundColor(MainActivity.getDominantColor(bitmap)); btnBuy.setTextColor(Color.WHITE); btnBuy.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { Intent newActivity = new Intent(getApplicationContext(), WebActivity.class); newActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); newActivity.putExtra("URL", "https://portal-battlehack.herokuapp.com/"); startActivity(newActivity); } }); layout.addView(imageview); layout.addView(btnBuy); MainActivity.myGallery.addView(layout); MainActivity.gal_size++; } }
From source file:com.bitants.wally.activities.ImageDetailsActivity.java
@Override protected void handleReceivedIntent(Context context, Intent intent) { long id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0L); if (WallyApplication.getDownloadIDs().containsKey(id)) { WallyApplication.getDownloadIDs().remove(id); updateSaveButton();//from w ww .ja v a2s .co m if (palette != null && palette.getVibrantSwatch() != null) { startHeartPopoutAnimation(buttonSave, palette.getVibrantSwatch().getBodyTextColor()); } else { startHeartPopoutAnimation(buttonSave, Color.WHITE); } String filename = pageUri.getLastPathSegment(); handleSavedImageData(WallyApplication.getDataProviderInstance().getFilePath(filename)); } }
From source file:com.phonegap.bossbolo.plugin.inappbrowser.InAppBrowser.java
/** * Display a new browser with the specified URL. * * @param url The url to load. * @param jsonObject/* ww w . j ava 2 s. c o m*/ * @param header */ public String showWebPage(final String url, HashMap<String, Boolean> features, final String header) { // Determine if we should hide the location bar. showLocationBar = true; showZoomControls = true; openWindowHidden = false; if (features != null) { Boolean show = features.get(LOCATION); if (show != null) { showLocationBar = show.booleanValue(); } Boolean zoom = features.get(ZOOM); if (zoom != null) { showZoomControls = zoom.booleanValue(); } Boolean hidden = features.get(HIDDEN); if (hidden != null) { openWindowHidden = hidden.booleanValue(); } Boolean hardwareBack = features.get(HARDWARE_BACK_BUTTON); if (hardwareBack != null) { hadwareBackButton = hardwareBack.booleanValue(); } Boolean cache = features.get(CLEAR_ALL_CACHE); if (cache != null) { clearAllCache = cache.booleanValue(); } else { cache = features.get(CLEAR_SESSION_CACHE); if (cache != null) { clearSessionCache = cache.booleanValue(); } } } final CordovaWebView thatWebView = this.webView; // Create dialog in new thread Runnable runnable = new Runnable() { /** * Convert our DIP units to Pixels * * @return int */ private int dpToPixels(int dipValue) { int value = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) dipValue, cordova.getActivity().getResources().getDisplayMetrics()); return value; } @SuppressLint("NewApi") public void run() { int backgroundColor = Color.parseColor("#46bff7"); // Let's create the main dialog dialog = new InAppBrowserDialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar); dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog; dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true); dialog.setInAppBroswer(getInAppBrowser()); // Main container layout LinearLayout main = new LinearLayout(cordova.getActivity()); main.setOrientation(LinearLayout.VERTICAL); // Toolbar layout header RelativeLayout toolbar = new RelativeLayout(cordova.getActivity()); //Please, no more black! toolbar.setBackgroundColor(android.graphics.Color.LTGRAY); toolbar.setLayoutParams( new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(50))); toolbar.setPadding(this.dpToPixels(8), this.dpToPixels(10), this.dpToPixels(8), this.dpToPixels(10)); toolbar.setHorizontalGravity(Gravity.LEFT); toolbar.setVerticalGravity(Gravity.TOP); toolbar.setBackgroundColor(backgroundColor); // Action Button Container layout RelativeLayout actionButtonContainer = new RelativeLayout(cordova.getActivity()); actionButtonContainer.setLayoutParams( new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); actionButtonContainer.setHorizontalGravity(Gravity.LEFT); actionButtonContainer.setVerticalGravity(Gravity.CENTER_VERTICAL); actionButtonContainer.setId(1); // Back button Button back = new Button(cordova.getActivity()); RelativeLayout.LayoutParams backLayoutParams = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); backLayoutParams.addRule(RelativeLayout.ALIGN_LEFT); back.setLayoutParams(backLayoutParams); back.setContentDescription("Back Button"); back.setId(2); back.setWidth(this.dpToPixels(34)); back.setHeight(this.dpToPixels(31)); Resources activityRes = cordova.getActivity().getResources(); int backResId = activityRes.getIdentifier("back", "drawable", cordova.getActivity().getPackageName()); Drawable backIcon = activityRes.getDrawable(backResId); if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { back.setBackgroundDrawable(backIcon); } else { back.setBackground(backIcon); } back.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { closeDialog(); // goBack(); } }); // Edit Text Box titletext = new TextView(cordova.getActivity()); RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); textLayoutParams.addRule(RelativeLayout.RIGHT_OF, this.dpToPixels(65)); textLayoutParams.addRule(RelativeLayout.LEFT_OF, this.dpToPixels(10)); titletext.setLayoutParams(textLayoutParams); titletext.setId(3); titletext.setSingleLine(true); titletext.setText(header); titletext.setTextColor(Color.WHITE); titletext.setGravity(Gravity.CENTER); titletext.setTextSize(TypedValue.COMPLEX_UNIT_PX, this.dpToPixels(20)); titletext.setSingleLine(); titletext.setEllipsize(TruncateAt.END); edittext = new EditText(cordova.getActivity()); RelativeLayout.LayoutParams editLayoutParams = new RelativeLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); editLayoutParams.addRule(RelativeLayout.RIGHT_OF, 1); editLayoutParams.addRule(RelativeLayout.LEFT_OF, 5); edittext.setLayoutParams(textLayoutParams); edittext.setId(4); edittext.setSingleLine(true); edittext.setText(url); edittext.setVisibility(View.GONE); // Forward button /*Button forward = new Button(cordova.getActivity()); RelativeLayout.LayoutParams forwardLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); forwardLayoutParams.addRule(RelativeLayout.RIGHT_OF, 2); forward.setLayoutParams(forwardLayoutParams); forward.setContentDescription("Forward Button"); forward.setId(3); int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName()); Drawable fwdIcon = activityRes.getDrawable(fwdResId); if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { forward.setBackgroundDrawable(fwdIcon); } else { forward.setBackground(fwdIcon); } forward.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { goForward(); } }); // Edit Text Box edittext = new TextView(cordova.getActivity()); RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); textLayoutParams.addRule(RelativeLayout.RIGHT_OF, 1); textLayoutParams.addRule(RelativeLayout.LEFT_OF, 5); edittext.setLayoutParams(textLayoutParams); edittext.setId(4); edittext.setSingleLine(true); edittext.setText(url); edittext.setInputType(InputType.TYPE_TEXT_VARIATION_URI); edittext.setImeOptions(EditorInfo.IME_ACTION_GO); edittext.setInputType(InputType.TYPE_NULL); // Will not except input... Makes the text NON-EDITABLE edittext.setOnKeyListener(new View.OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { navigate(edittext.getText().toString()); return true; } return false; } }); // Close/Done button Button close = new Button(cordova.getActivity()); RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); close.setLayoutParams(closeLayoutParams); forward.setContentDescription("Close Button"); close.setId(5); int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable", cordova.getActivity().getPackageName()); Drawable closeIcon = activityRes.getDrawable(closeResId); if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { close.setBackgroundDrawable(closeIcon); } else { close.setBackground(closeIcon); } close.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { closeDialog(); } });*/ // WebView inAppWebView = new WebView(cordova.getActivity()); inAppWebView.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView)); WebViewClient client = new InAppBrowserClient(thatWebView, edittext); inAppWebView.setWebViewClient(client); WebSettings settings = inAppWebView.getSettings(); settings.setJavaScriptEnabled(true); settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setBuiltInZoomControls(getShowZoomControls()); settings.setPluginState(android.webkit.WebSettings.PluginState.ON); //Toggle whether this is enabled or not! Bundle appSettings = cordova.getActivity().getIntent().getExtras(); boolean enableDatabase = appSettings == null ? true : appSettings.getBoolean("InAppBrowserStorageEnabled", true); if (enableDatabase) { String databasePath = cordova.getActivity().getApplicationContext() .getDir("inAppBrowserDB", Context.MODE_PRIVATE).getPath(); settings.setDatabasePath(databasePath); settings.setDatabaseEnabled(true); } settings.setDomStorageEnabled(true); if (clearAllCache) { CookieManager.getInstance().removeAllCookie(); } else if (clearSessionCache) { CookieManager.getInstance().removeSessionCookie(); } inAppWebView.loadUrl(url); inAppWebView.setId(6); inAppWebView.getSettings().setLoadWithOverviewMode(true); inAppWebView.getSettings().setUseWideViewPort(true); inAppWebView.requestFocus(); inAppWebView.requestFocusFromTouch(); // Add the back and forward buttons to our action button container layout actionButtonContainer.addView(back); // actionButtonContainer.addView(forward); // Add the views to our toolbar toolbar.addView(actionButtonContainer); toolbar.addView(titletext); // toolbar.addView(edittext); // toolbar.addView(close); // Don't add the toolbar if its been disabled if (getShowLocationBar()) { // Add our toolbar to our main view/layout main.addView(toolbar); } // Add our webview to our main view/layout main.addView(inAppWebView); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(dialog.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.MATCH_PARENT; dialog.setContentView(main); dialog.show(); dialog.getWindow().setAttributes(lp); // the goal of openhidden is to load the url and not display it // Show() needs to be called to cause the URL to be loaded if (openWindowHidden) { dialog.hide(); } } }; this.cordova.getActivity().runOnUiThread(runnable); return ""; }
From source file:com.coinblesk.client.utils.UIUtils.java
public static Drawable tintIconWhite(Drawable drawable, Context context) { return tintIcon(drawable, Color.WHITE); }